Using Ansible os family instead of multiple Ansible os distributions (#6)

* Using Ansible os family instead of multiple Ansible os distributions

* Added option to set timezone, this could save a bit of headache if someone has certificate problems

Co-authored-by: janic <janic.voser@schulen-unteraegeri.ch>
This commit is contained in:
Janic Voser 2022-04-09 18:04:25 +02:00 committed by GitHub
parent 97bed143b5
commit 1ce3319087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -4,6 +4,9 @@ k3s_version: v1.23.4+k3s1
ansible_user: ansibleuser ansible_user: ansibleuser
systemd_dir: /etc/systemd/system systemd_dir: /etc/systemd/system
# Set your timezone
system_timezone: "Your/Timezone"
# interface which will be used for flannel # interface which will be used for flannel
flannel_iface: "eth0" flannel_iface: "eth0"

View File

@ -1,8 +1,13 @@
--- ---
- name: Set same timezone on every Server
timezone:
name: "{{ system_timezone }}"
when: (system_timezone is defined) and (system_timezone != "Your/Timezone")
- name: Set SELinux to disabled state - name: Set SELinux to disabled state
selinux: selinux:
state: disabled state: disabled
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux'] when: ansible_os_family == "RedHat"
- name: Enable IPv4 forwarding - name: Enable IPv4 forwarding
sysctl: sysctl:
@ -23,13 +28,13 @@
content: "br_netfilter" content: "br_netfilter"
dest: /etc/modules-load.d/br_netfilter.conf dest: /etc/modules-load.d/br_netfilter.conf
mode: "u=rw,g=,o=" mode: "u=rw,g=,o="
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux'] when: ansible_os_family == "RedHat"
- name: Load br_netfilter - name: Load br_netfilter
modprobe: modprobe:
name: br_netfilter name: br_netfilter
state: present state: present
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux'] when: ansible_os_family == "RedHat"
- name: Set bridge-nf-call-iptables (just to be sure) - name: Set bridge-nf-call-iptables (just to be sure)
sysctl: sysctl:
@ -37,7 +42,7 @@
value: "1" value: "1"
state: present state: present
reload: yes reload: yes
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux'] when: ansible_os_family == "RedHat"
loop: loop:
- net.bridge.bridge-nf-call-iptables - net.bridge.bridge-nf-call-iptables
- net.bridge.bridge-nf-call-ip6tables - net.bridge.bridge-nf-call-ip6tables
@ -50,4 +55,4 @@
insertafter: EOF insertafter: EOF
path: /etc/sudoers path: /etc/sudoers
validate: 'visudo -cf %s' validate: 'visudo -cf %s'
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux'] when: ansible_os_family == "RedHat"