---
- name: Basic setup for nanna
  hosts: nanna
  tasks:
    - name: Configure sshd
      become: true
      ansible.builtin.copy:
        dest: /etc/ssh/sshd_config.d/00_pbri.conf
        mode: u=rw,g=r,o=r
        # Included by /etc/ssh/sshd_config before other configuration
        content: |
          Port 2309
          PermitRootLogin no
          PubkeyAuthentication yes
          AuthorizedKeysFile .ssh/authorized_keys
          PasswordAuthentication no
        validate: /usr/sbin/sshd -T -f %s
      notify:
        - Restart sshd
    - name: Install and set up Docker and docker-compose
      ansible.builtin.include_role:
        name: docker

  handlers:
    - name: Restart sshd
      become: true
      ansible.builtin.service:
        name: ssh
        state: restarted