I am trying to run two playbooks at the same time, with one taking a var from the previous playbook.
My code is as follows
- name: Provision AWS
hosts: localhost
gather_facts: no
vars_files:- configs/aws.yml
tasks:- debug: msg=‘tag_Name_{{ aws.ec2.Name }}’
register: aws_host_target- hosts: {{ hostvars.localhost.aws_host_target.msg
remote_user: ubuntu
sudo: Trues
tasks:- debug: var=hostvars.localhost.aws_host_target.msg
Yet everytime it hits the second playbook, the variable aws_host_target.msg is not readable specifically for the “hosts”
Any help would be great!