public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order
@ 2025-09-22 11:13 Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 1/6] Makefile: fix target " Daniel Gomez
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Daniel Gomez @ 2025-09-22 11:13 UTC (permalink / raw)
  To: Luis Chamberlain, Chuck Lever; +Cc: kdevops, Daniel Gomez

This series fixes Ansible warnings that appear during terraform setup
and simplifies ansible-playbook calls by establishing proper Makefile
target dependency order.

Problem: Terraform targets were executing before ansible.cfg and hosts
files existed, causing "No inventory was parsed" and "provided hosts
list is empty" warnings.

Root cause: The include order in Makefile caused terraform dependencies
to be added to DEFAULT_DEPS before core Ansible files.

Solution:
1. Establish correct dependency order: extra_vars.yaml → ansible.cfg →
hosts → nodes → rest
2. Add missing localhost entry in the new generic inventory template
(generic.j2)
3. Use explicit connection flags for bootstrap operations and remove
warning suppressions. Note, this reintroduces the --connection and
--inventory flags to the ansible.cfg and inventory targets. We only need
these 2 here for obvious reasons. This allows to remove the warnings
variables introduced after actually removing the flags. Being explicit
with flags is preferred here than using ANSIBLE_* variables.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Daniel Gomez (6):
      Makefile: fix target dependency order
      gen_hosts: add localhost to generic workflow template
      ansible_cfg: fix Python interpreter discovery warning
      Makefile: remove warnings from ANSIBLE_CFG_FILE target
      Makefile: simplify KDEVOPS_NODES ansible-playbook call
      Makefile: add explicit connection for inventory generation

 Makefile                                           | 41 ++++++++++++----------
 playbooks/ansible_cfg.yml                          |  2 ++
 .../roles/gen_hosts/templates/workflows/generic.j2 |  1 +
 3 files changed, 25 insertions(+), 19 deletions(-)
---
base-commit: 53943da513f1cfc857844bf5f961c27a13d3060d
change-id: 20250922-makefile-targets-order-d917a35f550a

Best regards,
--  
Daniel Gomez <da.gomez@samsung.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH RFT 1/6] Makefile: fix target dependency order
  2025-09-22 11:13 [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Daniel Gomez
@ 2025-09-22 11:13 ` Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 2/6] gen_hosts: add localhost to generic workflow template Daniel Gomez
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Gomez @ 2025-09-22 11:13 UTC (permalink / raw)
  To: Luis Chamberlain, Chuck Lever; +Cc: kdevops, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

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 <chuck.lever@oracle.com>
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFT 2/6] gen_hosts: add localhost to generic workflow template
  2025-09-22 11:13 [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 1/6] Makefile: fix target " Daniel Gomez
@ 2025-09-22 11:13 ` Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 3/6] ansible_cfg: fix Python interpreter discovery warning Daniel Gomez
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Gomez @ 2025-09-22 11:13 UTC (permalink / raw)
  To: Luis Chamberlain, Chuck Lever; +Cc: kdevops, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Add localhost ansible_connection=local to the generic workflow
template to match other workflow templates updated in commit 1cf0800c
("gen_hosts: templates: include localhost in the all group").

This ensures all inventory templates include localhost with proper
connection settings, allowing simplified ansible-playbook calls
without explicit connection flags.

Fixes: f4a4e347 ("gen_hosts: Add missing generic workflow template")

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 playbooks/roles/gen_hosts/templates/workflows/generic.j2 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/playbooks/roles/gen_hosts/templates/workflows/generic.j2 b/playbooks/roles/gen_hosts/templates/workflows/generic.j2
index c18ec9fc..20b2f389 100644
--- a/playbooks/roles/gen_hosts/templates/workflows/generic.j2
+++ b/playbooks/roles/gen_hosts/templates/workflows/generic.j2
@@ -6,6 +6,7 @@
 {% set nodes = [kdevops_host_prefix] %}
 {% endif %}
 [all]
+localhost ansible_connection=local
 {% for node in nodes %}
 {{ node }}
 {% endfor %}

-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFT 3/6] ansible_cfg: fix Python interpreter discovery warning
  2025-09-22 11:13 [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 1/6] Makefile: fix target " Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 2/6] gen_hosts: add localhost to generic workflow template Daniel Gomez
@ 2025-09-22 11:13 ` Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 4/6] Makefile: remove warnings from ANSIBLE_CFG_FILE target Daniel Gomez
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Gomez @ 2025-09-22 11:13 UTC (permalink / raw)
  To: Luis Chamberlain, Chuck Lever; +Cc: kdevops, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Add ansible_python_interpreter setting to suppress the Python
interpreter discovery warning during ansible.cfg generation.

Uses ansible_playbook_python variable to ensure consistency
with the Python interpreter running the playbook.

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 playbooks/ansible_cfg.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/playbooks/ansible_cfg.yml b/playbooks/ansible_cfg.yml
index 872f2ee4..a6c80227 100644
--- a/playbooks/ansible_cfg.yml
+++ b/playbooks/ansible_cfg.yml
@@ -1,5 +1,7 @@
 ---
 - name: Ansible Configuration Role
   hosts: localhost
+  vars:
+    ansible_python_interpreter: "{{ ansible_playbook_python }}"
   roles:
     - role: ansible_cfg

-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFT 4/6] Makefile: remove warnings from ANSIBLE_CFG_FILE target
  2025-09-22 11:13 [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Daniel Gomez
                   ` (2 preceding siblings ...)
  2025-09-22 11:13 ` [PATCH RFT 3/6] ansible_cfg: fix Python interpreter discovery warning Daniel Gomez
@ 2025-09-22 11:13 ` Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 5/6] Makefile: simplify KDEVOPS_NODES ansible-playbook call Daniel Gomez
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Gomez @ 2025-09-22 11:13 UTC (permalink / raw)
  To: Luis Chamberlain, Chuck Lever; +Cc: kdevops, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Remove ANSIBLE_LOCALHOST_WARNING and ANSIBLE_INVENTORY_UNPARSED_WARNING
from the ansible.cfg generation target since it uses explicit
--inventory localhost, and doesn't need the hosts file to exist yet.

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index fb7e9b81..5d855b6e 100644
--- a/Makefile
+++ b/Makefile
@@ -228,8 +228,7 @@ include scripts/gen-nodes.Makefile
 	false)
 
 $(ANSIBLE_CFG_FILE): .config
-	$(Q)ANSIBLE_LOCALHOST_WARNING=False ANSIBLE_INVENTORY_UNPARSED_WARNING=False \
-		ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
 		--inventory localhost, \
 		$(KDEVOPS_PLAYBOOKS_DIR)/ansible_cfg.yml \
 		--extra-vars=@./.extra_vars_auto.yaml

-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFT 5/6] Makefile: simplify KDEVOPS_NODES ansible-playbook call
  2025-09-22 11:13 [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Daniel Gomez
                   ` (3 preceding siblings ...)
  2025-09-22 11:13 ` [PATCH RFT 4/6] Makefile: remove warnings from ANSIBLE_CFG_FILE target Daniel Gomez
@ 2025-09-22 11:13 ` Daniel Gomez
  2025-09-22 11:13 ` [PATCH RFT 6/6] Makefile: add explicit connection for inventory generation Daniel Gomez
  2025-09-22 14:15 ` [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Chuck Lever
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Gomez @ 2025-09-22 11:13 UTC (permalink / raw)
  To: Luis Chamberlain, Chuck Lever; +Cc: kdevops, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Remove connection flags and warning suppressions from the KDEVOPS_NODES
target since all inventory templates now include localhost with proper
ansible_connection=local settings.

This allows the playbook to use the generated ansible.cfg and hosts
files automatically without explicit overrides.

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 5d855b6e..edf62db6 100644
--- a/Makefile
+++ b/Makefile
@@ -264,9 +264,7 @@ $(ANSIBLE_INVENTORY_FILE): .config $(ANSIBLE_CFG_FILE) $(KDEVOPS_HOSTS_TEMPLATE)
 		--extra-vars=@./extra_vars.yaml
 
 $(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 \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_nodes.yml \
 		--extra-vars=@./extra_vars.yaml
 

-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFT 6/6] Makefile: add explicit connection for inventory generation
  2025-09-22 11:13 [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Daniel Gomez
                   ` (4 preceding siblings ...)
  2025-09-22 11:13 ` [PATCH RFT 5/6] Makefile: simplify KDEVOPS_NODES ansible-playbook call Daniel Gomez
@ 2025-09-22 11:13 ` Daniel Gomez
  2025-09-22 14:15 ` [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Chuck Lever
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Gomez @ 2025-09-22 11:13 UTC (permalink / raw)
  To: Luis Chamberlain, Chuck Lever; +Cc: kdevops, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Add --connection=local and --inventory localhost, to the inventory
generation target since we're generating the hosts file and don't
have a proper inventory available yet.

This avoids inventory parsing warnings by being explicit about
the execution context, following the same pattern as ansible.cfg
generation.

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index edf62db6..90e8091d 100644
--- a/Makefile
+++ b/Makefile
@@ -258,8 +258,8 @@ include scripts/bringup.Makefile
 endif
 
 $(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) \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
+		--inventory localhost, \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_hosts.yml \
 		--extra-vars=@./extra_vars.yaml
 

-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order
  2025-09-22 11:13 [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Daniel Gomez
                   ` (5 preceding siblings ...)
  2025-09-22 11:13 ` [PATCH RFT 6/6] Makefile: add explicit connection for inventory generation Daniel Gomez
@ 2025-09-22 14:15 ` Chuck Lever
  2025-09-23 20:12   ` Daniel Gomez
  6 siblings, 1 reply; 9+ messages in thread
From: Chuck Lever @ 2025-09-22 14:15 UTC (permalink / raw)
  To: Daniel Gomez, Luis Chamberlain; +Cc: kdevops, Daniel Gomez

On 9/22/25 4:13 AM, Daniel Gomez wrote:
> This series fixes Ansible warnings that appear during terraform setup
> and simplifies ansible-playbook calls by establishing proper Makefile
> target dependency order.
> 
> Problem: Terraform targets were executing before ansible.cfg and hosts
> files existed, causing "No inventory was parsed" and "provided hosts
> list is empty" warnings.
> 
> Root cause: The include order in Makefile caused terraform dependencies
> to be added to DEFAULT_DEPS before core Ansible files.
> 
> Solution:
> 1. Establish correct dependency order: extra_vars.yaml → ansible.cfg →
> hosts → nodes → rest
> 2. Add missing localhost entry in the new generic inventory template
> (generic.j2)
> 3. Use explicit connection flags for bootstrap operations and remove
> warning suppressions. Note, this reintroduces the --connection and
> --inventory flags to the ansible.cfg and inventory targets. We only need
> these 2 here for obvious reasons. This allows to remove the warnings
> variables introduced after actually removing the flags. Being explicit
> with flags is preferred here than using ANSIBLE_* variables.
> 
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
> Daniel Gomez (6):
>       Makefile: fix target dependency order
>       gen_hosts: add localhost to generic workflow template
>       ansible_cfg: fix Python interpreter discovery warning
>       Makefile: remove warnings from ANSIBLE_CFG_FILE target
>       Makefile: simplify KDEVOPS_NODES ansible-playbook call
>       Makefile: add explicit connection for inventory generation
> 
>  Makefile                                           | 41 ++++++++++++----------
>  playbooks/ansible_cfg.yml                          |  2 ++
>  .../roles/gen_hosts/templates/workflows/generic.j2 |  1 +
>  3 files changed, 25 insertions(+), 19 deletions(-)
> ---
> base-commit: 53943da513f1cfc857844bf5f961c27a13d3060d
> change-id: 20250922-makefile-targets-order-d917a35f550a
> 
> Best regards,
> --  
> Daniel Gomez <da.gomez@samsung.com>
> 

I didn't look closely at the details, but this series makes a world
of sense.

Reviewed-by: Chuck Lever <chuck.lever@oracle.com>


-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order
  2025-09-22 14:15 ` [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Chuck Lever
@ 2025-09-23 20:12   ` Daniel Gomez
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Gomez @ 2025-09-23 20:12 UTC (permalink / raw)
  To: Chuck Lever, Luis Chamberlain; +Cc: kdevops, Daniel Gomez

On 22/09/2025 16.15, Chuck Lever wrote:
> On 9/22/25 4:13 AM, Daniel Gomez wrote:
> I didn't look closely at the details, but this series makes a world
> of sense.
> 
> Reviewed-by: Chuck Lever <chuck.lever@oracle.com>

Thanks! Applied and pushed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-09-23 20:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-22 11:13 [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Daniel Gomez
2025-09-22 11:13 ` [PATCH RFT 1/6] Makefile: fix target " Daniel Gomez
2025-09-22 11:13 ` [PATCH RFT 2/6] gen_hosts: add localhost to generic workflow template Daniel Gomez
2025-09-22 11:13 ` [PATCH RFT 3/6] ansible_cfg: fix Python interpreter discovery warning Daniel Gomez
2025-09-22 11:13 ` [PATCH RFT 4/6] Makefile: remove warnings from ANSIBLE_CFG_FILE target Daniel Gomez
2025-09-22 11:13 ` [PATCH RFT 5/6] Makefile: simplify KDEVOPS_NODES ansible-playbook call Daniel Gomez
2025-09-22 11:13 ` [PATCH RFT 6/6] Makefile: add explicit connection for inventory generation Daniel Gomez
2025-09-22 14:15 ` [PATCH RFT 0/6] Fix Ansible warnings and simplify build dependency order Chuck Lever
2025-09-23 20:12   ` Daniel Gomez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox