Commit 74650085 authored by viscapi's avatar viscapi
Browse files

Added support for CentOS 8 hosts

parent 8d5c0dc7
......@@ -6,10 +6,15 @@
register: stat_result
- name: Initialisation de la base de données ICAT
#command: /usr/pgsql-9.3/bin/initdb -D {{path_to_icat}}
command: /usr/pgsql-9.6/bin/initdb -D {{path_to_icat}}
become: true
become_user: postgres
when: stat_result.stat.exists == False
when: stat_result.stat.exists == False and (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7")
- name: Initialisation de la base de données ICAT
command: /usr/bin/initdb -D {{path_to_icat}}
become: true
become_user: postgres
when: stat_result.stat.exists == False and (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8")
...
......@@ -5,11 +5,11 @@
- import_tasks: repos.yml
- import_tasks: packages.yml
- import_tasks: pip.yml
- import_tasks: security.yml
- import_tasks: users.yml
- import_tasks: files.yml
- import_tasks: db_init.yml
- import_tasks: patches.yml
- import_tasks: security.yml
- import_tasks: systemd.yml
- import_tasks: db_privs.yml
......
---
- name: Installation paquets PostgreSQL
- name: Installation paquets PostgreSQL 9.6 pour CentOS 7
yum:
conf_file: '/etc/yum.conf'
name:
- libselinux-python
- python-pip
# - postgresql93
- postgresql96
# - postgresql93-server
- postgresql96-server
# - postgresql93-odbc
- postgresql96-odbc
state: present
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7")
- name: Installation paquets PostgreSQL 10.6 pour CentOS 8
dnf:
conf_file: '/etc/dnf/dnf.conf'
name:
- python3-libselinux
- python3-pip
- postgresql
- postgresql-server
- postgresql-odbc
state: present
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8")
...
---
#- name: Installation du dépôt PostgreSQL 9.3
- name: Installation du dépôt PostgreSQL 9.6
yum:
conf_file: '/etc/yum.conf'
name: https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
#name: https://download.postgresql.org/pub/repos/yum/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-3.noarch.rpm
state: present
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7")
...
......@@ -2,6 +2,19 @@
- selinux:
policy: targeted
state: "{{ selinux_mode }}"
state: "{{ selinux_mode }}"
#- name:
# debug:
# var: "{{ path_to_icat | splitext }}"
- name: Allow PostgreSQL to modify files in "{{ path_to_icat }}"
sefcontext:
target: '{{ path_to_icat }}(/.*)?'
setype: postgresql_db_t
state: present
- name: Apply new SELinux file context to filesystem
command: restorecon -irv "{{ path_to_icat }}"
...
---
# Activation du service postgresql-9.3
# Activation du service postgresql-9.6 pour CentOS 7
- name: Activation du service postgresql-9.3
- name: Activation du service postgresql-9.6 pour CentOS 7
systemd:
enabled: yes
# name: postgresql-9.3
name: postgresql-9.6
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7")
# Modification de la variable PGDATA dans /usr/lib/systemd/system/postgresql-9.3.service
- name: Activation du service postgresql pour CentOS 8
systemd:
enabled: yes
name: postgresql
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8")
# Modification de la variable PGDATA dans /usr/lib/systemd/system/postgresql-9.6.service
- lineinfile:
#path: /usr/lib/systemd/system/postgresql-9.3.service
path: /usr/lib/systemd/system/postgresql-9.6.service
regexp: '^Environment=PGDATA='
line: 'Environment=PGDATA={{path_to_icat}}'
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7")
- lineinfile:
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'] == "8")
# On recharge l'environnememnt
......@@ -22,12 +34,18 @@
systemd:
daemon_reload: yes
# Démarrage du service postgresql-9.3
# Démarrage du service postgresql-9.6
- name: Démarrage du service postgresql-9.3
- name: Démarrage du service postgresql-9.6
systemd:
#name: postgresql-9.3
name: postgresql-9.6
state: started
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7")
- name: Démarrage du service postgresql
systemd:
name: postgresql
state: started
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8")
...
---
- name: Création groupe UNIX postgres
group:
name: "{{ postgresql_unix_group_name }}"
state: present
system: yes
- name: Création groupe et utilisateur postgres
block:
- name: Création groupe UNIX postgres
group:
name: "{{ postgresql_unix_group_name }}"
state: present
system: yes
- name: Création utilisateur postgres
user:
name: "{{ postgresql_unix_user_name }}"
group: "{{ postgresql_unix_group_name }}"
state: present
system: yes
shell: /usr/bin/false
create_home: no
- name: Création utilisateur postgres
user:
name: "{{ postgresql_unix_user_name }}"
group: "{{ postgresql_unix_group_name }}"
state: present
system: yes
shell: /usr/bin/false
create_home: no
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7")
...
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