-
name: crate vpc.
ec2_vpc:
…
register: vpc -
debug: var=vpc.vpc_id
-
name: select public vpc
set_fact:
vpc_id: “{{vpc.vpc_id}}” -
debug: var=vpc_id
TASK [setup : setup : crate vpc] ************************************************
ok: [127.0.0.1] => {“changed”: false, … “vpc_id”: “vpc-e31c0086”}
TASK [setup : setup : debug var=vpc.vpc_id] *************************************
ok: [127.0.0.1] => {
“changed”: false,
“vpc.vpc_id”: “vpc-e31c0086”
}
TASK [setup : setup : select public vpc] ****************************************
ok: [127.0.0.1] => {“ansible_facts”: {“vpc_id”: “vpc-e31c0086”}, “changed”: false}
TASK [setup : setup : debug var=vpc_id] *****************************************
ok: [127.0.0.1] => {
“changed”: false,
“vpc_id”: “VARIABLE IS NOT DEFINED!”
}
what i’m doing wrong?