Skip to content

Commit

Permalink
Merge pull request ANXS#62 from leonelgalan/master
Browse files Browse the repository at this point in the history
Merges user privilages into correct role
  • Loading branch information
pjan committed Jan 30, 2015
2 parents f0ad7e4 + 7db5a39 commit 792f943
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
15 changes: 0 additions & 15 deletions tasks/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,3 @@
sudo_user: "{{postgresql_admin_user}}"
with_items: postgresql_users
when: postgresql_users|length > 0

- name: PostgreSQL | Update the user privileges
postgresql_user:
name: "{{item.name}}"
db: "{{item.db}}"
port: "{{postgresql_port}}"
priv: "{{item.priv | default('ALL')}}"
state: present
login_user: "{{postgresql_admin_user}}"
role_attr_flags: "{{item.role_attr_flags | default('')}}"
sudo: yes
sudo_user: "{{postgresql_admin_user}}"
with_items: postgresql_user_privileges
when: postgresql_users|length > 0

5 changes: 5 additions & 0 deletions tasks/users_privileges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
postgresql_user:
name: "{{item.name}}"
db: "{{item.db}}"
port: "{{postgresql_port}}"
priv: "{{item.priv | default('ALL')}}"
state: present
login_host: "{{item.host | default('localhost')}}"
login_user: "{{postgresql_admin_user}}"
role_attr_flags: "{{item.role_attr_flags | default('')}}"
sudo: yes
sudo_user: "{{postgresql_admin_user}}"
with_items: postgresql_user_privileges
when: postgresql_users|length > 0
7 changes: 4 additions & 3 deletions test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
- hosts: all
vars_files:
- 'defaults/main.yml'
- defaults/main.yml
- vars/test.yml
tasks:
- include: 'tasks/main.yml'
- include: tasks/main.yml
handlers:
- include: 'handlers/main.yml'
- include: handlers/main.yml
10 changes: 10 additions & 0 deletions vars/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
blah: one
postgresql_databases:
- name: foobar
postgresql_users:
- name: baz
pass: pass
postgresql_user_privileges:
- name: baz
db: foobar

0 comments on commit 792f943

Please sign in to comment.