Skip to content

Commit

Permalink
Prevent users, databases and schemas deletion
Browse files Browse the repository at this point in the history
In our case we prefer to prevent this kind of deletion through ansible
  • Loading branch information
Jamal-B committed Feb 14, 2024
1 parent 71553a4 commit aab9b9e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ postgresql_databases:
uuid_ossp: yes # flag to install the uuid-ossp extension on this database (yes/no)
citext: yes # flag to install the citext extension on this database (yes/no)
encoding: "UTF-8" # override global {{ postgresql_encoding }} variable per database
state: "present" # optional; one of 'present', 'absent', 'dump', 'restore'
lc_collate: "en_GB.UTF-8" # override global {{ postgresql_locale }} variable per database
lc_ctype: "en_GB.UTF-8" # override global {{ postgresql_ctype }} variable per database

Expand All @@ -114,18 +113,15 @@ postgresql_users:
- name: baz
pass: pass
encrypted: yes # if password should be encrypted, postgresql >= 10 does only accepts encrypted passwords
state: "present" # optional; one of 'present', 'absent'

# List of schemas to be created (optional)
postgresql_database_schemas:
- database: foobar # database name
schema: acme # schema name
state: present

- database: foobar # database name
schema: acme_baz # schema name
owner: baz # owner name
state: present

# List of user privileges to be applied (optional)
postgresql_user_privileges:
Expand Down
2 changes: 1 addition & 1 deletion tasks/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
lc_ctype: "{{ item.lc_ctype | default(postgresql_ctype) }}"
port: "{{postgresql_port}}"
template: "template0"
state: "{{ item.state | default('present') }}"
state: "present"
login_user: "{{postgresql_admin_user}}"
become: yes
become_user: "{{postgresql_admin_user}}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
login_password: "{{ item.password | default(omit) }}"
login_user: "{{ postgresql_admin_user }}"
port: "{{ postgresql_port }}"
state: "{{ item.state | default('present') }}"
state: "present"
become: yes
become_user: "{{ postgresql_admin_user }}"
no_log: "{{ postgresql_hide_passwords }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
password: "{{ item.pass | default(omit) }}"
encrypted: "{{ item.encrypted | default(omit) }}"
port: "{{postgresql_port}}"
state: "{{ item.state | default('present') }}"
state: "present"
login_user: "{{postgresql_admin_user}}"
no_log: "{{ postgresql_hide_passwords }}"
become: yes
Expand Down

0 comments on commit aab9b9e

Please sign in to comment.