Debugging templates

34 views
Skip to first unread message

Matt Clarkson

unread,
Jul 24, 2014, 2:46:01 AM7/24/14
to ansible...@googlegroups.com
Hi,

I'm looking for a way to quickly render/debug template files populated with variables from ec2.

My strategy is to write a playbook that discovers that facts then runs the template module locally.

Here is my current playbook:

---

- name: Gather ec2 facts

  hosts: all

  tasks:

   local_action: ec2_facts

- name: atemplate

  hosts: localhost

  tasks:

    action: template src=~/templates/raw/mako_PROD.properties.j2 dest=~/templates/out


The playbook runs completely but the atemplate command is never run.  Here's the output (my localhost is part of ec2 inventory):

PLAY [Gather ec2 facts] ******************************************************* 


GATHERING FACTS *************************************************************** 

<REDACTED: lots of ec2hosts>>

ok: [localhost]


PLAY [atemplate] ************************************************************** 


GATHERING FACTS *************************************************************** 

ok: [localhost]


PLAY RECAP ******************************************************************** 

<REDACTED: lots of ec2hosts>>

localhost                  : ok=2    changed=0    unreachable=0    failed=0   


Can I get some tips on what's wrong?  Or if there's a better way to achieve my objective would like to hear that too.... Thanks!

MTC

Michael DeHaan

unread,
Jul 24, 2014, 7:06:06 AM7/24/14
to ansible...@googlegroups.com
Your playbook appears to be manually typed in as I would expect to see tasks starting with a "-".

Can you please be sure to copy/paste the actual playbook.

I say this because even the first task is not correctly formatted, otherwise I would suggest this error with respect to the second, and also know we have error detection to make sure "tasks" is a list and suggest changes appropriately.




--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4a7a14ef-3ca1-49c7-bcb1-6c9a424f8a69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt Clarkson

unread,
Jul 24, 2014, 11:34:22 PM7/24/14
to ansible...@googlegroups.com
Hi Michael,

Thanks for your response.   The config in my original email was as it was in my playbook.   That being said, your hint to add list item delimiters in front of my tasks did the trick.  I am now able to run the tasks.  Thanks for that.

MTC
Reply all
Reply to author
Forward
0 new messages