From ebaca530d35d124cb3ec974213b2eedf594eb921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Br=C3=BCcher-Herpel?= <48645439+pilz0@users.noreply.github.com> Date: Mon, 16 Feb 2026 09:08:55 +0100 Subject: [PATCH 1/5] chore(github actions): use refactored workflows --- .github/workflows/ansible.yml | 10 +++++ .github/workflows/generate_readme.yml | 49 --------------------- .github/workflows/test.yml | 61 --------------------------- 3 files changed, 10 insertions(+), 110 deletions(-) create mode 100644 .github/workflows/ansible.yml delete mode 100644 .github/workflows/generate_readme.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ansible.yml b/.github/workflows/ansible.yml new file mode 100644 index 0000000..08a5774 --- /dev/null +++ b/.github/workflows/ansible.yml @@ -0,0 +1,10 @@ +--- +name: CI +on: + push: + workflow_dispatch: +jobs: + ansible-role: + uses: punktDe/shared-workflows/.github/workflows/ansible-role.yml@main + secrets: + galaxy_api_key: ${{ secrets.GALAXY_API_KEY }} diff --git a/.github/workflows/generate_readme.yml b/.github/workflows/generate_readme.yml deleted file mode 100644 index c95abdb..0000000 --- a/.github/workflows/generate_readme.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -name: Generate README.md for the role - -on: - push: - branches: - - '**' - tags-ignore: - - '**' - workflow_dispatch: - -permissions: - contents: write - -jobs: - readme: - name: Generate README.md from argument specs - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Set up Python - run: uv python install - - - name: Install dependencies - run: | - uv -q venv --allow-existing --seed .venv - . .venv/bin/activate - uv -q pip install -r requirements.txt - - - name: Run aar-doc - run: | - . .venv/bin/activate - aar-doc --output-mode replace --config-file .aar-doc.yml . markdown - - - name: Output diff - run: git diff README.md - - - name: Commit and push README - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git add README.md - git diff-index --quiet HEAD || git commit -m "chore: Generate README.md" - git push diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 0313f1e..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -name: Test -run-name: Run molecule tests on the role -on: - push: - workflow_dispatch: - -env: - ANSIBLE_ROLES_PATH: roles - ANSIBLE_HASH_BEHAVIOUR: merge - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Set up Python - run: uv python install - - - name: Install dependencies - run: | - uv -q venv --allow-existing --seed .venv - . .venv/bin/activate - uv -q pip install -r requirements.txt - - - name: Run ansible-lint - run: | - . .venv/bin/activate - ansible-lint - - molecule: - strategy: - matrix: - os: [ubuntu-2204, ubuntu-2404, debian-12, debian-13] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Set up Python - run: uv python install - - - name: Install dependencies. - run: | - uv -q venv --allow-existing --seed .venv - . .venv/bin/activate - uv -q pip install -r requirements.txt - ansible-galaxy install -r requirements.yml - - - name: Run molecule - run: | - . .venv/bin/activate - molecule test -p ${{ matrix.os }} From 89a69ea214f3401f1dd5a2104c782d085ce559b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Br=C3=BCcher-Herpel?= <48645439+pilz0@users.noreply.github.com> Date: Mon, 16 Feb 2026 12:50:18 +0100 Subject: [PATCH 2/5] fix(argument specs): remove invalid option definitions for dynamic dictionaries --- meta/argument_specs.yml | 65 +++-------------------------------------- 1 file changed, 4 insertions(+), 61 deletions(-) diff --git a/meta/argument_specs.yml b/meta/argument_specs.yml index d7fa9db..40b06e5 100644 --- a/meta/argument_specs.yml +++ b/meta/argument_specs.yml @@ -19,81 +19,24 @@ argument_specs: type: "str" description: - Directory for PostgreSQL configuration (e.g. pg_hba.conf, postgresql.conf include). - - Defaults depend on system; see defaults/main.yaml (e.g. /etc/postgresql/{{ version }}/main/conf.d on Linux). + - Defaults depend on system; see defaults/main.yaml (e.g. /etc/postgresql/{{ postgresql.version }}/main/conf.d on Linux). users: type: "dict" default: {} description: - Dict of PostgreSQL users to create (key is an arbitrary id, value defines the user). - options: - username: - type: "str" - description: Login name of the user. - password: - type: "str" - description: Password for the user (optional). - role_attributes: - type: "dict" - description: Role attributes (e.g. SUPERUSER, CREATEROLE); values are joined for role_attr_flags. - hosts: - type: "list" - elements: "str" - description: - - List of client addresses (e.g. 127.0.0.1) for which a pg_hba.conf host entry is added. - - Used together with privileges to allow password authentication from those hosts. + - "Values should contain: username (str), password (str, optional), role_attributes (dict, optional), hosts (list, optional)." privileges: type: "dict" default: {} description: - Dict of privileges to assign (key is arbitrary id). Each entry grants a role access to a database or object. - options: - username: - type: "str" - description: Role name to grant the privilege to. - database: - type: "str" - description: Database the privilege applies to. - type: - type: "str" - default: "table" - description: Type of object (e.g. table, database, schema). - objs: - type: "str" - description: Object name(s) for the grant (optional for type database). - schema: - type: "str" - description: Schema name (optional). - privs: - type: "list" - elements: "str" - description: List of privilege names (e.g. ALL, SELECT, INSERT). + - "Values should contain: username (str), database (str), type (str, default: table), objs (str, optional), schema (str, optional), privs (list)." databases: type: "dict" description: - Dict of databases to create (key is arbitrary id). At least the root database entry is required by defaults. - options: - name: - type: "str" - description: Name of the database. - owner: - type: "str" - description: - - Owner of the database. Use ~ to reference a user from postgresql.users by key (e.g. ~molecule). - encoding: - type: "str" - description: Character encoding (defaults to database_defaults.encoding). - lc_collate: - type: "str" - description: Locale for collation order (defaults to database_defaults.lc_collate). - lc_ctype: - type: "str" - description: Locale for character classification (defaults to database_defaults.lc_ctype). - template: - type: "str" - description: Template database to use (defaults to database_defaults.template). - import_file: - type: "path" - description: Path to a dump file to restore into the database after creation (optional). + - "Values should contain: name (str), owner (str), encoding (str, optional), lc_collate (str, optional), lc_ctype (str, optional), template (str, optional), import_file (path, optional)." database_defaults: type: "dict" options: From 40d66857f2130579714248315aa3575d906931dc Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 16 Feb 2026 11:50:41 +0000 Subject: [PATCH 3/5] chore: Generate README.md --- README.md | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index d320a15..c512ca1 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,9 @@ postgresql role for Proserver |---|---|---|---|---| | `version` | Major version of PostgreSQL to install/configure. Ignored on FreeBSD Proservers (version is determined by the system). | int | no | 13 | | `prefix` | | dict of 'prefix' options | no | | -| `users` | Dict of PostgreSQL users to create (key is an arbitrary id, value defines the user). | dict of 'users' options | no | {} | -| `privileges` | Dict of privileges to assign (key is arbitrary id). Each entry grants a role access to a database or object. | dict of 'privileges' options | no | {} | -| `databases` | Dict of databases to create (key is arbitrary id). At least the root database entry is required by defaults. | dict of 'databases' options | no | | +| `users` | Dict of PostgreSQL users to create (key is an arbitrary id, value defines the user). Values should contain: username (str), password (str, optional), role_attributes (dict, optional), hosts (list, optional). | dict | no | | +| `privileges` | Dict of privileges to assign (key is arbitrary id). Each entry grants a role access to a database or object. Values should contain: username (str), database (str), type (str, default: table), objs (str, optional), schema (str, optional), privs (list). | dict | no | | +| `databases` | Dict of databases to create (key is arbitrary id). At least the root database entry is required by defaults. Values should contain: name (str), owner (str), encoding (str, optional), lc_collate (str, optional), lc_ctype (str, optional), template (str, optional), import_file (path, optional). | dict | no | | | `database_defaults` | Defaults applied to database creation when not set per-database. | dict of 'database_defaults' options | no | | | `postgresql.conf` | Key-value options written to the role-managed include file (ansible.conf), included from postgresql.conf. Consult PostgreSQL documentation for valid settings. | dict | no | | | `repository` | Package repository used to install PostgreSQL (Linux/Debian). | dict of 'repository' options | no | | @@ -38,39 +38,7 @@ postgresql role for Proserver |Option|Description|Type|Required|Default| |---|---|---|---|---| -| `config` | Directory for PostgreSQL configuration (e.g. pg_hba.conf, postgresql.conf include). Defaults depend on system; see defaults/main.yaml (e.g. /etc/postgresql/{{ version }}/main/conf.d on Linux). | str | no | | - -#### Options for `postgresql.users` - -|Option|Description|Type|Required|Default| -|---|---|---|---|---| -| `username` | Login name of the user. | str | no | | -| `password` | Password for the user (optional). | str | no | | -| `role_attributes` | Role attributes (e.g. SUPERUSER, CREATEROLE); values are joined for role_attr_flags. | dict | no | | -| `hosts` | List of client addresses (e.g. 127.0.0.1) for which a pg_hba.conf host entry is added. Used together with privileges to allow password authentication from those hosts. | list of 'str' | no | | - -#### Options for `postgresql.privileges` - -|Option|Description|Type|Required|Default| -|---|---|---|---|---| -| `username` | Role name to grant the privilege to. | str | no | | -| `database` | Database the privilege applies to. | str | no | | -| `type` | Type of object (e.g. table, database, schema). | str | no | table | -| `objs` | Object name(s) for the grant (optional for type database). | str | no | | -| `schema` | Schema name (optional). | str | no | | -| `privs` | List of privilege names (e.g. ALL, SELECT, INSERT). | list of 'str' | no | | - -#### Options for `postgresql.databases` - -|Option|Description|Type|Required|Default| -|---|---|---|---|---| -| `name` | Name of the database. | str | no | | -| `owner` | Owner of the database. Use ~ to reference a user from postgresql.users by key (e.g. ~molecule). | str | no | | -| `encoding` | Character encoding (defaults to database_defaults.encoding). | str | no | | -| `lc_collate` | Locale for collation order (defaults to database_defaults.lc_collate). | str | no | | -| `lc_ctype` | Locale for character classification (defaults to database_defaults.lc_ctype). | str | no | | -| `template` | Template database to use (defaults to database_defaults.template). | str | no | | -| `import_file` | Path to a dump file to restore into the database after creation (optional). | path | no | | +| `config` | Directory for PostgreSQL configuration (e.g. pg_hba.conf, postgresql.conf include). Defaults depend on system; see defaults/main.yaml (e.g. /etc/postgresql/{{ postgresql.version }}/main/conf.d on Linux). | str | no | | #### Options for `postgresql.database_defaults` From a51f0c68bc118ab689220fb2bcdf3ef17d7a8d50 Mon Sep 17 00:00:00 2001 From: Wolfgang Medina-Erhardt Date: Tue, 17 Feb 2026 07:35:15 +0100 Subject: [PATCH 4/5] Fix Ansible Galaxy variable name --- .github/workflows/ansible.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ansible.yml b/.github/workflows/ansible.yml index 08a5774..448b790 100644 --- a/.github/workflows/ansible.yml +++ b/.github/workflows/ansible.yml @@ -7,4 +7,4 @@ jobs: ansible-role: uses: punktDe/shared-workflows/.github/workflows/ansible-role.yml@main secrets: - galaxy_api_key: ${{ secrets.GALAXY_API_KEY }} + galaxy_api_key: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} From 89798693864e04a7d258af894a7d91edc7e5e26f Mon Sep 17 00:00:00 2001 From: Wolfgang Medina-Erhardt Date: Tue, 17 Feb 2026 07:40:40 +0100 Subject: [PATCH 5/5] Update Molecule --- defaults/main.yaml | 2 +- molecule/default/molecule.yml | 2 ++ requirements.txt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/defaults/main.yaml b/defaults/main.yaml index 243a583..fbcfda3 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -42,5 +42,5 @@ postgresql: apt: key_url: https://packagecloud.io/timescale/timescaledb/gpgkey repository: | - deb https://packagecloud.io/timescale/timescaledb/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} main + deb https://packagecloud.io/timescale/timescaledb/{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} main package: timescaledb-2-postgresql-{{ postgresql_version }} diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index d9ef25b..379d05e 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -24,6 +24,8 @@ platforms: <<: *default_platform provisioner: name: ansible + env: + ANSIBLE_ROLES_PATH: ../../roles:../../../:~/.ansible/roles playbooks: converge: ${MOLECULE_PLAYBOOK:-converge.yml} verifier: diff --git a/requirements.txt b/requirements.txt index 94664a8..46920ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ ansible>12.0.0 ansible-lint docker -molecule<25.2.0 +molecule molecule-plugins yamllint requests