From ec27dfd1b00cebd04cfd2c714a4b91adfc18d22e Mon Sep 17 00:00:00 2001 From: Ruan Bekker Date: Thu, 14 Jun 2018 11:33:30 +0200 Subject: [PATCH] Create main.yml --- roles/configure-admin/tasks/main.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 roles/configure-admin/tasks/main.yml diff --git a/roles/configure-admin/tasks/main.yml b/roles/configure-admin/tasks/main.yml new file mode 100644 index 0000000..cc135da --- /dev/null +++ b/roles/configure-admin/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: Generate SSH keys + shell: ssh-keygen -b 2048 -f /home/docker/.ssh/id_rsa -t rsa -q -N "" + args: + creates: /home/docker/.ssh/id_rsa +- name: Copy Public Key Locally + fetch: + src: /home/docker/.ssh/id_rsa.pub + dest: /tmp/ + flat: yes +- name: Copy SSH Configuration + copy: + src: ssh_config + dest: /home/docker/.ssh/config + mode: 0644 +- name: empty known_hosts + file: + state: absent + path: ~/.ssh/known_hosts +- name: run ssh-keyscan to add keys to known_hosts + shell: "ssh-keyscan {{ item }} >> ~/.ssh/known_hosts" + with_items: + - "swarm-manager" + - "swarm-worker-1" + - "swarm-worker-2"