From f9f487ce4aa85cb0f339f6ec0f367f15e2534263 Mon Sep 17 00:00:00 2001 From: Vladimir Kozhukalov Date: Fri, 27 Oct 2023 13:56:32 -0500 Subject: [PATCH] Fix deploy-env role The role tried to include non-existing file which was forgotten while we moved the role to this repo. This inclusion is only actual for cases when we consume images from a buildset registry. Change-Id: I1510edf7bdc78f9c61f7722e2c7848e152edf892 --- playbooks/run-scripts.yaml | 29 +++---------------- .../tasks/buildset_registry_alias.yaml | 13 +++++++++ roles/deploy-env/tasks/containerd.yaml | 11 +++++++ 3 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 roles/deploy-env/tasks/buildset_registry_alias.yaml diff --git a/playbooks/run-scripts.yaml b/playbooks/run-scripts.yaml index 7ae51c4b3..4dcdbd43e 100644 --- a/playbooks/run-scripts.yaml +++ b/playbooks/run-scripts.yaml @@ -11,20 +11,6 @@ # limitations under the License. --- -- hosts: all - become: true - tasks: - - name: Configure /etc/hosts for buildset_registry to workaround docker not understanding ipv6 addresses - lineinfile: - path: /etc/hosts - state: present - regex: "^{{ buildset_registry.host }}\tzuul-jobs.buildset-registry$" - line: "{{ buildset_registry.host }}\tzuul-jobs.buildset-registry" - insertafter: EOF - when: - - buildset_registry is defined - - buildset_registry.host | ipaddr - - hosts: primary tasks: - name: Override images @@ -32,17 +18,10 @@ vars: work_dir: "{{ zuul.project.src_dir }}" block: - - name: Set buildset_registry alias variable when using ip - set_fact: - buildset_registry_alias: zuul-jobs.buildset-registry - when: - - buildset_registry.host | ipaddr - - - name: Set buildset_registry alias variable when using name - set_fact: - buildset_registry_alias: "{{ buildset_registry.host }}" - when: - - not ( buildset_registry.host | ipaddr ) + - name: Buildset registry alias + include_role: + name: deploy-env + tasks_from: buildset_registry_alias - name: Print zuul debug: diff --git a/roles/deploy-env/tasks/buildset_registry_alias.yaml b/roles/deploy-env/tasks/buildset_registry_alias.yaml new file mode 100644 index 000000000..b96c21cf8 --- /dev/null +++ b/roles/deploy-env/tasks/buildset_registry_alias.yaml @@ -0,0 +1,13 @@ +--- +- name: Set buildset_registry alias variable when using ip + set_fact: + buildset_registry_alias: zuul-jobs.buildset-registry + when: + - buildset_registry.host | ipaddr + +- name: Set buildset_registry alias variable when using name + set_fact: + buildset_registry_alias: "{{ buildset_registry.host }}" + when: + - not ( buildset_registry.host | ipaddr ) +... diff --git a/roles/deploy-env/tasks/containerd.yaml b/roles/deploy-env/tasks/containerd.yaml index 372933ec9..01065b68a 100644 --- a/roles/deploy-env/tasks/containerd.yaml +++ b/roles/deploy-env/tasks/containerd.yaml @@ -87,6 +87,17 @@ include_tasks: file: buildset_registry_alias.yaml + - name: Configure /etc/hosts for buildset_registry to workaround docker not understanding ipv6 addresses + lineinfile: + path: /etc/hosts + state: present + regex: "^{{ buildset_registry.host }}\tzuul-jobs.buildset-registry$" + line: "{{ buildset_registry.host }}\tzuul-jobs.buildset-registry" + insertafter: EOF + when: + - buildset_registry is defined + - buildset_registry.host | ipaddr + - name: Write buildset registry TLS certificate copy: content: "{{ buildset_registry.cert }}"