On Fri, Jan 24, 2020, at 1:58 PM, FG wrote:
> 
> I am facing same issue , Any leads ??? 
> 
> 

Could you be more specific? What exactly is the issue you're seeing? Playbooks? 
Commands you're using? Output?

In any case, this is definitely a better question for ansible-project@ list

The post below had lots of errors, including self referring variables, and lack 
if understanding variables scope 
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#scoping-variables


V/r,
James Cassell


> 
> Regards
> 
> 
> On Thursday, May 23, 2019 at 9:53:08 AM UTC-4, Geoff wrote:
> > I have a playbook called: *testing_vars_pass.yml*
> > 
> > It imports another playbook called: *testing_vars_call.yml*
> > 
> > The playbook *testing_vars_call.yml* expects a variable called: *myVar*
> > 
> > 
> > Below is the contents of each playbook ...
> > 
> > $ cat *testing_vars_pass.yml*
> > ---
> > - name: Test pass vars
> >  hosts: all
> >  vars:
> >  myVar: hello
> > 
> >  tasks:
> > 
> >  - name: Debug pass vars
> >  debug:
> >  msg: "{{ myVar }}"
> > 
> > - import_playbook: *testing_vars_call.yml* myVar="{{ myVar }}"
> > 
> > 
> >  ... and ...
> > 
> > 
> > $ cat *testing_vars_call.yml*
> > ---
> > - name: Test call vars
> >  hosts: all
> >  vars:
> >  myVar: = "{{ myVar }}"
> > 
> >  tasks:
> > 
> >  - name: Debug call vars
> >  debug:
> >  msg: "{{ myVar }}"
> > 
> > 
> > 
> > This produces the following error ...
> > 
> > 18 TASK [Debug call vars] 
> > *********************************************************
> > 
> > 19 fatal: [1.1.1.1]: FAILED! => {"msg": "An unhandled exception occurred 
> > while templating '{{ myVar }}'. Error was a <class 
> > 'ansible.errors.AnsibleError'>, original message: An unhandled exception 
> > occurred while templating '{{ myVar }}'. [...]
> > 
> > 
> > 
> > The same error is seen if I use the syntax ...
> > 
> > - import_playbook: testing_vars_call.yml
> >  vars:
> >  myVar: "{{ myOwnVar }}"
> > 
> > 
> > 
> > In case the fact that the 'myVars' variable had the same name in both 
> > playbooks, I changed the name in the first playbook ...
> > 
> > $ cat *testing_vars_pass.yml*
> > ---
> > - name: Test pass vars
> >  hosts: all
> >  vars:
> >  my*Own*Var: hello
> > 
> >  tasks:
> > 
> >  - name: Debug pass vars
> >  debug:
> >  msg: "{{ my*Own*Var }}"
> > 
> > - import_playbook: testing_vars_call.yml myVar="{{ my*Own*Var }}"
> > 
> > 
> > This time, I get a different error ...
> > 
> > 18 TASK [Debug call vars] 
> > *********************************************************
> > 
> > 19 fatal: [1.1.1.1]: FAILED! => {"msg": "The task includes an option with 
> > an undefined variable. The error was: 'myOwnVar' is undefined\n\nThe error 
> > appears to have been in 
> > '/var/lib/awx/projects/_6__unix/testing_vars_call.yml': line 9, column 5, 
> > but may\nbe elsewhere in the file depending on the exact syntax 
> > problem.\n\nThe offending line appears to be:\n\n\n - name: Debug call 
> > vars\n ^ here\n"}
> > 
> > 
> > What is the correct way to pass variables into playbooks via 
> > 'import_playbook'?
> > 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/9eb9c767-c48c-4c42-9cd2-699c7f5117ea%40www.fastmail.com.

Reply via email to