From 46dd5038bbc126a665e5a26b7d0c5dc4c266ed51 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sun, 17 May 2020 22:35:01 -0500 Subject: [PATCH 1/5] Fixes #24: Add more clarity around inventory file creation. --- .gitignore | 1 + README.md | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..788482a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hosts.ini diff --git a/README.md b/README.md index 9fcaf65..71fa1b1 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Master and nodes must have passwordless SSH access ## Usage -Add the system information gathered above into a file called hosts.ini. For example: +Add the system information gathered above into a file called `hosts.ini` in the same directory as this README file. There is a template in the `inventory` directory. For example: ```bash [master] @@ -35,13 +35,12 @@ Add the system information gathered above into a file called hosts.ini. For exam [k3s_cluster:children] master node - ``` Start provisioning of the cluster using the following command: ```bash -ansible-playbook site.yml -i inventory/hosts.ini +ansible-playbook site.yml ``` ## Kubeconfig @@ -51,4 +50,3 @@ To get access to your **Kubernetes** cluster just ```bash scp debian@master_ip:~/.kube/config ~/.kube/config ``` - From 9452fd4b094d41d9aacb3d9480ac4b45381d22a6 Mon Sep 17 00:00:00 2001 From: Markus Fischbacher Date: Tue, 19 May 2020 09:13:29 +0200 Subject: [PATCH 2/5] iptables-legacy for Raspian Buster --- roles/raspbian/tasks/main.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/roles/raspbian/tasks/main.yml b/roles/raspbian/tasks/main.yml index 3c51075..69800e9 100644 --- a/roles/raspbian/tasks/main.yml +++ b/roles/raspbian/tasks/main.yml @@ -16,8 +16,35 @@ - ansible_facts.architecture is search("arm") register: boot_cmdline +- name: Flush iptables before changing iptables-legacy + shell: + cmd: 'iptables -F' + register: flush_iptables + changed_when: + - flush_iptables.rc == 0 and flush_iptables.stdout != "" + when: + - ansible_facts.distribution_release is search("buster") + +- name: Changing to iptables-legacy for Raspbian Buster + alternatives: + path: /usr/sbin/iptables-legacy + name: iptables + register: ip6_legacy + when: + - ansible_facts.distribution_release is search("buster") + +- name: Changing to ip6tables-legacy for Raspbian Buster + alternatives: + path: /usr/sbin/ip6tables-legacy + name: ip6tables + register: ip4_legacy + when: + - ansible_facts.distribution_release is search("buster") + - name: Rebooting on Raspbian reboot: when: - boot_cmdline is changed - ansible_facts.architecture is search("arm") + - ip6_legacy is changed + - ip4_legacy is changed From bdd2d21dfc33590defc4a1055d4378baf247bac5 Mon Sep 17 00:00:00 2001 From: Markus Fischbacher Date: Tue, 19 May 2020 09:22:51 +0200 Subject: [PATCH 3/5] fix ansible-lint error --- roles/raspbian/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/raspbian/tasks/main.yml b/roles/raspbian/tasks/main.yml index 69800e9..86b222a 100644 --- a/roles/raspbian/tasks/main.yml +++ b/roles/raspbian/tasks/main.yml @@ -21,7 +21,7 @@ cmd: 'iptables -F' register: flush_iptables changed_when: - - flush_iptables.rc == 0 and flush_iptables.stdout != "" + - flush_iptables.rc == 0 and flush_iptables.stdout_lines.count == 0 when: - ansible_facts.distribution_release is search("buster") From 02e9b3607d57df57e5cc0b801346921e02fd65bd Mon Sep 17 00:00:00 2001 From: Markus Fischbacher Date: Tue, 19 May 2020 09:36:53 +0200 Subject: [PATCH 4/5] change to native ansible iptables flush --- roles/raspbian/tasks/main.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/roles/raspbian/tasks/main.yml b/roles/raspbian/tasks/main.yml index 86b222a..05909fa 100644 --- a/roles/raspbian/tasks/main.yml +++ b/roles/raspbian/tasks/main.yml @@ -17,11 +17,8 @@ register: boot_cmdline - name: Flush iptables before changing iptables-legacy - shell: - cmd: 'iptables -F' - register: flush_iptables - changed_when: - - flush_iptables.rc == 0 and flush_iptables.stdout_lines.count == 0 + iptables: + flush: true when: - ansible_facts.distribution_release is search("buster") From 5d92b0ac41ec56b370301fd2fb6d6cccee98e020 Mon Sep 17 00:00:00 2001 From: Markus Fischbacher Date: Tue, 19 May 2020 17:15:40 +0200 Subject: [PATCH 5/5] make sure its Raspbian Buster --- roles/raspbian/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/raspbian/tasks/main.yml b/roles/raspbian/tasks/main.yml index 05909fa..9fcd127 100644 --- a/roles/raspbian/tasks/main.yml +++ b/roles/raspbian/tasks/main.yml @@ -20,7 +20,7 @@ iptables: flush: true when: - - ansible_facts.distribution_release is search("buster") + - ansible_facts.lsb.description is match("[Rr]aspbian.*[Bb]uster") - name: Changing to iptables-legacy for Raspbian Buster alternatives: @@ -28,7 +28,7 @@ name: iptables register: ip6_legacy when: - - ansible_facts.distribution_release is search("buster") + - ansible_facts.lsb.description is match("[Rr]aspbian.*[Bb]uster") - name: Changing to ip6tables-legacy for Raspbian Buster alternatives: @@ -36,7 +36,7 @@ name: ip6tables register: ip4_legacy when: - - ansible_facts.distribution_release is search("buster") + - ansible_facts.lsb.description is match("[Rr]aspbian.*[Bb]uster") - name: Rebooting on Raspbian reboot: