Hi,
here is my site.yml:
---
- name: apply common configuration
hosts: all
remote_user: zgansible
become: "yes"
tasks:
- name: get package facts
package_facts:
manager: "auto"
- import_role:
name: mlocate
when: ansible_facts.packages["mlocate"] is defined
That one doesn't work:
fatal: [emptysid86]: FAILED! => {"msg":
"The conditional check 'ansible_facts.packages[\"mlocate\"]
is defined' failed.
The error was: error while evaluating conditional
(ansible_facts.packages[\"mlocate\"] is defined):
'dict object' has no attribute 'packages'
The error appears to have been in
'/home/mh/git/zgdebansible/roles/mlocate/tasks/main.yml':
line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:- name:create symlinks for mlocate
^ here
"}
The alternative, writing the when clause into all tasks in the role,
clutters up the roles and makes them unportable. Also, I need to have
all my roles depend on package_facts, which for some weird reason causes
the package_facts role to be re-executed over and over and over again
which takes ages.
How would I make the ansible_facts.packages dictionary universally
availabe while only collecting the list of installed packages once?
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/20190522155539.GB3170%40torres.zugschlus.de.
For more options, visit https://groups.google.com/d/optout.