Comply with ansible-lint

Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Derek Nola
2023-11-07 13:35:08 -08:00
parent 5b17c77e71
commit 1031ea3ce2
15 changed files with 74 additions and 67 deletions

View File

@@ -1,6 +1,6 @@
---
- name: Enable cgroup via boot commandline if not already enabled for Centos
lineinfile:
ansible.builtin.lineinfile:
path: /boot/cmdline.txt
backrefs: yes
regexp: '^((?!.*\bcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory\b).*)$'

View File

@@ -1,11 +1,11 @@
---
- name: Check if /boot/firmware/cmdline.txt exists
stat:
ansible.builtin.stat:
path: /boot/firmware/cmdline.txt
register: boot_firmware_cmdline_txt
- name: Activating cgroup support
lineinfile:
ansible.builtin.lineinfile:
path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}"
regexp: '^((?!.*\bcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory\b).*)$'
line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory'
@@ -13,22 +13,22 @@
notify: reboot
- name: Install iptables
apt:
ansible.builtin.apt:
name: iptables
- name: Flush iptables before changing to iptables-legacy
iptables:
ansible.builtin.iptables:
flush: true
changed_when: false # iptables flush always returns changed
- name: Changing to iptables-legacy
alternatives:
community.general.alternatives:
path: /usr/sbin/iptables-legacy
name: iptables
register: ip4_legacy
- name: Changing to ip6tables-legacy
alternatives:
community.general.alternatives:
path: /usr/sbin/ip6tables-legacy
name: ip6tables
register: ip6_legacy

View File

@@ -1,6 +1,6 @@
---
- name: Activating cgroup support
lineinfile:
ansible.builtin.lineinfile:
path: /boot/cmdline.txt
regexp: '^((?!.*\bcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory\b).*)$'
line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory'
@@ -8,18 +8,18 @@
notify: reboot
- name: Flush iptables before changing to iptables-legacy
iptables:
ansible.builtin.iptables:
flush: true
changed_when: false # iptables flush always returns changed
- name: Changing to iptables-legacy
alternatives:
community.general.alternatives:
path: /usr/sbin/iptables-legacy
name: iptables
register: ip4_legacy
- name: Changing to ip6tables-legacy
alternatives:
community.general.alternatives:
path: /usr/sbin/ip6tables-legacy
name: ip6tables
register: ip6_legacy

View File

@@ -1,15 +1,16 @@
---
- name: Enable cgroup via boot commandline if not already enabled for Ubuntu on a Raspberry Pi
lineinfile:
ansible.builtin.lineinfile:
path: /boot/firmware/cmdline.txt
backrefs: yes
regexp: '^((?!.*\bcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory\b).*)$'
line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory'
notify: reboot
- name: Install Ubuntu Raspi Extra Packages
apt:
name:
- linux-modules-extra-raspi #Fixes issues in newer Ubuntu where VXLan isn't setup right. See: https://github.com/k3s-io/k3s/issues/4234
ansible.builtin.apt:
# Fixes issues in newer Ubuntu where VXLan isn't setup right.
# See: https://github.com/k3s-io/k3s/issues/4234
name: linux-modules-extra-raspi
update_cache: yes
state: present
when: "ansible_distribution_version is version('20.10', '>=')"
when: "ansible_distribution_version is version('20.10', '>=')"