From 61e88a236a1a326dac771469cceaafc4651349d2 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Sat, 16 Sep 2023 03:51:58 +0000 Subject: [PATCH] ci: test another workaround --- molecule/shared/prepare/base.yml | 12 ------------ molecule/shared/prepare/kubernetes.yml | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/molecule/shared/prepare/base.yml b/molecule/shared/prepare/base.yml index 1bf8b0f97..80f2c69e6 100644 --- a/molecule/shared/prepare/base.yml +++ b/molecule/shared/prepare/base.yml @@ -18,18 +18,6 @@ workspace_path: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}" domain_name: "{{ (lookup('env', 'HOST_IP') | default(ansible_default_ipv4.address, true)).replace('.', '-') }}.{{ lookup('env', 'ATMOSPHERE_DNS_SUFFIX_NAME') | default('nip.io', True) }}" # noqa: yaml[line-length] -# NOTE(mnaser): Since we create the workspace in the same playbook, we need to -# load all of the variables (howver Ansible won't see them in -# this playbook), so we will loop over all the `group_vars` and -# use `include_vars` to load them. -- name: Workaround for https://github.com/ansible/ansible/issues/24987 - hosts: all - gather_facts: false - tasks: - - name: Load group_vars - ansible.builtin.include_vars: - dir: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/group_vars" - - name: Prepare systems for test hosts: all become: true diff --git a/molecule/shared/prepare/kubernetes.yml b/molecule/shared/prepare/kubernetes.yml index cf27c63eb..d82e216ba 100644 --- a/molecule/shared/prepare/kubernetes.yml +++ b/molecule/shared/prepare/kubernetes.yml @@ -12,7 +12,20 @@ # License for the specific language governing permissions and limitations # under the License. -- ansible.builtin.import_playbook: vexxhost.atmosphere.kubernetes +# NOTE(mnaser): Since we create the workspace in the same playbook, we need to +# load all of the variables (howver Ansible won't see them in +# this playbook), so we will loop over all the `group_vars` and +# use `include_vars` to load them. +- name: Workaround for https://github.com/ansible/ansible/issues/24987 + hosts: all + gather_facts: false + tasks: + - name: Load Kubernetes variables + ansible.builtin.include_vars: + file: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}/group_vars/all/kubernetes.yml" + +- name: Install Kubernetes + ansible.builtin.import_playbook: vexxhost.atmosphere.kubernetes # NOTE(mnaser): When using Docker with custom networks, it will use 127.0.0.11 # as the DNS server which trips up the CoreDNS "loop" plugin. @@ -56,9 +69,9 @@ - Wait for CoreDNS to be ready handlers: - name: Rollout CoreDNS - command: kubectl -n kube-system rollout restart deploy/coredns + ansible.builtin.command: kubectl -n kube-system rollout restart deploy/coredns - name: Wait for CoreDNS to be ready - command: kubectl -n kube-system rollout status deploy/coredns + ansible.builtin.command: kubectl -n kube-system rollout status deploy/coredns - ansible.builtin.import_playbook: vexxhost.atmosphere.csi