In
roles/daniel-rhoades.aws-security-groups/tasks/main.yml
After:
Commission inbound security groups
-
name: "AWS | Provision networking | Create Inbound Security Groups"
local_action:
module: ec2_group
name: "{{ item.sg_name }}"
description: "{{ item.sg_description }}"
region: "{{ vpc_region }}"
vpc_id: "{{ vpc_id }}"
state: "{{ ec2_inbound_group_state }}"
rules: "{{ item.sg_rules }}"
with_items: "{{ ec2_group_inbound_sg }}"
register: ec2_group_inbound_sg
-
debug: var=ec2_group_inbound_sg verbosity=4
I get:
fatal: [localhost]: FAILED! => {
"failed": true,
"msg": "[{u'sg_rules': [{u'to_port': 80, u'from_port': 80, u'group_id': u'{{ ec2_group_inbound_sg.results[0].group_id }}', u'proto': u'tcp'}], u'sg_name': u'inbound-web-internal', u'sg_description': u'allow http and https access (from load balancer only)'}]: 'list object' has no attribute 'results'"
}
suppose ansible can't register already existing variable. When I change variable name for register all works fine.
In
roles/daniel-rhoades.aws-security-groups/tasks/main.yml
After:
Commission inbound security groups
name: "AWS | Provision networking | Create Inbound Security Groups"
local_action:
module: ec2_group
name: "{{ item.sg_name }}"
description: "{{ item.sg_description }}"
region: "{{ vpc_region }}"
vpc_id: "{{ vpc_id }}"
state: "{{ ec2_inbound_group_state }}"
rules: "{{ item.sg_rules }}"
with_items: "{{ ec2_group_inbound_sg }}"
register: ec2_group_inbound_sg
debug: var=ec2_group_inbound_sg verbosity=4
I get:
fatal: [localhost]: FAILED! => {
"failed": true,
"msg": "[{u'sg_rules': [{u'to_port': 80, u'from_port': 80, u'group_id': u'{{ ec2_group_inbound_sg.results[0].group_id }}', u'proto': u'tcp'}], u'sg_name': u'inbound-web-internal', u'sg_description': u'allow http and https access (from load balancer only)'}]: 'list object' has no attribute 'results'"
}
suppose ansible can't register already existing variable. When I change variable name for register all works fine.