Skip to content

Commit

Permalink
Improve package installation
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkyffin committed Aug 8, 2023
1 parent 1be9791 commit 00c6adf
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 95 deletions.
11 changes: 1 addition & 10 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
---
- name: "Update apt cache if running on Debian system"
apt:
update_cache: yes
when: ansible_os_family == 'Debian'

- name: "Update yum cache if running on RedHat system"
yum:
update_cache: yes
when: ansible_os_family == 'RedHat'

- name: "Installing common packages"
package:
state: latest
state: present
name:
- htop
- unzip
Expand Down
1 change: 1 addition & 0 deletions roles/dev_common/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---

dependencies:
- role: java
- role: payara
19 changes: 10 additions & 9 deletions roles/dev_common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
---
- include_vars: vars/redhat.yml
when: ansible_os_family == 'RedHat'

- include_vars: vars/debian-16.yml
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == '16'

- include_vars: vars/debian-20.yml
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == '20'
- name: "Install Java -devel package (RedHat only)"
package:
state: present
name: "java-{{ java_version }}-openjdk-devel"
when: ansible_os_family == "RedHat"

- name: "Installing common dev packages"
package:
state: latest
name: "{{ dev_common_pkgs }}"
state: present
name:
- git
- maven
- python3-pip

- name: "Installing common dev python packages"
pip:
Expand Down
5 changes: 0 additions & 5 deletions roles/dev_common/vars/debian-16.yml

This file was deleted.

5 changes: 0 additions & 5 deletions roles/dev_common/vars/debian-20.yml

This file was deleted.

5 changes: 0 additions & 5 deletions roles/dev_common/vars/redhat.yml

This file was deleted.

9 changes: 3 additions & 6 deletions roles/icat_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
- include_vars: vars/redhat.yml
when: ansible_os_family == 'RedHat'

- include_vars: vars/debian-16.yml
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == '16'

- include_vars: vars/debian-20.yml
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == '20'
- include_vars: vars/debian.yml
when: ansible_os_family == 'Debian'

- name: "Install common icat_server dependencies"
package:
state: latest
state: present
name: "{{ icat_server_pkgs }}"

- name: "Check icat_server package"
Expand Down
4 changes: 0 additions & 4 deletions roles/icat_server/vars/debian-16.yml

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion roles/java/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

# Either choose '8' or '11'
# Either choose '11' or '17'
java_version: '11'
15 changes: 5 additions & 10 deletions roles/java/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
---
- include_vars: vars/redhat-java-8.yml
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7' and java_version == '8'

- include_vars: vars/redhat-java-11.yml
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7' and java_version == '11'
- include_vars: vars/redhat.yml
when: ansible_os_family == 'RedHat'

- include_vars: vars/debian-java-8.yml
when: ansible_os_family == 'Debian' and ( ansible_distribution_major_version == '16' or ansible_distribution_major_version == '20') and java_version == '8'

- include_vars: vars/debian-java-11.yml
when: ansible_os_family == 'Debian' and ( ansible_distribution_major_version == '16' or ansible_distribution_major_version == '20') and java_version == '11'
- include_vars: vars/debian.yml
when: ansible_os_family == 'Debian'

- name: "Install Java packages"
package:
state: latest
state: present
name: "{{ java_pkgs }}"
3 changes: 0 additions & 3 deletions roles/java/vars/debian-java-11.yml

This file was deleted.

3 changes: 0 additions & 3 deletions roles/java/vars/debian-java-8.yml

This file was deleted.

6 changes: 6 additions & 0 deletions roles/java/vars/debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

java_pkgs:
- openjdk-{{ java_version }}-jdk-headless

java_dir: /usr/lib/jvm/java-{{ java_version }}-openjdk-amd64
4 changes: 0 additions & 4 deletions roles/java/vars/redhat-java-11.yml

This file was deleted.

4 changes: 0 additions & 4 deletions roles/java/vars/redhat-java-8.yml

This file was deleted.

6 changes: 6 additions & 0 deletions roles/java/vars/redhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

java_pkgs:
- java-{{ java_version }}-openjdk-headless

java_dir: /usr/lib/jvm/java-{{ java_version }}-openjdk
9 changes: 3 additions & 6 deletions roles/mariadb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
- include_vars: vars/redhat.yml
when: ansible_os_family == 'RedHat'

- include_vars: vars/debian-16.yml
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == '16'

- include_vars: vars/debian-20.yml
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == '20'
- include_vars: vars/debian.yml
when: ansible_os_family == 'Debian'

- name: "Install mariadb packages"
package:
state: latest
state: present
name: "{{ mariadb_pkgs }}"

- name: "Configure default storage engine"
Expand Down
9 changes: 0 additions & 9 deletions roles/mariadb/vars/debian-20.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ mariadb_config_dir: /etc/mysql/conf.d
mariadb_pkgs:
- mariadb-server
- mariadb-client
- python-mysqldb
- python3-mysqldb
12 changes: 2 additions & 10 deletions roles/payara/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,11 @@
executable: /bin/bash
when: installationResult.stat.exists is defined and installationResult.stat.exists == false

- name: 'Make sure we are using the correct java version for payara for Debian systems (Ubuntu 16.04 & 20.04)'
- name: 'Make sure we are using the correct java version for payara'
lineinfile:
path: /home/{{ payara_user }}/{{ payara_directory }}/glassfish/config/asenv.conf
line: 'AS_JAVA="/usr/lib/jvm/java-1.{{ java_version }}.0-openjdk-amd64"'
line: 'AS_JAVA="{{ java_dir }}"'
regexp: '^AS_JAVA='
when: ansible_os_family == 'Debian' and ( ansible_distribution_major_version == '16' or ansible_distribution_major_version == '20')

- name: 'Make sure we are using the correct java version for payara for Red Hat systems (EL 7)'
lineinfile:
path: /home/{{ payara_user }}/{{ payara_directory }}/glassfish/config/asenv.conf
line: 'AS_JAVA="/usr/lib/jvm/java-{{ java_version }}-openjdk"'
regexp: '^AS_JAVA='
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7'

- name: 'Temporary fix for https://github.com/payara/Payara/issues/6344'
lineinfile:
Expand Down

0 comments on commit 00c6adf

Please sign in to comment.