* [PATCH] ansible_cfg: template boolean defaults must be "False"
@ 2025-04-16 13:41 cel
[not found] ` <CABj0suARn7ycHyjiXQPEi7JLd4bGmapkndcz2f7pfZsekxtWzA@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: cel @ 2025-04-16 13:41 UTC (permalink / raw)
To: Daniel Gomez; +Cc: kdevops, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
I found that the "disable_skipped_hosts" Kconfig setting was not
working.
Using "output yaml" with a boolean behaves somewhat counter-
intuitively. When the user specifies "Yes, please set this", the
variable appears in .extra_vars_auto.yaml with a value of True.
When the user specifies "No, please do not set this" the variable
does not appear in .extra_vars_auto.yaml at all.
To make a template that uses these variables behave correctly, then,
the defaults/main.yml setting has to be False always. When the
Kconfig setting is enabled, that will override this default.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
playbooks/roles/ansible_cfg/defaults/main.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/playbooks/roles/ansible_cfg/defaults/main.yml b/playbooks/roles/ansible_cfg/defaults/main.yml
index e01de2f4481d..4ff00c18976d 100644
--- a/playbooks/roles/ansible_cfg/defaults/main.yml
+++ b/playbooks/roles/ansible_cfg/defaults/main.yml
@@ -1,12 +1,12 @@
---
-ansible_cfg_deprecation_warnings: true
+ansible_cfg_deprecation_warnings: false
ansible_cfg_callback_plugin_string: dense
ansible_cfg_callback_plugin_check_mode_markers: false
ansible_cfg_callback_plugin_display_failed_stderr: false
-ansible_cfg_callback_plugin_display_ok_hosts: true
-ansible_cfg_callback_plugin_display_skipped_hosts: true
+ansible_cfg_callback_plugin_display_ok_hosts: false
+ansible_cfg_callback_plugin_display_skipped_hosts: false
ansible_cfg_callback_plugin_show_custom_stats: false
-ansible_cfg_callback_plugin_show_per_host_start: true
-ansible_cfg_callback_plugin_show_task_path_on_failure: true
+ansible_cfg_callback_plugin_show_per_host_start: false
+ansible_cfg_callback_plugin_show_task_path_on_failure: false
ansible_cfg_interpreter_python: "auto_silent"
ansible_cfg_forks: 10
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ansible_cfg: template boolean defaults must be "False"
[not found] ` <CABj0suARn7ycHyjiXQPEi7JLd4bGmapkndcz2f7pfZsekxtWzA@mail.gmail.com>
@ 2025-04-16 16:22 ` Chuck Lever
0 siblings, 0 replies; 2+ messages in thread
From: Chuck Lever @ 2025-04-16 16:22 UTC (permalink / raw)
To: Daniel Gomez; +Cc: Daniel Gomez, kdevops, Chuck Lever
On 4/16/25 11:48 AM, Daniel Gomez wrote:
> On Wed, 16 Apr 2025 at 15.41, <cel@kernel.org <mailto:cel@kernel.org>>
> wrote:
>
> From: Chuck Lever <chuck.lever@oracle.com
> <mailto:chuck.lever@oracle.com>>
>
> I found that the "disable_skipped_hosts" Kconfig setting was not
> working.
>
> Using "output yaml" with a boolean behaves somewhat counter-
> intuitively. When the user specifies "Yes, please set this", the
> variable appears in .extra_vars_auto.yaml with a value of True.
> When the user specifies "No, please do not set this" the variable
> does not appear in .extra_vars_auto.yaml at all.
>
>
> This is a good catch. Does this issue affect other playbooks?
Whenever Kconfig passes a boolean setting via "output yaml", we might
have this issue. The "False" value has to be provided by a Makefile or a
defaults/main.yml setting.
My recent terraform patches removed the Ansible defaults except for the
booleans for this very reason (see
playbooks/roles/gen_tfvars/defaults/main.yml).
I haven't looked closely for it outside of terraform/ however. The
defaults/main.yml treatment is pervasive, so I just go with that flow
and make a mental adjustment ;-)
> To make a template that uses these variables behave correctly, then,
> the defaults/main.yml setting has to be False always. When the
> Kconfig setting is enabled, that will override this default.
>
>
> It seems counterintuitive too to default to False only to ensure it can
> be overwritten. Perhaps we could fix this in kconfig/yaml? If we can
> rely on kconfig defaults, we might even be able to remove playbook
> defaults as we talked recently (not only here but globally).
>
> What do you think?
I guess that is indeed an option, since the YAML output logic is only in
kdevops' version of Kconfig?
But I think this arises from Kconfig itself: For booleans, the setting
is written into .config as either "CONFIG_YADA=y" or "# CONFIG_YADA is
not set" probably because CONFIG_YADA can be checked via "#ifdef"; not
defined inherently means "false".
Yes, I agree it is something that is likely to trip up developers again,
and it makes sense that "output yaml" should always define the Ansible/
YAML version of the variable whether it is set to True or False.
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com
> <mailto:chuck.lever@oracle.com>>
> ---
> playbooks/roles/ansible_cfg/defaults/main.yml | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/playbooks/roles/ansible_cfg/defaults/main.yml b/
> playbooks/roles/ansible_cfg/defaults/main.yml
> index e01de2f4481d..4ff00c18976d 100644
> --- a/playbooks/roles/ansible_cfg/defaults/main.yml
> +++ b/playbooks/roles/ansible_cfg/defaults/main.yml
> @@ -1,12 +1,12 @@
> ---
> -ansible_cfg_deprecation_warnings: true
> +ansible_cfg_deprecation_warnings: false
> ansible_cfg_callback_plugin_string: dense
> ansible_cfg_callback_plugin_check_mode_markers: false
> ansible_cfg_callback_plugin_display_failed_stderr: false
> -ansible_cfg_callback_plugin_display_ok_hosts: true
> -ansible_cfg_callback_plugin_display_skipped_hosts: true
> +ansible_cfg_callback_plugin_display_ok_hosts: false
> +ansible_cfg_callback_plugin_display_skipped_hosts: false
> ansible_cfg_callback_plugin_show_custom_stats: false
> -ansible_cfg_callback_plugin_show_per_host_start: true
> -ansible_cfg_callback_plugin_show_task_path_on_failure: true
> +ansible_cfg_callback_plugin_show_per_host_start: false
> +ansible_cfg_callback_plugin_show_task_path_on_failure: false
> ansible_cfg_interpreter_python: "auto_silent"
> ansible_cfg_forks: 10
> --
> 2.49.0
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-16 16:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 13:41 [PATCH] ansible_cfg: template boolean defaults must be "False" cel
[not found] ` <CABj0suARn7ycHyjiXQPEi7JLd4bGmapkndcz2f7pfZsekxtWzA@mail.gmail.com>
2025-04-16 16:22 ` Chuck Lever
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox