Skip to content

Instantly share code, notes, and snippets.

@xuxiaodong
Created December 12, 2013 05:23
Show Gist options
  • Save xuxiaodong/7923564 to your computer and use it in GitHub Desktop.
Save xuxiaodong/7923564 to your computer and use it in GitHub Desktop.
---
# Tasks for configuring PostgreSQL server.
#- name: init postgresql
# command: service postgresql initdb creates=/var/lib/pgsql/data/PG_VERSION
# when: ansible_distribution != "Ubuntu"
# tags: postgresql
- name: update postgresql authentication settings
template: src=pg_hba.conf.j2 dest={{pg_hba_location}} owner=postgres
notify: restart postgresql
tags: postgresql
- name: restart postgresql and configure to startup automatically
service: name=postgresql state=restarted enabled=yes
tags: postgresql
- name: wait for postgresql restart
command: sleep 10
tags: postgresql
- name: create the postgresql user for awx
postgresql_user: name={{pg_username}} password={{pg_password}} login_user=postgres
sudo_user: postgres
tags: postgresql
- name: create the postgresql database for awx
postgresql_db: name={{pg_database}} owner={{pg_username}} state=present login_user=postgres
sudo_user: postgres
tags: postgresql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment