Skip to content

Commit ec26a00

Browse files
committed
update_ssh_config_guestfs: fix incorrect task privilege
This task does not require elevated privileges, so become: true is unnecessary and can be removed. Its use was also causing the task to run as root (the default become_user [1]), which led to the following error: task path: /home/cel/src/kdevops/buildbot-configs/playbooks/roles/ update_ssh_config_guestfs/tasks/main.yml:73 fatal: [localhost]: FAILED! => { "changed": false, "path": "/root/.ssh/config", "state": "absent" } MSG: file (/root/.ssh/config) is absent, cannot continue Ensure the task is only run when the conditions are appropiate, i.e. when the file exists. [1] https://docs.ansible.com/ansible/latest/playbook_guide/ playbooks_privilege_escalation.html#become-directives Fixes f301c9a ("guestfs: ensure right permissions for ssh config") Reported-by: Chuck Lever <chuck.lever@oracle.com> Closes: https://lore.kernel.org/all/b2fb6337-f737-4ab9-94a5-f6d5d94db749@oracle.com/ Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
1 parent a0afdba commit ec26a00

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

  • playbooks/roles/update_ssh_config_guestfs/tasks

playbooks/roles/update_ssh_config_guestfs/tasks/main.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@
7171
Include ~/.ssh/config_kdevops_*
7272
7373
- name: Ensure ~/.ssh/config permissions
74-
become: true
75-
become_flags: 'su - -c'
76-
become_method: ansible.builtin.sudo
7774
ansible.builtin.file:
7875
path: ~/.ssh/config
7976
mode: "0600"
77+
when: ssh_config.stat.exists

0 commit comments

Comments
 (0)