Hi.
We are not using v2 of ansible yet so the elastic ip association isnt 
available yet.

I was hoping i could do this via aws cli in the short term

I came across this post
http://engineering.ticketbis.com/how-to-use-aws-cli-from-ansible-tower/

and added task assoicate with elastic ip below.

tasks:    - name: Create vm      ec2:        key_name: "{{ aws_key_name }}"     
   instance_type: "{{ cms_machine_type }}"        image: "{{ aws_vm_image }}"   
     wait: yes        exact_count: 1        count_tag:            role: cms     
   group_id: "{{ aws_cms_security_group_id }}"        region: "{{ aws_region 
}}"        monitoring: yes        assign_public_ip: yes        vpc_subnet_id: 
"{{ aws_vpc_subnet_id }}"        instance_tags:           role: cms           
has_shared: true      register: ec2    - name: Add new instance to ansible in 
memory host group      add_host: hostname={{item.public_ip}} groupname=cms      
with_items: ec2.instances    - name: assoicate with elastic ip        
local_action:          module: shell aws ec2 associate-address --instance-id={{ 
item.id }} --allocation-id eipalloc-xxxx


The error i get is


Traceback (most recent call last):
  File "/usr/bin/aws", line 15, in <module>
    import awscli.clidriver
  File "/usr/share/awscli/awscli/clidriver.py", line 16, in <module>
    import botocore.session
  File "/usr/lib/python3/dist-packages/botocore/session.py", line 37, in 
<module>
    import botocore.service
  File "/usr/lib/python3/dist-packages/botocore/service.py", line 25, in 
<module>
    from .endpoint import get_endpoint
  File "/usr/lib/python3/dist-packages/botocore/endpoint.py", line 32, in 
<module>
    import botocore.response
  File "/usr/lib/python3/dist-packages/botocore/response.py", line 26, in 
<module>
    from .hooks import first_non_none_response
  File "/usr/lib/python3/dist-packages/botocore/hooks.py", line 22, in <module>
    import inspect
  File "/usr/lib/python3.4/inspect.py", line 35, in <module>
    import importlib.machinery
ImportError: No module named 'importlib.machinery'


Anyone seen this or know the correct way to use aws cli from playbook.

I can run the command on the linux command line adn that works fine.

Thanks



-- 


This message is private and confidential and for the exclusive use of the 
intended recipient(s). If you receive this email in error, please notify 
the sender immediately and delete all copies from your system. If you are 
not the intended recipient disclosure, distribution, copying or use of this 
communication is strictly prohibited. Any views or opinions presented in 
this email are solely those of the author and do not necessarily represent 
those of IDG UK. Clients and suppliers can view our full terms and 
conditions at www.idg.co.uk/terms-and-conditions/


IDG Communications Ltd. Company Reg No: 1197840. Registered in England and 
Wales.

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7c7a9510-3fca-403a-8d8e-802dd549e6e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to