0
votes

I'm trying to create an ec2 instance in aws using ansible.

i provided the access key id and the access key secret using aws configure beforehand

i took these keys from my account in rosttahub

this is the code


---
  - name: Launch EC2 Instance
    hosts: local
    connection: local
    tasks:
      - name: Launching_Instance
        ec2:
          key_name: UbuntuKey
          region: eu-west-1
          instance_type: t2.micro
          image: ami-08d658f84a6d84a80
          group: default
          vpc_subnet_id: subnet-904a51c8
          assign_public_ip: yes
          count: 1
          aws_access_key: ''
          aws_secret_key: ''
          wait: yes

this is what is included in my host file

[local]
localhost ansible_connection=local ansible_python_interpreter=python

when i run the playbook

ansible-playbook ec2.yml

PLAY [Launch EC2 Instance] **********************************************************************************************

TASK [Gathering Facts] **************************************************************************************************
ok: [localhost]

TASK [Launching_Instance] ***********************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "boto required for this module"}

PLAY RECAP **************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
1

1 Answers

0
votes

You need to install the boto python module. If you have pip installed it is simple as:

pip install boto

If you use pip to install the awscli module it will install all the dependent modules too