I want to include a defaults, or variable file in the /defaults/main.yml of a
role I am playing
Upon execution I am getting "the defaults/main.yml file for role
'postgres_disable' must contain a dictionary of variables"
====== DETAILED ERROR
============================================================
ansible-playbook [core 2.12.2]
config file =
/home/gwagner/repos/ansible/open_source/postgres_upgrade/ansible.cfg
configured module search path = ['/home/gwagner/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location =
/home/gwagner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.8.12 (default, Sep 16 2021, 10:46:05) [GCC 8.5.0 20210514
(Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True
Using /home/gwagner/repos/ansible/open_source/postgres_upgrade/ansible.cfg as
config file
host_list declined parsing /etc/ansible/hosts as it did not pass its
verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file()
method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file()
method
Parsed /etc/ansible/hosts inventory source with ini plugin
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
ERROR! The defaults/main.yml file for role 'postgres_disable' must contain a
dictionary of variables
==================================================================================
I tried all 3 variants of addressing the file in the TASK below seprately. Each
of them throws the same error
===== my TASK
====================================================================
- name: include defaults file
ansible.builtin.include_vars:
file: "{{ item }}"
loop:
- ../vars/pg_disable_defaults.yml
-
/home/gwagner/repos/ansible/open_source/postgres_upgrade/roles/postgres_disable/vars/pg_disable_defaults.yml
- pg_disable_defaults.yml
==================================================================================
===== my FOLDER STRUCTURE
========================================================
roles/postgres_disable/
├── defaults
│ └── main.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── README.md
├── tasks
│ ├── main.yml
│ └── postgres_disable.yml
├── tests
│ ├── inventory
│ └── test.yml
└── vars
├── main.yml
└── pg_disable_defaults.yml
==================================================================================
the pg_disable_defaults.yml works as soon I move it to ~/defaults/main.yml, so
the file itself does not appear to be the source of bad here.
Seems I am fundamentally getting something wrong here ... what is it?
Maybe the idea of a starting point in 'role_name/defaults/main.yml'?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/1271492684.42080.1659717388175%40office.mailbox.org.