Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbazhenoff committed Mar 23, 2024
1 parent bea0f9c commit 55f3993
Show file tree
Hide file tree
Showing 58 changed files with 159 additions and 188 deletions.
13 changes: 5 additions & 8 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
# Based on ansible-lint config
extends: default
ignore: |
templates/
files/*.j2
README.md
LICENSE
.yamllint
.flake8
verify.py
!*.ya?ml

rules:
braces:
min-spaces-inside: 0
max-spaces-inside: 1
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
level: error
brackets:
max-spaces-inside: 1
Expand Down Expand Up @@ -43,4 +40,4 @@ rules:
trailing-spaces: enable
truthy:
allowed-values: ['true', 'false']
check-keys: true
check-keys: true
Empty file removed roles/.gitkeep
Empty file.
10 changes: 2 additions & 8 deletions roles/.yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
# Based on ansible-lint config
extends: default
ignore: |
templates/
files/*.j2
README.md
LICENSE
.yamllint
.flake8
verify.py
!*.ya?ml

rules:
braces:
Expand Down Expand Up @@ -43,4 +37,4 @@ rules:
trailing-spaces: enable
truthy:
allowed-values: ['true', 'false']
check-keys: true
check-keys: true
10 changes: 2 additions & 8 deletions roles/bareos/.yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
# Based on ansible-lint config
extends: default
ignore: |
templates/
files/*.j2
README.md
LICENSE
.yamllint
.flake8
verify.py
!*.ya?ml

rules:
braces:
Expand Down Expand Up @@ -43,4 +37,4 @@ rules:
trailing-spaces: enable
truthy:
allowed-values: ['true', 'false']
check-keys: true
check-keys: true
10 changes: 2 additions & 8 deletions roles/lxcfs/.yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
# Based on ansible-lint config
extends: default
ignore: |
templates/
files/*.j2
README.md
LICENSE
.yamllint
.flake8
verify.py
!*.ya?ml

rules:
braces:
Expand Down Expand Up @@ -42,4 +36,4 @@ rules:
trailing-spaces: enable
truthy:
allowed-values: ['true', 'false']
check-keys: true
check-keys: true
2 changes: 1 addition & 1 deletion roles/postgresql/.ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
exclude_paths:
- .gitignore
- .gitmodules
quiet: True
quiet: true
verbosity: 1

# skip_list:
Expand Down
12 changes: 3 additions & 9 deletions roles/postgresql/.yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
# Based on ansible-lint config
extends: default
ignore: |
templates/
files/*.j2
README.md
LICENSE
.yamllint
.flake8
verify.py
!*.ya?ml

rules:
braces:
Expand Down Expand Up @@ -42,5 +36,5 @@ rules:
type: unix
trailing-spaces: enable
truthy:
allowed-values: ['True', 'false']
check-keys: True
allowed-values: ['true', 'false']
check-keys: true
56 changes: 28 additions & 28 deletions roles/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ Using this role all `postgresql.conf` change actions ends up with postgresql dae
role_subject: schemas
postgresql_schemas:
- name: acme
cascade_drop: True
cascade_drop: true

#### 8. Privileges management

Expand All @@ -465,7 +465,7 @@ Using this role all `postgresql.conf` change actions ends up with postgresql dae
objs: books,authors
schema: public
roles: librarian,reader
grant_option: True
grant_option: true

- name: "Same as above leveraging default values"
ansible.builtin.include_role:
Expand Down Expand Up @@ -550,7 +550,7 @@ Using this role all `postgresql.conf` change actions ends up with postgresql dae
type: group
objs: librarian,reader
roles: alice,bob
admin_option: True
admin_option: true
# Note that here "db: postgres" specifies the database to connect to, not the
# database to grant privileges on (which is specified via the "objs" param)
Expand Down Expand Up @@ -596,7 +596,7 @@ Using this role all `postgresql.conf` change actions ends up with postgresql dae
privs: ALL
type: default_privs
role: librarian
grant_option: True
grant_option: true

# Objs must be set, ALL_DEFAULT to TABLES/SEQUENCES/TYPES/FUNCTIONS
# ALL_DEFAULT works only with privs=ALL
Expand Down Expand Up @@ -821,23 +821,23 @@ Role Variables
|--------------------------------|---------|------------------------------------------------------------------------------------------------------------------------|
| role_action | install | Role action: uninstall, install, configure, create, grant, drop, revoke, dump, rename, restore |
| role_subject | server | Role subject to perform with: server, pgadmin, hba_conf, postgresql_conf, users, databases, privileges, schemas, slots |
| clean_install | True | Perform clean install |
| clean_install | true | Perform clean install |
| postgresql_version | 15 | Version of pgsql repository |
| cleanup_data_directory | True | Clean-up PostgreSQL data directory |
| postgresql_recommended_version | False | Install recommended version for current Linux distribution (1) |
| cleanup_data_directory | true | Clean-up PostgreSQL data directory |
| postgresql_recommended_version | false | Install recommended version for current Linux distribution (1) |
| postgresql_additional_packages | [] | List of additional PostgreSQL related packages to install (2) |
| install_psycopg2 | True | Install [psycopg2](https://pypi.org/project/psycopg2/) |
| install_pgadmin | False | Install [pgadmin4](https://www.pgadmin.org/) for web mode alongside with postgresql server |
| install_psycopg2 | true | Install [psycopg2](https://pypi.org/project/psycopg2/) |
| install_pgadmin | false | Install [pgadmin4](https://www.pgadmin.org/) for web mode alongside with postgresql server |
| pgadmin_installation_type | web | pgadmin installation type: web or desktop. Leave them empty to install both web and desktop. |
| firewall_control | True | Add or remove firewalld and/or ufw rules on install or uninstall. Will be skipped when firewall disabled. |
| firewall_control | true | Add or remove firewalld and/or ufw rules on install or uninstall. Will be skipped when firewall disabled. |

* (1) Recommended version install based on distribution repository or
[dnf modules](https://docs.fedoraproject.org/en-US/modularity/using-modules/). Useful when the current version of
PostgreSQL server instance is not available for your Linux distribution (e.g. check
[RedHat repository](https://www.postgresql.org/download/linux/redhat/)).

* (2) List of additional PostgreSQL related packages, e.g: 'postgresql-contrib' or 'postgresql14-contrib' for
`postgresql_recommended_version: True` (explore what packages available
`postgresql_recommended_version: true` (explore what packages available
[here](https://www.postgresql.org/download/linux/)). There is no automated version handling in this list, include
versions to package names.

Expand Down Expand Up @@ -892,18 +892,18 @@ Defaults:
| comment | optional | (omit) | Adds a comment on the user (equivalent to the COMMENT ON ROLE statement) |
| password | optional | (omit) | Set the user's password |
| conn_limit | optional | (omit) | Specifies the user (role) connection limit. |
| no_password_changes | optional | False | If True, does not inspect the database for password changes (1) |
| no_password_changes | optional | false | If true, does not inspect the database for password changes (1) |
| database | optional | '' | Name of database to connect to and where user's permissions are granted. |
| encrypted | optional | True | Whether the password is stored hashed in the database (2) |
| encrypted | optional | true | Whether the password is stored hashed in the database (2) |
| role_attr_flags | optional | '' | PostgreSQL user attributes string in the format: CREATEDB,CREATEROLE,SUPERUSER (3) |
| ssl_mode | optional | prefer | Determines how an SSL session is negotiated with the server (4) |
| ca_cert | optional | '' | Specifies the name of a file containing SSL certificate authority (CA) certificate(s) (5) |
| trust_input | optional | True | It makes sense to use False only when SQL injections through the options are possible (6) |
| trust_input | optional | true | It makes sense to use false only when SQL injections through the options are possible (6) |

* (1) If true, does not inspect the database for password changes. If the user already exists, skips all password
related checks. Useful when `pg_authid` is not accessible (such as in AWS RDS). Otherwise, makes password changes as
necessary.
* (2) You can specify an unhashed password, and PostgreSQL ensures the stored password is hashed when `encrypted=True`
* (2) You can specify an unhashed password, and PostgreSQL ensures the stored password is hashed when `encrypted=true`
is set. If you specify a hashed password, the module uses it as-is, regardless of the setting of encrypted. Note:
Postgresql 10 and newer does not support unhashed passwords.
* (3) Note that `[NO]CREATEUSER` is deprecated. To create a simple role for using it like a group, use `NOLOGIN` flag.
Expand All @@ -912,7 +912,7 @@ See the full list of supported flags in documentation for your PostgreSQL versio
information on the modes. Default of prefer matches libpq default. Choices: "allow", "disable", "prefer", "require",
"verify-ca", "verify-full".
* (5) If the file exists, verifies that the server's certificate is signed by one of these authorities.
* (6) If False, checks whether values of options name, password, privs, expires, role_attr_flags, groups, comment,
* (6) If false, checks whether values of options name, password, privs, expires, role_attr_flags, groups, comment,
session_role are potentially dangerous.

#### Database management.
Expand Down Expand Up @@ -941,7 +941,7 @@ Defaults:
| dump_extra_args | optional | (omit) | Provides additional arguments when role_action is `dump` (4) |
| ssl_mode | optional | prefer | Determines how an SSL session is negotiated with the server (5) |
| ca_cert | optional | '' | Specifies the name of a file containing SSL certificate authority (CA) (6) |
| trust_input | optional | True | It makes sense only when SQL injections through the options are possible (7) |
| trust_input | optional | true | It makes sense only when SQL injections through the options are possible (7) |

* (1) Collation order (LC_COLLATE) to use in the database must match collation order of a template database unless
`template0` is used as template.
Expand All @@ -956,8 +956,8 @@ role_action is `dump` or `restore`.
"allow", "disable", "prefer", "require", "verify-ca", "verify-full".
* (6) The name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's
certificate will be verified to be signed by one of these authorities.
* (7) If `False`, check whether values of parameters owner, conn_limit, encoding, db, template, tablespace,
session_role are potentially dangerous. It makes sense to use `False` only when SQL injections via the parameters are
* (7) If `false`, check whether values of parameters owner, conn_limit, encoding, db, template, tablespace,
session_role are potentially dangerous. It makes sense to use `false` only when SQL injections via the parameters are
possible.

#### Schema management.
Expand All @@ -974,12 +974,12 @@ Defaults:
| Parameter | Type | Default | Comment |
|--------------|-----------|----------|---------------------------------------------------------------------------------------|
| name | mandatory | | Name of the schema to add or remove |
| cascade_drop | optional | (omit) | Drop schema with CASCADE to remove child objects. Choices: False/True |
| cascade_drop | optional | (omit) | Drop schema with CASCADE to remove child objects. Choices: false/true |
| database | optional | postgres | Name of the database to connect to and add or remove the schema |
| owner | optional | (omit) | Name of the role to set as owner of the schema |
| ssl_mode | optional | prefer | Determines how an SSL session is negotiated with the server |
| ca_cert | optional | '' | Specifies the name of a file containing SSL certificate authority (CA) certificate(s) |
| trust_input | optional | True | It makes sense only when SQL injections through the options are possible |
| trust_input | optional | true | It makes sense only when SQL injections through the options are possible |

#### Privileges management.

Expand All @@ -1004,11 +1004,11 @@ Defaults:
| type | optional | (omit) | Type of database object to set privileges on (5) |
| ssl_mode | optional | prefer | Determines how an SSL session is negotiated with the server |
| ca_cert | optional | '' | Specifies the name of a file containing SSL certificate authority (CA) certificate(s) |
| trust_input | optional | True | It makes sense only when SQL injections through the options are possible |
| trust_input | optional | true | It makes sense only when SQL injections through the options are possible |

* (1) The special value `PUBLIC` can be provided instead to set permissions for the implicitly defined PUBLIC group.
* (2) Set to `False` to revoke GRANT OPTION, leave unspecified to make no changes. grant_option only has an effect if
`role_action` is `grant`. Choices: `True`, `False`.
* (2) Set to `false` to revoke GRANT OPTION, leave unspecified to make no changes. grant_option only has an effect if
`role_action` is `grant`. Choices: `true`, `false`.
* (3) If type is `table`, `partition table`, `sequence`, `function` or `procedure`, the special value `ALL_IN_SCHEMA`
can be provided instead to specify all database objects of type in the schema specified via schema. (This also works
with PostgreSQL < 9.0). `procedure` is supported since PostgreSQL 11 and community.postgresql collection 1.3.0. If type
Expand All @@ -1035,15 +1035,15 @@ Defaults:
|---------------------|-----------|----------|--------------------------------------------------------------------------------------------|
| name | mandatory | | Name of the replication slot to add or remove |
| db | optional | (omit) | Name of database to connect to |
| immediately_reserve | optional | False | Specifies that the LSN slot be reserved immediately, otherwise on the first connection (1) |
| immediately_reserve | optional | false | Specifies that the LSN slot be reserved immediately, otherwise on the first connection (1) |
| slot_type | optional | physical | Slot type: logical or physical |
| output_plugin | optional | (omit) | All logical slots must indicate which output plugin decoder they're using (2) |
| ssl_mode | optional | prefer | Determines how an SSL session is negotiated with the server |
| ca_cert | optional | '' | Specifies the name of a file containing SSL certificate authority (CA) certificate(s) |
| trust_input | optional | True | It makes sense only when SQL injections through the options are possible |
| trust_input | optional | true | It makes sense only when SQL injections through the options are possible |

* (1) Optional parameter that when `True` specifies that the LSN for this replication slot be reserved immediately,
otherwise the default, `False`, specifies that the LSN is reserved on the first connection from a streaming replication
* (1) Optional parameter that when `true` specifies that the LSN for this replication slot be reserved immediately,
otherwise the default, `false`, specifies that the LSN is reserved on the first connection from a streaming replication
client. Is available from PostgreSQL version 9.6. Uses only with *slot_type=physical*. Mutually exclusive with
*slot_type=logical*.
* (2) This parameter does not apply to physical slots. It will be ignored with *slot_type=physical*. If it wasn't set
Expand Down
8 changes: 4 additions & 4 deletions roles/postgresql/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ role_action: install
role_subject: server

# Perform clean install
clean_install: True
clean_install: true

# Version of pgsql repository.
postgresql_version: 15

# Clean-up PostgreSQL data directory (also see $PGDATA env variable).
cleanup_data_directory: True
cleanup_data_directory: true

# Install only a maximum recommended version based on dnf profile (https://www.postgresql.org/download/linux/redhat/)
# Affects only for systems with dnf package manager. Also read about dnf modules in specified Linux distribution, e.g.:
Expand All @@ -28,7 +28,7 @@ postgresql_recommended_version: false
postgresql_additional_packages: []

# Install psycopg2: https://pypi.org/project/psycopg2/
install_psycopg2: True
install_psycopg2: true

# Install pgadmin for web mode with postgresql server: https://www.pgadmin.org/
install_pgadmin: false
Expand All @@ -37,7 +37,7 @@ install_pgadmin: false
pgadmin_installation_type: web

# Add or remove firewalld and/or ufw rules on installation or uninstallation. Will be skipped when firewall disabled.
firewall_control: True
firewall_control: true


### SERVER PARAMETERS:
Expand Down
2 changes: 1 addition & 1 deletion roles/postgresql/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Side Effect
hosts: all
become: True
become: true
become_method: sudo

tasks:
Expand Down
6 changes: 3 additions & 3 deletions roles/postgresql/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

- name: Verify
hosts: all
gather_facts: True
become: False
gather_facts: true
become: false

tasks:

Expand All @@ -16,6 +16,6 @@
ansible.builtin.lineinfile:
dest: /tmp/test_db.dir
line: "-- PostgreSQL database dump complete"
check_mode: True
check_mode: true
register: dump_complete_line_results
failed_when: dump_complete_line_results.changed
4 changes: 2 additions & 2 deletions roles/postgresql/tasks/add_pgadmin_repo_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
dest: /tmp/pgadmin.gpg
mode: 0644
validate_certs: false
force: True
force: true
register: pgadmin_apt_key_results
until: pgadmin_apt_key_results is succeeded
retries: 5
Expand All @@ -15,4 +15,4 @@
- name: "add pgadmin repo debian | Install pgadmin packages signing key" # noqa risky-shell-pipe
ansible.builtin.shell: >-
cat /tmp/pgadmin.gpg | sudo gpg --dearmor --yes -o {{ pgadmin_apt_keys_dir }}/pgadmin.gpg; rm -f /tmp/pgadmin.gpg
changed_when: True
changed_when: true
4 changes: 2 additions & 2 deletions roles/postgresql/tasks/add_pgdg_repo_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
url: "{{ postgresql_apt_key_url }}"
dest: "{{ postgresql_apt_keys_dir }}/pgdg.asc"
mode: 0755
validate_certs: False
force: True
validate_certs: false
force: true
register: postgresql_apt_key_results
until: postgresql_apt_key_results is succeeded
retries: 5
Expand Down
Loading

0 comments on commit 55f3993

Please sign in to comment.