From d61d782f6b7ea5f35b916838244770ef8c36ae66 Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Fri, 6 Sep 2019 23:10:26 +0000 Subject: [PATCH] Add updating SSH keys and /etc/hosts to core ansible role --- ansible/roles/core/tasks/configure-ssh.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ansible/roles/core/tasks/configure-ssh.yml b/ansible/roles/core/tasks/configure-ssh.yml index 77fd836..2dbd6e9 100644 --- a/ansible/roles/core/tasks/configure-ssh.yml +++ b/ansible/roles/core/tasks/configure-ssh.yml @@ -18,6 +18,22 @@ content: | user:cccckey1cccc:cccckey2cccc +- name: Add custom /etc/hosts + lineinfile: + dest: /etc/hosts + line: '{{ item }}' + with_items: + - '127.0.0.1 localhost' + - '127.0.0.2 www.otherhost.com otherhost' + +- name: Add SSH Keys + lineinfile: + dest: /home/kansible/.ssh/authorized_keys + line: '{{ item }}' + with_items: + - 'ssh-idrsa AAZ1NTE5AAAAIA+ndydG+ddddpdddaabvbumkiuyk7778678676547564563434XwmnYb user@host' + + - name: Copy ssh configuration file template: src=files/sshd_config dest=/etc/ssh/sshd_config notify: