0

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
  • Possible duplicate of [Ansible ec2: "boto required for this module"](https://stackoverflow.com/questions/41774695/ansible-ec2-boto-required-for-this-module) – dsumsky Jun 10 '19 at 13:36
  • refer this answer: https://stackoverflow.com/questions/30227140/best-way-to-launch-aws-ec2-instances-with-ansible/30298524#30298524 – Arbab Nazar Jun 11 '19 at 08:15

1 Answers1

0

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

Mike A
  • 500
  • 4
  • 16