diff options
author | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-06-02 08:40:27 +0000 |
---|---|---|
committer | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-06-02 13:56:08 +0000 |
commit | 02faf51e91a8c55adfbb6d953bca354ab99bf261 (patch) | |
tree | eff61e6fe9bb3adcf254c4e86eebca7190c65cce /install-files/openstack/usr/share/openstack/postgres.yml | |
parent | 65ddf13f13ab68c1c5728e40dd81f1e8826ab0cf (diff) | |
download | definitions-02faf51e91a8c55adfbb6d953bca354ab99bf261.tar.gz |
Move all the directories used for install-files into a subdirectorybaserock/adamcoldrick/all-exts-in-definitions-v2
Change-Id: I309c183ce8b9ff9d0f5ac4807244547f2cc4ddf5
Diffstat (limited to 'install-files/openstack/usr/share/openstack/postgres.yml')
-rw-r--r-- | install-files/openstack/usr/share/openstack/postgres.yml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/install-files/openstack/usr/share/openstack/postgres.yml b/install-files/openstack/usr/share/openstack/postgres.yml new file mode 100644 index 00000000..5ff9355e --- /dev/null +++ b/install-files/openstack/usr/share/openstack/postgres.yml @@ -0,0 +1,48 @@ +--- +- hosts: localhost + vars_files: + - "/etc/openstack/postgres.conf" + tasks: + + - name: Create postgres user + user: + name: postgres + comment: PostgreSQL Server + shell: /sbin/nologin + home: /var/lib/pgsql + + - name: Create the postgres directories + file: + path: "{{ item }}" + state: directory + owner: postgres + group: postgres + with_items: + - /var/run/postgresql + - /var/lib/pgsql/data + + - name: Initialise postgres database + command: pg_ctl -D /var/lib/pgsql/data initdb + args: + creates: /var/lib/pgsql/data/base + sudo: yes + sudo_user: postgres + + - name: Add the configuration needed for postgres for Openstack + template: + src: /usr/share/openstack/postgres/{{ item }} + dest: /var/lib/pgsql/data/{{ item }} + owner: postgres + group: postgres + mode: 0600 + with_items: + - postgresql.conf + - pg_hba.conf + + - name: Enable and start postgres services + service: + name: "{{ item }}" + enabled: yes + state: started + with_items: + - postgres-server |