fixed ssh-keys Ansible task

This commit is contained in:
Bryan Joshua Pedini 2022-03-17 11:53:18 +01:00
parent 743e7e144a
commit 97c6c49bbe

View File

@ -4,23 +4,8 @@
path: ~/.ssh path: ~/.ssh
mode: 0700 mode: 0700
state: directory state: directory
- name: Ensure the authorized_keys file is present and has the right permissions
ansible.builtin.file:
path: ~/.ssh/authorized_keys
mode: 0600
state: touch
- name: Check if the "bryanpedini@bryanbox.home.bjphoster.cloud" key is present
ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys
value: |
# bryanpedini@bryanbox.home.bjphoster.cloud
check_mode: true
register: bryanbox_key
- name: Ensure the "bryanpedini@bryanbox.home.bjphoster.cloud" key is present - name: Ensure the "bryanpedini@bryanbox.home.bjphoster.cloud" key is present
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys path: ~/.ssh/authorized_keys
insertafter: EOF mode: 0600
value: | value: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOuad05527ZlLMfVh9fOlDapVBdQ3dEAyoyZfNvoxqBQ bryanpedini@bryanbox.home.bjphoster.cloud
# bryanpedini@bryanbox.home.bjphoster.cloud
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQC2x86/7D1kVAHIz9GIns9sjeyr9ziriWo9ittbyNUBbE8O+FOC4ew3MOl8Z3g47vGu1aQ7+pOGCD8BMpTx1k0RX7tqegqoHqHvjbAzuYkBJAcJTUj/nzNEK5fuG5rND2cnTM8SCY+WOxyJvNi9pOYkKyv2OWq63t0irLI+wHY9J/Yf0EUwlGfDSJCy5CqanInWF1eL8FgUL0+84sue++sczoeHCSMw751xvSWFOnj8lbiANWP/A9t2bKe814Jog/yOspwKOJtXp9sgkhX1TsoyUfyBYyJol4Qwlqr5Jfh0sqGFe9F2HZtPLYvb1l+S6H64Y+Xql58bzWDpfY/noHBqprh16HA+46kHPZRG6d8k0JT4DmViBWWRNyzB0K5MzCHc8eFMnmSixXDcyKqU25Nz97V2J3/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