Created
September 21, 2016 08:10
-
-
Save nguyenvinhlinh/38313fc2ad97beeffd2590614571fbfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: kmt | |
become_user: root | |
become: yes | |
gather_facts: no | |
remote_user: vagrant | |
tasks: | |
- name: Install postgres database | |
apt: | |
name: "{{item}}" | |
state: installed | |
with_items: | |
- postgresql | |
- libpq-dev | |
- python-psycopg2 | |
- hosts: kmt | |
become: yes | |
become_user: postgres | |
gather_facts: no | |
vars: | |
dbname: kmt_prod | |
dbuser: nguyenvinhlinh | |
dbpassword: nguyenvinhlinh | |
tasks: | |
- name: make database | |
postgresql_db: name={{dbname}} | |
- name: ensure user has access to database | |
postgresql_user: db={{dbname}} name={{dbuser}} password={{dbpassword}} priv=ALL | |
- name: ensure user does not have unnecessary privilege | |
postgresql_user: name={{dbuser}} role_attr_flags=NOSUPERUSER,NOCREATEDB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment