On 27. juli 2017 18:42, Frank Thommen wrote:
Hi,
I was looking for a way to run the distro-dependent package manager w/o
too many "when"s and I found this (on
https://ansible-tips-and-tricks.readthedocs.io/en/latest/os-dependent-tasks/installing_packages/#installing-packages):
- name: install basic package
action: >
{{ ansible_pkg_mgr }} name=vim state=present update_cache=yes
However I cannot find this "action" module mentioned anywhere in the
whole Ansible documentation
https://docs.ansible.com/ansible/latest/playbooks_intro.html#tasks-list
https://docs.ansible.com/ansible/latest/playbooks_intro.html#action-shorthand
In short, it's an old syntax not encourage used anymore.
and I also don't understand, why the ">" is
needed at that point.
It's an yaml indicator character, ">" indicate that the lines can be
broken to multiple lines.
Is this an obsolete feature or a very new one,
which is not documented yet? What exactly can one do with it?
I think you need to use action if the module name is a variable as in
you example.
I think these two examples would fail.
- name: install basic package
{{ ansible_pkg_mgr }}: name=vim state=present update_cache=yes
and
- name: install basic package
{{ ansible_pkg_mgr }}:
name: vim
state: present
update_cache: yes
--
Kai Stian Olstad
--
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/c76f1871-4999-00fe-0fd0-2779e56a4c91%40olstad.com.
For more options, visit https://groups.google.com/d/optout.