Commit 9d322442 authored by viscapi's avatar viscapi
Browse files

Systemd module now compatible with both stock and external PostgreSQL

parent 3af57edc
...@@ -2,10 +2,17 @@ ...@@ -2,10 +2,17 @@
- name: Set PGDATA environment variable on CentOS 7 - name: Set PGDATA environment variable on CentOS 7
lineinfile: lineinfile:
path: /usr/lib/systemd/system/postgresql-{{ postgresql_version }}.service path: /usr/lib/systemd/system/postgresql.service
regexp: '^Environment=PGDATA='
line: 'Environment=PGDATA={{path_to_icat}}'
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7" and use_distribution_postgresql)
- name: Set PGDATA environment variable on CentOS 7
lineinfile:
path: /usr/lib/systemd/system/postgresql-{{ external_postgresql_version }}.service
regexp: '^Environment=PGDATA=' regexp: '^Environment=PGDATA='
line: 'Environment=PGDATA={{path_to_icat}}' line: 'Environment=PGDATA={{path_to_icat}}'
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7") when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7" and not use_distribution_postgresql)
- name: Set PGDATA environment variable on CentOS 8 - name: Set PGDATA environment variable on CentOS 8
lineinfile: lineinfile:
...@@ -14,13 +21,21 @@ ...@@ -14,13 +21,21 @@
line: 'Environment=PGDATA={{path_to_icat}}' line: 'Environment=PGDATA={{path_to_icat}}'
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8") when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8")
- name: Start postgresql service on CentOS 7
systemd:
name: postgresql
state: started
daemon_reload: yes
enabled: yes
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7" and use_distribution_postgresql)
- name: Start postgresql-{{ postgresql_version }} service on CentOS 7 - name: Start postgresql-{{ postgresql_version }} service on CentOS 7
systemd: systemd:
name: postgresql-{{ postgresql_version }} name: postgresql-{{ external_postgresql_version }}
state: started state: started
daemon_reload: yes daemon_reload: yes
enabled: yes enabled: yes
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7") when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7" and not use_distribution_postgresql)
- name: Start postgresql service on CentOS 8 - name: Start postgresql service on CentOS 8
systemd: systemd:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment