chore(ansible): dump newly discovered information

This commit is contained in:
Michele Cereda
2025-07-26 10:47:40 +02:00
parent d7aa9480c0
commit aabfb48e3a
6 changed files with 190 additions and 87 deletions

View File

@@ -25,6 +25,7 @@
var: install_method
- name: Print all available variables
tags: print_all
ansible.builtin.debug:
var: vars # magic variable
@@ -37,7 +38,9 @@
ansible.builtin.shell: printenv | sort
- name: Start the debugger on failure
tags: never
tags:
- never # avoid execution unless explicitly requested with other tags
- debugger
# print all variables at this point => p task_vars
# continue => c
# abort and quit => q

View File

@@ -319,3 +319,13 @@
this_is_true_again: "{{ not false }}"
true_is_truthy: "{{ true is truthy }}"
false_is_falsy: "{{ false is falsy }}"
- name: Undefined variables
tags: undefined_variable
# refer <https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating_undef.html>
# only works for variables of lesser priority
# e.g., works in tasks' `vars:`, but not in the `set_facts` module to (re)define a variable
vars:
test_var: "{{ undef() }}"
ansible.builtin.debug:
var: test_var

View File

@@ -8,11 +8,23 @@
connection: local
gather_facts: false
tasks:
- ansible.builtin.import_tasks: tasks/debug.yml
- ansible.builtin.import_tasks:
- name: Import tasks in-line
ansible.builtin.import_tasks: tasks/debug.yml
- name: Import tasks with arguments and set variables for them
vars:
somevar: some value
ansible.builtin.import_tasks:
file: tasks/control flows.yml
- ansible.builtin.include_tasks: tasks/manipulate data.yml
- ansible.builtin.include_tasks:
- name: Include tasks in-line
tags: always
ansible.builtin.include_tasks: tasks/manipulate data.yml
- name: Include tasks with arguments and set variables for them
tags: always
vars:
somevar: some value
ansible.builtin.include_tasks:
file: tasks/manipulate data.yml
apply:
tags: data_manipulation
vars:
someothervar: some other value