-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathhw_setup.yaml
71 lines (59 loc) · 1.95 KB
/
hw_setup.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#Install depencies before running this script
#Expect that user anunez exists
# - apt-get install openssh-server python vim
# - ip add add 192.168.2.3
# - allow ssh as root -> uncomment "PermitRootLogin prohibit-password" in "/etc/ssh/sshd_config"
# - ssh-copy-id then "cp -a /home/anunez/.ssh /root;chown -R root:root /root/.ssh"
- name: Setup HW to run Kubernetes
hosts: all
tasks:
# - name: Add and update packages
# import_tasks: tasks/hw/apt.yaml
- name: Setup system parameters (boot, hosts, timzone)
import_tasks: tasks/hw/system.yaml
# - name: Setup network parameters
# import_tasks: tasks/hw/network.yaml
# # check if we need a reboot
# - name: check if reboot needed
# stat: path=/var/run/reboot-required
# register: reboot_required_file
# - name: Need reboot?
# when: reboot_required_file.stat.exists
# set_fact: need_reboot=True
# #Reboot if needed at the end
# - name: Reboot immediately if there was a change.
# shell: "sleep 5 && reboot"
# async: 1
# poll: 0
# when: need_reboot | default(False)
# - name: Wait for the reboot to complete if there was a change.
# wait_for_connection:
# connect_timeout: 20
# sleep: 5
# delay: 5
# timeout: 300
# when: need_reboot | default(False)
- name: "Prepare nodes for development"
hosts: nodes
tasks:
- name: Insert/update ssh authorised_keys
blockinfile:
path: .ssh/authorized_keys
block: |
{%- for key in SSH_PUB_KEYS_2_INSTALL %}
#{{ key.description }}
{{ key.value }}"
{% endfor %}
- name: Copy ssh files
copy:
dest: ".ssh/{{ item.key }}"
mode: 0600
content: "{{ item.value }}"
with_items: '{{ SSH_FILES_2_INSTALL | dict2items }}'
- name: Insert/Update bash aliases
blockinfile:
path: .bashrc
block: |
{%- for alias in ALIAS_2_INSTALL %}
alias {{ alias }}="{{ ALIAS_2_INSTALL[alias] }}"
{% endfor %}