ec2 mudoles can't create ec2 instances

356 views
Skip to first unread message

lwq Adolph

unread,
Jan 18, 2016, 8:26:17 AM1/18/16
to Ansible Project
Hi, everyone:
   My base environment are below:
  • ubuntu 14.04 64bit
  • ansible 1.9.4
  • python 2.7.9 64bit

    I am green hand to ansible.I study ansible documentation for ec2 module http://docs.ansible.com/ansible/ec2_module.html . I want to create at least 100 ec2 instances on AWS. So I wrate a test yml file just for a test,the content is bellow:

---
  - name: deploy basic env
    hosts: 127.0.0.1
    connection: local
    gather_facts: False

    tasks:
      - name: Provision a set of instances
        ec2:
          aws_access_key: "xxx"
          aws_secret_key: "xxx"
          instance_type: t2.micro
          image: ami-52d1183f
          group: test
          count_tag:
            Name: testenv
          count: 3
          wait: yes
          vpc_subnet_id: subnet-2649d843
          assign_public_ip: yes
          region: cn-north-1
        register: ec2_test

      - name: Add all instance public IPs to host group
        add_host: hostname={{ item.public_ip }} groups=ec2hosts
        with_items: ec2_test.instances
I add 
[localhost]
127.0.0.1
to 
 /etc/ansible/hosts
​  

When I run

adolph@geek:dcos_absible_prac$ ansible-playbook prac.yml 

PLAY [deploy basic env] ******************************************************* 

TASK: [Provision a set of instances] ****************************************** 
failed: [127.0.0.1] => {"failed": true}
msg: Region cn-north-1 does not seem to be available for aws module boto.ec2. If the region definitely exists, you may need to upgrade boto

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/adolph/prac.retry

127.0.0.1                  : ok=0    changed=0    unreachable=0    failed=1
I am in China and 
cn-noarth-1
is supported by boto. So I don't know what is the problem.Can you help me ?
​ isis supported by boto





Rob White

unread,
Jan 20, 2016, 6:27:08 PM1/20/16
to Ansible Project
Ansible gets its regions using the boto module regions call.  E.g. for ec2 = http://boto.cloudhackers.com/en/latest/ref/ec2.html#boto.ec2.regions

Double check your boto version.
Reply all
Reply to author
Forward
0 new messages