public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
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	[thread overview]
Message-ID: <20240309233603.1306533-7-smayhew@redhat.com> (raw)
In-Reply-To: <20240309233603.1306533-1-smayhew@redhat.com>

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 <smayhew@redhat.com>
---
 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


  parent reply	other threads:[~2024-03-09 23:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 23:35 [PATCH v2 00/10] add initial support for testing nfs with krb5 Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 01/10] nfsd: make sure the appropriate fsprogs package is installed Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 02/10] update_etc_hosts: fix up hostnames on debian guestfs hosts Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 03/10] nfsd: use EXTRA_VAR_INPUTS for export options Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 04/10] devconfig: set /etc/hostname earlier Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 05/10] nfsd: add a pipefs-directory config to nfs.conf Scott Mayhew
2024-03-09 23:35 ` Scott Mayhew [this message]
2024-03-09 23:36 ` [PATCH v2 07/10] bringup: clean up the nfs-related make targets Scott Mayhew
2024-03-09 23:36 ` [PATCH v2 08/10] gen_hosts/gen_nodes: clean up nfsd-related stuff Scott Mayhew
2024-03-09 23:36 ` [PATCH v2 09/10] kconfigs: clean up Kconfig.bringup.goals Scott Mayhew
2024-03-09 23:36 ` [PATCH v2 10/10] fstests/nfs: add krb5 support Scott Mayhew
2024-03-11 12:57 ` [PATCH v2 00/10] add initial support for testing nfs with krb5 Jeff Layton
2024-03-11 22:05 ` Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240309233603.1306533-7-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc=kdevops@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox