mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-12-25 00:12:37 +01:00
Comply with ansible-lint
Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
---
|
||||
- name: Test for raspberry pi /proc/cpuinfo
|
||||
command: grep -E "Raspberry Pi|BCM2708|BCM2709|BCM2835|BCM2836" /proc/cpuinfo
|
||||
ansible.builtin.command: grep -E "Raspberry Pi|BCM2708|BCM2709|BCM2835|BCM2836" /proc/cpuinfo
|
||||
register: grep_cpuinfo_raspberrypi
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: Test for raspberry pi /proc/device-tree/model
|
||||
command: grep -E "Raspberry Pi" /proc/device-tree/model
|
||||
ansible.builtin.command: grep -E "Raspberry Pi" /proc/device-tree/model
|
||||
register: grep_device_tree_model_raspberrypi
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: Set raspberry_pi fact to true
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
raspberry_pi: true
|
||||
when:
|
||||
grep_cpuinfo_raspberrypi.rc == 0 or grep_device_tree_model_raspberrypi.rc == 0
|
||||
|
||||
- name: Set detected_distribution to Raspbian
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
detected_distribution: Raspbian
|
||||
when: >
|
||||
raspberry_pi|default(false) and
|
||||
@@ -26,7 +26,7 @@
|
||||
ansible_facts.lsb.description|default("") is match("[Rr]aspbian.*") )
|
||||
|
||||
- name: Set detected_distribution to Debian
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
detected_distribution: Debian
|
||||
when: >
|
||||
raspberry_pi|default(false) and
|
||||
@@ -34,14 +34,14 @@
|
||||
ansible_facts.lsb.description|default("") is match("Debian") )
|
||||
|
||||
- name: Set detected_distribution_major_version
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
detected_distribution_major_version: "{{ ansible_facts.lsb.major_release }}"
|
||||
when: >
|
||||
when: >
|
||||
( detected_distribution | default("") == "Raspbian" or
|
||||
detected_distribution | default("") == "Debian" )
|
||||
|
||||
- name: execute OS related tasks on the Raspberry Pi
|
||||
include_tasks: "{{ item }}"
|
||||
- name: Execute OS related tasks on the Raspberry Pi
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
with_first_found:
|
||||
- "prereq/{{ detected_distribution }}-{{ detected_distribution_major_version }}.yml"
|
||||
- "prereq/{{ detected_distribution }}.yml"
|
||||
|
||||
@@ -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).*)$'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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', '>=')"
|
||||
|
||||
Reference in New Issue
Block a user