Re: [ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread Jeremy Hobbs
Suneel,  I attempted your solution, but it didn't work with the way I was 
setting up the workflow.  Dick,  I tried the Dummy host and it worked 
perfectly.  Thank you for your responses.  


Jeremy


On Thursday, May 21, 2020 at 11:12:22 AM UTC-5, Dick Visser wrote:
>
> Not tried yet, but this describes a dummy host: 
> https://stackoverflow.com/a/47811099/12731515 
>
> On Thu, 21 May 2020 at 17:56, Jeremy Hobbs > 
> wrote: 
> > 
> > I simplified the playbook for the post.  But, this specific call is used 
> by many different playbooks.  So instead of having to update each playbook 
> if it changes, I want to abstract it out.  Writing to a file seems a pretty 
> crappy workaround.  Is there not a way to pass variables between the 
> playbooks directly? 
> > 
> > 
> > 
> > On Thursday, May 21, 2020 at 10:49:04 AM UTC-5, David Foley wrote: 
> >> 
> >> Why two Playbook ? 
> >> 
> >> But either way, Copy the Reg to a Local Json File 
> >> 
> >> Then in your Second Playbook Just read in the JSON File 
> >> 
> >>  name: Read Json File 
> >> shell: cat Info.json 
> >> register: json_file 
> >> 
> >> 
> >> (json_file.stdout | from_json).VALUE 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/51b1da39-f24c-454d-8f93-eb332c8c4b23%40googlegroups.com.
>  
>
>
>
>
> -- 
> Dick Visser 
> Trust & Identity Service Operations Manager 
> GÉANT 
>

-- 
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/3e0c6879-f1c2-409c-a037-8423b633a8ca%40googlegroups.com.


Re: [ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread Dick Visser
Not tried yet, but this describes a dummy host:
https://stackoverflow.com/a/47811099/12731515

On Thu, 21 May 2020 at 17:56, Jeremy Hobbs  wrote:
>
> I simplified the playbook for the post.  But, this specific call is used by 
> many different playbooks.  So instead of having to update each playbook if it 
> changes, I want to abstract it out.  Writing to a file seems a pretty crappy 
> workaround.  Is there not a way to pass variables between the playbooks 
> directly?
>
>
>
> On Thursday, May 21, 2020 at 10:49:04 AM UTC-5, David Foley wrote:
>>
>> Why two Playbook ?
>>
>> But either way, Copy the Reg to a Local Json File
>>
>> Then in your Second Playbook Just read in the JSON File
>>
>>  name: Read Json File
>> shell: cat Info.json
>> register: json_file
>>
>>
>> (json_file.stdout | from_json).VALUE
>
> --
> 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/51b1da39-f24c-454d-8f93-eb332c8c4b23%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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/CAL8fbwNmUvq6YrnGE4%2B%3DxvsV%2Bi8FW6Z1MnVVQ0pZUHV7NRtJow%40mail.gmail.com.


Re: [ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread Suneel Gali
can you try to pass the variable to include_tasks?

*Reference*:
https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.7.html#include-tasks-import-tasks-inline-variables

-Suneel

On Thu, May 21, 2020 at 9:26 PM Jeremy Hobbs  wrote:

> I simplified the playbook for the post.  But, this specific call is used
> by many different playbooks.  So instead of having to update each playbook
> if it changes, I want to abstract it out.  Writing to a file seems a pretty
> crappy workaround.  Is there not a way to pass variables between the
> playbooks directly?
>
>
>
> On Thursday, May 21, 2020 at 10:49:04 AM UTC-5, David Foley wrote:
>>
>> Why two Playbook ?
>>
>> But either way, Copy the Reg to a Local Json File
>>
>> Then in your Second Playbook Just read in the JSON File
>>
>>  name: Read Json File
>> shell: cat Info.json
>> register: json_file
>>
>>
>> (json_file.stdout | from_json).VALUE
>>
> --
> 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/51b1da39-f24c-454d-8f93-eb332c8c4b23%40googlegroups.com
> 
> .
>

-- 
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/CAKH5KHLqU8ZiX%3DqpJcaQJOkH%3DAayTpUj%2Brrd8Rr9Nf%2BW2Ka3YQ%40mail.gmail.com.


[ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread David Foley
Another way I know is to send the reg to the stdout and cat that stdout 
into the other playbook.
similar to outputting to the File, but if the API Value is big you may be 
better off with the Text File.


 register: test
   - debug: msg="{{test.stdout}}"

 


  tasks:
   - shell: cat "{{test.stdout}}"

-- 
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/bef73289-d9ca-43be-bfba-9dcd0514ab08%40googlegroups.com.


[ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread Jeremy Hobbs
I simplified the playbook for the post.  But, this specific call is used by 
many different playbooks.  So instead of having to update each playbook if 
it changes, I want to abstract it out.  Writing to a file seems a pretty 
crappy workaround.  Is there not a way to pass variables between the 
playbooks directly?



On Thursday, May 21, 2020 at 10:49:04 AM UTC-5, David Foley wrote:
>
> Why two Playbook ? 
>
> But either way, Copy the Reg to a Local Json File
>
> Then in your Second Playbook Just read in the JSON File 
>
>  name: Read Json File
> shell: cat Info.json
> register: json_file
>
>
> (json_file.stdout | from_json).VALUE
>

-- 
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/51b1da39-f24c-454d-8f93-eb332c8c4b23%40googlegroups.com.


[ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread David Foley
Why two Playbook ? 

But either way, Copy the Reg to a Local Json File

Then in your Second Playbook Just read in the JSON File 

 name: Read Json File
shell: cat Info.json
register: json_file


(json_file.stdout | from_json).VALUE

-- 
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/d5ceca07-32d7-4a76-8079-984ee24d26b9%40googlegroups.com.