Re: [ansible-project] run_once not working to register value of curl

2020-04-16 Thread Nicola Contu
The discussion has been moved to another problem after Dick's suggestion, sorry for the confusion. By the way I solved it using this : hostvars['localhost']['PHP_SITE_RESPONSE'].json.version That's the way to pass a variable to another play. Il giorno gio 16 apr 2020 alle ore 02:14 Dan Linder

Re: [ansible-project] run_once not working to register value of curl

2020-04-15 Thread Dan Linder
When you say "variable is not available between plays in the same playbook", that is a different question than the one originally asked in this thread. I'd suggest you post a very minimal playbook showing the error so we can reproduce it and assist you further with that problem. You wrote "I

Re: [ansible-project] run_once not working to register value of curl

2020-04-15 Thread Nicola Contu
I am sorry Dan, I think I did not understand what you want to debug. This playbook does not work and I can't make it working. Sorry about that. Btw, the issue is that the variable is not available between plays in the same playbook. I just want to know how to pass those variable to the next play

Re: [ansible-project] run_once not working to register value of curl

2020-04-10 Thread Dan Linder
So, from that output we know that the 'PHP_SITE_RESPONSE' variable is being set and we have the variable structure to look at. Your error from a few messages back just showed: {"msg": "The task includes an option with an undefined variable. The error was: 'PHP_SITE_RESPONSE' is undefined I

Re: [ansible-project] run_once not working to register value of curl

2020-04-10 Thread Nicola Contu
[ncontu@cmd-config cmd]$ ansible-playbook playbooks/test.yml -e "variable_host=127.0.0.1" [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will change, but still be user configurable on deprecation. This feature will

Re: [ansible-project] run_once not working to register value of curl

2020-04-10 Thread Dan Linder
Hi Nicola, I'd take a bit step back and reduce your playbook to just a couple of tasks: ``` - hosts: "{{ variable_host }}" serial: 1 tasks: - name: "Get PHP version from site" register: PHP_SITE_RESPONSE uri: body_format: json method: GET

Re: [ansible-project] run_once not working to register value of curl

2020-04-10 Thread Nicola Contu
Hey Dick, I tried that but the subsequent play is not able to recognise those variables. *{"msg": "The task includes an option with an undefined variable. The error was: 'PHP_SITE_RESPONSE' is undefined* I changed the playbook like this : *- hosts:

Re: [ansible-project] run_once not working to register value of curl

2020-04-10 Thread Kai Stian Olstad
On Fri, Apr 10, 2020 at 06:48:05AM -0700, Nicola Contu wrote: > Hello, > I am trying to get the latest version of few softwares and comparing it > with a list of hosts with the current installed. > > Calling the github API is creating issues with the number of call due to > the the list of

Re: [ansible-project] run_once not working to register value of curl

2020-04-10 Thread Dick Visser
Add a new play to the top of the list that targets localhost. The use the registered vars in a subsequent play that targets all your hosts. On Fri, 10 Apr 2020 at 15:48, Nicola Contu wrote: > Hello, > I am trying to get the latest version of few softwares and comparing it > with a list of hosts

[ansible-project] run_once not working to register value of curl

2020-04-10 Thread Nicola Contu
Hello, I am trying to get the latest version of few softwares and comparing it with a list of hosts with the current installed. Calling the github API is creating issues with the number of call due to the the list of hosts that is quite big. So I would like to register the latest versions in a