[PATCH RFT 1/6] Makefile: fix target dependency order

Daniel Gomez <[email protected]>
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Daniel Gomez <[email protected]>

Fix Ansible warnings by ensuring proper build order:
extra_vars.yaml -> ansible.cfg -> hosts -> nodes -> rest

This fixes Ansible WARNINGS introduced by d7028bde ("terraform: remove
redundant ansible inventory and connection overrides") while executing
terraform Makefile targets. Reported by Chuck Lever.

Warnings:
==> [terraform/aws/terraform.tfvars]
+ ansible-playbook playbooks/gen_tfvars.yml
--extra-vars=@./extra_vars.yaml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available.
Note that the implicit localhost does not match 'all'

Generated-by: Claude AI
Reported-by: Chuck Lever <[email protected]>
Signed-off-by: Daniel Gomez <[email protected]>
---
 Makefile | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index dbd52ca3..fb7e9b81 100644
--- a/Makefile
+++ b/Makefile
@@ -124,6 +124,23 @@ LOCALHOST_SETUP_WORK :=
 
 ANSIBLE_EXTRA_ARGS += $(LOCAL_DEVELOPMENT_ARGS)
 
+# We may not need the extra_args.yaml file all the time.  If this file is empty
+# you don't need it. All of our ansible kdevops roles check for this file
+# without you having to specify it as an extra_args=@extra_args.yaml file. This
+# helps us with allowing users call ansible on the command line themselves,
+# instead of using the make constructs we have built here.
+# Core dependencies now added before provision.Makefile include
+ifneq (,$(ANSIBLE_EXTRA_ARGS))
+DEFAULT_DEPS += $(KDEVOPS_EXTRA_VARS)
+endif
+
+DEFAULT_DEPS += $(ANSIBLE_CFG_FILE)
+DEFAULT_DEPS += $(ANSIBLE_INVENTORY_FILE)
+
+ifneq (,$(KDEVOPS_NODES))
+DEFAULT_DEPS += $(KDEVOPS_NODES)
+endif
+
 include scripts/provision.Makefile
 include scripts/firstconfig.Makefile
 include scripts/systemd-timesync.Makefile
@@ -152,15 +169,6 @@ ifeq (y,$(CONFIG_WORKFLOW_KOTD_ENABLE))
 include scripts/kotd.Makefile
 endif # WORKFLOW_KOTD_ENABLE
 
-# We may not need the extra_args.yaml file all the time.  If this file is empty
-# you don't need it. All of our ansible kdevops roles check for this file
-# without you having to specify it as an extra_args=@extra_args.yaml file. This
-# helps us with allowing users call ansible on the command line themselves,
-# instead of using the make constructs we have built here.
-ifneq (,$(ANSIBLE_EXTRA_ARGS))
-DEFAULT_DEPS += $(KDEVOPS_EXTRA_VARS)
-endif
-
 DEFAULT_DEPS += $(DEFAULT_DEPS_REQS_EXTRA_VARS)
 
 include scripts/install-menuconfig-deps.Makefile
@@ -250,14 +258,12 @@ ifneq (,$(KDEVOPS_BRING_UP_DEPS))
 include scripts/bringup.Makefile
 endif
 
-DEFAULT_DEPS += $(ANSIBLE_INVENTORY_FILE)
-$(ANSIBLE_INVENTORY_FILE): .config $(ANSIBLE_CFG_FILE) $(KDEVOPS_HOSTS_TEMPLATE) $(KDEVOPS_NODES) $(KDEVOPS_EXTRA_VARS)
+$(ANSIBLE_INVENTORY_FILE): .config $(ANSIBLE_CFG_FILE) $(KDEVOPS_HOSTS_TEMPLATE) $(KDEVOPS_EXTRA_VARS)
 	$(Q)ANSIBLE_LOCALHOST_WARNING=False ANSIBLE_INVENTORY_UNPARSED_WARNING=False \
 		ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_hosts.yml \
 		--extra-vars=@./extra_vars.yaml
 
-DEFAULT_DEPS += $(KDEVOPS_NODES)
 $(KDEVOPS_NODES): .config $(ANSIBLE_CFG_FILE) $(KDEVOPS_NODES_TEMPLATE) $(KDEVOPS_EXTRA_VARS)
 	$(Q)ANSIBLE_LOCALHOST_WARNING=False ANSIBLE_INVENTORY_UNPARSED_WARNING=False \
 		ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \

-- 
2.50.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.