All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Gomez <da.gomez@kernel.org>
To: Luis Chamberlain <mcgrof@kernel.org>,
	Chuck Lever <cel@kernel.org>, Daniel Gomez <da.gomez@kruces.com>,
	kdevops@lists.linux.dev
Subject: Re: [PATCH v2 2/9] Makefile: suppress Ansible warnings during configuration generation
Date: Wed, 30 Jul 2025 08:22:38 +0200	[thread overview]
Message-ID: <2ecef063-ca92-48fc-9984-989306261dcb@kernel.org> (raw)
In-Reply-To: <20250730060147.182140-3-mcgrof@kernel.org>

On 30/07/2025 08.01, Luis Chamberlain wrote:
> The initial configuration generation playbooks (ansible_cfg.yml,
> gen_hosts.yml, and gen_nodes.yml) run without a proper inventory file
> by design, as they are responsible for creating the configuration files
> that will be used by subsequent playbooks.
> 
> This causes Ansible to emit warnings about:
> - "No inventory was parsed, only implicit localhost is available"
> - "provided hosts list is empty, only localhost is available"
> 
> These warnings are harmless but create noise in the build output,
> potentially confusing users who might think something is wrong.

Agree.

> 
> Add ANSIBLE_LOCALHOST_WARNING=False and ANSIBLE_INVENTORY_UNPARSED_WARNING=False
> environment variables to these three ansible-playbook invocations to
> suppress these specific warnings. This makes the build output cleaner
> while maintaining the same functionality.
> 
> The warnings were appearing because:
> 1. ansible_cfg.yml creates the ansible.cfg file
> 2. gen_hosts.yml creates the hosts inventory file
> 3. gen_nodes.yml creates the kdevops_nodes.yaml file
> 
> All three intentionally run with "--connection=local" and minimal
> inventory since they're bootstrapping the configuration that other
> playbooks will use.
> 
> Generated-by: Claude AI
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  Makefile | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 37c2522b..31f544e9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -195,7 +195,8 @@ include scripts/gen-nodes.Makefile
>  	false)
>  
>  $(ANSIBLE_CFG_FILE): .config
> -	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
> +	$(Q)ANSIBLE_LOCALHOST_WARNING=False ANSIBLE_INVENTORY_UNPARSED_WARNING=False \
> +		ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
>  		--inventory localhost, \
>  		$(KDEVOPS_PLAYBOOKS_DIR)/ansible_cfg.yml \
>  		--extra-vars=@./.extra_vars_auto.yaml
> @@ -226,13 +227,15 @@ endif
>  
>  DEFAULT_DEPS += $(ANSIBLE_INVENTORY_FILE)
>  $(ANSIBLE_INVENTORY_FILE): .config $(ANSIBLE_CFG_FILE) $(KDEVOPS_HOSTS_TEMPLATE)
> -	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
> +	$(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)
> -	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
> +	$(Q)ANSIBLE_LOCALHOST_WARNING=False ANSIBLE_INVENTORY_UNPARSED_WARNING=False \

I think at this point we have the inventory file with all guests/hosts
and the ansible.cfg. If that is correct I think we may not need to disable
ANSIBLE_INVENTORY_UNPARSED_WARNING and ANSIBLE_LOCALHOST_WARNING here. And 
we can probably remove --connection=local and --inventory localhost, arguments.

> +		ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
>  		--inventory localhost, \
>  		$(KDEVOPS_PLAYBOOKS_DIR)/gen_nodes.yml \
>  		--extra-vars=@./extra_vars.yaml

But in general it makes sense to enable these variables only for these specific
ansible-playbook invocations. I initially thought we could inject them into
the ansible.cfg and wrap ansible-playbook with the new environment, allowing
subsequent invocations to leverage that. But we don't want the rest of the
ansible-playbook runs to suppress these warnings, in case they do exist, as that
would hide errors.

Thanks!

Reviewed-by: Daniel Gomez <da.gomez@samsung.com>

  reply	other threads:[~2025-07-30  6:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30  6:01 [PATCH v2 0/9] kdevops: add support for A/B testing Luis Chamberlain
2025-07-30  6:01 ` [PATCH v2 1/9] roles/guestfs: add missing bootlinux_9p: False Luis Chamberlain
2025-07-30 14:17   ` Chuck Lever
2025-07-30  6:01 ` [PATCH v2 2/9] Makefile: suppress Ansible warnings during configuration generation Luis Chamberlain
2025-07-30  6:22   ` Daniel Gomez [this message]
2025-07-30  6:01 ` [PATCH v2 3/9] playbooks: few space cleanups Luis Chamberlain
2025-07-30  6:01 ` [PATCH v2 4/9] style: add extensive code formatting checks to make style Luis Chamberlain
2025-07-30  6:01 ` [PATCH v2 5/9] Makefile: move styling to scripts/style.Makefile Luis Chamberlain
2025-07-30  6:01 ` [PATCH v2 6/9] CLAUDE.md: add instrucitons to verify commit Luis Chamberlain
2025-07-30  6:01 ` [PATCH v2 7/9] all: run black Luis Chamberlain
2025-07-31 12:57   ` Daniel Gomez
2025-08-01  8:12     ` Daniel Gomez
2025-08-01 12:55       ` Chuck Lever
2025-08-01 16:29         ` Daniel Gomez
2025-08-01 16:55           ` Chuck Lever
2025-07-30  6:01 ` [PATCH v2 8/9] devconfig: add automatic APT mirror fallback for Debian testing Luis Chamberlain
2025-07-30  6:41   ` Daniel Gomez
2025-08-01 17:39     ` Luis Chamberlain
2025-07-30  6:01 ` [PATCH v2 9/9] bootlinux: add support for A/B kernel testing 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=2ecef063-ca92-48fc-9984-989306261dcb@kernel.org \
    --to=da.gomez@kernel.org \
    --cc=cel@kernel.org \
    --cc=da.gomez@kruces.com \
    --cc=kdevops@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.