forked from dsariel/swiftacular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_cluster_nodes.yaml
46 lines (34 loc) · 984 Bytes
/
prepare_cluster_nodes.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
#
# First setup a package_cache, especially when using
# your laptop and Vagrant
#
- hosts:
- all
# gather_facts: no
tasks:
- name: install python
command: yum install -y python3-devel python3
- name: Check that the somefile.conf exists
stat:
path: /root/.ssh/id_rsa
register: stat_result
- name: Generate RSA host key
command: "ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -C \"\" -N \"\""
when: not stat_result.stat.exists
- name: make sure id_rsa.pub exists
command: cat ~/.ssh/id_rsa.pub
- hosts:
- all
tasks:
- name: install sshpass
become: yes
raw: yum install -y sshpass
- name: register id_rsa.pub content
command: cat ~/.ssh/id_rsa.pub
register: public_rsa
- name: add ssh key to authorized_keys
become: yes
raw: echo {{ public_rsa.stdout }} >> ./.ssh/authorized_keys
register: mainnodehosts
with_items: groups['mainnodes']