Divide hypervisor/vapp details over secret/configmap;Add filter plugin;Retain newlines in template;Add vApp properties
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-09-06 13:34:39 +02:00
parent 1794b24998
commit a67ef0e1bd
4 changed files with 60 additions and 6 deletions

View File

@ -7,15 +7,20 @@
kubeconfig: "{{ kubeconfig.path }}"
# values: "{{ components.sealedsecrets.chart_values }}"
- name: Store hypervisor details in secret
- name: Store hypervisor details in configmap/secret
kubernetes.core.k8s:
state: present
template: secret.j2
template: "{{ item.kind }}.j2"
kubeconfig: "{{ kubeconfig.path }}"
vars:
_template:
name: hypervisor-credentials
name: "{{ item.name }}"
namespace: "{{ item.namespace }}"
data: "{{ item.data }}"
loop:
- name: hypervisor-credentials
namespace: kube-system
kind: secret
data:
- key: HV_FQDN
value: "{{ vapp['hv.fqdn'] | b64encode }}"
@ -23,3 +28,21 @@
value: "{{ vapp['hv.username'] | b64encode }}"
- key: HV_PASSWORD
value: "{{ vapp['hv.password'] | b64encode }}"
- name: hypervisor-ippool
namespace: kube-system
kind: configmap
data:
- key: VAPP_MOREF
value: "{{ moref_id }}"
- key: VAPP_IPPOOL_NETWORK
value: "{{ (vapp['guestinfo.ipaddress'] + '/' + vapp['guestinfo.prefixlength']) | ansible.utils.ipaddr('network') }}"
- key: VAPP_IPPOOL_NETMASK
value: "{{ (vapp['guestinfo.ipaddress'] + '/' + vapp['guestinfo.prefixlength']) | ansible.utils.ipaddr('netmask') }}"
- key: VAPP_IPPOOL_DNSSERVER
value: "{{ vapp['guestinfo.dnsserver'] }}"
- key: VAPP_IPPOOL_GATEWAY
value: "{{ vapp['guestinfo.gateway'] }}"
- key: VAPP_IPPOOL_RANGE
value: "{{ vapp['ippool.startip'] + '#' + (vapp['ippool.startip'] | netaddr_iter_iprange(vapp['ippool.endip']) | length | string) }}"
loop_control:
label: "{{ item.kind + '/' + item.name + ' (' + item.namespace + ')' }}"