-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_upload_config.yml
56 lines (49 loc) · 1.5 KB
/
generate_upload_config.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
- hosts: localhost
gather_facts: yes
tasks:
- debug: var=ansible_date_time
- set_fact:
config_datetime: "{{ansible_date_time.iso8601_basic_short}}"
- name: Generate Device Specific Config via Template
template:
src: last_checkpoint.j2
dest: ./vars_files/last_checkpoint.yml
- hosts: roseville-site
gather_facts: False
collections:
- arubanetworks.aoscx
vars:
ansible_connection: network_cli
tasks:
- name: Backup checkpoint BEFORE Ansible
aoscx_command:
commands:
- copy running check ANSIBLE_{{ hostvars['localhost']['config_datetime']}}
- name: Generate Device Specific Config via Template
template:
src: cx_access.j2
dest: ../tmp/{{inventory_hostname}}_tmp.txt
- name: Copy Config to switch
aoscx_config:
src: ../tmp/{{inventory_hostname}}_tmp.txt
- name: Backup Config Locally
aoscx_config:
backup: True
backup_options:
filename: "{{inventory_hostname}}.txt"
dir_path: ./configs
# - hosts: all
# gather_facts: False
# collections:
# - arubanetworks.aoscx
# vars:
# ansible_connection: network_cli
# tasks:
# - name: Generate Device Specific Config via Template
# template:
# src: cx_access.j2
# dest: ../tmp/{{inventory_hostname}}_tmp.txt
# - name: Execute Generated Config via SSH
# aoscx_config:
# src: ../tmp/{{inventory_hostname}}_tmp.txt
# back