Skip to content

Commit

Permalink
Merge branch 'Copperfield-master'
Browse files Browse the repository at this point in the history
* Copperfield-master:
  Sparate users's tasks in functional units
  Users bafore database. Other way it make no sense
  Provide support for a basic user owner database
  • Loading branch information
pjan committed Jan 28, 2015
2 parents 78b1463 + 6345cc8 commit 92dd45a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ postgresql_service_group: "{{ postgresql_admin_user }}"
postgresql_cluster_name: "main"
postgresql_cluster_reset: false

postgresql_database_owner: "{{ postgresql_admin_user }}"
# Extensions
postgresql_ext_install_contrib: no
postgresql_ext_install_dev_headers: no
Expand Down
1 change: 1 addition & 0 deletions tasks/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- name: PostgreSQL | Make sure the PostgreSQL databases are present
postgresql_db:
name: "{{item.name}}"
owner: "{{postgresql_database_owner}}"
encoding: "{{postgresql_encoding}}"
lc_collate: "{{postgresql_locale}}"
lc_ctype: "{{postgresql_locale}}"
Expand Down
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
tags: [postgresql, postgresql-extensions]

- include: configure.yml
<<<<<<< HEAD
tags: [postgresql, postgresql-configure]

- include: databases.yml
Expand All @@ -15,6 +16,11 @@
- include: users.yml
tags: [postgresql, postgresql-users]

=======
- include: users.yml
- include: databases.yml
- include: users_priv.yml
>>>>>>> c20146400af29681dc4faed4d6744e74bd6aacd6
- include: monit.yml
when: monit_protection is defined and monit_protection == true
tags: [postgresql, postgresql-monit]
10 changes: 0 additions & 10 deletions tasks/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,3 @@
login_host: "{{item.host | default('localhost')}}"
with_items: postgresql_users
when: postgresql_users|length > 0

- name: PostgreSQL | Update the user privileges
postgresql_user:
name: "{{item.name}}"
db: "{{item.db}}"
priv: "{{item.priv | default('ALL')}}"
state: present
login_host: "{{item.host | default('localhost')}}"
with_items: postgresql_user_privileges
when: postgresql_users|length > 0
11 changes: 11 additions & 0 deletions tasks/users_privileges.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# file: postgresql/tasks/users_privileges.yml

- name: PostgreSQL | Update the user privileges
postgresql_user:
name: "{{item.name}}"
db: "{{item.db}}"
priv: "{{item.priv | default('ALL')}}"
state: present
login_host: "{{item.host | default('localhost')}}"
with_items: postgresql_user_privileges
when: postgresql_users|length > 0

0 comments on commit 92dd45a

Please sign in to comment.