mirror of https://github.com/ansible/ansible.git
Fix ec2_group for numbered protocols (GRE) (#42765)
* Fix spurious `changed=True` when int is passed as tag
* Fix for all AWS module using compare_aws_tags
* Handle improperly stringified protocols and allow inconsistency between None/-1 on non-tcp protocols
* Add integration test that reproduces the same bug
* Return false if the comparsison is not equal
(cherry picked from commit 20f21779d3
)
pull/45307/head
parent
66759810a0
commit
f0eebf9187
@ -0,0 +1,71 @@
|
||||
---
|
||||
- block:
|
||||
- name: set up aws connection info
|
||||
set_fact:
|
||||
group_tmp_name: '{{ec2_group_name}}-numbered-protos'
|
||||
aws_connection_info: &aws_connection_info
|
||||
aws_access_key: "{{ aws_access_key }}"
|
||||
aws_secret_key: "{{ aws_secret_key }}"
|
||||
security_token: "{{ security_token }}"
|
||||
region: "{{ aws_region }}"
|
||||
no_log: yes
|
||||
|
||||
- name: Create a group with numbered protocol (GRE)
|
||||
ec2_group:
|
||||
name: '{{ group_tmp_name }}'
|
||||
vpc_id: '{{ vpc_result.vpc.id }}'
|
||||
description: '{{ ec2_group_description }}'
|
||||
rules:
|
||||
- proto: 47
|
||||
to_port: -1
|
||||
from_port: -1
|
||||
cidr_ip: 0.0.0.0/0
|
||||
<<: *aws_connection_info
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- name: Create a group with a quoted proto
|
||||
ec2_group:
|
||||
name: '{{ group_tmp_name }}'
|
||||
vpc_id: '{{ vpc_result.vpc.id }}'
|
||||
description: '{{ ec2_group_description }}'
|
||||
rules:
|
||||
- proto: '47'
|
||||
to_port: -1
|
||||
from_port: -1
|
||||
cidr_ip: 0.0.0.0/0
|
||||
<<: *aws_connection_info
|
||||
state: present
|
||||
register: result
|
||||
- assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- name: Add a tag with a numeric value
|
||||
ec2_group:
|
||||
name: '{{ group_tmp_name }}'
|
||||
vpc_id: '{{ vpc_result.vpc.id }}'
|
||||
description: '{{ ec2_group_description }}'
|
||||
tags:
|
||||
foo: 1
|
||||
<<: *aws_connection_info
|
||||
- name: Read a tag with a numeric value
|
||||
ec2_group:
|
||||
name: '{{ group_tmp_name }}'
|
||||
vpc_id: '{{ vpc_result.vpc.id }}'
|
||||
description: '{{ ec2_group_description }}'
|
||||
tags:
|
||||
foo: 1
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
- assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
always:
|
||||
- name: tidy up egress rule test security group
|
||||
ec2_group:
|
||||
name: '{{group_tmp_name}}'
|
||||
state: absent
|
||||
vpc_id: '{{ vpc_result.vpc.id }}'
|
||||
<<: *aws_connection_info
|
||||
ignore_errors: yes
|
Loading…
Reference in New Issue