On 27. juli 2017 19:41, Frank Thommen wrote:
> On 07/27/2017 07:25 PM, Kai Stian Olstad wrote:
>> On 27. juli 2017 18:42, Frank Thommen wrote:
>>> 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.
>
> Yes, that I know that, but I just don't understand, why
It looks nicer and that don't need the quotes perhaps?
> - name: install basic package
> action: {{ ansible_pkg_mgr }} name=vim state=present update_cache=yes
>
> or
>
> - name: install basic package
> action: "{{ ansible_pkg_mgr }}" name=vim state=present update_cache=yes
>
> Wouldn't work (both fail with YAML syntax error)
{ it's not allox after the colon and in yaml, if it start with a quote
it must end with the same qoute, so this should work.
- name: install basic package
action: "{{ ansible_pkg_mgr }} name=vim state=present pdate_cache=yes"
>>> 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
>
> Indeed they fail, and there doesn't seem to be a useable replacement in
> the current syntax. :-(
If you don't need the cache update a module exist, it's called packages.
--
Kai Stian Olstad