Hello,
I'm new to ansible and am trying to use import_playbook and register but it
is not working. I have a playbook called vpc.yml:
- hosts: localhost
tasks:
- import_role:
name: vpc
vars:
aws_region: "{{aws_region}}"
register: public_subnet
within another playbook:
- import_playbook: vpc.yml
# register: public_subnet
- hosts: localhost
connection: local
gather_facts: False
name: set up EC2 instances
tasks:
- name: Provision a set of instances
ec2:
key_name: AnsibleTest
# group: test
instance_type: t2.micro
image: ami-900ae6e8
wait: true
exact_count: "{{ node_count }}"
count_tag:
Name: Test
instance_tags:
Name: Test
region: "{{aws_region}}"
vpc_subnet_id: public_subnet
register: ec2
If I run the above I get an error saying the subnet ID public_subnet is
undefined, but if I try to change the import_playbook to user the register:
public_subnet line commented above I get a syntax error.
I understand I could rather easily just use the VPC role in my top level
playbook but I'm trying to learn. From what I understand this should be
possible, or at least was possible before 2.4. What am I missing here?
Thanks!
Dave
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f8366cbe-b4ca-4e7f-8137-1fd30df415c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.