Skip to content

Instantly share code, notes, and snippets.

@dalethestirling
Created September 10, 2017 22:24
Show Gist options
  • Save dalethestirling/f02410ddf2b1b3369954243d34ca4bd7 to your computer and use it in GitHub Desktop.
Save dalethestirling/f02410ddf2b1b3369954243d34ca4bd7 to your computer and use it in GitHub Desktop.
Create Postgres DB user using lookup()
- name: Create db users
postgresql_user:
login_host: "{{ hostname }}"
login_user: "{{ db_user }}"
login_password: "{{ db_passwd }}"
db: "{{ db }}"
priv: "{{ db_priv }}"
name: "{{ item }}"
password: "{{ lookup('password', playbook_dir + '/' + db + '-' + item.user + '.passwd') }}"
no_password_changes: yes
with_items: "{{ db_user_list }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment