ansible-conf.yml 694 B

12345678910111213141516171819202122232425262728293031
  1. ---
  2. - hosts: all
  3. become_user: root
  4. become: yes
  5. tasks:
  6. - name: Make sure we have a wheel group
  7. ansible.builtin.group:
  8. name: wheel
  9. state: present
  10. - name: Allow wheel group to have passwordless sudo
  11. lineinfile:
  12. dest: /etc/sudoers
  13. state: present
  14. regexp: '^%wheel'
  15. line: '%wheel ALL=(ALL) NOPASSWD: ALL'
  16. validate: 'visudo -cf %s'
  17. - name: Add sudoers users to wheel group
  18. user:
  19. name=ansible
  20. groups=wheel
  21. append=yes
  22. state=present
  23. createhome=yes
  24. - name: Set up authorized keys for the deployer user
  25. authorized_key: user=ansible key="{{item}}"
  26. with_file:
  27. - /home/cmte/.ssh/ansible.pub