forked from CiscoDevNet/ps-crn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
export-policy.yml
45 lines (40 loc) · 1.39 KB
/
export-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
- name: Export 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: Get policy lists
vmanage_policy_list_facts:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
register: policy_list_facts
- name: Get policy definitions
vmanage_policy_definition_facts:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
register: policy_definition_facts
- name: Get central policies
vmanage_central_policy_facts:
user: "{{ ansible_user }}"
host: "{{ vmanage_ip }}"
password: "{{ ansible_password }}"
register: central_policy_facts
- set_fact:
vmanage_policy:
vmanage_policy_lists: "{{ policy_list_facts.policy_lists }}"
vmanage_policy_definitions: "{{ policy_definition_facts.policy_definitions }}"
vmanage_central_policies: "{{ central_policy_facts.central_policies }}"
# - debug:
# var: vmanage_policy
- name: Write out policies to {{ file }}
copy:
content: "{{ vmanage_policy | to_nice_yaml(indent=2, width=1337) }}"
dest: "{{ file }}"