Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rocky 8+9 #194

Merged
merged 22 commits into from
Oct 9, 2024
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
6 changes: 5 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ galaxy_info:
- 22.04
- name: SLES
versions:
- name: Rocky
versions:
- 8
- 9

dependencies: []
dependencies: []
16 changes: 16 additions & 0 deletions tasks/base/Rocky-8/install_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Install base dependencies
package:
name: "{{ item }}"
state: present

# Note: Elastic doc'n calls for sysstat & net-tools,
# but the RedHat-8 version of this file omits them
with_items:
- lvm2
- iptables
- sysstat
- net-tools
# for Rocky 9
# - containernetworking-plugins

42 changes: 42 additions & 0 deletions tasks/base/Rocky-8/install_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# Note: this code is largely copied from the RedHat-8 version

- name: Remove docker
package:
name: "{{ packages }}"
state: absent
vars:
packages:
- docker
register: remove_packages
retries: 10
delay: 30
until: remove_packages is success

- name: disable SELinux
selinux:
state: disabled

- name: Add Docker GPG Key
rpm_key:
key: "{{ docker_version_map[docker_version]['keys']['server'] }}"
state: present

- name: Add Rocky8 Extras repository
shell: dnf config-manager --add-repo="{{ docker_version_map[docker_version]['repo'] }}"
register: repo_installed
retries: 10
delay: 30
until: repo_installed is success

- name: Install docker
package:
name: "{{ docker_version_map[docker_version]['package'] }}"
state: present

- name: Verify that fs.may_detach_mounts is enabled
lineinfile:
path: /etc/sysctl.conf
regexp: '^fs.may_detach_mounts'
line: 'fs.may_detach_mounts = 1'
create: yes
12 changes: 12 additions & 0 deletions tasks/base/Rocky-8/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Disable firewalld
systemd:
name: firewalld
state: stopped
enabled: no
ignore_errors: true

- include_tasks: install_dependencies.yml
- include_tasks: install_docker.yml
tags: [install_docker, destructive]

15 changes: 15 additions & 0 deletions tasks/base/Rocky-9/install_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Install base dependencies
package:
name: "{{ item }}"
state: present

# Note: Elastic doc'n calls for sysstat & net-tools,
# but the RedHat-8 version of this file omits them
with_items:
- lvm2
- iptables
- sysstat
- net-tools
# Elastic doc'n specifically mentions this for Rocky 9
- containernetworking-plugins
42 changes: 42 additions & 0 deletions tasks/base/Rocky-9/install_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# Note: this code is largely copied from the RedHat-8 version

- name: Remove docker
package:
name: "{{ packages }}"
state: absent
vars:
packages:
- docker
register: remove_packages
retries: 10
delay: 30
until: remove_packages is success

- name: disable SELinux
selinux:
state: disabled

- name: Add Docker GPG Key
rpm_key:
key: "{{ docker_version_map[docker_version]['keys']['server'] }}"
state: present

- name: Add Rocky9 Extras repository
shell: dnf config-manager --add-repo="{{ docker_version_map[docker_version]['repo'] }}"
register: repo_installed
retries: 10
delay: 30
until: repo_installed is success

- name: Install docker
package:
name: "{{ docker_version_map[docker_version]['package'] }}"
state: present

- name: Verify that fs.may_detach_mounts is enabled
lineinfile:
path: /etc/sysctl.conf
regexp: '^fs.may_detach_mounts'
line: 'fs.may_detach_mounts = 1'
create: yes
12 changes: 12 additions & 0 deletions tasks/base/Rocky-9/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Disable firewalld
systemd:
name: firewalld
state: stopped
enabled: no
ignore_errors: true

- include_tasks: install_dependencies.yml
- include_tasks: install_docker.yml
tags: [install_docker, destructive]

28 changes: 28 additions & 0 deletions vars/os_Rocky_8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
docker_unit_after: "multi-user.target"
docker_storage_driver: overlay2
bootloader_update_command: grub2-mkconfig -o /etc/grub2.cfg
conntrack_module: ip_conntrack

# Docker version mapping
docker_version_map:
"19.03":
name: 'Docker-CE'
package:
- docker-ce-19.03.13
- docker-ce-cli-19.03.13
- containerd.io-1.5.11
repo: https://download.docker.com/linux/centos/docker-ce.repo
keys:
server: https://download.docker.com/linux/centos/gpg
id: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
"20.10":
name: 'Docker-CE'
package:
- docker-ce-20.10.8
- docker-ce-cli-20.10.8
- containerd.io-1.5.11
repo: https://download.docker.com/linux/centos/docker-ce.repo
keys:
server: https://download.docker.com/linux/centos/gpg
id: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
28 changes: 28 additions & 0 deletions vars/os_Rocky_9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
docker_unit_after: "multi-user.target"
docker_storage_driver: overlay2
bootloader_update_command: grub2-mkconfig -o /etc/grub2.cfg
conntrack_module: ip_conntrack

# Docker version mapping
docker_version_map:
"19.03":
name: 'Docker-CE'
package:
- docker-ce-19.03.13
- docker-ce-cli-19.03.13
- containerd.io-1.5.11
repo: https://download.docker.com/linux/centos/docker-ce.repo
keys:
server: https://download.docker.com/linux/centos/gpg
id: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
"20.10":
name: 'Docker-CE'
package:
- docker-ce-20.10.8
- docker-ce-cli-20.10.8
- containerd.io-1.5.11
repo: https://download.docker.com/linux/centos/docker-ce.repo
keys:
server: https://download.docker.com/linux/centos/gpg
id: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35