# stumped by Ansible/python/pyrax...

**URL:** <https://forum.ansible.com/t/stumped-by-ansible-python-pyrax/14395>\
**Category:** Ansible Project\
**Created:** [January 21, 2014, 8:45pm UTC](https://forum.ansible.com/t/stumped-by-ansible-python-pyrax/14395 "2014-01-21T20:45:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Buddy\_D](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@Buddy\_D](https://forum.ansible.com/u/Buddy_D)\
**Post date:** [January 21, 2014, 8:45pm UTC](https://forum.ansible.com/t/stumped-by-ansible-python-pyrax/14395/1 "2014-01-21T20:45:04Z")

</div>

Hi all,

Working to convert bash scripts to Ansible, I’ve been wrestling with the following ( and having no luck ). It runs perfectly from a shell CLI so the problem appears to be my Ansible syntax.Specifically, the f.write line with the filename in ()'s is being flagged by Ansible as a syntax issue, plesase see below

---

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [January 22, 2014, 1:29am UTC](https://forum.ansible.com/t/stumped-by-ansible-python-pyrax/14395/2 "2014-01-22T01:29:19Z")

</div>

Write the python out into a script file, then use the script: module to transfer it out and execute it. Far easier than trying to quote it all in yaml/jinja.

-jlk

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 22, 2014, 2:36am UTC](https://forum.ansible.com/t/stumped-by-ansible-python-pyrax/14395/3 "2014-01-22T02:36:56Z")

</div>

Also, note that we have pull requests in to add Rackspace cloud files support which will likely be seen in the 1.5 release:

[https://github.com/ansible/ansible/pull/5496](https://github.com/ansible/ansible/pull/5496)  
[https://github.com/ansible/ansible/pull/5540](https://github.com/ansible/ansible/pull/5540)

You could always start using the rax\_files\_objects file from 5496 now to get the functionality you are looking for.

---

<div class="post-metadata">

**Author:** ![Buddy\_D](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@Buddy\_D](https://forum.ansible.com/u/Buddy_D)\
**Post date:** [January 22, 2014, 2:35pm UTC](https://forum.ansible.com/t/stumped-by-ansible-python-pyrax/14395/4 "2014-01-22T14:35:21Z")

</div>

Thanks Jesse!! That crossed my mind but I wanted to see if I was unaware of some additional Ansible functionality. But the script method seems the way to go.

Much appreciated!

---

<div class="post-metadata">

**Author:** ![Buddy\_D](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@Buddy\_D](https://forum.ansible.com/u/Buddy_D)\
**Post date:** [January 22, 2014, 2:39pm UTC](https://forum.ansible.com/t/stumped-by-ansible-python-pyrax/14395/5 "2014-01-22T14:39:28Z")

</div>

Thanks Matt!! I’ll take a look at the links in order to familiarize myself with what’s coming in Ansible. I appreciate the response.
