pkg:
- fail2ban
when: ("DMZ" in group_names)
-- name: Add ansible user to server
- ansible.builtin.user:
- name: ansible
- shell: /bin/bash
-- name: Allow "ansible"-user to have passwordless sudo
- ansible.builtin.copy:
- src: sudo_ansible
- dest: /etc/sudoers.d/ansible
- owner: root
- group: root
- mode: "0440"
-- name: Add installbox-ansible-user _public_ ssh-key to the servers authorized_keys file
- ansible.posix.authorized_key:
- user: ansible
- state: present
- manage_dir: true
- key: "{{ lookup('file', '/home/ansible/.ssh/id_ed25519.pub') }}"