-
Notifications
You must be signed in to change notification settings - Fork 0
/
prep_snake.yml
70 lines (63 loc) · 1.82 KB
/
prep_snake.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
- hosts: dut
connection: local
gather_facts: no
vars:
state: present
snake_tag: snake
roles:
- ansible-nfvis
tasks:
- name: Get NFVIS facts
nfvis_facts:
host: "{{ ansible_host }}"
user: "{{ ansible_user }}"
password: "{{ ansible_password }}"
register: nfvis_facts
- set_fact:
search_string: "^{{ snake_tag }}-"
- name: Add VNF to inventory
add_host:
name: "{{ item.name }}"
ansible_port: "{{ item.vm_group[0].interfaces.interface[0].port_forwarding.port[0].external_port_range[0].start }}"
ansible_host: "{{ ansible_host }}"
groups: snake
loop: "{{ nfvis_facts.deployments.deployment }}"
when: item.name is search("^{{ snake_tag }}-")
- hosts: snake
gather_facts: no
tasks:
- name: Wait for VNFs to boot (timeout 10min)
wait_for:
port: "{{ ansible_port }}"
host: "{{ ansible_host }}"
timeout: 600
delegate_to: localhost
- name: Configure licensing
hosts: snake
gather_facts: no
connection: network_cli
vars:
smart_licensing:
boot_level: ax
throughput_level: 2500
idtoken: "{{ license_token }}"
tasks:
- name: Set the license boot level
ios_config:
lines:
- "license boot level {{ smart_licensing.boot_level }}"
- "platform hardware throughput level MB {{ smart_licensing.throughput_level }}"
- name: Register to smart account
cli_command:
command: "license smart register idtoken {{ smart_licensing.idtoken }}"
- name: Save configuration
ios_config:
save_when: modified
- name: Waiting for successful registration
ios_command:
commands:
- show license status
register: license_status
until: "'AUTHORIZED' in license_status.stdout[0]"
retries: 60
delay: 10