Hi Tom,
I just tried the syntax you suggested.
My very simple playbook is:
- hosts: myhost
tasks:
- name: install packages
yum:
name:
- screen
- tmux
state: installed
However, when I run this, I get an errors:
SUDO-SUCCESS-ziubbkxxzglhrtsmdmekoixffubflanc
Traceback (most recent call last):
File "/tmp/ansible-tmp-1422870182.84-7050423984136/yum", line 2402, in
<module>
main()
File "/tmp/ansible-tmp-1422870182.84-7050423984136/yum", line 832, in main
disablerepo, disable_gpg_check)
File "/tmp/ansible-tmp-1422870182.84-7050423984136/yum", line 717, in
ensure
items = pkgspec.split(',')
AttributeError: 'list' object has no attribute 'split'
Are you certain that plain YAML syntax works for modules?
On 2 February 2015 at 01:24, Tom Bamford <[email protected]> wrote:
> Hi Anand
>
> You actually can (and I prefer to) write your playbooks with that kind of
> plain YAML syntax. e.g.
>
> - hosts: localhost
> tasks:
> - name: blah
> yum:
> name:
> - mypackage
> - otherpackage
> state: present
> - name: blurh
> copy:
> src: myfile
> dest: /tmp/myfile
> mode: 0640
> owner: me
>
> It gets more interesting with the shell and command modules
>
> - hosts: localhost
> tasks:
> - name: run this
> shell: mycommand
> args:
> creates: /tmp/artefact
> chdir: /path/to/dir
> executable: /bin/bash
>
> On 2 February 2015 at 02:15, Anand Buddhdev <[email protected]> wrote:
>
> Hi Ansible developers,
>>
>> I've been wondering about something. Ansible's syntax for module
>> arguments is key=value parameters, all on a single line. This then needs to
>> be parsed, and the key=value elements properly separated.
>>
>> Wouldn't it be much nicer if the module parameters were also just written
>> in YAML syntax? For example:
>>
>> - hosts: all
>> tasks:
>> - name: blah
>> yum:
>> - name: package
>> - state: installed
>>
>> And it might even be an idea to pass the playbook through Jinja first,
>> allowing things like:
>>
>> - name: blah
>> yum:
>> {% for pkg in packages %}
>> - name: "{{ pkg }}"
>> - state: installed
>> {% endfor %}
>>
>> We would not need the "when:" conditional, or the shlex module to split
>> key=value pairs. This would allow taking full advantage of Jinja's
>> templating features.
>>
>> Could this be an idea for Ansible 2.0?
>>
>> Regards,
>> Anand
>>
>> --
>> 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/34adf7d7-5d32-459d-a3a3-8fe02d049271%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/34adf7d7-5d32-459d-a3a3-8fe02d049271%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/dGJRlrohfmY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAAnNz0NnD0x08r0ODROxGEf8sQtFFKKe2ACVux6EXysgvC7uzQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAAnNz0NnD0x08r0ODROxGEf8sQtFFKKe2ACVux6EXysgvC7uzQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CANbPJFmvAxuLXhJt7DDK9FZz5D7bEuKC0X5FcTrTWwoRGVhj0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.