-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure-control.yml
92 lines (79 loc) · 2.31 KB
/
configure-control.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
- hosts: control
gather_facts: no
become: yes
pre_tasks:
- name: Install python for Ansible
raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt install -qqy python-minimal)"
register: output
changed_when: output.stdout
- name: Gathering Facts
setup:
tasks:
- name: Update and upgrade apt
apt:
upgrade: yes
update_cache: yes
- name: Install packages
apt:
name:
- python3
- python3-pip
- libssl-dev
- sshpass
- python3-setuptools
- python-setuptools
- libffi-dev
- name: Install required PIP packages
pip:
name: "{{ item }}"
executable: pip3
requirements: requirements.txt
- name: Make python 3 the default
alternatives:
name: python
link: /usr/bin/python
path: /usr/bin/python3
priority: 10
- name: Add VIRL hosts to /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: '.*{{ item }}$'
line: "{{ hostvars[item].ansible_host }} {{ item }}"
state: present
when: hostvars[item].ansible_host is defined
with_items: "{{ groups.virl_hosts }}"
- name: clone the repo
git:
repo: 'https://github.com/CiscoDevNet/ps-crn.git'
dest: /home/virl/ps-crn
become_user: virl
- name: Creare .virlrc
blockinfile:
path: /home/virl/.virlrc
create: yes
block: |
VIRL_USERNAME={{ virl_username }}
VIRL_PASSWORD={{ virl_password }}
VIRL_HOST=192.133.178.9
- name: Create simulation environment directory
file:
path: /home/virl/ps-crn/.virl/default
state: directory
- name: Create simulation ID file
copy:
dest: /home/virl/ps-crn/.virl/default/id
content: "{{ virl_simulation }}"
- name: Create license directory
file:
path: /home/virl/ps-crn/licenses
state: directory
- name: Copy license
copy:
dest: /home/virl/ps-crn/licenses
src: licenses/serialFile.viptela
- name: Copy viptela.yml
copy:
dest: /home/virl/ps-crn/inventory/group_vars/all/viptela.yml
src: inventory/group_vars/all/viptela.yml
- debug:
msg: "Control node IP: {{ ansible_host }}"