Hi Mujeeb,
Please follow the below step
Once you are done with the AWS account and the User creation, you can move
forward and install the required things.
1. Ansible:
1. Install Ansible on a RHEL/CentOS Linux based system
1. *$ sudo yum install Ansible*
2. Install Ansible on a Debian/Ubuntu Linux based system
1. *$ sudo apt-get install software-properties-common*
2. *$ sudo apt-add-repository ppa:Ansible/Ansible*
3. *$ sudo apt-get update*
4. *$ sudo apt-get install Ansible*
3. Install Ansible using pip
1. *$ sudo pip install Ansible*
2. *Once installed you can verify by Ansible –version this
command.*
2. Python:
1. $ sudo apt-get update
2. $ sudo apt-get install python3.6
3. You can follow this link
<https://docs.python-guide.org/starting/install3/linux/> for more
details.
3. Boto: (Boto is a Python package which provides an interface to AWS.)
1. First, install pip
1. *$ sudo apt install python3-pip or*
2. *$ yum install python-pip*
2. Now install boto
1. *$ pip install boto*
Now, we are done with the package installation, we can move ahead and start
writing our Ansible playbook.
Note: There are multiple ways you can install the above packages. I have
added the ones that I followed but you can install as per your knowledge.
Now open a terminal and create a file with the extension .yml or .ymal, add
below script and save it.
# Basic provisioning example
- name: Ansible test
hosts: localhost
tasks:
- name: launching AWS instance using Ansible
ec2:
key_name: aws_instance_Ansible
instance_type: t2.micro
image: ami-0dacb0c129b49f529
region: us-east-2
wait: yes
group: Ansible
count: 1
vpc_subnet_id: default
assign_public_ip: yes
aws_access_key: ***********xxxxxxxx
Aws_secret_key: ***********xxxxxxxx
On Tue, 23 Jun 2020 at 15:37, Mujeeb k.s <[email protected]> wrote:
> Hi
>
> I am trying to create EC2 in using play book, but i am unable to create
> instance
> I am getting below error
>
> Please help me, how can i fix this issue
>
>
> [root@jenkinansible ansible]# ansible-playbook ec2.yml
>
> PLAY [creating ec2 instance]
> ************************************************************************************************************************************************************************
>
> TASK [Gathering Facts]
> ******************************************************************************************************************************************************************************
> ok: [localhost]
>
> TASK [creating ec2 instance]
> ************************************************************************************************************************************************************************
> fatal: [localhost]: FAILED! => {"changed": false, "msg": "Instance
> creation failed => Unsupported: The requested configuration is currently
> not supported. Please check the documentation for supported
> configurations."}
>
> PLAY RECAP
> ******************************************************************************************************************************************************************************************
> localhost : ok=1 changed=0 unreachable=0
> failed=1 skipped=0 rescued=0 ignored=0
>
> [root@jenkinansible ansible]#
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/509b3dbe-e01c-4a52-833d-65eb0c5dedb8o%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/509b3dbe-e01c-4a52-833d-65eb0c5dedb8o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CABAvFDOpaNCLqh%3Dc-mszTXuifQ%2B3R%2BYSZtwF9PQn%3DMh0Xf0aAg%40mail.gmail.com.