* [PATCH 1/5] gen_nodes: remove vagrant tasks
2025-05-12 14:36 [PATCH 0/5] Ansible fixes in different roles Daniel Gomez
@ 2025-05-12 14:36 ` Daniel Gomez
2025-05-12 14:36 ` [PATCH 2/5] update_ssh_config_guestfs: fix broken conditionals Daniel Gomez
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-05-12 14:36 UTC (permalink / raw)
To: kdevops, Luis Chamberlain; +Cc: Daniel Gomez, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
If Vagrant is installed in a system, it will make gen_nodes fail.
Since we are done with the transition to guestfs and Vagrant is on it's
way out in kdevops, clean up the tasks related to Vagrant bringup in
gen_nodes playbook.
Fixes:
task 48. [started TASK: gen_nodes : Get the control host's timezone
on localhost]
task 48: gen_nodes : Get the control host's timezone
changed: localhost: {"changed": true, "cmd": ["timedatectl", "show",
"-p", "Timezone", "--value"], "rc": 0, "stdout": "Etc/UTC"}
[WARNING]: Encountered 1 template error.
error 1 - 'kdevops_vagrant_template_full_path' is undefined
Origin:
/scratch/dagomez/linux-kdevops/kdevops/playbooks/roles/gen_nodes/tasks/
main.yml:480:9
478 register: kdevops_host_timezone
479
480 - name: Verify vagrant template file exists
{{ kdevops_vagrant_template_full_path }}
^ column 9
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
playbooks/roles/gen_nodes/tasks/main.yml | 44 --------------------------------
1 file changed, 44 deletions(-)
diff --git a/playbooks/roles/gen_nodes/tasks/main.yml b/playbooks/roles/gen_nodes/tasks/main.yml
index 9ae4910a69e57d709d7f0bc1ff1cf10c5fb30888..86a86b10be396b74382b04aec956458ed8b7f0d9 100644
--- a/playbooks/roles/gen_nodes/tasks/main.yml
+++ b/playbooks/roles/gen_nodes/tasks/main.yml
@@ -477,50 +477,6 @@
ansible.builtin.command: "timedatectl show -p Timezone --value"
register: kdevops_host_timezone
-- name: Verify vagrant template file exists {{ kdevops_vagrant_template_full_path }}
- stat:
- path: "{{ kdevops_vagrant_template_full_path }}"
- register: vagrant_template
- when:
- - kdevops_enable_vagrant
-
-- name: Check if {{ kdevops_vagrant }} exists already
- stat:
- path: "{{ topdir_path }}/{{ kdevops_vagrant }}"
- register: vagrant_dest
- when:
- - kdevops_enable_vagrant
-
-- name: Ensure proper permission on {{ kdevops_vagrant }}
- become: yes
- become_flags: 'su - -c'
- become_method: sudo
- file:
- path: "{{ topdir_path }}/{{ kdevops_vagrant }}"
- owner: "{{ my_user.stdout }}"
- group: "{{ my_group.stdout }}"
- when:
- - kdevops_enable_vagrant|bool
- - vagrant_dest.stat.exists
-
-- name: Generate the {{ kdevops_vagrant_generated }} file using {{ kdevops_vagrant_template }} as jinja2 source template
- tags: [ 'vagrant' ]
- template:
- src: "{{ kdevops_vagrant_template | basename }}"
- dest: "{{ topdir_path }}/{{ kdevops_vagrant_generated }}"
- force: yes
- when:
- - kdevops_enable_vagrant|bool
- - vagrant_template.stat.exists
-
-- name: Copy the generated {{ kdevops_vagrant_generated }} to {{ kdevops_vagrant }} if it does not exist already
- tags: [ 'vagrant' ]
- command: "cp {{ topdir_path }}/{{ kdevops_vagrant_generated }} {{ topdir_path }}/{{ kdevops_vagrant }}"
- when:
- - kdevops_enable_vagrant|bool
- - vagrant_template.stat.exists
- - not vagrant_dest.stat.exists
-
- name: Verify if dedicated workflow defined a custom nodes template and the final file exists {{ kdevops_nodes_template_full_path }}
stat:
path: "{{ topdir_path }}/{{ kdevops_nodes }}"
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/5] update_ssh_config_guestfs: fix broken conditionals
2025-05-12 14:36 [PATCH 0/5] Ansible fixes in different roles Daniel Gomez
2025-05-12 14:36 ` [PATCH 1/5] gen_nodes: remove vagrant tasks Daniel Gomez
@ 2025-05-12 14:36 ` Daniel Gomez
2025-05-12 14:36 ` [PATCH 3/5] create_partition: fix using atribute append of list object Daniel Gomez
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-05-12 14:36 UTC (permalink / raw)
To: kdevops, Luis Chamberlain; +Cc: Daniel Gomez, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
Fixes error:
if [[ "y" == "y" ]]; then \
ansible-playbook -v --connection=local \
--inventory localhost, \
playbooks/update_ssh_config_guestfs.yml \
--extra-vars=@./extra_vars.yaml; \
LIBVIRT_DEFAULT_URI="qemu:///system" \
.//scripts/update_ssh_config_guestfs.py; \
fi
Using /scratch/dagomez/linux-kdevops/kdevops/ansible.cfg as config file
PLAY 1: LOCALHOST
task 1. [started TASK: Gathering Facts on localhost]
task 2. [started TASK: update_ssh_config_guestfs : Check if the ssh
config file exists on localhost]
task 3. [started TASK: update_ssh_config_guestfs : Check if the kdevops
include directive was used on localhost]
task 4. [started TASK: update_ssh_config_guestfs : Check if the new
include directive was used with a kdevops_version comment on localhost]
task 5.[ERROR]: Conditional result was '1' of type 'int', which
evaluates to True. Conditionals must have a boolean result.
Origin:
/scratch/dagomez/linux-kdevops/kdevops/playbooks/roles/update_ssh_config
_guestfs/tasks/main.yml:34:7
32 when:
33 - ssh_config.stat.exists
34 - kdevops_ssh_include.found
^ column 7
Broken conditionals can be temporarily allowed with the
`ALLOW_BROKEN_CONDITIONALS` configuration option
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
playbooks/roles/update_ssh_config_guestfs/tasks/main.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml b/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
index 0e728d9a84996dce592465c6f2fa2d16b62ae963..6c6c49034d8a0313cda5fd5ca673093f1a8054cf 100644
--- a/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
+++ b/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
@@ -31,8 +31,8 @@
meta: end_play
when:
- ssh_config.stat.exists
- - kdevops_ssh_include.found
- - fixed_ssh_entry.found
+ - kdevops_ssh_include.found | bool
+ - fixed_ssh_entry.found | bool
# If we're still running it means the correct include directive following a new
# line was not found. So remove old stale include directives which may be
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/5] create_partition: fix using atribute append of list object
2025-05-12 14:36 [PATCH 0/5] Ansible fixes in different roles Daniel Gomez
2025-05-12 14:36 ` [PATCH 1/5] gen_nodes: remove vagrant tasks Daniel Gomez
2025-05-12 14:36 ` [PATCH 2/5] update_ssh_config_guestfs: fix broken conditionals Daniel Gomez
@ 2025-05-12 14:36 ` Daniel Gomez
2025-05-12 14:36 ` [PATCH 4/5] gen_hosts: blktests: fix hosts names generation Daniel Gomez
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-05-12 14:36 UTC (permalink / raw)
To: kdevops, Luis Chamberlain; +Cc: Daniel Gomez, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
TASK [create_partition : Partitions | Collect
partition information onto part_mounts]
task path:
/scratch/dagomez/linux-kdevops/kdevops/playbooks/roles/create_partition/
tasks/main.yml:93
[ERROR]: Task failed: Finalization of task args for
'ansible.builtin.set_fact' failed: Error while resolving value for
'part_mounts': access to attribute 'append' of 'list' object is unsafe.
Task failed.
Origin:
/scratch/dagomez/linux-kdevops/kdevops/playbooks/roles/create_partition/
tasks/main.yml:93:3
91 tags: [ 'partition' ]
92
93 - name: Partitions | Collect partition information onto part_mounts
^ column 3
<<< caused by >>>
Finalization of task args for 'ansible.builtin.set_fact' failed.
Origin:
/scratch/dagomez/linux-kdevops/kdevops/playbooks/roles/create_partition/
tasks/main.yml:94:3
92
93 - name: Partitions | Collect partition information onto part_mounts
94 set_fact:
^ column 3
<<< caused by >>>
Error while resolving value for 'part_mounts': access to attribute
'append' of 'list' object is unsafe.
Origin:
/scratch/dagomez/linux-kdevops/kdevops/playbooks/roles/create_partition/
tasks/main.yml:95:18
93 - name: Partitions | Collect partition information onto part_mounts
94 set_fact:
95 part_mounts: |
^ column 18
fatal: [debian13-btrfs-simple]: FAILED! => {
"changed": false,
"msg": "Task failed: Finalization of task args for
'ansible.builtin.set_fact' failed: Error while resolving value for
'part_mounts': access to attribute 'append' of 'list' object is unsafe."
}
PLAY RECAP
debian13-btrfs-simple : ok=23 changed=2 unreachable=0
failed=1 skipped=20 rescued=0 ignored=0
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
playbooks/roles/create_partition/tasks/main.yml | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/playbooks/roles/create_partition/tasks/main.yml b/playbooks/roles/create_partition/tasks/main.yml
index 014ed5ac3b554d450b68bcc40f095f07517fc205..8e72263c50c68784e1421dd0dc780f4b6a09d6a3 100644
--- a/playbooks/roles/create_partition/tasks/main.yml
+++ b/playbooks/roles/create_partition/tasks/main.yml
@@ -92,12 +92,7 @@
- name: Partitions | Collect partition information onto part_mounts
set_fact:
- part_mounts: |
- {%- set x = [] -%}
- {%- for line in result.stdout_lines -%}
- {{ x.append(line.split()) }}
- {%- endfor -%}
- {{ x }}
+ part_mounts: "{{ result.stdout_lines | map('split') | list }}"
when: >
result is success and
result.stdout_lines is defined
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/5] gen_hosts: blktests: fix hosts names generation
2025-05-12 14:36 [PATCH 0/5] Ansible fixes in different roles Daniel Gomez
` (2 preceding siblings ...)
2025-05-12 14:36 ` [PATCH 3/5] create_partition: fix using atribute append of list object Daniel Gomez
@ 2025-05-12 14:36 ` Daniel Gomez
2025-05-12 14:36 ` [PATCH 5/5] gen_nodes: " Daniel Gomez
2025-05-14 18:32 ` [PATCH 0/5] Ansible fixes in different roles Luis Chamberlain
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-05-12 14:36 UTC (permalink / raw)
To: kdevops, Luis Chamberlain; +Cc: Daniel Gomez, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
The user of vars in set_fact tasks makes blktests_enabled_test_type to
expand to a list of chars instead of a list of strings, resulting in a
wrong hosts file generation with every char of a blktests enabled
section (BLKTESTS_SECTION_) a different host.
Pipe the variable generation into a block without using intermediate
variables that generates a list of strings.
Before:
[all]
dgc-[
dgc-'
dgc-b
dgc-l
dgc-o
dgc-c
dgc-k
dgc-'
dgc-,
dgc-
dgc-'
dgc-l
dgc-o
dgc-o
dgc-p
dgc-'
dgc-,
dgc-
dgc-'
dgc-n
dgc-b
dgc-d
dgc-'
{..}
After:
[all]
dgc-block
dgc-loop
{..}
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
playbooks/roles/gen_hosts/tasks/main.yml | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/playbooks/roles/gen_hosts/tasks/main.yml b/playbooks/roles/gen_hosts/tasks/main.yml
index a50355f721606a7da961b54ec29b16875391eca9..aeec3e934c19ab0f16a21bea76956e4c9e937985 100644
--- a/playbooks/roles/gen_hosts/tasks/main.yml
+++ b/playbooks/roles/gen_hosts/tasks/main.yml
@@ -203,13 +203,14 @@
- ansible_hosts_template.stat.exists
- name: Infer enabled blktests test section types
- vars:
- kdevops_config_data: "{{ lookup('file', topdir_path + '/.config') }}"
- config_val: "CONFIG_BLKTESTS_SECTION_"
- config_block_test_types: "{{ kdevops_config_data | regex_findall('^' + config_val + '(.*)=y$', multiline=True) }}"
- config_block_test_type_names: "{{ config_block_test_types | lower }}"
set_fact:
- blktests_enabled_test_types: "{{ config_block_test_type_names }}"
+ blktests_enabled_test_types: >-
+ {{
+ lookup('file', topdir_path + '/.config')
+ | regex_findall('^CONFIG_BLKTESTS_SECTION_(.*)=y$', multiline=True)
+ | map('lower')
+ | list
+ }}
when:
- kdevops_workflows_dedicated_workflow
- kdevops_workflow_enable_blktests
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/5] gen_nodes: blktests: fix hosts names generation
2025-05-12 14:36 [PATCH 0/5] Ansible fixes in different roles Daniel Gomez
` (3 preceding siblings ...)
2025-05-12 14:36 ` [PATCH 4/5] gen_hosts: blktests: fix hosts names generation Daniel Gomez
@ 2025-05-12 14:36 ` Daniel Gomez
2025-05-14 18:32 ` [PATCH 0/5] Ansible fixes in different roles Luis Chamberlain
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-05-12 14:36 UTC (permalink / raw)
To: kdevops, Luis Chamberlain; +Cc: Daniel Gomez, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
The user of vars in set_fact tasks makes blktests_enabled_test_type to
expand to a list of chars instead of a list of strings, resulting in a
wrong guestfs/<guest_name> folder generation with every char of a
blktests enabled section (BLKTESTS_SECTION_) a different host.
Pipe the variable generation into a block without using intermediate
variables that generates a list of strings.
Before:
ls guestfs/
bc720facc421- 'bc720facc421-[' bc720facc421-c bc720facc421-i
bc720facc421-m bc720facc421-p bc720facc421-v
"bc720facc421-'" bc720facc421-] bc720facc421-d bc720facc421-k
bc720facc421-n bc720facc421-r bc720facc421-z
bc720facc421-, bc720facc421-b bc720facc421-e bc720facc421-l
bc720facc421-o bc720facc421-s kdevops_nodes.yaml
After:
ls guestfs/
bc720facc421-block bc720facc421-loop bc720facc421-nbd
bc720facc421-nvme bc720facc421-scsi bc720facc421-srp bc720facc421-zbd
kdevops_nodes.yaml
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
playbooks/roles/gen_nodes/tasks/main.yml | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/playbooks/roles/gen_nodes/tasks/main.yml b/playbooks/roles/gen_nodes/tasks/main.yml
index 86a86b10be396b74382b04aec956458ed8b7f0d9..db1c902b804c4e848658b4fa2f50097b790a9573 100644
--- a/playbooks/roles/gen_nodes/tasks/main.yml
+++ b/playbooks/roles/gen_nodes/tasks/main.yml
@@ -305,13 +305,20 @@
- ansible_nodes_template.stat.exists
- name: Infer enabled blktests test section types
- vars:
- kdevops_config_data: "{{ lookup('file', topdir_path + '/.config') }}"
- config_val: "CONFIG_BLKTESTS_SECTION_"
- config_block_test_types: "{{ kdevops_config_data | regex_findall('^' + config_val + '(.*)=y$', multiline=True) }}"
- config_block_test_type_names: "{{ config_block_test_types | lower }}"
set_fact:
- blktests_enabled_test_types: "{{ [kdevops_host_prefix + '-'] | product(config_block_test_type_names) | map('join') | list }}"
+ blktests_enabled_test_types: >-
+ {{
+ [kdevops_host_prefix + '-']
+ | product(
+ lookup('file', topdir_path + '/.config')
+ | regex_findall('^CONFIG_BLKTESTS_SECTION_(.*)=y$', multiline=True)
+ | map('lower')
+ | list
+ )
+ | map('join')
+ | list
+ }}
+
when:
- kdevops_workflows_dedicated_workflow
- kdevops_workflow_enable_blktests
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/5] Ansible fixes in different roles
2025-05-12 14:36 [PATCH 0/5] Ansible fixes in different roles Daniel Gomez
` (4 preceding siblings ...)
2025-05-12 14:36 ` [PATCH 5/5] gen_nodes: " Daniel Gomez
@ 2025-05-14 18:32 ` Luis Chamberlain
5 siblings, 0 replies; 7+ messages in thread
From: Luis Chamberlain @ 2025-05-14 18:32 UTC (permalink / raw)
To: Daniel Gomez; +Cc: kdevops, Daniel Gomez
On Mon, May 12, 2025 at 04:36:11PM +0200, Daniel Gomez wrote:
> I run into all these issues when adding blktests CI support in the
> following Debian testing machine:
>
> ansible --version
> ansible [core 2.19.0b2]
> config file = None
> configured module search path =
> ['/home/dagomez/.ansible/plugins/modules',
> '/usr/share/ansible/plugins/modules']
> ansible python module location = /usr/lib/python3/dist-packages/ansible
> ansible collection location =
> /home/dagomez/.ansible/collections:/usr/share/ansible/collections
> executable location = /usr/bin/ansible
> python version = 3.13.3 (main, Apr 10 2025, 21:38:51) [GCC 14.2.0]
> (/usr/bin/python3)
> jinja version = 3.1.6
> pyyaml version = 6.0.2 (with libyaml v0.2.5)
>
> sudo dpkg -l ansible*
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-
> pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name Version Architecture Description
> +++-==============-================-============-==============
> ii ansible 12.0.0~a2+dfsg-1 all Configuration
> management, deployment,
> and task execution
> system
> ii ansible-core 2.19.0~beta2-1 all Configuration
> management, deployment,
> and task execution
> system
> uname -r
> 6.12.25-amd64
>
> lsb_release -a
> No LSB modules are available.
> Distributor ID: Debian
> Description: Debian GNU/Linux trixie/sid
> Release: n/a
> Codename: trixie
>
> Last 2 patches may also be needed in other workflows. I'll keep an eye
> and send fixes if needed.
>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
^ permalink raw reply [flat|nested] 7+ messages in thread