From ccbd4ed9846ba623691071ac45361059ebbe8384 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Thu, 18 Aug 2022 12:44:08 +0200 Subject: [PATCH] Fix task order;Add default hostname value --- .../roles/metacluster/tasks/main.yml | 22 +++++++++---------- scripts/Update-OvfConfiguration.yml | 7 ++++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml index d62a6e3..79eb11f 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml @@ -13,6 +13,17 @@ INSTALL_K3S_EXEC: 'server --cluster-init --disable local-storage' when: ansible_facts.services['k3s.service'] is undefined + - name: Ensure API availability + ansible.utils.cli_parse: + command: curl -k https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose + parser: + name: ansible.utils.json + set_fact: api_readycheck + ignore_errors: yes + until: api_readycheck.apiVersion is defined + retries: 3 + delay: 30 + - name: Initialize tempfile ansible.builtin.tempfile: state: file @@ -57,17 +68,6 @@ - name: Trigger handlers ansible.builtin.meta: flush_handlers - - name: Ensure API availability - ansible.utils.cli_parse: - command: curl -k https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose - parser: - name: ansible.utils.json - set_fact: api_readycheck - ignore_errors: yes - until: api_readycheck.apiVersion is defined - retries: 3 - delay: 30 - - name: Install kubectl tab-completion ansible.builtin.shell: cmd: kubectl completion bash | tee /etc/bash_completion.d/kubectl diff --git a/scripts/Update-OvfConfiguration.yml b/scripts/Update-OvfConfiguration.yml index 62abc04..45a7203 100644 --- a/scripts/Update-OvfConfiguration.yml +++ b/scripts/Update-OvfConfiguration.yml @@ -50,8 +50,8 @@ PropertyCategories: - Key: guestinfo.hostname Type: string(1..15) Label: Hostname* - Description: '(max length: 15 characters)' - DefaultValue: '' + Description: '' + DefaultValue: 'META-NODE-{{ hostname.suffix }}' Configurations: '*' UserConfigurable: true @@ -151,6 +151,9 @@ AdvancedOptions: --- Variables: +- Name: hostname.suffix + Expression: | + (-join ((48..57) + (97..122) | Get-Random -Count 5 | % {[char]$_})).ToUpper() - Name: appliance.name Expression: | $Parameter['appliance.name']