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:
Danny Bessems 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 - name: Configure clusterctl
ansible.builtin.template: ansible.builtin.template:
src: clusterctl.j2 src: clusterctl.j2
@ -15,7 +10,7 @@
infrastructure_vsphere: "{{ components.clusterapi.management.version.infrastructure_vsphere }}" infrastructure_vsphere: "{{ components.clusterapi.management.version.infrastructure_vsphere }}"
hv: hv:
fqdn: "{{ vapp['hv.fqdn'] }}" fqdn: "{{ vapp['hv.fqdn'] }}"
tlsthumbprint: "{{ (tls_thumbprint.stdout | split('='))[-1] }}" tlsthumbprint: "{{ vcenter_info.tls_thumbprint }}"
username: "{{ vapp['hv.username'] }}" username: "{{ vapp['hv.username'] }}"
password: "{{ vapp['hv.password'] }}" password: "{{ vapp['hv.password'] }}"
datacenter: "{{ vcenter_info.datacenter }}" datacenter: "{{ vcenter_info.datacenter }}"

View File

@ -38,15 +38,20 @@
part: NF part: NF
- attribute: resourcepool - attribute: resourcepool
moref: >- 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') jq -r '.[] | select(.Name == "resourcePool").Val | .Type + ":" + .Value')
part: 0 part: 0
loop_control: loop_control:
label: "{{ item.attribute }}" 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 - name: Store hypervisor details in dictionary
ansible.builtin.set_fact: 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: "{{ govc_inventory.results }}"
loop_control: loop_control:
label: "{{ item.item.attribute }}" label: "{{ item.item.attribute }}"

View File

@ -112,7 +112,7 @@
docker://{{ item }} \ docker://{{ item }} \
docker-archive:./{{ ( item | regex_findall('[^/:]+'))[-2] }}_{{ uid }}.tar:{{ item }} docker-archive:./{{ ( item | regex_findall('[^/:]+'))[-2] }}_{{ uid }}.tar:{{ item }}
chdir: /opt/metacluster/container-images chdir: /opt/metacluster/container-images
var: vars:
uid: "{{ lookup('ansible.builtin.password', '/dev/null length=5 chars=ascii_lowercase,digits seed=item') }}" uid: "{{ lookup('ansible.builtin.password', '/dev/null length=5 chars=ascii_lowercase,digits seed=item') }}"
loop: "{{ ((containerimages.results | map(attribute='stdout_lines') | select('defined') | flatten) + dependencies.container_images + (clusterapi_containerimages | list)) | unique }}" loop: "{{ ((containerimages.results | map(attribute='stdout_lines') | select('defined') | flatten) + dependencies.container_images + (clusterapi_containerimages | list)) | unique }}"