Fix deploy-env when buildset_registry is defined

It used to configure /etc/hosts in two different places.
The buildset registry record was added while configuing
Containerd and then this record was removed while
configuring Kubernetes.

The PR adds the buildset registry record to the /etc/hosts
template and the task is moved to the tasks/main.yaml.

Change-Id: I7d1ae6c7d33a33d8ca80b63ef9d69decb283e0a6
This commit is contained in:
Vladimir Kozhukalov 2023-10-31 17:23:50 -05:00
parent ff552d5969
commit b5b66f1489
4 changed files with 10 additions and 18 deletions

View File

@ -1,2 +1,5 @@
127.0.0.1 localhost
{{ ansible_default_ipv4['address'] }} {{ ansible_hostname }}
{% if buildset_registry is defined and (buildset_registry.host | ipaddr) %}
{{ buildset_registry.host }} zuul-jobs.buildset-registry
{% endif %}

View File

@ -85,11 +85,6 @@
- /etc/resolv.conf
- /run/systemd/resolve/resolv.conf
- name: Configure /etc/hosts
template:
src: files/hosts
dest: /etc/hosts
# We download Calico manifest on all nodes because we then want to download
# Calico images BEFORE deploying it
- name: Download Calico manifest

View File

@ -87,17 +87,6 @@
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 }}"

View File

@ -3,11 +3,16 @@
include_tasks:
file: prerequisites.yaml
- name: Include common tasks
- name: Configure /etc/hosts
template:
src: files/hosts
dest: /etc/hosts
- name: Deploy Containerd
include_tasks:
file: containerd.yaml
- name: Include common tasks
- name: Common K8s tasks
include_tasks:
file: common_k8s.yaml