Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bootstrap] fix: remove conflicting condition for immutable flag and state:absent #1064

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

sp3nx0r
Copy link
Contributor

@sp3nx0r sp3nx0r commented Dec 7, 2023

When trying to run the Ansible node preparation script after the first run, below error gets thrown because Ansible is trying to remove the immutable flag AND delete the file at the same time (apparently it's not smart enough to do the attributes first). By adding an additional step to nuke the immutable attribute, this allows the preparation script to be run multiple times. Also includes some minor lints for Ansible style in that same Jinja2 file.

TASK [Network Configuration | Stop systemd-resolved] *****************************************************************************************************************
changed: [k3s-master-0]
changed: [k3s-worker-2]
changed: [k3s-worker-1]
changed: [k3s-worker-0]

TASK [Network Configuration | Remove /etc/resolv.conf] ***************************************************************************************************************
fatal: [k3s-worker-0]: FAILED! => {"changed": false, "gid": 0, "group": "root", "mode": "01204", "msg": "unlinking failed: [Errno 1] Operation not permitted: b'/etc/r
esolv.conf' ", "owner": "root", "path": "/etc/resolv.conf", "size": 28, "state": "file", "uid": 0}
fatal: [k3s-master-0]: FAILED! => {"changed": false, "gid": 0, "group": "root", "mode": "01204", "msg": "unlinking failed: [Errno 1] Operation not permitted: b'/etc/r
esolv.conf' ", "owner": "root", "path": "/etc/resolv.conf", "size": 28, "state": "file", "uid": 0}
fatal: [k3s-worker-1]: FAILED! => {"changed": false, "gid": 0, "group": "root", "mode": "01204", "msg": "unlinking failed: [Errno 1] Operation not permitted: b'/etc/r
esolv.conf' ", "owner": "root", "path": "/etc/resolv.conf", "size": 28, "state": "file", "uid": 0}
fatal: [k3s-worker-2]: FAILED! => {"changed": false, "gid": 0, "group": "root", "mode": "01204", "msg": "unlinking failed: [Errno 1] Operation not permitted: b'/etc/r
esolv.conf' ", "owner": "root", "path": "/etc/resolv.conf", "size": 28, "state": "file", "uid": 0}

And with this new step added:

TASK [Network Configuration | Remove immutable flag from /etc/resolv.conf] *******************************************************************************************
changed: [k3s-master-0]                                                                                                                                               
changed: [k3s-worker-0]                                                                                                                                               
changed: [k3s-worker-1]                                                                                                                                               
changed: [k3s-worker-2]                                                                                                                                               
                                                                                                                                                                      
TASK [Network Configuration | Remove /etc/resolv.conf] ***************************************************************************************************************
changed: [k3s-worker-0]                                                                                                                                               
changed: [k3s-master-0]                                                                                                                                               
changed: [k3s-worker-1]                                                                                                                                               
changed: [k3s-worker-2]                                                                                                                                               
                                                                                                                                                                      
TASK [Network Configuration | Add custom /etc/resolv.conf] ***********************************************************************************************************
changed: [k3s-worker-0]                                                                                                                                               
changed: [k3s-master-0]                                                                                                                                               
changed: [k3s-worker-2]                                                                                                                                               
changed: [k3s-worker-1]      

@github-actions github-actions bot added area/ansible area/bootstrap Changes made in the bootstrap directory labels Dec 7, 2023
@onedr0p
Copy link
Owner

onedr0p commented Dec 7, 2023

I meant to circle back on this one because I wasn't sure if ansible would make the file mutable and then delete it. Thanks for confirming this and the fix!

@onedr0p onedr0p merged commit 6be6e78 into onedr0p:main Dec 7, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bootstrap Changes made in the bootstrap directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants