k3s-io / k3s-ansible

Apache License 2.0
2.01k stars 802 forks source link

Ignore fatal error for none airgap runs #303

Closed imhof-marco closed 7 months ago

imhof-marco commented 7 months ago

None airgap run allways fails if no airgap install files are present. Task is not skipped because of "fatal error" Message. It is skipped when "fatal error" is ignored.

dereknola commented 7 months ago

Your description of the problem is unclear. This section should only run when airgap_dir is defined.

imhof-marco commented 7 months ago

I was also thinking that it would be skipped. All other tasks in the airgap role are skipped!

Is it possible that ansible is running the "with_first_found" in the first place and skipping the step afterwards?

I'm on debian stable (cloudimage/qcow2) with this ansible Version:

ansible [core 2.14.3] config file = None configured module search path = ['/home/debian/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible ansible collection location = /home/debian/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3) jinja version = 3.1.2 libyaml = True

The log of my last run without my changes:

PLAY [Cluster prep] ****

TASK [Gathering Facts] ***** Thursday 22 February 2024 18:26:57 +0000 (0:00:00.028) 0:00:00.028 * ok: [192.168.10.23] ok: [192.168.10.22] ok: [192.168.10.21]

TASK [prereq : Install Dependent Ubuntu Packages] ** Thursday 22 February 2024 18:26:59 +0000 (0:00:02.142) 0:00:02.170 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Enable IPv4 forwarding] ***** Thursday 22 February 2024 18:26:59 +0000 (0:00:00.114) 0:00:02.285 * ok: [192.168.10.21] ok: [192.168.10.22] ok: [192.168.10.23]

TASK [prereq : Enable IPv6 forwarding] ***** Thursday 22 February 2024 18:27:00 +0000 (0:00:00.582) 0:00:02.867 * ok: [192.168.10.21] ok: [192.168.10.22] ok: [192.168.10.23]

TASK [prereq : Populate service facts] ***** Thursday 22 February 2024 18:27:01 +0000 (0:00:00.538) 0:00:03.406 * ok: [192.168.10.21] ok: [192.168.10.23] ok: [192.168.10.22]

TASK [prereq : Get ufw status] ***** Thursday 22 February 2024 18:27:05 +0000 (0:00:03.971) 0:00:07.377 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : If ufw enabled, open api port] ** Thursday 22 February 2024 18:27:05 +0000 (0:00:00.147) 0:00:07.524 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : If ufw enabled, open etcd ports] **** Thursday 22 February 2024 18:27:05 +0000 (0:00:00.103) 0:00:07.628 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : If ufw enabled, allow default CIDRs] **** Thursday 22 February 2024 18:27:05 +0000 (0:00:00.108) 0:00:07.737 ***** skipping: [192.168.10.21] => (item=10.42.0.0/16) skipping: [192.168.10.21] => (item=10.43.0.0/16) skipping: [192.168.10.21] skipping: [192.168.10.22] => (item=10.42.0.0/16) skipping: [192.168.10.22] => (item=10.43.0.0/16) skipping: [192.168.10.22] skipping: [192.168.10.23] => (item=10.42.0.0/16) skipping: [192.168.10.23] => (item=10.43.0.0/16) skipping: [192.168.10.23]

TASK [prereq : If firewalld enabled, open api port] **** Thursday 22 February 2024 18:27:05 +0000 (0:00:00.133) 0:00:07.871 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : If firewalld enabled, open etcd ports] ** Thursday 22 February 2024 18:27:05 +0000 (0:00:00.105) 0:00:07.977 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : If firewalld enabled, allow default CIDRs] ** Thursday 22 February 2024 18:27:05 +0000 (0:00:00.115) 0:00:08.093 ***** skipping: [192.168.10.21] => (item=10.42.0.0/16) skipping: [192.168.10.21] => (item=10.43.0.0/16) skipping: [192.168.10.21] skipping: [192.168.10.22] => (item=10.42.0.0/16) skipping: [192.168.10.22] => (item=10.43.0.0/16) skipping: [192.168.10.22] skipping: [192.168.10.23] => (item=10.42.0.0/16) skipping: [192.168.10.23] => (item=10.43.0.0/16) skipping: [192.168.10.23]

TASK [prereq : Add br_netfilter to /etc/modules-load.d/] *** Thursday 22 February 2024 18:27:05 +0000 (0:00:00.137) 0:00:08.230 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Load br_netfilter] ** Thursday 22 February 2024 18:27:06 +0000 (0:00:00.096) 0:00:08.326 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Set bridge-nf-call-iptables (just to be sure)] ** Thursday 22 February 2024 18:27:06 +0000 (0:00:00.087) 0:00:08.414 ***** skipping: [192.168.10.21] => (item=net.bridge.bridge-nf-call-iptables) skipping: [192.168.10.21] => (item=net.bridge.bridge-nf-call-ip6tables) skipping: [192.168.10.22] => (item=net.bridge.bridge-nf-call-iptables) skipping: [192.168.10.22] => (item=net.bridge.bridge-nf-call-ip6tables) skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23] => (item=net.bridge.bridge-nf-call-iptables) skipping: [192.168.10.23] => (item=net.bridge.bridge-nf-call-ip6tables) skipping: [192.168.10.23]

TASK [prereq : Check for Apparmor existence] *** Thursday 22 February 2024 18:27:06 +0000 (0:00:00.116) 0:00:08.530 * ok: [192.168.10.22] ok: [192.168.10.23] ok: [192.168.10.21]

TASK [prereq : Check if Apparmor is enabled] *** Thursday 22 February 2024 18:27:06 +0000 (0:00:00.581) 0:00:09.112 * ok: [192.168.10.22] ok: [192.168.10.21] ok: [192.168.10.23]

TASK [prereq : Install Apparmor Parser [Suse]] ***** Thursday 22 February 2024 18:27:07 +0000 (0:00:00.636) 0:00:09.748 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Install Apparmor Parser [Debian]] *** Thursday 22 February 2024 18:27:07 +0000 (0:00:00.106) 0:00:09.854 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Gather the package facts] *** Thursday 22 February 2024 18:27:07 +0000 (0:00:00.097) 0:00:09.952 * ok: [192.168.10.22] ok: [192.168.10.21] ok: [192.168.10.23]

TASK [prereq : If iptables v1.8.0-1.8.4, warn user] **** Thursday 22 February 2024 18:27:10 +0000 (0:00:02.585) 0:00:12.537 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Add /usr/local/bin to sudo secure_path] ***** Thursday 22 February 2024 18:27:10 +0000 (0:00:00.253) 0:00:12.791 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Make rancher directory] ***** Thursday 22 February 2024 18:27:10 +0000 (0:00:00.263) 0:00:13.054 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Create symlink] ***** Thursday 22 February 2024 18:27:10 +0000 (0:00:00.219) 0:00:13.274 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Make manifests directory] *** Thursday 22 February 2024 18:27:11 +0000 (0:00:00.191) 0:00:13.465 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [prereq : Copy manifests] ***** Thursday 22 February 2024 18:27:11 +0000 (0:00:00.171) 0:00:13.637 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Verify Ansible meets airgap version requirements.] ** Thursday 22 February 2024 18:27:11 +0000 (0:00:00.263) 0:00:13.901 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Download k3s install script] **** Thursday 22 February 2024 18:27:11 +0000 (0:00:00.233) 0:00:14.134 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Distribute K3s install script] ** Thursday 22 February 2024 18:27:11 +0000 (0:00:00.156) 0:00:14.291 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Distribute K3s binary] ** Thursday 22 February 2024 18:27:12 +0000 (0:00:00.142) 0:00:14.433 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Distribute K3s SELinux RPM] ***** Thursday 22 February 2024 18:27:12 +0000 (0:00:00.153) 0:00:14.586 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Install K3s SELinux RPM] **** Thursday 22 February 2024 18:27:12 +0000 (0:00:00.154) 0:00:14.741 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Make images directory] ** Thursday 22 February 2024 18:27:12 +0000 (0:00:00.154) 0:00:14.895 ***** skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Determine Architecture] ***** Thursday 22 February 2024 18:27:12 +0000 (0:00:00.228) 0:00:15.124 * skipping: [192.168.10.21] skipping: [192.168.10.22] skipping: [192.168.10.23]

TASK [airgap : Distribute K3s amd64 images] **** Thursday 22 February 2024 18:27:12 +0000 (0:00:00.151) 0:00:15.275 ***** fatal: [192.168.10.21]: FAILED! => {"msg": "No file was found when using first_found."} fatal: [192.168.10.22]: FAILED! => {"msg": "No file was found when using first_found."} fatal: [192.168.10.23]: FAILED! => {"msg": "No file was found when using first_found."}

PLAY RECAP ***** 192.168.10.21 : ok=7 changed=0 unreachable=0 failed=1 skipped=27 rescued=0 ignored=0
192.168.10.22 : ok=7 changed=0 unreachable=0 failed=1 skipped=27 rescued=0 ignored=0
192.168.10.23 : ok=7 changed=0 unreachable=0 failed=1 skipped=27 rescued=0 ignored=0

Thursday 22 February 2024 18:27:13 +0000 (0:00:00.122) 0:00:15.397 ***** =============================================================================== prereq : Populate service facts ----------------------------------------- 3.97s prereq : Gather the package facts --------------------------------------- 2.59s Gathering Facts --------------------------------------------------------- 2.14s prereq : Check if Apparmor is enabled ----------------------------------- 0.64s prereq : Enable IPv4 forwarding ----------------------------------------- 0.58s prereq : Check for Apparmor existence ----------------------------------- 0.58s prereq : Enable IPv6 forwarding ----------------------------------------- 0.54s prereq : Copy manifests ------------------------------------------------- 0.26s prereq : Add /usr/local/bin to sudo secure_path ------------------------- 0.26s prereq : If iptables v1.8.0-1.8.4, warn user ---------------------------- 0.25s airgap : Verify Ansible meets airgap version requirements. -------------- 0.23s airgap : Make images directory ------------------------------------------ 0.23s prereq : Make rancher directory ----------------------------------------- 0.22s prereq : Create symlink ------------------------------------------------- 0.19s prereq : Make manifests directory --------------------------------------- 0.17s airgap : Download k3s install script ------------------------------------ 0.16s airgap : Distribute K3s SELinux RPM ------------------------------------- 0.15s airgap : Install K3s SELinux RPM ---------------------------------------- 0.15s airgap : Distribute K3s binary ------------------------------------------ 0.15s airgap : Determine Architecture ----------------------------------------- 0.15s

imhof-marco commented 7 months ago

I just checked the ansible Changelogs for 2.14. Maybe the last Bugfix (- strategy plugins ...) for Release 2.14.3 has something to do with it:

v2.14.3

Release Summary

| Release Date: 2023-02-27 | Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>__

Minor Changes

Bugfixes

dereknola commented 7 months ago

This sounds like a duplicate of https://github.com/k3s-io/k3s-ansible/issues/257. You should try it with ansible 2.15+

imhof-marco commented 7 months ago

Your are right! That did the trick. Sorry to bother you with that after all. Next time i will dig deeper before.

On my current project i'm stuck with debian/stable repositorys so i think i will do a airgap installation even if it is not nesassary. That will keep me away from the fatal error message.

Thanks for your time and effort to keep this project alive. It helped me a lot in the past.