CORD-636 provide ssh keys to ssh from corddev to head node
Change-Id: I20d5888342ccf3a6f34b8755f8e541cf35a14b66
diff --git a/roles/head-node/tasks/main.yml b/roles/head-node/tasks/main.yml
index 62b7766..5ff355b 100644
--- a/roles/head-node/tasks/main.yml
+++ b/roles/head-node/tasks/main.yml
@@ -1,3 +1,17 @@
+# SSH Key access from the current machine to the target node is required for the
+# synchronize action to work.
+- name: Ensure User SSH Keys
+ local_action: user name='{{ansible_user_id}}' generate_ssh_key=yes ssh_key_bits=2048
+ tags:
+ - establish_ssh_keys
+
+- name: Ensure Key Authorized on Target Head Node
+ authorized_key:
+ user: "{{ ansible_user }}"
+ key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
+ tags:
+ - establish_ssh_keys
+
- name: Ensure MAAS Ansible Config Directory
become: yes
file:
@@ -9,13 +23,9 @@
- name: Ensure Ansible Roles
become: yes
- copy:
+ synchronize:
src: "{{ item }}"
dest: /etc/maas/ansible
- owner: maas
- group: maas
- mode: u=rwX,g=rX,o=rX
- force: true
with_items:
- roles
- library