Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A8035339D for ; Sat, 9 Mar 2024 23:36:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710027369; cv=none; b=h6jTvPEIL2YR3fH1dGwxbezRxHL0uPkol5RC1UsNy6EKIOoFe20hWphi65GP/pDZwNMM60MpOiQasnv94eN6qnp9KpdTOrENN5VqDJ91etPWph+dTzco+Z/Kbx4GpyPg8X44oiUOHPOYTHHxALfhZwb8PD0uJs/lVWnkUjy29+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710027369; c=relaxed/simple; bh=dLkwbNIEWmNFHzLVE6hJgwQFbl4qnvL6qOr9avhwQbg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WZ2FqhCTVNYWM/RgH6efGTqX5fZj3ZnNNtxoB2YSpjPVMgzLi1rK2rbRwbpIDog1t3UKk+mHqa922NhgaWu3u3cPUoJgi92NM79RrVXUm1WjTqvBdfrIzg3MA1b4GLDkrj/9CLxfeBE/p39hjTRZhs1PisLHaM0kbokZyF+qif8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hCQIDQD7; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hCQIDQD7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710027366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KHiV9PK7t54cEEHbp6FAK8E6zmRgmqKF2PuqVV/0nV4=; b=hCQIDQD7v5RC3JqERHvDVADIfhPouMzL5gHuRfjRV3QSmGh83vQrORxx/Anb+FeWT84hpG f1exVyCTEwmRMQ8dZb8mqPaXSRQ15elDkR3VZLrRzzDfoQ1BrbkO4PPEnGjCdJacElX33N 4+IbpbNakJNJ279x0xNL3jwaUBbvUJ4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-644-9Pna5Z1CO7-GQj6Yv7lbig-1; Sat, 09 Mar 2024 18:36:04 -0500 X-MC-Unique: 9Pna5Z1CO7-GQj6Yv7lbig-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 94CF42803051 for ; Sat, 9 Mar 2024 23:36:04 +0000 (UTC) Received: from aion.redhat.com (unknown [10.22.16.116]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88E8617AA7 for ; Sat, 9 Mar 2024 23:36:04 +0000 (UTC) Received: from aion.redhat.com (localhost [IPv6:::1]) by aion.redhat.com (Postfix) with ESMTP id 0BC9E12D1FD for ; Sat, 9 Mar 2024 18:36:04 -0500 (EST) From: Scott Mayhew To: kdevops@lists.linux.dev Subject: [PATCH v2 06/10] bringup: move the update_etc_hosts task to run early Date: Sat, 9 Mar 2024 18:35:59 -0500 Message-ID: <20240309233603.1306533-7-smayhew@redhat.com> In-Reply-To: <20240309233603.1306533-1-smayhew@redhat.com> References: <20240309233603.1306533-1-smayhew@redhat.com> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Previously, update_etc_hosts was run after all of the other bringup dependencies. Fix this by making it an early (i.e. KDEVOPS_BRING_UP_DEPS_EARLY) task. This serves two purposes. First, it allows the top-level makefiles to be cleaned up a bit. Second, it allows other bringup tasks (i.e. KDEVOPS_BRING_UP_DEPS and KDEVOPS_BRING_UP_LATE_DEPS tasks) to rely on the fact that /etc/hosts has already been updated on the target hosts. Signed-off-by: Scott Mayhew --- Makefile | 1 + playbooks/roles/update_etc_hosts/tasks/main.yml | 14 +++++++++----- playbooks/update_etc_hosts.yml | 1 + scripts/bringup.Makefile | 6 +----- scripts/update_etc_hosts.Makefile | 7 +++++++ 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 scripts/update_etc_hosts.Makefile diff --git a/Makefile b/Makefile index 9ca3a5f3..e0cb89c5 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,7 @@ ANSIBLE_EXTRA_ARGS += $(LOCAL_DEVELOPMENT_ARGS) include scripts/provision.Makefile include scripts/systemd-timesync.Makefile include scripts/journal-server.Makefile +include scripts/update_etc_hosts.Makefile KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_BRING_UP_DEPS_EARLY) KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_PROVISIONED_DEVCONFIG) diff --git a/playbooks/roles/update_etc_hosts/tasks/main.yml b/playbooks/roles/update_etc_hosts/tasks/main.yml index 34a69f6d..694d08db 100644 --- a/playbooks/roles/update_etc_hosts/tasks/main.yml +++ b/playbooks/roles/update_etc_hosts/tasks/main.yml @@ -1,8 +1,4 @@ -- name: Gather network facts - ansible.builtin.setup: - gather_subset: - - 'network' - +--- - name: Import optional extra_args file include_vars: "{{ item }}" ignore_errors: yes @@ -14,6 +10,14 @@ skip: true tags: vars +- name: Wait for hosts to become available + wait_for_connection: + +- name: Gather network facts + ansible.builtin.setup: + gather_subset: + - 'network' + - name: Build network address set_fact: private_network: "{{ terraform_private_net_prefix }}/{{ terraform_private_net_mask }}" diff --git a/playbooks/update_etc_hosts.yml b/playbooks/update_etc_hosts.yml index 89a63773..a0c21741 100644 --- a/playbooks/update_etc_hosts.yml +++ b/playbooks/update_etc_hosts.yml @@ -1,4 +1,5 @@ --- - hosts: all + gather_facts: no roles: - role: update_etc_hosts diff --git a/scripts/bringup.Makefile b/scripts/bringup.Makefile index 5a477847..55e7d8d1 100644 --- a/scripts/bringup.Makefile +++ b/scripts/bringup.Makefile @@ -33,11 +33,7 @@ ifeq (y,$(CONFIG_KDEVOPS_SETUP_SIW)) KDEVOPS_BRING_UP_DEPS += siw endif # KDEVOPS_SETUP_SIW -update_etc_hosts: - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -f 30 -i hosts playbooks/update_etc_hosts.yml - -bringup: $(KDEVOPS_BRING_UP_DEPS) update_etc_hosts +bringup: $(KDEVOPS_BRING_UP_DEPS) destroy: $(KDEVOPS_DESTROY_DEPS) diff --git a/scripts/update_etc_hosts.Makefile b/scripts/update_etc_hosts.Makefile new file mode 100644 index 00000000..e4eb0bca --- /dev/null +++ b/scripts/update_etc_hosts.Makefile @@ -0,0 +1,7 @@ +update_etc_hosts: + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + -f 30 -i hosts playbooks/update_etc_hosts.yml + +KDEVOPS_BRING_UP_DEPS_EARLY += update_etc_hosts + +PHONY += update_etc_hosts -- 2.43.0