diff options
Diffstat (limited to 'openstack/usr/share/openstack')
-rw-r--r-- | openstack/usr/share/openstack/keystone.yml | 45 | ||||
-rw-r--r-- | openstack/usr/share/openstack/postgres.yml | 48 |
2 files changed, 48 insertions, 45 deletions
diff --git a/openstack/usr/share/openstack/keystone.yml b/openstack/usr/share/openstack/keystone.yml index 64a78ccd..330d74d0 100644 --- a/openstack/usr/share/openstack/keystone.yml +++ b/openstack/usr/share/openstack/keystone.yml @@ -42,51 +42,6 @@ with_items: - rabbitmq-server - # Postgres configuration, this may end up in a different playbook - - 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 - - # Keystone configuration - name: Create the keystone user. user: diff --git a/openstack/usr/share/openstack/postgres.yml b/openstack/usr/share/openstack/postgres.yml new file mode 100644 index 00000000..3cf23704 --- /dev/null +++ b/openstack/usr/share/openstack/postgres.yml @@ -0,0 +1,48 @@ +--- +- hosts: localhost + vars_files: + - "/etc/openstack/keystone.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 |