mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Update main.yml
This commit is contained in:
parent
bbe819aa22
commit
950313fd98
1 changed files with 60 additions and 47 deletions
|
@ -1,91 +1,104 @@
|
||||||
- name: Install PostgreSQL packages
|
- name: Install PostgreSQL packages
|
||||||
package: name={{ item }}
|
package:
|
||||||
state=present
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- postgresql
|
- postgresql
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
|
|
||||||
- name: Install PostgreSQL for Debian
|
- name: Install postgresql-client (debuntu)
|
||||||
package: name=postgresql-client
|
package:
|
||||||
|
name: postgresql-client
|
||||||
when: is_debuntu
|
when: is_debuntu
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
|
|
||||||
- name: Install PostgreSQL for Fedora
|
- name: Install postgresql-server (OS's other than debuntu)
|
||||||
package: name=postgresql-server
|
package:
|
||||||
|
name: postgresql-server
|
||||||
when: not is_debuntu
|
when: not is_debuntu
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
|
|
||||||
- name: Create postgresql-iiab systemd service
|
- name: Create postgresql-iiab systemd service
|
||||||
template: src=postgresql-iiab.service
|
template:
|
||||||
dest=/etc/systemd/system/postgresql-iiab.service
|
src: postgresql-iiab.service
|
||||||
owner=root
|
dest: /etc/systemd/system/postgresql-iiab.service
|
||||||
group=root
|
owner: root
|
||||||
mode=0644
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
- name: Create postgres data directory
|
- name: Create postgres data directory
|
||||||
file: path=/library/pgsql-iiab
|
file:
|
||||||
owner=postgres
|
path: /library/pgsql-iiab
|
||||||
group=postgres
|
owner: postgres
|
||||||
mode=0700
|
group: postgres
|
||||||
state=directory
|
mode: 0700
|
||||||
|
state: directory
|
||||||
|
|
||||||
- name: Make sure that the en_US locale is enabled
|
- name: Make sure that the en_US locale is enabled (debuntu)
|
||||||
lineinfile: dest=/etc/locale.gen
|
lineinfile:
|
||||||
line="{{ postgresql_locale }} UTF-8"
|
dest: /etc/locale.gen
|
||||||
|
line: "{{ postgresql_locale }} UTF-8"
|
||||||
when: is_debuntu
|
when: is_debuntu
|
||||||
|
|
||||||
- name: Generate the selected locales
|
- name: Generate the selected locales (debuntu)
|
||||||
command: /usr/sbin/locale-gen
|
command: /usr/sbin/locale-gen
|
||||||
when: is_debuntu
|
when: is_debuntu
|
||||||
|
|
||||||
- name: Initialize the postgres db
|
- name: Initialize the postgres db (debuntu)
|
||||||
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"
|
||||||
creates=/library/pgsql-iiab/pg_hba.conf
|
args:
|
||||||
|
creates: /library/pgsql-iiab/pg_hba.conf
|
||||||
when: is_debuntu
|
when: is_debuntu
|
||||||
|
|
||||||
- name: Initialize the postgres db
|
- name: Initialize the postgres db (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"
|
||||||
creates=/library/pgsql-iiab/pg_hba.conf
|
args:
|
||||||
|
creates: /library/pgsql-iiab/pg_hba.conf
|
||||||
when: not is_debuntu
|
when: not is_debuntu
|
||||||
|
|
||||||
- name: Configure PostgreSQL
|
- name: Configure PostgreSQL
|
||||||
template: backup=yes
|
template:
|
||||||
src=postgresql.conf.j2
|
backup: yes
|
||||||
dest=/library/pgsql-iiab/postgresql.conf
|
src: postgresql.conf.j2
|
||||||
owner=postgres
|
dest: /library/pgsql-iiab/postgresql.conf
|
||||||
group=postgres
|
owner: postgres
|
||||||
mode=0640
|
group: postgres
|
||||||
|
mode: 0640
|
||||||
|
|
||||||
- name: Stop postgresql service
|
- name: Stop postgresql service (debuntu)
|
||||||
command: "/etc/init.d/postgresql stop"
|
command: "/etc/init.d/postgresql stop"
|
||||||
ignore_errors: True
|
ignore_errors: True
|
||||||
when: postgresql_install and is_debuntu
|
when: postgresql_install and is_debuntu
|
||||||
|
|
||||||
- name: Stop and disable stock postgresql service
|
- name: Stop and disable stock postgresql service
|
||||||
service: name=postgresql
|
service:
|
||||||
state=stopped
|
name: postgresql
|
||||||
enabled=no
|
state: stopped
|
||||||
|
enabled: no
|
||||||
|
|
||||||
- name: Start and enable postgresql-iiab service
|
- name: Start and enable postgresql-iiab service
|
||||||
service: name=postgresql-iiab
|
service:
|
||||||
state=started
|
name: postgresql-iiab
|
||||||
enabled=yes
|
state: started
|
||||||
|
enabled: yes
|
||||||
when: postgresql_enabled
|
when: postgresql_enabled
|
||||||
|
|
||||||
- name: Stop and disable postgresql-iiab service if not postgresql_enabled
|
- name: Stop and disable postgresql-iiab service if not postgresql_enabled
|
||||||
service: name=postgresql-iiab
|
service:
|
||||||
state=stopped
|
name: postgresql-iiab
|
||||||
enabled=no
|
state: stopped
|
||||||
|
enabled: no
|
||||||
when: not postgresql_enabled
|
when: not postgresql_enabled
|
||||||
|
|
||||||
- name: Add postgresql to service list
|
- name: Add 'postgresql' to list of services at /etc/iiab/iiab.ini
|
||||||
ini_file: dest='{{ service_filelist }}'
|
ini_file:
|
||||||
section=postgresql
|
dest: "{{ service_filelist }}"
|
||||||
option='{{ item.option }}'
|
section: postgresql
|
||||||
value='{{ item.value }}'
|
option: "{{ item.option }}"
|
||||||
|
value: "{{ item.value }}"
|
||||||
with_items:
|
with_items:
|
||||||
- option: name
|
- option: name
|
||||||
value: postgresql
|
value: postgresql
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue