Uploaded image for project: 'Ansible Cloud Automation'
  1. Ansible Cloud Automation
  2. ACA-1631

[amazon.aws/2118] [ec2_asg] fail when update tags inside ASG with KeyError; 'LaunchTemplate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Undefined Undefined
    • None
    • Unspecified
    • cloud-content, Public Cloud
    • False
    • Hide

      None

      Show
      None
    • False
    • CC Team ScrumBan: Sprint 0

      https://github.com/ansible-collections/amazon.aws/issues/2118

          1. Summary

      `trying to add new tag inside my current ASG created before seems apply changes but appears this error and break

          1. Issue Type

      Bug Report

          1. Component Name

      ec2_asg

          1. Ansible Version

      ```console
      $ ansible --version
      ansible [core 2.16.6]
      config file = /etc/ansible/ansible.cfg
      configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /home/user/.local/lib/python3.10/site-packages/ansible
      ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
      executable location = /home/user/.local/bin/ansible
      python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
      jinja version = 3.1.4
      libyaml = True
      ```

          1. Configuration

      ```console

      1. if using a version older than ansible-core 2.12 you should omit the '-t all'
        $ ansible-config dump --only-changed -t all
      2. Since Ansible 2.12 (core):
      3. To generate an example config file (a "disabled" one with all default settings, commented out):
      4. $ ansible-config init --disabled > ansible.cfg
        #
      5. Also you can now have a more complete file by including existing plugins:
      6. ansible-config init --disabled -t all > ansible.cfg
      1. For previous versions of Ansible you can check for examples in the 'stable' branches of each version
      2. Note that this file was always incomplete and lagging changes to configuration settings
      1. for example, for 2.9: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg
        ```
          1. OS / Environment

      Ubuntu 22.04 WSL

          1. Steps to Reproduce

      <!--- Paste example playbooks or commands between quotes below -->
      ```
      name: Get Auto Scaling Groups for EKS cluster
      amazon.aws.autoscaling_group_info:
      tags:
      eks:cluster-name: add-tags-asg
      register: asg_info

      name: Add new tag to Auto Scaling Groups
      amazon.aws.autoscaling_group:
      name: "{{ item.auto_scaling_group_name }}"
      tags:

      • Product: new tag
        propagate_at_launch: true
        loop: "{{ asg_info.results }}"
        register: asg_update

      debug: msg="{{ asg_update.stderr }}"`

      ```

          1. Expected Results

      New tag added to ASG

          1. Actual Results

      ```console
      `
      Traceback (most recent call last):
      File "/tmp/ansible_amazon.aws.autoscaling_group_payload_s3ziqwd6/ansible_amazon.aws.autoscaling_group_payload.zip/ansible_collections/amazon/aws/plugins/modules/autoscaling_group.py", line 1399, in create_autoscaling_group
      KeyError: 'LaunchConfigurationName'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "/home/user/.ansible/tmp/ansible-tmp-1717076495.9101698-178940-110762071316883/AnsiballZ_autoscaling_group.py", line 107, in <module>
      _ansiballz_main()
      File "/home/user/.ansible/tmp/ansible-tmp-1717076495.9101698-178940-110762071316883/AnsiballZ_autoscaling_group.py", line 99, in _ansiballz_main
      invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/user/.ansible/tmp/ansible-tmp-1717076495.9101698-178940-110762071316883/AnsiballZ_autoscaling_group.py", line 47, in invoke_module
      runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.autoscaling_group', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.autoscaling_group', _modlib_path=modlib_path),
      File "/usr/lib/python3.10/runpy.py", line 224, in run_module
      return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code
      _run_code(code, mod_globals, init_globals,
      File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
      exec(code, run_globals)
      File "/tmp/ansible_amazon.aws.autoscaling_group_payload_s3ziqwd6/ansible_amazon.aws.autoscaling_group_payload.zip/ansible_collections/amazon/aws/plugins/modules/autoscaling_group.py", line 2005, in <module>
      File "/tmp/ansible_amazon.aws.autoscaling_group_payload_s3ziqwd6/ansible_amazon.aws.autoscaling_group_payload.zip/ansible_collections/amazon/aws/plugins/modules/autoscaling_group.py", line 1977, in main
      File "/tmp/ansible_amazon.aws.autoscaling_group_payload_s3ziqwd6/ansible_amazon.aws.autoscaling_group_payload.zip/ansible_collections/amazon/aws/plugins/modules/autoscaling_group.py", line 1401, in create_autoscaling_group
      KeyError: 'LaunchTemplate'
      `
      ```

          1. Code of Conduct
      • [X] I agree to follow the Ansible Code of Conduct

            gosriniv@redhat.com Gomathi selvi Srinivasan
            gosriniv@redhat.com Gomathi selvi Srinivasan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: