26 lines
708 B
YAML
26 lines
708 B
YAML
- name: My first play
|
|
hosts: myhosts
|
|
tasks:
|
|
# - name: Ping my hosts
|
|
# ansible.builtin.ping:
|
|
# - name: Reboot machine
|
|
# ansible.builtin.reboot:
|
|
# msg: "Rebooting machine..."
|
|
# - name: Print message
|
|
# ansible.builtin.debug:
|
|
# msg: Hello world
|
|
- name: Set authorized key taken from file
|
|
ansible.posix.authorized_key:
|
|
user: root
|
|
key: "{{ lookup('file', './config/id_ed25519.pub') }}"
|
|
- name: Copy over SSHD config file
|
|
ansible.builtin.copy:
|
|
src: ./config/sshd_config
|
|
dest: /etc/ssh/sshd_config
|
|
owner: root
|
|
group: root
|
|
mode: '0600'
|
|
- name: Restart SSHD
|
|
service:
|
|
name: sshd
|
|
state: restarted
|