forked from CiscoDevNet/ps-crn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
import-policy.yml
57 lines (54 loc) · 1.63 KB
/
import-policy.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
- name: Import vManage Policy Lists
hosts: localhost
connection: local
roles:
- ansible-viptela
vars:
vmanage_host: "{{ groups.vmanage_hosts | first }}"
vmanage_ip: "{{ hostvars[vmanage_host].ansible_host }}"
file: vmanage_policy.yml
gather_facts: no
tasks:
- name: Reading file {{ file }}
tags:
- policy_lists
- policy_definitions
- central_policy
include_vars:
file: "{{ file }}"
name: vmanage_policy
- name: Import policy lists
tags:
- policy_lists
vmanage_policy_list:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
type: "{{ item.key }}"
state: present
aggregate: "{{ item.value }}"
loop: "{{ lookup('dict', vmanage_policy.vmanage_policy_lists) }}"
when: item.value
register: policy_list_facts
- name: Import policy definitions
tags:
- policy_definitions
vmanage_policy_definition:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
type: "{{ item.key }}"
state: present
aggregate: "{{ item.value }}"
loop: "{{ lookup('dict', vmanage_policy.vmanage_policy_definitions) }}"
when: item.value
register: policy_list_facts
- name: Import central policies
tags:
- central_policy
vmanage_central_policy:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
state: present
aggregate: "{{ vmanage_policy.vmanage_central_policies }}"