Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not use variables in tag names when using amazon.aws.ec2_tag #239

Closed
finnje opened this issue Jan 14, 2021 · 0 comments
Closed

Can not use variables in tag names when using amazon.aws.ec2_tag #239

finnje opened this issue Jan 14, 2021 · 0 comments

Comments

@finnje
Copy link

finnje commented Jan 14, 2021

SUMMARY

When using the module: ec2_tag variables within the "key" (tag name) aren't populated. It creates a tag with the name and actually adds {{ VARIABLE_NAME }} to the tag. The value side lookups work fine, just not the name.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

amazon.aws.ec2_tag module

ANSIBLE VERSION
ansible 2.10.3
  config file = /builds/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
CONFIGURATION
ANSIBLE_PIPELINING(/builds/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/builds/ansible.cfg) = -F config/ssh.config -o ControlMaster=auto -o ControlPersist=60s
COMMAND_WARNINGS(/builds/ansible.cfg) = False
DEFAULT_BECOME(/builds/ansible.cfg) = True
DEFAULT_BECOME_METHOD(/builds/ansible.cfg) = sudo
DEFAULT_FORKS(/builds/ansible.cfg) = 20
DEFAULT_HOST_LIST(/builds/ansible.cfg) = ['/builds/hosts']
DEFAULT_REMOTE_USER(/builds/ansible.cfg) = ubuntu
DEFAULT_ROLES_PATH(/builds/ansible.cfg) = ['/builds/roles']
DEFAULT_SCP_IF_SSH(/builds/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/builds/ansible.cfg) = yaml
DEFAULT_TIMEOUT(/builds/ansible.cfg) = 60
DEPRECATION_WARNINGS(/builds/ansible.cfg) = False
DISPLAY_SKIPPED_HOSTS(/builds/ansible.cfg) = False
HOST_KEY_CHECKING(/builds/ansible.cfg) = False
RETRY_FILES_ENABLED(/builds/ansible.cfg) = False
OS / ENVIRONMENT

CentOS8 docker container - ansible installed via pip

STEPS TO REPRODUCE
---

- hosts:        localhost
  connection:   local
  gather_facts: false

  collections:
    - amazon.aws

  vars:
    SUBNET:    subnet-**********
    TAG_KEY:   color
    TAG_VALUE: blue

  tasks:

    - name: aws    | add tag to resource
      amazon.aws.ec2_tag:
        resource: '{{ SUBNET }}'
        state:    present
        tags:
          '{{ TAG_KEY }}': '{{ TAG_VALUE }}'
      register: tag_result

    - name: Print tag result
      debug:
        var: tag_result
EXPECTED RESULTS

Running the above playbook should result in a tag on my_subnet set to color: blue

ok: [127.0.0.1] => 
  tag_result:
    added_tags:
      color: blue
    changed: true
    failed: false
    tags:
      color: blue
ACTUAL RESULTS

Current result is my_subnet gets tagged with {{ TAG_KEY }}: blue

TASK [Print tag result] ***************************************************************************************************************************************************************************************************
ok: [127.0.0.1] => 
  tag_result:
    added_tags:
      '{{ TAG_KEY }}': blue
    changed: true
    failed: false
    tags:
      '{{ TAG_KEY }}': blue

@finnje finnje closed this as completed Jan 14, 2021
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
…ctions#239)

Add source_version param to ec2_launch_template module

SUMMARY
Add support for Boto3.create_launch_template_version's source_version parameter.
Accepted values:

int (specific version) : Creates a new launch template using this version as the base, hence keeping all its parameters
string ( 'latest') : Uses the latest found in list template_versions

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_launch_template.py
ADDITIONAL INFORMATION
Sanity tests passed for this module.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Joseph Torcasso <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
…ctions#239)

Add source_version param to ec2_launch_template module

SUMMARY
Add support for Boto3.create_launch_template_version's source_version parameter.
Accepted values:

int (specific version) : Creates a new launch template using this version as the base, hence keeping all its parameters
string ( 'latest') : Uses the latest found in list template_versions

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_launch_template.py
ADDITIONAL INFORMATION
Sanity tests passed for this module.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Joseph Torcasso <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
…ctions#239)

Add source_version param to ec2_launch_template module

SUMMARY
Add support for Boto3.create_launch_template_version's source_version parameter.
Accepted values:

int (specific version) : Creates a new launch template using this version as the base, hence keeping all its parameters
string ( 'latest') : Uses the latest found in list template_versions

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_launch_template.py
ADDITIONAL INFORMATION
Sanity tests passed for this module.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Joseph Torcasso <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 18, 2024
…ctions#239)

Add source_version param to ec2_launch_template module

SUMMARY
Add support for Boto3.create_launch_template_version's source_version parameter.
Accepted values:

int (specific version) : Creates a new launch template using this version as the base, hence keeping all its parameters
string ( 'latest') : Uses the latest found in list template_versions

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_launch_template.py
ADDITIONAL INFORMATION
Sanity tests passed for this module.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Joseph Torcasso <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@279bbc9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant