mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Clean & tighten postgresql/tasks/install.yml
This commit is contained in:
parent
b8ffdb1258
commit
060a371de3
1 changed files with 21 additions and 34 deletions
|
@ -1,21 +1,11 @@
|
||||||
- name: Install 'postgresql' package
|
- name: 'Install packages: postgresql, postgresql-client'
|
||||||
package:
|
package:
|
||||||
name: postgresql
|
name:
|
||||||
|
- postgresql
|
||||||
|
- postgresql-client
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install 'postgresql-client' package (debuntu)
|
- name: Install /etc/systemd/system/postgresql-iiab.service from template (0644 by default)
|
||||||
package:
|
|
||||||
name: postgresql-client
|
|
||||||
state: present
|
|
||||||
when: is_debuntu
|
|
||||||
|
|
||||||
- name: Install 'postgresql-server' package (OS's other than debuntu)
|
|
||||||
package:
|
|
||||||
name: postgresql-server
|
|
||||||
state: present
|
|
||||||
when: not is_debuntu
|
|
||||||
|
|
||||||
- name: Install /etc/systemd/system/postgresql-iiab.service from template
|
|
||||||
template:
|
template:
|
||||||
src: postgresql-iiab.service
|
src: postgresql-iiab.service
|
||||||
dest: /etc/systemd/system/postgresql-iiab.service
|
dest: /etc/systemd/system/postgresql-iiab.service
|
||||||
|
@ -23,50 +13,47 @@
|
||||||
# group: root
|
# group: root
|
||||||
# mode: '0644'
|
# mode: '0644'
|
||||||
|
|
||||||
- name: Create PostgreSQL data dir /library/pgsql-iiab, owned by postgres:postgres
|
- name: Create PostgreSQL data dir /library/pgsql-iiab, owned by postgres:postgres (0700)
|
||||||
file:
|
file:
|
||||||
|
state: directory
|
||||||
path: /library/pgsql-iiab
|
path: /library/pgsql-iiab
|
||||||
owner: postgres
|
owner: postgres
|
||||||
group: postgres
|
group: postgres
|
||||||
mode: '0700'
|
mode: 0700
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: Make sure locale {{ postgresql_locale }} is enabled (debuntu) # en_US.UTF-8
|
- name: Make sure locale {{ postgresql_locale }} is enabled # en_US.UTF-8
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/locale.gen
|
dest: /etc/locale.gen
|
||||||
line: "{{ postgresql_locale }} UTF-8"
|
line: "{{ postgresql_locale }} UTF-8"
|
||||||
when: is_debuntu
|
|
||||||
|
|
||||||
- name: Generate locales (debuntu)
|
- name: Generate locales
|
||||||
command: /usr/sbin/locale-gen
|
command: /usr/sbin/locale-gen
|
||||||
when: is_debuntu
|
|
||||||
|
|
||||||
- name: Initialize the PostgreSQL db, creating /library/pgsql-iiab/pg_hba.conf (debuntu)
|
- name: Initialize the PostgreSQL db, creating /library/pgsql-iiab/pg_hba.conf
|
||||||
#command: su - postgres -c "/usr/lib/postgresql/{{ postgresql_version }}/bin/initdb -E 'UTF-8' --locale={{ postgresql_locale }} -D /library/pgsql-iiab"
|
#command: su - postgres -c "/usr/lib/postgresql/{{ postgresql_version }}/bin/initdb -E 'UTF-8' --locale={{ postgresql_locale }} -D /library/pgsql-iiab"
|
||||||
command: /usr/lib/postgresql/{{ postgresql_version }}/bin/initdb -E 'UTF-8' --locale={{ postgresql_locale }} -D /library/pgsql-iiab
|
command: /usr/lib/postgresql/{{ postgresql_version }}/bin/initdb -E 'UTF-8' --locale={{ postgresql_locale }} -D /library/pgsql-iiab
|
||||||
args:
|
args:
|
||||||
creates: /library/pgsql-iiab/pg_hba.conf
|
creates: /library/pgsql-iiab/pg_hba.conf
|
||||||
become: yes
|
become: yes
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
when: is_debuntu
|
|
||||||
|
|
||||||
- name: Initialize the PostgreSQL db, creating /library/pgsql-iiab/pg_hba.conf (OS's other than debuntu)
|
# - name: Initialize the PostgreSQL db, creating /library/pgsql-iiab/pg_hba.conf (OS's other than debuntu)
|
||||||
#command: su - postgres -c "/usr/bin/initdb -E 'UTF-8' --lc-collate={{ postgresql_locale }} --lc-ctype={{ postgresql_locale }} -D /library/pgsql-iiab"
|
# #command: su - postgres -c "/usr/bin/initdb -E 'UTF-8' --lc-collate={{ postgresql_locale }} --lc-ctype={{ postgresql_locale }} -D /library/pgsql-iiab"
|
||||||
command: /usr/bin/initdb -E 'UTF-8' --lc-collate={{ postgresql_locale }} --lc-ctype={{ postgresql_locale }} -D /library/pgsql-iiab
|
# command: /usr/bin/initdb -E 'UTF-8' --lc-collate={{ postgresql_locale }} --lc-ctype={{ postgresql_locale }} -D /library/pgsql-iiab
|
||||||
args:
|
# args:
|
||||||
creates: /library/pgsql-iiab/pg_hba.conf
|
# creates: /library/pgsql-iiab/pg_hba.conf
|
||||||
become: yes
|
# become: yes
|
||||||
become_user: postgres
|
# become_user: postgres
|
||||||
when: not is_debuntu
|
# when: not is_debuntu
|
||||||
|
|
||||||
- name: Install /library/pgsql-iiab/postgresql.conf owned by postgres:postgres, from template
|
- name: Install /library/pgsql-iiab/postgresql.conf from template (postgres:postgres, 0640)
|
||||||
template:
|
template:
|
||||||
backup: yes
|
backup: yes
|
||||||
src: postgresql.conf.j2
|
src: postgresql.conf.j2
|
||||||
dest: /library/pgsql-iiab/postgresql.conf
|
dest: /library/pgsql-iiab/postgresql.conf
|
||||||
owner: postgres
|
owner: postgres
|
||||||
group: postgres
|
group: postgres
|
||||||
mode: '0640'
|
mode: 0640
|
||||||
|
|
||||||
- name: Disable & Stop stock 'postgresql' (parent) systemd service
|
- name: Disable & Stop stock 'postgresql' (parent) systemd service
|
||||||
systemd:
|
systemd:
|
||||||
|
|
Loading…
Reference in a new issue