ansible-role-dhcp
ansible-role-dhcp copied to clipboard
When using ansible with root account verification fails
Since there is internet police officer in my homelab, I use the root account with ansible.
Verification of the dhcp configuration fails, because the AppArmor fix only applies to user directories located within /home.
Adding a task to apply the AppArmor fix to root's home directory, too, is necessary:
- name: AppArmor fix | Ensure dhcpd can acces temp config file for validation (3/3)
lineinfile:
dest: "{{ dhcp_apparmor_policy }}"
line: ' /root/.ansible/** r,'
insertbefore: '.*/etc/dhcp/ r,'
state: present
create: false
when: apparmor_policyfile.stat.exists
failed_when: false
#register: apparmor_fix_2
notify: restart apparmor
tags: dhcp
Whilst I can't condone using the root account for everything, I can see that this is a workaround in your particular circumstance to address the use of the root account.
I will leave this comment here for the time being, so that if others choose the same route, they are able to fix up their local installations.
Thanks for the information.
My opinion on this issue is that it is not a concern for this role. It is specific to the OP's local situation, so I think this code belongs in their site playbook.