-
Notifications
You must be signed in to change notification settings - Fork 1
/
9.12-playbook_set_k8s_controller_config.yml
70 lines (68 loc) · 2.63 KB
/
9.12-playbook_set_k8s_controller_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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Example Playbook to configure PPDM Certificates
- name: Set PPDM K8S Controller
hosts: localhost
gather_facts: no
connection: local
vars_files:
- ./vars/main.yml
tasks:
# - name: Checking Required Variables - licenseKey
# fail:
# msg: "We do not have licenseKey !"
# when: (licenseKey is not defined) or (licenseKey|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 "api.ocs1.home.labbuildr.com" and type eq "KUBERNETES"
- 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_config }}"
verbosity: 0
- name: creating configurations
vars:
old_config:
configurations: "{{ new_config }}"
my_new_config:
configurations:
- key: k8s.velero.exclude.resources
type: CONTROLLER_CONFIG
value: secrets, operators.operator.openshift.io, cloudcredentials.operator.openshift.io, clusteroperators.config.openshift.io, rolebindings,events, events.events.k8s.io,customresourcedefinitions.apiextensions.k8s.io, build.openshift.io, prometheusrules.monitoring.coreos.com
set_fact:
new_config: "{{ old_config | default([]) | combine(my_new_config, list_merge='append',recursive=True, ) }}"
- debug:
msg: "{{ new_config }}"
verbosity: 0
- name: final list_merge
vars:
new_details:
details:
k8s: "{{ new_config }}"
set_fact:
new_inventorysources: "{{ new_inventorysources | default([]) | combine(new_details, recursive=True, ) }}"
- debug:
msg: "{{ new_inventorysources }}"
verbosity: 0
- name: Set K8S Controller Options
vars:
data: "{{ new_inventorysources }}"
id: "{{ new_inventorysources.id }}"
include_role:
name: set_ppdm_inventory