I have this working. I've a role that configs the L3VPN, so I created two tasks within that role. One loads the vars, and the other produces the router configuration.
roles/config_l3vpn/tasks/load.yml --- - name: include vars include_vars: ./host_vars/{{ inventory_hostname }}/engendered_l3vpn.yaml roles/config_l3vpn/tasks/build.yml --- - name: Building VPN configuration template: > src=config_l3vpn.conf.j2 dest={{ build_dir }}/junos-l3vpn.conf.part roles/config_l3vpn/tasks/main.yaml --- - include: load.yml - include: build.yml On Friday, 6 March 2020 14:05:16 UTC, Brandon Daly wrote: > > I have a play that is creating yaml for each of my hosts and this is > stored in './host_vars/{{ inventory_hostname }}/l3vpn.yml > > I then have a second play in which I wish to use this yaml. > > both are called from another playbook; > > > [ansible@ansi001 juniper]$ more live.all.pb.yam > --- > - import_playbook: make_clean.p.yaml > - import_playbook: l3vpnconf.p.yaml < this one creates the per > host yaml > - import_playbook: createconfig.p.yaml < this one > attempt to use them > - import_playbook: assemble_and_commit.p.yaml > > > > > In createconfigp.p.yaml I've attempted to access the l3vpn yaml using; > > vars_files: > - ./host_vars/{{ inventory_hostname }}/engendered_l3vpn.yml > > but this produces the error 'ERROR! vars file ./host_vars/{{ > inventory_hostname }}/l3vpn.yml was not found' > > Is it possible to create yaml per host in one play and have the second > play use the yaml? > > > > -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3c76ef5b-e606-401c-a73e-fa5e07876448%40googlegroups.com.