Thanks Tom! I didn't realise it was already possible! So I can also use Jinja functions in a playbook to include/exclude some parameters based on facts?
On Monday, 2 February 2015, 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] > <javascript:_e(%7B%7D,'cvml','[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] >> <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');> >> . >> To post to this group, send email to [email protected] >> <javascript:_e(%7B%7D,'cvml','[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] > <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[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/CANbPJF%3Dt1LfT26dsGs%3DfPPdzUBF-SPGXEHnNbPtv%3D4YXV6xvzw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
