amazon.aws
amazon.aws copied to clipboard
cloudformation_facts module in ansible 2.10 returns StackStatus in stack_description. Previously was stack_status
SUMMARY
cloudformation_facts module in ansible 2.10 returns StackStatus in stack_description. Previously was stack_status In ansible 2.9: cfn_stack.ansible_facts.cloudformation[cfn_stack_name].stack_description.stack_status is defined In ansible 2.10: cfn_stack.ansible_facts.cloudformation[cfn_stack_name].stack_description.stack_status is not defined Instead ansible 2.10 has this dict key defined: cfn_stack.ansible_facts.cloudformation[cfn_stack_name].stack_description.StackStatus
ISSUE TYPE
- Bug Report
COMPONENT NAME
cloudformation_facts
ANSIBLE VERSION
ansible 2.10.3
config file = /home/ubuntu/cosops-ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.17 (default, Sep 30 2020, 13:38:04) [GCC 7.5.0]
CONFIGURATION
[DEPRECATION WARNING]: DEFAULT_HASH_BEHAVIOUR option, This feature is fragile and not portable, leading to continual
confusion and misuse , use the ``combine`` filter explicitly instead. This feature will be removed in version 2.13.
Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
DEFAULT_HASH_BEHAVIOUR(/home/ubuntu/cosops-ansible/ansible.cfg) = merge
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/ubuntu/cosops-ansible/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/home/ubuntu/cosops-ansible/ansible.cfg) = yaml
LOCALHOST_WARNING(/home/ubuntu/cosops-ansible/ansible.cfg) = False
OS / ENVIRONMENT
Ubuntu 18.04
STEPS TO REPRODUCE
- name: "Get a resources list in '{{ cfn_stack_name }}' stack"
cloudformation_facts:
stack_name: "{{ cfn_stack_name }}"
stack_resources: "yes"
region: "{{ ansible_ec2_placement_region }}"
register: cfn_stack
- debug:
msg: "{{ cfn_stack }}"
- name: "Get current stack status of '{{ cfn_stack_name }}' stack"
set_fact:
# yamllint disable-line rule:line-length
cfn_stack_status: "{{ cfn_stack.ansible_facts.cloudformation[cfn_stack_name].stack_description.stack_status }}"
EXPECTED RESULTS
cfn_stack.ansible_facts.cloudformation[cfn_stack_name].stack_description.stack_status variable is defined and return stack actual status
ACTUAL RESULTS
TASK [aws : Get current stack status of 'test-deploy-telemetry' stack] ******************************************************
fatal: [localhost]: FAILED! =>
msg: |-
The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stack_status'
The error appears to be in '/home/ubuntu/cosops-ansible/roles/aws/tasks/cfn_facts.yaml': line 36, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: "Get current stack status of '{{ cfn_stack_name }}' stack"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
Files identified in the description:
- [
plugins/modules/cloudformation.py](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws']/blob/main/plugins/modules/cloudformation.py) - [
plugins/modules/cloudformation_info.py](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws']/blob/main/plugins/modules/cloudformation_info.py)
If these files are inaccurate, please update the component name section of the description or use the !component bot command.
cc @jmenga @jsmartin @s-hertel @tremble @waffie1 @wimnat click here for bot help
This regression is unfortunate. To preserve the compatibility with the two versions we need now to expose the two keys in the result.
@mkyrianov This issue can be resolved by using cloudformation_info instead of cloudformation_facts. cloudformation_facts module is deprecated from amazon.aws 3.0.0 onwards. Please run your task with cloudformation_info module and let us know the result.
Files identified in the description: None
If these files are inaccurate, please update the component name section of the description or use the !component bot command.
The issue is fixed with cloudformation_info module from amazon.aws 3.0.0. Hence closing this issue.