ansible-role-dhcp icon indicating copy to clipboard operation
ansible-role-dhcp copied to clipboard

When using ansible with root account verification fails

Open yuergen opened this issue 4 years ago • 1 comments

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

yuergen avatar Mar 21 '20 20:03 yuergen

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.

blofeldthefish avatar May 04 '20 12:05 blofeldthefish

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.

bertvv avatar Oct 21 '22 11:10 bertvv