Commit ec1de1e6 authored by viscapi's avatar viscapi
Browse files

WIP: Added preliminary support for Ubuntu 18.04

parent 95cae560
--- ---
- name: Install iRODS packages and misc. - name: Install iRODS packages and misc. on CentOS
package: package:
name: name:
- libselinux-python - libselinux-python
...@@ -8,5 +8,15 @@ ...@@ -8,5 +8,15 @@
- irods-server-{{ irods_version }} - irods-server-{{ irods_version }}
- irods-database-plugin-postgres-{{ irods_version }} - irods-database-plugin-postgres-{{ irods_version }}
state: present state: present
when: ansible_facts['distribution'] == "CentOS"
- name: Install iRODS packages and misc. on Ubuntu
package:
name:
- python-pip
- irods-server={{ irods_version }}
- irods-database-plugin-postgres={{ irods_version }}
state: present
when: ansible_facts['distribution'] == "Ubuntu"
... ...
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
state: present state: present
validate_certs: yes validate_certs: yes
- name: Add iRODS repository on Debian / Ubuntu - name: Add iRODS repository on Ubuntu 18
apt_repository: apt_repository:
repo: deb [arch=amd64] https://package.irods.org/apt/ $(lsb_release -sc) main" repo: "deb [arch=amd64] https://packages.irods.org/apt/ {{ ansible_distribution_release }} main"
state: present state: present
filename: renci-irods filename: renci-irods
update_cache: yes update_cache: true
validate_certs: yes validate_certs: yes
when: ansible_facts['distribution'] == "Debian" when: ansible_facts['distribution'] == "Ubuntu"
... ...
--- ---
- name: Set SELinux mode - name: Set SELinux mode on CentOS
selinux: selinux:
policy: targeted policy: targeted
state: "{{ selinux_mode }}" state: "{{ selinux_mode }}"
when: ansible_facts['distribution'] == "CentOS"
... ...
--- ---
- name: Collect PostgreSQL version - name: Collect and print PostgreSQL version on Ubuntu
become: yes block:
become_user: postgres - name: Collect PostgreSQL version
postgresql_info: become: yes
filter: ver* become_user: postgres
register: postgresql_version postgresql_info:
filter: ver*
register: postgresql_version
- name: Print PostgreSQL version - name: Print PostgreSQL version
debug: debug:
var: postgresql_version.version.major var: postgresql_version.version.major
when: (ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] == "18")
... ...
...@@ -12,6 +12,12 @@ ...@@ -12,6 +12,12 @@
register: stat_result_debian register: stat_result_debian
when: ansible_facts['distribution'] == "Debian" when: ansible_facts['distribution'] == "Debian"
- name: Check that the database doesn't exist yet on Ubuntu
stat:
path: "/etc/postgresql/{{ postgresql_version.version.major }}/{{ cluster_name }}/postgresql.conf"
register: stat_result_ubuntu
when: ansible_facts['distribution'] == "Ubuntu"
- name: Initialization of ICAT database on CentOS 7 - name: Initialization of ICAT database on CentOS 7
command: /usr/pgsql-{{ external_postgresql_version }}/bin/initdb -D {{path_to_icat}} command: /usr/pgsql-{{ external_postgresql_version }}/bin/initdb -D {{path_to_icat}}
become: true become: true
...@@ -42,4 +48,10 @@ ...@@ -42,4 +48,10 @@
become_user: postgres become_user: postgres
when: (ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_major_version'] == "10" and stat_result_debian.stat.exists == False) when: (ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_major_version'] == "10" and stat_result_debian.stat.exists == False)
- name: Initialization of ICAT database on Ubuntu 18.04
command: /usr/bin/pg_createcluster -d {{ path_to_icat }} {{ postgresql_version.version.major }} {{ cluster_name }}
become: true
become_user: postgres
when: (ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] == "18" and stat_result_ubuntu.stat.exists == False)
... ...
...@@ -6,15 +6,16 @@ ...@@ -6,15 +6,16 @@
state: present state: present
password: "{{ database_password }}" password: "{{ database_password }}"
login_user: postgres login_user: postgres
login_unix_socket: /tmp become: true
# login_unix_socket mandatory (else looks it up in /var/run/postgresql) become_user: postgres
- name: Create PostgreSQL iRODS database - name: Create PostgreSQL iRODS database
postgresql_db: postgresql_db:
name: "{{ database_name }}" name: "{{ database_name }}"
state: present state: present
login_user: postgres login_user: postgres
login_unix_socket: /tmp become: true
become_user: postgres
- name: Set database privileges - name: Set database privileges
postgresql_privs: postgresql_privs:
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
type: database type: database
roles: "{{ database_user }}" roles: "{{ database_user }}"
login_user: postgres login_user: postgres
login_unix_socket: /tmp become: true
become_user: postgres
... ...
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
- import_tasks: pip.yml - import_tasks: pip.yml
- import_tasks: users.yml - import_tasks: users.yml
- import_tasks: files.yml - import_tasks: files.yml
- import_tasks: db_info.yml
- import_tasks: db_init.yml - import_tasks: db_init.yml
- import_tasks: patches.yml - import_tasks: patches.yml
- import_tasks: security.yml - import_tasks: security.yml
- import_tasks: systemd.yml - import_tasks: systemd.yml
- import_tasks: db_info.yml
- import_tasks: db_privs.yml - import_tasks: db_privs.yml
... ...
...@@ -66,4 +66,16 @@ ...@@ -66,4 +66,16 @@
state: present state: present
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8" and use_distribution_postgresql) when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8" and use_distribution_postgresql)
- name: Install ancillary packages for Ubuntu 18.04
apt:
name: python-pip
state: present
when: (ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] == "18")
- name: Install PostgreSQL 10 packages for Ubuntu 18.04
apt:
name: postgresql
state: present
when: (ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] == "18" and use_distribution_postgresql)
... ...
--- ---
- name: Configure PostgreSQL listen address - name: Configure PostgreSQL listen address and authorization in pg_hba.conf on CentOS
lineinfile: block:
path: "{{ path_to_icat }}/postgresql.conf" - name: Configure PostgreSQL listen address on CentOS
regexp: '^#listen_addresses =' lineinfile:
line: 'listen_addresses = {{ ansible_nodename }}' path: "{{ path_to_icat }}/postgresql.conf"
backrefs: yes regexp: '^#listen_addresses ='
backup: yes line: 'listen_addresses = {{ ansible_nodename }}'
backrefs: yes
backup: yes
- name: Set autorization in pg_hba.conf - name: Set authorization in pg_hba.conf on CentOS
postgresql_pg_hba: postgresql_pg_hba:
dest: "{{ path_to_icat }}/pg_hba.conf" dest: "{{ path_to_icat }}/pg_hba.conf"
databases: "{{ database_name }}" databases: "{{ database_name }}"
users: "{{ database_user }}" users: "{{ database_user }}"
address: "{{ provider_ip }}/24" address: "{{ provider_ip }}/24"
contype: host contype: host
method: trust method: trust
when: (ansible_facts['distribution'] == "CentOS")
- name: Configure PostgreSQL listen address and authorization in pg_hba.conf on Ubuntu
block:
- name: Configure PostgreSQL listen address on Ubuntu
lineinfile:
path: "/etc/postgresql/{{ postgresql_version.version.major }}/{{ cluster_name }}/postgresql.conf"
regexp: '^#listen_addresses ='
line: 'listen_addresses = {{ ansible_nodename }}'
backrefs: yes
backup: yes
- name: Set autorization in pg_hba.conf on Ubuntu
postgresql_pg_hba:
dest: /etc/postgresql/{{ postgresql_version.version.major }}/{{ cluster_name }}/pg_hba.conf
databases: "{{ database_name }}"
users: "{{ database_user }}"
address: "{{ provider_ip }}/24"
contype: host
method: trust
when: (ansible_facts['distribution'] == "Ubuntu")
... ...
--- ---
- name: Set SELinux mode - name: Set SELinux mode on CentOS
selinux: selinux:
policy: targeted policy: targeted
state: "{{ selinux_mode }}" state: "{{ selinux_mode }}"
when: ansible_facts['distribution'] == "CentOS"
- name: Allow PostgreSQL to modify files in "{{ path_to_icat }}" - name: Allow PostgreSQL to modify files in "{{ path_to_icat }}" on CentOS
sefcontext: sefcontext:
target: '{{ path_to_icat }}(/.*)?' target: '{{ path_to_icat }}(/.*)?'
setype: postgresql_db_t setype: postgresql_db_t
state: present state: present
when: ansible_facts['distribution'] == "CentOS"
- name: Apply new SELinux file context to filesystem - name: Apply new SELinux file context to filesystem
command: restorecon -irv "{{ path_to_icat }}" command: restorecon -irv "{{ path_to_icat }}"
when: ansible_facts['distribution'] == "CentOS"
... ...
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