-
Notifications
You must be signed in to change notification settings - Fork 5
/
push_config.yaml
58 lines (48 loc) · 1.53 KB
/
push_config.yaml
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
---
- name: Update Tenant
hosts: localhost
gather_facts: false
connection: local
vars_files:
- vars/main.yaml
tasks:
- name: Create tmp Directory for Declarations
file:
path: tmp/
state: directory
- name: Group all Application Files
assemble:
remote_src: False
src: "apps/{{item[0]}}/{{item[1]}}/"
dest: /Users/test/Desktop/Demo/ansible-as3-builder/tmp/{{item[0]}}-{{item[1]}}_combined.yaml
delimiter: ","
# validate: 'ls %s'
with_nested:
- "{{datacenters}}"
- "{{tenants}}"
- name: Retrive AS3 JSON Body
set_fact: tenant_body="{{ lookup('file', 'tmp/{{item[0]}}-{{item[1]}}_combined.yaml', split_lines=False) }}"
with_nested:
- "{{datacenters}}"
- "{{tenants}}"
register: tenant_json
- name: Retrive AS3 files to push
command: "ls tmp/"
register: dir_out
- name: URI POST Tenant
uri:
url: "https://{{ groups[item.split('-')[0]][0] }}:{{hostvars[groups[item.split('-')[0]][0]]['f5_admin_port']}}/mgmt/shared/appsvcs/declare"
method: POST
user: "admin"
password: "{{ hostvars[groups[item.split('-')[0]][0]]['f5_password'] }}"
validate_certs: no
body: "{{ lookup('template', 'j2/tenant_base.j2') }}"
body_format: json
with_items:
- "{{dir_out.stdout_lines}}"
# - name: Remove Temporary Combined File
# file:
# path: tmp/{{item}}
# state: absent
# with_items:
# - "{{dir_out.stdout_lines}}"