-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path99_re-ip_dd_after_headswap.yml
58 lines (58 loc) · 2.16 KB
/
99_re-ip_dd_after_headswap.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
# Example Playbook to configure PPDM Certificates
- name: Re-IP Inventory Source
hosts: localhost
gather_facts: no
connection: local
vars_files:
- ./vars/main.yml
tasks:
- name: Checking Required Variables - old_address
fail:
msg: "We do not have old_address !"
when: (old_address is not defined) or (old_address|length <= 5)
- name: Checking Required Variables - new_address
fail:
msg: "We do not have new_address !"
when: (new_address is not defined) or (new_address|length <= 5)
- name: Setting Base URL
set_fact:
ppdm_baseurl: "https://{{ ppdm_fqdn | regex_replace('^https://') }}"
- name: Get PPDM Token for https://{{ ppdm_fqdn | regex_replace('^https://') }}
include_role:
name: get_ppdm_token
vars:
ppdm_password: "{{ ppdm_new_password }}"
- debug:
msg: "{{ access_token }}"
verbosity: 1
name: do we have a token ?
- name: Get PPDM inventory-sources
include_role:
name: get_ppdm_inventory-sources
vars:
filter: address eq "{{ old_address }}" and type eq "EXTERNALDATADOMAIN"
- name: creating configurations
set_fact:
## prior 19.7, we published _links .... new_config: "{% set copy=configuration.content[0].copy() %}{% set removed=copy.pop('_links') %}{{ copy }}"
new_inventorysources: "{% set copy=inventorysources[0].copy() %}{% set removed=copy.pop('_links') %}{{ copy }}"
# name: Generating K8S Configuration
new_config: "{{ inventorysources[0] }}" # | json_query('details.k8s.configurations[?key!=`k8s.velero.exclude.resources`]')
- debug:
msg: "{{ new_inventorysources }}"
verbosity: 0
- name: merge new setup
vars:
my_new_config:
address: "{{ new_address }}"
name: "{{ new_address }}"
set_fact:
new_inventorysources: "{{ new_inventorysources | default([]) | combine(my_new_config, recursive=True) }}"
- debug:
msg: "{{ new_inventorysources }}"
verbosity: 0
- name: Set Infrastructure Update Options
vars:
data: "{{ new_inventorysources }}"
id: "{{ new_inventorysources.id }}"
include_role:
name: set_ppdm_inventory