Add install support for Alma Linux.

This commit is contained in:
Marco Ochse 2023-07-03 23:43:31 +02:00
parent 45d7b60d4c
commit 1ebdfc2eac
2 changed files with 70 additions and 65 deletions

View file

@ -27,12 +27,12 @@ if [ ${EUID} -eq 0 ];
fi fi
# Check if running on a supported distribution # Check if running on a supported distribution
mySUPPORTED_DISTRIBUTIONS=("Fedora Linux" "Debian GNU/Linux" "openSUSE Tumbleweed" "Rocky Linux" "Ubuntu") mySUPPORTED_DISTRIBUTIONS=("AlmaLinux" "Debian GNU/Linux" "Fedora Linux" "openSUSE Tumbleweed" "Rocky Linux" "Ubuntu")
myCURRENT_DISTRIBUTION=$(awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d '"') myCURRENT_DISTRIBUTION=$(awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d '"')
if [[ ! " ${mySUPPORTED_DISTRIBUTIONS[@]} " =~ " ${myCURRENT_DISTRIBUTION} " ]]; if [[ ! " ${mySUPPORTED_DISTRIBUTIONS[@]} " =~ " ${myCURRENT_DISTRIBUTION} " ]];
then then
echo "### Only the following distributions are supported: Fedora, Debian, openSUSE Tumbleweed, Rocky and Ubuntu." echo "### Only the following distributions are supported: AlmaLinux, Fedora, Debian, openSUSE Tumbleweed, Rocky Linux and Ubuntu."
echo echo
exit 1 exit 1
fi fi
@ -96,7 +96,7 @@ case ${myCURRENT_DISTRIBUTION} in
echo "export ANSIBLE_PYTHON_INTERPRETER=/bin/python3" | sudo tee /etc/profile.d/ansible.sh >/dev/null echo "export ANSIBLE_PYTHON_INTERPRETER=/bin/python3" | sudo tee /etc/profile.d/ansible.sh >/dev/null
source /etc/profile.d/ansible.sh source /etc/profile.d/ansible.sh
;; ;;
"Rocky Linux") "AlmaLinux"|"Rocky Linux")
echo echo
echo ${myINSTALL_NOTIFICATION} echo ${myINSTALL_NOTIFICATION}
echo echo

View file

@ -8,6 +8,7 @@
gather_facts: true gather_facts: true
become: false become: false
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
@ -22,7 +23,7 @@
success_msg: "Running as user: {{ ansible_user_id }}." success_msg: "Running as user: {{ ansible_user_id }}."
- name: Check if supported distribution (All) - name: Check if supported distribution (All)
assert: assert:
that: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] that: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
fail_msg: "T-Pot is not supported on this plattform: {{ ansible_distribution }}." fail_msg: "T-Pot is not supported on this plattform: {{ ansible_distribution }}."
success_msg: "T-Pot will now install on {{ ansible_distribution }}." success_msg: "T-Pot will now install on {{ ansible_distribution }}."
@ -38,8 +39,9 @@
tasks: tasks:
- name: Syncing clocks (All) - name: Syncing clocks (All)
shell: "hwclock --hctosys" shell: "hwclock --hctosys"
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
@ -55,7 +57,7 @@
- git - git
- gnupg - gnupg
- grc - grc
- neovim - vim
- net-tools - net-tools
state: latest state: latest
update_cache: yes update_cache: yes
@ -64,16 +66,17 @@
- "Debian" - "Debian"
- "Ubuntu" - "Ubuntu"
- name: Install grc from remote repo (Rocky) - name: Install grc from remote repo (AlmaLinux, Rocky)
ansible.builtin.dnf: ansible.builtin.dnf:
name: 'https://github.com/kriipke/grc/releases/download/1.13.8/grc-1.13.8-1.el7.noarch.rpm' name: 'https://github.com/kriipke/grc/releases/download/1.13.8/grc-1.13.8-1.el7.noarch.rpm'
disable_gpg_check: true disable_gpg_check: true
state: present state: present
when: ansible_distribution in ["Rocky"] when: ansible_distribution in ["AlmaLinux", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Rocky" - "Rocky"
- name: Install recommended packages (Fedora, Rocky) - name: Install recommended packages (AlmaLinux, Fedora, Rocky)
package: package:
name: name:
- bash-completion - bash-completion
@ -82,30 +85,13 @@
- dnf-plugins-core - dnf-plugins-core
- git - git
- grc - grc
- neovim - vim
- net-tools - net-tools
state: latest state: latest
update_cache: yes update_cache: yes
when: ansible_distribution in ["Fedora", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
tags:
- "Fedora"
- "Rocky"
- name: Install recommended packages (Fedora, Rocky)
package:
name:
- bash-completion
- ca-certificates
- curl
- dnf-plugins-core
- git
- grc
- neovim
- net-tools
state: latest
update_cache: yes
when: ansible_distribution in ["Fedora"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
@ -132,7 +118,7 @@
- curl - curl
- git - git
- grc - grc
- neovim - vim
state: latest state: latest
update_cache: yes update_cache: yes
when: ansible_distribution in ["openSUSE Tumbleweed"] when: ansible_distribution in ["openSUSE Tumbleweed"]
@ -149,7 +135,7 @@
become: true become: true
tasks: tasks:
- name: Remove distribution based Docker packages (Debian, Fedora, Rocky, Ubuntu) - name: Remove distribution based Docker packages (AlmaLinux, Debian, Fedora, Rocky, Ubuntu)
package: package:
name: name:
- docker - docker
@ -159,8 +145,9 @@
- runc - runc
state: absent state: absent
update_cache: yes update_cache: yes
when: ansible_distribution in ["Debian", "Fedora", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
@ -216,14 +203,15 @@
tags: tags:
- "Fedora" - "Fedora"
- name: Add Docker repository (Rocky) - name: Add Docker repository (AlmaLinux, Rocky)
shell: | shell: |
if [ "$(dnf repolist docker-ce-stable)" == "" ]; if [ "$(dnf repolist docker-ce-stable)" == "" ];
then then
dnf -y config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo dnf -y config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
fi fi
when: ansible_distribution in ["Rocky"] when: ansible_distribution in ["AlmaLinux", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Rocky" - "Rocky"
@ -253,7 +241,7 @@
tags: tags:
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
- name: Install Docker Engine packages (Debian, Fedora, Rocky, Ubuntu) - name: Install Docker Engine packages (AlmaLinux, Debian, Fedora, Rocky, Ubuntu)
package: package:
name: name:
- docker-ce - docker-ce
@ -263,8 +251,9 @@
- docker-compose-plugin - docker-compose-plugin
state: latest state: latest
update_cache: yes update_cache: yes
when: ansible_distribution in ["Debian", "Fedora", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
@ -275,8 +264,9 @@
name: docker name: docker
state: stopped state: stopped
enabled: false enabled: false
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
@ -298,8 +288,9 @@
name: tpot name: tpot
gid: 2000 gid: 2000
state: present state: present
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
@ -314,8 +305,9 @@
shell: /bin/false shell: /bin/false
home: /nonexistent home: /nonexistent
group: tpot group: tpot
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
@ -339,13 +331,14 @@
tags: tags:
- "Ubuntu" - "Ubuntu"
- name: Change SSH Port to 64295 (Debian, Fedora, Rocky, Ubuntu) - name: Change SSH Port to 64295 (AlmaLinux, Debian, Fedora, Rocky, Ubuntu)
lineinfile: lineinfile:
path: /etc/ssh/sshd_config path: /etc/ssh/sshd_config
line: "Port 64295" line: "Port 64295"
insertafter: EOF insertafter: EOF
when: ansible_distribution in ["Debian", "Fedora", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
@ -360,60 +353,66 @@
tags: tags:
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
- name: Add T-Pot SSH port to Firewall (Fedora, openSUSE Tumbleweed, Rocky) - name: Add T-Pot SSH port to Firewall (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
firewalld: firewalld:
port: 64295/tcp port: 64295/tcp
permanent: yes permanent: yes
state: enabled state: enabled
when: ansible_distribution in ["Fedora", "openSUSE Tumbleweed", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
- "Rocky" - "Rocky"
- name: Set T-Pot default target to ACCEPT (Fedora, openSUSE Tumbleweed, Rocky) - name: Set T-Pot default target to ACCEPT (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
firewalld: firewalld:
zone: public zone: public
target: ACCEPT target: ACCEPT
permanent: yes permanent: yes
state: enabled state: enabled
when: ansible_distribution in ["Fedora", "openSUSE Tumbleweed", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
- "Rocky" - "Rocky"
- name: Load kernel modules (Fedora, Rocky) - name: Load kernel modules (AlmaLinux, Fedora, Rocky)
command: modprobe -v iptable_filter command: modprobe -v iptable_filter
when: ansible_distribution in ["Fedora", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
- name: Update iptables.conf (Fedora, Fedora) - name: Update iptables.conf (AlmaLinux, Fedora, Rocky)
lineinfile: lineinfile:
path: /etc/modules-load.d/iptables.conf path: /etc/modules-load.d/iptables.conf
line: iptable_filter line: iptable_filter
create: yes create: yes
when: ansible_distribution in ["Fedora", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
- name: Set SELinux config to permissive (Fedora, Rocky) - name: Set SELinux config to permissive (AlmaLinux, Fedora, Rocky)
lineinfile: lineinfile:
path: /etc/selinux/config path: /etc/selinux/config
regexp: '^SELINUX=' regexp: '^SELINUX='
line: 'SELINUX=permissive' line: 'SELINUX=permissive'
when: ansible_distribution in ["Fedora", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
- name: Set SELinux to permissive (Fedora, Rocky) - name: Set SELinux to permissive (AlmaLinux, Fedora, Rocky)
command: "setenforce Permissive" command: "setenforce Permissive"
when: ansible_distribution in ["Fedora", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
@ -456,30 +455,33 @@
- "Fedora" - "Fedora"
- "Ubuntu" - "Ubuntu"
- name: Restart Firewalld (Fedora, openSUSE Tumbleweed, Rocky) - name: Restart Firewalld (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
service: service:
name: firewalld name: firewalld
state: restarted state: restarted
when: ansible_distribution in ["Fedora", "openSUSE Tumbleweed", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
- name: Get Firewall rules (Fedora, openSUSE Tumbleweed, Rocky) - name: Get Firewall rules (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
command: "firewall-cmd --list-all" command: "firewall-cmd --list-all"
register: firewall_output register: firewall_output
when: ansible_distribution in ["Fedora", "openSUSE Tumbleweed", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "Rocky" - "Rocky"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
- name: Print Firewall rules (Fedora, openSUSE Tumbleweed, Rocky) - name: Print Firewall rules (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
debug: debug:
var: firewall_output.stdout_lines var: firewall_output.stdout_lines
when: ansible_distribution in ["Fedora", "openSUSE Tumbleweed", "Rocky"] when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
tags: tags:
- "AlmaLinux"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
- "Rocky" - "Rocky"
@ -489,8 +491,9 @@
name: docker name: docker
state: restarted state: restarted
enabled: true enabled: true
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
@ -502,8 +505,9 @@
name: "{{ 'ssh' if ansible_distribution in ['Ubuntu'] else 'sshd' }}" name: "{{ 'ssh' if ansible_distribution in ['Ubuntu'] else 'sshd' }}"
state: restarted state: restarted
enabled: true enabled: true
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
@ -519,6 +523,7 @@
gather_facts: true gather_facts: true
become: false become: false
tags: tags:
- "AlmaLinux"
- "Debian" - "Debian"
- "Fedora" - "Fedora"
- "openSUSE Tumbleweed" - "openSUSE Tumbleweed"
@ -535,7 +540,7 @@
marker: "# {mark} ANSIBLE MANAGED BLOCK" marker: "# {mark} ANSIBLE MANAGED BLOCK"
insertafter: EOF insertafter: EOF
state: present state: present
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
- name: Clone / Update T-Pot repository (All) - name: Clone / Update T-Pot repository (All)
git: git:
@ -544,7 +549,7 @@
version: dev version: dev
clone: yes clone: yes
update: no update: no
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
- name: Add current user to Docker, T-Pot group (All) - name: Add current user to Docker, T-Pot group (All)
become: true become: true
@ -554,10 +559,10 @@
- docker - docker
- tpot - tpot
append: yes append: yes
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
- name: Check for non-root user id (All) - name: Check for non-root user id (All)
debug: debug:
msg: "Detected user: '{{ ansible_user_id }}'" msg: "Detected user: '{{ ansible_user_id }}'"
when: ansible_distribution in ["Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"] when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Rocky", "Ubuntu"]
failed_when: ansible_user_id == "root" failed_when: ansible_user_id == "root"