forked from Ig-88/Contrail-Builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContrail-AIO.yml
166 lines (134 loc) · 3.88 KB
/
Contrail-AIO.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
- name: delete ssh key info
hosts: localhost
connection: local
tasks:
- name: delete ssh key info
copy: src=/dev/null dest=/root/.ssh/known_hosts
- name: Setup OS for Contrail
hosts: controller1
vars:
ansible_connection: ssh
ansible_ssh_user: contrail
ansible_ssh_pass: contrail123
ansible_sudo_pass: contrail123
become: true
become_user: root
become_method: sudo
tasks:
- name: Apt update
apt:
update_cache: yes
- name: Install extra apps
shell: apt-get install -y -f curl ntp open-vm-tools cpu-checker sysstat
# - name: 'Remove apparmor'
# apt:
# name: apparmor
# state: absent
- name: 'Setup NTP'
shell: echo server 192.168.1.1 > /etc/ntp.conf
- name: Make Contrail dir
file:
path: /Contrail
state: directory
- name: Get PIP
get_url:
url: https://bootstrap.pypa.io/get-pip.py
dest: /Contrail/get-pip.py
- name: Install PIP
shell: python /Contrail/get-pip.py
- name: 'Allow root ssh'
lineinfile:
path: /etc/ssh/sshd_config
line: 'PermitRootLogin yes'
state: present
- name: 'increase ssh session timeout'
linefile:
path: /etc/ssh/sshd_config
line: 'ClientAliveInterval 600'
state: present
- name: 'increse ssh session timeout'
linefile:
path: /etc/ssh/sshd_config
line: 'ClientAliveCountMax 3'
state: present
- name: Add entires to ETC Hosts
lineinfile:
path: /etc/hosts
line: "{{ item }}"
with_items:
- "192.168.1.11 controller1"
# - "192.168.1.12 controller2"
# - "192.168.1.13 controller3"
# - "192.168.1.14 compute1"
# - "192.168.1.15 compute2"
# - "192.168.1.10 contrail"
- name: Comment out PermitRootLogin without-password
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^PermitRootLogin without-password$'
line: '#PermitRootLogin without-password'
- name: Disable UFW
ufw:
state: disabled
- service:
name: ssh
state: restarted
- name: sudo root pass
lineinfile:
path: /etc/sudoers
line: contrail ALL=(ALL) NOPASSWD:ALL
- name: root pass change
command: echo -e "contrail123\contrail123" | sudo -S passwd
- name: copy rooter file
copy:
src: /Builder/Packer/rooter.sh
dest: /root/rooter.sh
- name: run rooter
command: sh /root/rooter.sh
- name: Copy Contrail files to VM
copy:
src: /Builder/Contrail/v3_2_2/contrail-install-packages_3.2.2.0-33~ubuntu-14-04mitaka_all.deb
dest: /Contrail/contrail-install-packages_3.2.2.0-33~ubuntu-14-04mitaka_all.deb
- name: Copy testbed.py file
copy:
src: /Builder/Contrail/testbed.py
dest: /Contrail/testbed.py
- name: unpack Contrail deb file
apt:
deb: /Contrail/contrail-install-packages_3.2.2.0-33~ubuntu-14-04mitaka_all.deb
- name: setup Contrail
shell: /opt/contrail/contrail_packages/setup.sh
- name: copy fabfile
shell: cp /Contrail/testbed.py /opt/contrail/utils/fabfile/testbeds/testbed.py
# - name: upgrade kernel
# shell: chdir=/opt/contrail/utils fab upgrade_kernel_all
# async: 1
# poll: 0
# - name: Is the VM back up yet?
# wait_for:
# host= "{{ inventory_hostname }}"
# port =22
# delay= 15
# timeout= 60
# delegate_to= localhost
# - name: Is the VM back up yet?
# local_action: wait_for host=controller1 port=22 state=started delay=10 timeout=360
- name: Install Contrail
shell: chdir=/opt/contrail/utils fab install_contrail
async: 300
poll: 15
ignore_errors: true
# - name: Is the VM back yet?
# wait_for:
# host: controller1
# port: 22
# state: started
# delay: 300
# timeout: 600
# delegate_to: localhost
- name: Setup Contrail
shell: chdir=/opt/contrail/utils fab setup_all
async: 840
poll: 10
ignore_errors: true