Hi,

I'm trying to create aws launch template using ansible module - "  
community.aws.ec2_launch_template". I have different types of nodes and 
want to map different volumes (according to node type) in the launch 
template. 

For Core node - I'm trying to map 2 volumes (sdf and sdh) for which I'm 
getting below error -

* ansibleundefinedvariable 'str object' has no attribute 'device_name'*


My code looks like this -

- name: Set ebs volumes

  set_fact:

    ebs_volumes_list:

    - device_name: *sdf*

      ebs:

        volume_size: 10

        delete_on_termination: yes

        encrypted: yes

        volume_type: gp3

    - device_name:* sdh*

      ebs:

        volume_size: 10

        delete_on_termination: yes

        encrypted: yes

        volume_type: io1

        iops: 500

  when: node_type == "Core"


- name: "Create Node launch template"

  community.aws.ec2_launch_template:

    template_name: "Test”

    monitoring:

      enabled: true

    state: present

*    block_device_mappings:*

*     - device_name: "{{ item.device_name }}"*

*       ebs: "{{ item.ebs}}”*


  loop: "{{ ebs_volumes_list }}"

Ansible version -
ansible [core 2.12.1]
python version = 3.9.9 (main, Jan  5 2022, 11:59:43) [GCC 4.8.5 20150623 
(Red Hat 4.8.5-44)]



-- 
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/09aeef6b-cefe-494a-93ba-a1f98cd7e5c0n%40googlegroups.com.

Reply via email to