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:
name:
- libselinux-python
......@@ -8,5 +8,15 @@
- irods-server-{{ irods_version }}
- irods-database-plugin-postgres-{{ irods_version }}
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 @@
state: present
validate_certs: yes
- name: Add iRODS repository on Debian / Ubuntu
- name: Add iRODS repository on Ubuntu 18
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
filename: renci-irods
update_cache: yes
update_cache: true
validate_certs: yes
when: ansible_facts['distribution'] == "Debian"
when: ansible_facts['distribution'] == "Ubuntu"
...
---
- name: Set SELinux mode
- name: Set SELinux mode on CentOS
selinux:
policy: targeted
state: "{{ selinux_mode }}"
when: ansible_facts['distribution'] == "CentOS"
...
---
- name: Collect PostgreSQL version
become: yes
become_user: postgres
postgresql_info:
filter: ver*
register: postgresql_version
- name: Collect and print PostgreSQL version on Ubuntu
block:
- name: Collect PostgreSQL version
become: yes
become_user: postgres
postgresql_info:
filter: ver*
register: postgresql_version
- name: Print PostgreSQL version
debug:
var: postgresql_version.version.major
- name: Print PostgreSQL version
debug:
var: postgresql_version.version.major
when: (ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] == "18")
...
......@@ -12,6 +12,12 @@
register: stat_result_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
command: /usr/pgsql-{{ external_postgresql_version }}/bin/initdb -D {{path_to_icat}}
become: true
......@@ -42,4 +48,10 @@
become_user: postgres
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 @@
state: present
password: "{{ database_password }}"
login_user: postgres
login_unix_socket: /tmp
# login_unix_socket mandatory (else looks it up in /var/run/postgresql)
become: true
become_user: postgres
- name: Create PostgreSQL iRODS database
postgresql_db:
name: "{{ database_name }}"
state: present
login_user: postgres
login_unix_socket: /tmp
become: true
become_user: postgres
- name: Set database privileges
postgresql_privs:
......@@ -24,6 +25,7 @@
type: database
roles: "{{ database_user }}"
login_user: postgres
login_unix_socket: /tmp
become: true
become_user: postgres
...
......@@ -7,11 +7,11 @@
- import_tasks: pip.yml
- import_tasks: users.yml
- import_tasks: files.yml
- import_tasks: db_info.yml
- import_tasks: db_init.yml
- import_tasks: patches.yml
- import_tasks: security.yml
- import_tasks: systemd.yml
- import_tasks: db_info.yml
- import_tasks: db_privs.yml
...
......@@ -66,4 +66,16 @@
state: present
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
lineinfile:
path: "{{ path_to_icat }}/postgresql.conf"
regexp: '^#listen_addresses ='
line: 'listen_addresses = {{ ansible_nodename }}'
backrefs: yes
backup: yes
- name: Configure PostgreSQL listen address and authorization in pg_hba.conf on CentOS
block:
- name: Configure PostgreSQL listen address on CentOS
lineinfile:
path: "{{ path_to_icat }}/postgresql.conf"
regexp: '^#listen_addresses ='
line: 'listen_addresses = {{ ansible_nodename }}'
backrefs: yes
backup: yes
- name: Set autorization in pg_hba.conf
postgresql_pg_hba:
dest: "{{ path_to_icat }}/pg_hba.conf"
databases: "{{ database_name }}"
users: "{{ database_user }}"
address: "{{ provider_ip }}/24"
contype: host
method: trust
- name: Set authorization in pg_hba.conf on CentOS
postgresql_pg_hba:
dest: "{{ path_to_icat }}/pg_hba.conf"
databases: "{{ database_name }}"
users: "{{ database_user }}"
address: "{{ provider_ip }}/24"
contype: host
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:
policy: targeted
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:
target: '{{ path_to_icat }}(/.*)?'
setype: postgresql_db_t
state: present
when: ansible_facts['distribution'] == "CentOS"
- name: Apply new SELinux file context to filesystem
command: restorecon -irv "{{ path_to_icat }}"
when: ansible_facts['distribution'] == "CentOS"
...
Markdown is supported
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