Marc Haber
unread,May 22, 2019, 11:55:48 AM5/22/19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
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