Move task;Fix static value;Improve shell logic/ansible filter;Fix typo
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-11-17 09:22:58 +01:00
parent be562f0124
commit 83ee632ff9
3 changed files with 9 additions and 9 deletions

View File

@ -1,8 +1,3 @@
- name: Retrieve hypervisor TLS thumbprint
ansible.builtin.shell:
cmd: openssl s_client -connect {{ vapp['hv.fqdn'] }}:443 < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout -in /dev/stdin
register: tls_thumbprint
- name: Configure clusterctl
ansible.builtin.template:
src: clusterctl.j2
@ -15,7 +10,7 @@
infrastructure_vsphere: "{{ components.clusterapi.management.version.infrastructure_vsphere }}"
hv:
fqdn: "{{ vapp['hv.fqdn'] }}"
tlsthumbprint: "{{ (tls_thumbprint.stdout | split('='))[-1] }}"
tlsthumbprint: "{{ vcenter_info.tls_thumbprint }}"
username: "{{ vapp['hv.username'] }}"
password: "{{ vapp['hv.password'] }}"
datacenter: "{{ vcenter_info.datacenter }}"

View File

@ -38,15 +38,20 @@
part: NF
- attribute: resourcepool
moref: >-
$(govc object.collect -json /DeSchakel/vm/Kubernetes.Bootstrap.Appliance2 |
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
jq -r '.[] | select(.Name == "resourcePool").Val | .Type + ":" + .Value')
part: 0
loop_control:
label: "{{ item.attribute }}"
- name: Retrieve hypervisor TLS thumbprint
ansible.builtin.shell:
cmd: openssl s_client -connect {{ vapp['hv.fqdn'] }}:443 < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout -in /dev/stdin | awk -F'=' '{print $2}'
register: tls_thumbprint
- name: Store hypervisor details in dictionary
ansible.builtin.set_fact:
vcenter_info: "{{ vcenter_info | default({}) | combine({ item.item.attribute : item.stdout }) }}"
vcenter_info: "{{ vcenter_info | default({}) | combine({ item.item.attribute : item.stdout }) | combine({ 'tls_thumbprint': tls_thumbprint.stdout }) }}"
loop: "{{ govc_inventory.results }}"
loop_control:
label: "{{ item.item.attribute }}"