Ansible: Using EC2 external inventory script gives a Syntax Error












0















I'm trying to follow this to fetch inventory in us-east-1 region. I downloaded the EC2 External Inventory script and made it executable. My ~/.boto looks like following.



[Credentials]
aws_access_key_id = <ACCESS_KEY>
aws_secret_access_key = <SECRET_KEY>


Where <ACCESS_KEY> and <SECRET_KEY> have real aws access and secret key values respectively.



When I run following command I get an error instead of list nodes in the region.



$ ansible -i ec2.py -u ubuntu us-east-1 -m ping

File "/home/waseem/Repositories/Learning/Ansible/ec2.py", line 168
print data_to_print
^
SyntaxError: invalid syntax

ERROR: failed to parse executable inventory script results: {'msg': '', 'failed': True, 'parsed': False}


What am I doing wrong?










share|improve this question























  • What version of Python do you have? This looks like an issue with Python, not Ansible - Python 3 removed the simple print statement (docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function)

    – Kyle
    Aug 9 '14 at 19:24













  • @kyl191 I have 3.4.1. Which version of Python is recommended with ansible?

    – Waseem
    Aug 9 '14 at 19:28













  • As per docs.ansible.com/intro_installation.html, at this point, any Python 2.6+ version - python.org says 2.7.8 is the latest

    – Kyle
    Aug 9 '14 at 19:32













  • No problem, glad to help. I've rewritten the comments as an answer, it would be nice if you marked it as accepted. Thanks!

    – Kyle
    Aug 11 '14 at 17:45
















0















I'm trying to follow this to fetch inventory in us-east-1 region. I downloaded the EC2 External Inventory script and made it executable. My ~/.boto looks like following.



[Credentials]
aws_access_key_id = <ACCESS_KEY>
aws_secret_access_key = <SECRET_KEY>


Where <ACCESS_KEY> and <SECRET_KEY> have real aws access and secret key values respectively.



When I run following command I get an error instead of list nodes in the region.



$ ansible -i ec2.py -u ubuntu us-east-1 -m ping

File "/home/waseem/Repositories/Learning/Ansible/ec2.py", line 168
print data_to_print
^
SyntaxError: invalid syntax

ERROR: failed to parse executable inventory script results: {'msg': '', 'failed': True, 'parsed': False}


What am I doing wrong?










share|improve this question























  • What version of Python do you have? This looks like an issue with Python, not Ansible - Python 3 removed the simple print statement (docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function)

    – Kyle
    Aug 9 '14 at 19:24













  • @kyl191 I have 3.4.1. Which version of Python is recommended with ansible?

    – Waseem
    Aug 9 '14 at 19:28













  • As per docs.ansible.com/intro_installation.html, at this point, any Python 2.6+ version - python.org says 2.7.8 is the latest

    – Kyle
    Aug 9 '14 at 19:32













  • No problem, glad to help. I've rewritten the comments as an answer, it would be nice if you marked it as accepted. Thanks!

    – Kyle
    Aug 11 '14 at 17:45














0












0








0








I'm trying to follow this to fetch inventory in us-east-1 region. I downloaded the EC2 External Inventory script and made it executable. My ~/.boto looks like following.



[Credentials]
aws_access_key_id = <ACCESS_KEY>
aws_secret_access_key = <SECRET_KEY>


Where <ACCESS_KEY> and <SECRET_KEY> have real aws access and secret key values respectively.



When I run following command I get an error instead of list nodes in the region.



$ ansible -i ec2.py -u ubuntu us-east-1 -m ping

File "/home/waseem/Repositories/Learning/Ansible/ec2.py", line 168
print data_to_print
^
SyntaxError: invalid syntax

ERROR: failed to parse executable inventory script results: {'msg': '', 'failed': True, 'parsed': False}


What am I doing wrong?










share|improve this question














I'm trying to follow this to fetch inventory in us-east-1 region. I downloaded the EC2 External Inventory script and made it executable. My ~/.boto looks like following.



[Credentials]
aws_access_key_id = <ACCESS_KEY>
aws_secret_access_key = <SECRET_KEY>


Where <ACCESS_KEY> and <SECRET_KEY> have real aws access and secret key values respectively.



When I run following command I get an error instead of list nodes in the region.



$ ansible -i ec2.py -u ubuntu us-east-1 -m ping

File "/home/waseem/Repositories/Learning/Ansible/ec2.py", line 168
print data_to_print
^
SyntaxError: invalid syntax

ERROR: failed to parse executable inventory script results: {'msg': '', 'failed': True, 'parsed': False}


What am I doing wrong?







automation amazon-web-services






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 6 '14 at 14:34









WaseemWaseem

1406




1406













  • What version of Python do you have? This looks like an issue with Python, not Ansible - Python 3 removed the simple print statement (docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function)

    – Kyle
    Aug 9 '14 at 19:24













  • @kyl191 I have 3.4.1. Which version of Python is recommended with ansible?

    – Waseem
    Aug 9 '14 at 19:28













  • As per docs.ansible.com/intro_installation.html, at this point, any Python 2.6+ version - python.org says 2.7.8 is the latest

    – Kyle
    Aug 9 '14 at 19:32













  • No problem, glad to help. I've rewritten the comments as an answer, it would be nice if you marked it as accepted. Thanks!

    – Kyle
    Aug 11 '14 at 17:45



















  • What version of Python do you have? This looks like an issue with Python, not Ansible - Python 3 removed the simple print statement (docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function)

    – Kyle
    Aug 9 '14 at 19:24













  • @kyl191 I have 3.4.1. Which version of Python is recommended with ansible?

    – Waseem
    Aug 9 '14 at 19:28













  • As per docs.ansible.com/intro_installation.html, at this point, any Python 2.6+ version - python.org says 2.7.8 is the latest

    – Kyle
    Aug 9 '14 at 19:32













  • No problem, glad to help. I've rewritten the comments as an answer, it would be nice if you marked it as accepted. Thanks!

    – Kyle
    Aug 11 '14 at 17:45

















What version of Python do you have? This looks like an issue with Python, not Ansible - Python 3 removed the simple print statement (docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function)

– Kyle
Aug 9 '14 at 19:24







What version of Python do you have? This looks like an issue with Python, not Ansible - Python 3 removed the simple print statement (docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function)

– Kyle
Aug 9 '14 at 19:24















@kyl191 I have 3.4.1. Which version of Python is recommended with ansible?

– Waseem
Aug 9 '14 at 19:28







@kyl191 I have 3.4.1. Which version of Python is recommended with ansible?

– Waseem
Aug 9 '14 at 19:28















As per docs.ansible.com/intro_installation.html, at this point, any Python 2.6+ version - python.org says 2.7.8 is the latest

– Kyle
Aug 9 '14 at 19:32







As per docs.ansible.com/intro_installation.html, at this point, any Python 2.6+ version - python.org says 2.7.8 is the latest

– Kyle
Aug 9 '14 at 19:32















No problem, glad to help. I've rewritten the comments as an answer, it would be nice if you marked it as accepted. Thanks!

– Kyle
Aug 11 '14 at 17:45





No problem, glad to help. I've rewritten the comments as an answer, it would be nice if you marked it as accepted. Thanks!

– Kyle
Aug 11 '14 at 17:45










1 Answer
1






active

oldest

votes


















3














This is an issue with the wrong version of Python being used, not with Ansible itself.



http://docs.ansible.com/intro_installation.html specifies that Ansible runs on Python 2.6+, not Python 3.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f793272%2fansible-using-ec2-external-inventory-script-gives-a-syntax-error%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    This is an issue with the wrong version of Python being used, not with Ansible itself.



    http://docs.ansible.com/intro_installation.html specifies that Ansible runs on Python 2.6+, not Python 3.






    share|improve this answer




























      3














      This is an issue with the wrong version of Python being used, not with Ansible itself.



      http://docs.ansible.com/intro_installation.html specifies that Ansible runs on Python 2.6+, not Python 3.






      share|improve this answer


























        3












        3








        3







        This is an issue with the wrong version of Python being used, not with Ansible itself.



        http://docs.ansible.com/intro_installation.html specifies that Ansible runs on Python 2.6+, not Python 3.






        share|improve this answer













        This is an issue with the wrong version of Python being used, not with Ansible itself.



        http://docs.ansible.com/intro_installation.html specifies that Ansible runs on Python 2.6+, not Python 3.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 11 '14 at 17:43









        KyleKyle

        1465




        1465






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f793272%2fansible-using-ec2-external-inventory-script-gives-a-syntax-error%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?