Your code uses a templates variable as the image, which fails.
Then you supply a list, which also fails.
This is correct as the image parameter requires a simple string:
https://docs.ansible.com/ansible/latest/modules/ec2_module.html

Follow that documentation.

There might be more issues ahead, I haven't looked at that...



On Thu, 13 Aug 2020 at 23:22, Alfred Kamga <ananab...@qmail.qcc.edu> wrote:

> Hello guys,
>
> I have an issue with my ansible file.:
>
> ---
>
> - hosts: localhost
>   #user: root
>   #connection: local
>   gather_facts: no
>   become: no
> #  ignore_errors: yes
>   tasks:
>
>      - name: Install python-pip
>        yum:
>         name: python-pip
>         state: present
>
>      - name: Install boto
>        pip:
>         name: boto
>         state: present
>
>      - name: Provision Ec2 instance
>        ec2:
>          region: [ 'us-east-1' ]
>          vpc_subnet_id: [ 'vpc-1509766f' ]
>          image: "{{ ami-02354e95b39ca8dec }}"
>          aws_access_key_ID: [ 'AKIARTQFUHGRKH2LPZVM' ]
>          aws_secret_access_key: [
> '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' ]
>          ## group: "{{ ansible_group }}" ##
>          key_name: [ 'Dockerkeypair' ]
>          instance_type: [ 't2.micro' ]
>          wait: [ 'yes' ]
>          count: 1
>          assign_public_ip: [ 'yes' ]
>        register: ec2
>
> I am trying to create an ec2 instance using ansible and it throws me
> errors as follow.
> fatal: [localhost]: FAILED! => {"msg": "template error while templating
> string: unexpected char u'e' at 12. String: {{ ami-02354e95b39ca8dec }}"}
>
> Could someone help me please ? even when i changed to [
> 'ami-02354e95b39ca8dec'  ]
> it is still not working.
>
>
>
>
>
>
>
>
>
> --
>
>
> 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 ansible-project+unsubscr...@googlegroups.com.
>
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7e17e9e0-7c19-4ae9-a165-09879ca7bb5cn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7e17e9e0-7c19-4ae9-a165-09879ca7bb5cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwN2gXNR14i5rSvnKzRh1VWSamnSLcDCqUT5OvJaBx8GyQ%40mail.gmail.com.

Reply via email to