Error while executing playbook to start ec2 instance

0 votes

I have a playbook that starts an ec2 instance. But I keep getting the following error when I run it.


- name: Create an ec2 instance
  hosts: localhost
  gather_facts: false

      region: us-east-1
      instance_type: t2.micro
      ami: ami-01ac7d9c1179d7b74
      keypair: priyajdm


    - name: Create an ec2 instance
         key_name: "{{ keypair }}"
         group: launch-wizard-31
         instance_type: "{{ instance_type }}"
         image: "{{ ami }}"
         wait: true
         region: "{{ region }}"
         count: 1
         vpc_subnet_id: subnet-02f498e16fd56c277
         assign_public_ip: yes
      register: ec2

Error: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AuthFailureAWS was not able to validate the provided access credentialscb70bd1a-b7ec-41aa-895a-fabf9e0b6cfe fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1553599571.08-120541135236553/\", line 113, in \n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1553599571.08-120541135236553/\", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1553599571.08-120541135236553/\", line 48, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File \"/tmp/ansible_ec2_payload_hXpgWw/\", line 1702, in \n File \"/tmp/ansible_ec2_payload_hXpgWw/\", line 1686, in main\n File \"/tmp/ansible_ec2_payload_hXpgWw/\", line 989, in create_instances\n File \"/home/ubuntu/.local/lib/python2.7/site-packages/boto/vpc/\", line 1152, in get_all_subnets\n return self.get_list('DescribeSubnets', params, [('item', Subnet)])\n File \"/home/ubuntu/.local/lib/python2.7/site-packages/boto/\", line 1186, in get_list\n raise self.ResponseError(response.status, response.reason, body)\nboto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized\n\nAuthFailureAWS was not able to validate the provided access credentialscb70bd1a-b7ec-41aa-895a-fabf9e0b6cfe\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Mar 29, 2019 in Ansible by Kalgi

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Ansible

0 votes
1 answer

Playbook to start ec2 instance

- name: Create an ec2 instance ...READ MORE

answered Apr 9, 2019 in Ansible by Kalgi
0 votes
1 answer
0 votes
1 answer

Ansible playbook to automate security configurations of an EC2 instance

Hey @Kiara, your indentation is very wrong. ...READ MORE

answered Jan 24, 2019 in Ansible by Harsh
0 votes
1 answer

Playbook to add ec2 instance to ELB

Hey, @Kishore, try something like this: - hosts: ...READ MORE

answered Mar 26, 2019 in Ansible by Yesha
0 votes
0 answers
0 votes
1 answer

How to launch an EC2 instance using Ansible Playbook?

Hi@akhtar, Ansible has one module named ec2. This ...READ MORE

answered Aug 12, 2020 in Ansible by MD
• 95,320 points
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer