public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Daniel Gomez <da.gomez@kernel.org>, Luis Chamberlain <mcgrof@kernel.org>
Cc: kdevops@lists.linux.dev, Daniel Gomez <da.gomez@samsung.com>
Subject: Re: [PATCH 6/8] ansible_cfg: add inventory support
Date: Thu, 1 May 2025 15:41:19 -0400	[thread overview]
Message-ID: <18ff2639-4ab0-426d-bcef-635a357e429a@oracle.com> (raw)
In-Reply-To: <20250501-ansible_cfg_inventory-v1-6-c568bbaa3502@samsung.com>

On 5/1/25 2:35 PM, Daniel Gomez wrote:
> From: Daniel Gomez <da.gomez@samsung.com>
> 
> Allow to configure the inventory file (currently via KDEVOPS_HOSTFILE
> and KDEVOPS_HOSTS) via ansible.cfg.
> 
> The Ansible inventory file [1][2][3] is used in all kdevops/Makefile
> ansible-playbook calls. Enable this configuration to the global Ansible
> configuration file (ansible.cfg) and allow to define the inventory via
> Kconfig. This will simplify the playbook invocation.
> 
> [1]
> https://docs.ansible.com/ansible/latest/reference_appendices/
> config.html#default-host-list
> 
> [2]
> https://docs.ansible.com/ansible/latest/cli/
> ansible-inventory.html#cmdoption-ansible-inventory-i
> 
> [3]
> https://docs.ansible.com/ansible/latest/reference_appendices/
> config.html#envvar-ANSIBLE_INVENTORY
> 
> This has not effects yet as all ansible-playbook calls specify the
> --inventory/-i argument. The next commits will cleanup and allow the
> inventory defined in ansible.cfg to actually work.
> 
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
>  kconfigs/Kconfig.ansible_cfg                         | 5 +++++
>  kconfigs/Kconfig.ansible_provisioning                | 6 ------
>  playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 | 1 +
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/kconfigs/Kconfig.ansible_cfg b/kconfigs/Kconfig.ansible_cfg
> index b587596bc8d5f1215fa8c006f32d941bea5288cc..05587cf31098cc5ca816d5b5fbbcdc9e8794e641 100644
> --- a/kconfigs/Kconfig.ansible_cfg
> +++ b/kconfigs/Kconfig.ansible_cfg
> @@ -207,6 +207,11 @@ config ANSIBLE_CFG_FORKS
>  
>  endif # !ANSIBLE_CFG_FORKS_CUSTOM
>  
> +config ANSIBLE_CFG_INVENTORY
> +	string "Ansible Inventory"

Perhaps "Pathname to Ansible hosts inventory file" might be more clear.


> +	output yaml
> +	default "$(TOPDIR_PATH)/hosts"

I've never had need to adjust this pathname. It would be great to
include a help section here that explains why changing this pathname
might be necessary.


> +
>  if DISTRO_OPENSUSE
>  
>  config ANSIBLE_CFG_RECONNECTION_RETRIES
> diff --git a/kconfigs/Kconfig.ansible_provisioning b/kconfigs/Kconfig.ansible_provisioning
> index 63f04306e7b26f228defa9e50630f5ed07eaac37..4416d06754df3a9645fef15173e83e2279cfce1a 100644
> --- a/kconfigs/Kconfig.ansible_provisioning
> +++ b/kconfigs/Kconfig.ansible_provisioning
> @@ -98,12 +98,6 @@ config KDEVOPS_DEVCONFIG_SYSTEMD_WATCHDOG_TIMEOUT_KEXEC
>  
>  endif # KDEVOPS_DEVCONFIG_ENABLE_SYSTEMD_WATCHDOG
>  
> -config KDEVOPS_ANSIBLE_INVENTORY_FILE
> -	string "The ansible inventory file to use"
> -	default $(shell, scripts/append-makefile-vars.sh $(KDEVOPS_HOSTFILE))
> -	help
> -	  The file to use for the ansible inventory.
> -
>  config HAVE_DISTRO_PREFERS_ANSIBLE_PYTHON2
>  	bool
>  	default n
> diff --git a/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 b/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2
> index 2bc916321f424ab93447af40eccef30911d27bb6..fddbab6d3a4dc03524a819b5b695336445ecb732 100644
> --- a/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2
> +++ b/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2
> @@ -10,6 +10,7 @@ show_per_host_start = {{ ansible_cfg_callback_plugin_show_per_host_start }}
>  show_task_path_on_failure = {{ ansible_cfg_callback_plugin_show_task_path_on_failure }}
>  interpreter_python = {{ ansible_cfg_interpreter_python_string }}
>  forks = {{ ansible_cfg_forks }}
> +inventory = {{ ansible_cfg_inventory }}
>  {% if ansible_facts['distribution'] == 'openSUSE' %}
>  [connection]
>  retries = {{ ansible_cfg_reconnection_retries }}
> 


-- 
Chuck Lever

  reply	other threads:[~2025-05-01 19:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-01 18:35 [PATCH 0/8] Define Ansible inventory in the Ansible Configuration file Daniel Gomez
2025-05-01 18:35 ` [PATCH 1/8] playbooks: fix playbook name for all hosts plays Daniel Gomez
2025-05-01 18:35 ` [PATCH 2/8] playbooks: fix playbook name for localhost plays Daniel Gomez
2025-05-01 18:35 ` [PATCH 3/8] Makefile: use long form of limit argument for clarity Daniel Gomez
2025-05-01 18:35 ` [PATCH 4/8] Makefile: print target when debug Daniel Gomez
2025-05-01 18:35 ` [PATCH 5/8] .github/workflows/fstests.yml: enable make verbosity Daniel Gomez
2025-05-01 18:35 ` [PATCH 6/8] ansible_cfg: add inventory support Daniel Gomez
2025-05-01 19:41   ` Chuck Lever [this message]
2025-05-01 20:22     ` Daniel Gomez
2025-05-01 20:40       ` Chuck Lever
2025-05-01 21:50         ` Daniel Gomez
2025-05-01 18:35 ` [PATCH 7/8] gen_hosts: templates: add localhost to all hosts Daniel Gomez
2025-05-01 18:35 ` [PATCH 8/8] Makefile: use inventory from ansible.cfg Daniel Gomez
2025-05-02 16:34 ` [PATCH 0/8] Define Ansible inventory in the Ansible Configuration file Luis Chamberlain
2025-05-02 19:27   ` Daniel Gomez
2025-05-02 22:43     ` Luis Chamberlain
2025-05-02 22:45       ` Luis Chamberlain
2025-05-03 18:52         ` Daniel Gomez
2025-05-03 18:17       ` Daniel Gomez
2025-05-03 18:58         ` 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=18ff2639-4ab0-426d-bcef-635a357e429a@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=da.gomez@kernel.org \
    --cc=da.gomez@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox