Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ansible-atom

This role helps to install Access to Memory (AtoM) in Linux (trusty, xenial and Centos / RedHat 7).
This role helps to install Access to Memory (AtoM) in Linux (trusty, xenial, bionic, focal, jammy, noble, Centos/RedHat 7, Rocky/ALmalinux/Redhat 8, Rocky/ALmalinux/Redhat 9).

Please feel free to add support for other platforms, pull requests accepted!

Expand All @@ -18,22 +18,26 @@ This role allows to install AtoM on CentOS 7 and Ubuntu 14.04, 16:04, 18.04 and
| AtoM 2.5 | 7.0 and 7.2 | CentOS/RedHat 7 | 16.04 and 18.04| >=5.0,<6.0 | >=5.1,<6.0 |
| AtoM 2.6 | 7.2 and 7.3 | CentOS/RedHat 7 | 18.04 | >=5.0,<6.0 | >=8.0 |
| AtoM 2.7 | 7.4 |CentOS/RH 7, Rocky/RH 8-9| 20.04 | >=5.0,<6.0 | >=8.0 |
| AtoM 2.8 | 7.4 |CentOS/RH 7, Rocky/RH 8-9| 20.04 | >=5.0,<6.0 | >=8.0 |
| AtoM 2.9 | 8.1, 8.2, 8.3 | RH 9, Rocky/RH 9 | 22.04 and 24.04| >=6.0,<7.0 | >=8.0 |

The next table explains the valid `atom_php_version` values that you can use
depending on the AtoM version and Linux Distro. It is very important to take
into account the default value (last column), because if you need a different
php version you must set the `atom_php_version` variable on ansible `host_vars`
or `group_vars` files to the desired version.

|Linux Distro| AtoM 2.3 | AtoM 2.4 | AtoM 2.5 | AtoM 2.6 | AtoM 2.7 | Default |
|------------|----------|----------|----------|----------|----------|----------|
|CentOS/RH 7 | 70 | 70 | 70,71,72 | 72,73 | 74 | 72 |
|Rocky/RH 8 | | | | | 74 | 74 |
|Rocky/RH 9 | | | | | 74 | 74 |
|Ubuntu 14.04| 5 | 5 | | | | 5 |
|Ubuntu 16.04| 7.0 | 7.0 | 7.0 | | | 7.0 |
|Ubuntu 18.04| | | 7.2 | 7.2 | | 7.2 |
|Ubuntu 20.04| | | | | 7.4 | 7.4 |
|Linux Distro| AtoM 2.3 | AtoM 2.4 | AtoM 2.5 | AtoM 2.6 | AtoM 2.7 | AtoM 2.8 | AtoM 2.9 | Default |
|------------|----------|----------|----------|----------|----------|----------|----------|----------|
|CentOS/RH 7 | 70 | 70 | 70,71,72 | 72,73 | 74 | 74 | | 72 |
|Rocky/RH 8 | | | | | 74 | 74 | | 74 |
|Rocky/RH 9 | | | | | 74 | 74 | 81,82,83 | 74 |
|Ubuntu 14.04| 5 | 5 | | | | | | 5 |
|Ubuntu 16.04| 7.0 | 7.0 | 7.0 | | | | | 7.0 |
|Ubuntu 18.04| | | 7.2 | 7.2 | | | | 7.2 |
|Ubuntu 20.04| | | | | 7.4 | 7.4 | | 7.4 |
|Ubuntu 22.04| | | | | | | 8.1 | 8.1 |
|Ubuntu 24.04| | | | | | | 8.3 | 8.3 |

From the table above, you can see the Linux distro you need depending on the
AtoM version. For instance, AtoM 2.6 can only be installed on CentOS 7 or
Expand All @@ -43,7 +47,9 @@ Ubuntu 18.04.

- AtoM <=2.4, Binder 0.8: Elasticsearch>=1.3,<2.0; MySQL>5.1,<6.0
- Atom 2.5, Binder 0.9: Elasticsearch>=5.3,<6.x; MySQL>5.1,<6.0
- AtoM >= 2.6: Elasticsearch>=5.3,<6.x; MySQL>=8.0
- AtoM 2.6-2.8: Elasticsearch>=5.3,<6.x; MySQL>=8.0
- AtoM 2.9: Elasticsearch=>6.0,<7.0; MySQL>=8.0


## Overriding default templates

Expand Down
13 changes: 12 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ atom_worker_old_config: "no"
# CLI tasks
#

# Clear cache
atom_clear_cache: "yes"
# Compile all available themes
atom_compile_all_themes: "no"
# Populate search index
Expand Down Expand Up @@ -288,4 +290,13 @@ atom_php_install_memprof_module: "no"
# NPM
#

atom_npm_version: "9.8.1"
# Define default `atom_npm_version` depending on OS and version
atom_npm_version: >-
{{
(
"10.9.2" if ansible_os_family == 'Debian' and ansible_distribution_version >= '22.04' else
"10.9.2" if ansible_os_family == 'RedHat' and ansible_distribution_version > '7' else
"9.8.1"
) | trim
}}

1 change: 1 addition & 0 deletions tasks/cli_tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
command: "php symfony cache:clear"
args:
chdir: "{{ atom_path }}/{{ atom_extra_path }}"
when: "atom_clear_cache|bool"
notify:
- "Reload PHP service"

Expand Down
131 changes: 131 additions & 0 deletions tasks/deps-rh-php-81.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---

- name: "Install epel repo"
yum:
name: "epel-release"
state: "installed"
when:
- ansible_distribution not in ['RedHat']
- install_rpm_repositories|bool

- name: "Add epel-release repository (RHEL)"
yum:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version|int }}.noarch.rpm"
state: "present"
when:
- ansible_distribution == 'RedHat'
- install_rpm_repositories|bool

- name: "Import Remi GPG key (php version >= 8.1) (EL9)"
rpm_key:
key: "https://rpms.remirepo.net/RPM-GPG-KEY-remi2021"
state: present
when:
- install_rpm_repositories|bool
- ansible_distribution_major_version|int == 9

- name: "Import Remi GPG key (php version >= 8.1) (EL8)"
rpm_key:
key: "https://rpms.remirepo.net/RPM-GPG-KEY-remi2018"
state: present
when:
- install_rpm_repositories|bool
- ansible_distribution_major_version|int == 8

- name: "Import Remi GPG key (php version >= 8.1) (EL7)"
rpm_key:
key: "https://rpms.remirepo.net/RPM-GPG-KEY-remi"
state: present
when:
- install_rpm_repositories|bool
- ansible_distribution_major_version|int == 7


- name: "Install Remi Repo (php version >= 8.1)"
yum:
name: "https://rpms.remirepo.net/enterprise/remi-release-{{ ansible_distribution_major_version }}.rpm"
state: "installed"
when: install_rpm_repositories|bool

- name: "Disable nodejs module on RedHat/Rocky 8"
command: "dnf module -y disable nodejs"
when:
- ansible_distribution_major_version|int == 8
- install_rpm_repositories|bool

- name: "Import nodesource GPG key (php version >= 8.1)"
rpm_key:
key: "https://rpm.nodesource.com/gpgkey/ns-operations-public.key"
state: present
when: install_rpm_repositories|bool

# Based on install script: https://rpm.nodesource.com/setup_23.x
- name: "Add NodeSource Node.js {{ nodejs_major_version }} repository"
yum_repository:
name: "nodesource-nodejs"
description: "Node.js Packages for Linux RPM based distros - x86_64"
baseurl: "https://rpm.nodesource.com/pub_22.x/nodistro/nodejs/x86_64"
enabled: yes
gpgcheck: yes
gpgkey: "https://rpm.nodesource.com/gpgkey/ns-operations-public.key"
priority: 9
module_hotfixes: yes
when: install_rpm_repositories|bool

- name: "Add rpmfusion free repo (for ffmpeg)"
command: 'yum localinstall -y --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-{{ ansible_distribution_major_version }}.noarch.rpm'
args:
creates: "/etc/yum.repos.d/rpmfusion-free-updates.repo"
when: install_rpm_repositories|bool

# Required by ffmpeg
- name: "Enable powertools repo on RedHat/Rocky 8)"
command: "dnf config-manager --set-enabled powertools"
when:
- ansible_distribution_major_version|int == 8
- install_rpm_repositories|bool

- name: "Install AtoM dependencies"
yum:
name:
- "ImageMagick" # ↓ AtoM dependencies
- "ghostscript" #
- "poppler-utils" #
- "ffmpeg" #
- "git" # ↓ Build dependencies
- "make" #
- "gcc" #
- "java-11-openjdk-headless" # needed by FOP
state: "latest"

- name: "Install nodejs build dependency (php version >= 8.1)"
yum:
name:
- "nodejs"
state: "latest"

- name: "Check if exists an old lessc symlink"
stat:
path: "/usr/bin/lessc"
register: _lessc_symlink

- name: "Remove old lessc symlink"
file:
path: "/usr/bin/lessc"
state: "absent"
when: _lessc_symlink.stat.islnk is defined and _lessc_symlink.stat.islnk

- name: "Install npm global dependencies (also required during the build)"
npm:
name: "{{ item }}"
global: "yes"
with_items:
- "grunt-cli"
- "less@<4.0.0"

- name: "Install selinux necessary packages required by this ansible role"
yum:
name: "{{ atom_selinux_ansible_deps }}"
state: "latest"
when:
- ansible_selinux is defined and ansible_selinux != False and ansible_selinux.status == 'enabled'
24 changes: 18 additions & 6 deletions tasks/deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,29 @@
update_cache: "yes"
when: "ansible_distribution_version is version('14.04', '<=')"

- name: "Add nodesource repo for nodejs (Ubuntu >=20.04)"
- name: "Add nodesource repo key for nodejs (Ubuntu == 20.04)"
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
when: "ansible_distribution_version is version('20.04', '>=')"
when: "ansible_distribution_version is version('20.04', '==')"

- name: "Add nodejs 14.x ppa for apt repo (Ubuntu >=20.04)"
- name: "Add nodesource repo key for nodejs (Ubuntu >=22.04)"
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
state: present
when: "ansible_distribution_version is version('22.04', '>=')"

- name: "Add nodejs 14.x PPA for apt repo (Ubuntu == 20.04)"
apt_repository:
repo: "deb https://deb.nodesource.com/node_14.x focal main"
update_cache: yes
when: "ansible_distribution_version is version('20.04', '==')"

- name: "Add nodejs 22.x PPA for apt repo (Ubuntu >= 22.04)"
apt_repository:
repo: "deb https://deb.nodesource.com/node_14.x focal main"
update_cache: "yes"
when: "ansible_distribution_version is version('20.04', '>=')"
repo: "deb https://deb.nodesource.com/node_22.x nodistro main"
update_cache: yes
when: "ansible_distribution_version is version('22.04', '>=')"

- name: "Install AtoM dependencies (Ubuntu <= Xenial/16.04)"
apt:
Expand Down
6 changes: 4 additions & 2 deletions tasks/devbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
git:
update: "yes"
repo: "https://github.com/artefactual/atom-docs.git"
version: "2.7"
version: "2.9"
dest: "{{ ansible_env.HOME }}/atom-docs"
accept_hostkey: "yes"
become_user: "vagrant"
Expand All @@ -94,11 +94,13 @@
pip:
name: "pip"
state: "present"
version: "20.3"
version: "25.0.1"
break_system_packages: true

- name: "Install atom-docs requirements"
pip:
requirements: "{{ ansible_env.HOME }}/atom-docs/requirements.txt"
break_system_packages: true

- name: "Create symlink to AtoM sources"
file:
Expand Down
20 changes: 18 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
- "atom-deps"
when:
- ansible_os_family in ["RedHat","Rocky"]
- php_version|int >= 74
- php_version|int >= 74 and php_version|int < 81

- import_tasks: "deps-rh-php-81.yml"
tags:
- "atom-deps"
when:
- ansible_os_family in ["RedHat","Rocky"]
- php_version|int >= 81

- import_tasks: "php.yml"
tags:
Expand All @@ -52,7 +59,16 @@
- "atom-php"
when:
- ansible_os_family in ["RedHat","Rocky"]
- php_version|int >= 74
- php_version|int == 74

- import_tasks: "php-rh-8.yml"
environment:
- PATH: "{{ ansible_env.PATH }}:{{ php_rh_centos_path }}"
tags:
- "atom-php"
when:
- ansible_os_family in ["RedHat","Rocky"]
- php_version|int >= 80

- import_tasks: "php-composer.yml"
environment:
Expand Down
11 changes: 10 additions & 1 deletion tasks/php-rh-74.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@
- "java-1.8.0-openjdk-headless" # needed for fop
state: "latest"

- name: "Remove existing /usr/bin/php"
file:
path: "/usr/bin/php"
state: absent

- name: "Create /usr/bin/php link"
file:
src: "{{ php_rh_centos_path }}/php"
src: "{{ php_rh_centos_path }}/php"
dest: "/usr/bin/php"
state: "link"

- name: "Restore SELinux context for /usr/bin/php"
command: "restorecon -v /usr/bin/php"
when: ansible_selinux.status == "enabled"

- name: "Set php.ini memory to 512"
lineinfile:
path: "{{ php_rh_centos_etc_path }}/php.ini"
Expand Down
45 changes: 45 additions & 0 deletions tasks/php-rh-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---

- name: Remove old PHP 7 packages
yum:
name: "php7*"
state: absent
- name: "Install PHP packages in RH/Centos"
yum:
name:
- "php{{ php_version }}-php-cli"
- "php{{ php_version }}-php-ldap"
- "php{{ php_version }}-php-fpm"
- "php{{ php_version }}-php-mysqlnd"
- "php{{ php_version }}-php-xml"
- "php{{ php_version }}-php-opcache"
- "php{{ php_version }}-php-devel"
- "php{{ php_version }}-php-mbstring"
- "php{{ php_version }}-php-pecl-apcu"
- "php{{ php_version }}-php-pecl-memcache"
- "php{{ php_version }}-php-pecl-memprof"
- "php{{ php_version }}-php-pecl-zip"
- "zlib-devel" # needed for memcached
- "unzip"
- "java-1.8.0-openjdk-headless" # needed for fop
allowerasing: true
install_weak_deps: false
state: "latest"

- name: "Create /usr/bin/php link"
file:
src: "{{ php_rh_centos_path }}/php"
dest: "/usr/bin/php"
state: "link"

- name: "Set php.ini memory to 512"
lineinfile:
path: "{{ php_rh_centos_etc_path }}/php.ini"
regexp: '^memory_limit'
line: 'memory_limit = 512M'

- name: "Enable php{{ php_version }}-php-fpm service"
systemd:
name: "php{{ php_version }}-php-fpm"
state: "restarted"
enabled: "yes"
Loading