mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Update postgresql/tasks/main.yml
This commit is contained in:
parent
150d836137
commit
117f48b422
1 changed files with 25 additions and 17 deletions
|
@ -1,30 +1,32 @@
|
||||||
- name: Install postgresql package
|
# TO DO:
|
||||||
|
# - validate input vars postgresql_install & postgresql_enabled
|
||||||
|
# - put the ~12 stanzas below into install.yml
|
||||||
|
# - when: postgresql_install is defined
|
||||||
|
|
||||||
|
- name: Install 'postgresql' package
|
||||||
package:
|
package:
|
||||||
name: postgresql
|
name: postgresql
|
||||||
state: present
|
state: present
|
||||||
#tags: download
|
|
||||||
|
|
||||||
- name: Install postgresql-client (debuntu)
|
- name: Install 'postgresql-client' package (debuntu)
|
||||||
package:
|
package:
|
||||||
name: postgresql-client
|
name: postgresql-client
|
||||||
state: present
|
state: present
|
||||||
when: is_debuntu | bool
|
when: is_debuntu | bool
|
||||||
#tags: download
|
|
||||||
|
|
||||||
- name: Install postgresql-server (OS's other than debuntu)
|
- name: Install 'postgresql-server' package (OS's other than debuntu)
|
||||||
package:
|
package:
|
||||||
name: postgresql-server
|
name: postgresql-server
|
||||||
state: present
|
state: present
|
||||||
when: not is_debuntu
|
when: not is_debuntu
|
||||||
#tags: download
|
|
||||||
|
|
||||||
- name: Install /etc/systemd/system/postgresql-iiab.service from template
|
- 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
|
||||||
owner: root
|
# owner: root
|
||||||
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
|
||||||
file:
|
file:
|
||||||
|
@ -71,26 +73,32 @@
|
||||||
group: postgres
|
group: postgres
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
|
|
||||||
# Probably Not Nec! Given stanza below does the same.
|
# Likely No Longer Nec! Given stanza below does the same...
|
||||||
- name: 'Stop postgresql service: /etc/init.d/postgresql stop (debuntu)'
|
#- name: 'Stop postgresql service: /etc/init.d/postgresql stop (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: Disable stock postgresql service
|
- name: Disable & Stop stock 'postgresql' systemd service
|
||||||
systemd:
|
systemd:
|
||||||
name: postgresql
|
name: postgresql
|
||||||
state: stopped
|
state: stopped
|
||||||
enabled: no
|
enabled: no
|
||||||
|
|
||||||
- name: Enable & Start postgresql-iiab systemd service, if postgresql_enabled
|
- name: "Add 'postgresql_installed: True' to {{ iiab_state_file }}"
|
||||||
|
lineinfile:
|
||||||
|
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
||||||
|
regexp: '^postgresql_installed'
|
||||||
|
line: 'postgresql_installed: True'
|
||||||
|
|
||||||
|
- name: Enable & Start 'postgresql-iiab' systemd service, if 'postgresql_enabled'
|
||||||
systemd:
|
systemd:
|
||||||
name: postgresql-iiab
|
name: postgresql-iiab
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
when: postgresql_enabled | bool
|
when: postgresql_enabled | bool
|
||||||
|
|
||||||
- name: Disable postgresql-iiab service, if not postgresql_enabled
|
- name: Disable 'postgresql-iiab' systemd service, if not 'postgresql_enabled'
|
||||||
systemd:
|
systemd:
|
||||||
name: postgresql-iiab
|
name: postgresql-iiab
|
||||||
state: stopped
|
state: stopped
|
||||||
|
|
Loading…
Reference in a new issue