Re: [ansible-project] Ansible's plans regarding Python 2 EOL

2019-09-25 Thread Matt Martz
Nothing is changing from the Ansible perspective, which is why nothing has been said. Ansible modules will still be required to support Python 2.6+ and controller code will still be required to support Python 2.7+. This will likely continue until the EOL of Linux distributions that use Python 2,

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
There are no issues with the debug. I rest this case with the experts of this forum to suggest. -- 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

Re: [ansible-project] Re: Loading variables with data from REST

2019-09-25 Thread Brian Coca
you can also use a lookup varname: '{{ lookup("url" }}' -- -- Brian Coca -- 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] Re: Ansible Fails to Restart Jetty on a remote host

2019-09-25 Thread Andre Gronwald
i think it is because the process is started within the ssh session opened by ansible, and if you close the session, the subprocesses will be stopped as well. 2 solutions: 1. use a system-service to restart jetty (don't know if it exists; maybe jetty.sh is doing this already, then the solution

Re: [ansible-project] Ansible Fails to Restart Jetty on a remote host

2019-09-25 Thread Jonathan Lozada De La Matta
probably because you have sh on the command. Probably better if you pass the whole directory to jetty.sh restart. Like /apps/servers/jetty/bin/jetty.sh restart On Wed, Sep 25, 2019 at 9:58 AM Madushan Chathuranga < mchathuran...@gmail.com> wrote: > Hi All, > > I'm trying to restart jetty using

[ansible-project] Ansible Fails to Restart Jetty on a remote host

2019-09-25 Thread Madushan Chathuranga
Hi All, I'm trying to restart jetty using an ansible script bellow is a snippet from my script --- - hosts: all tasks: - name: start jetty command: sh jetty.sh restart args: chdir: /apps/servers/jetty/bin my inventory file is 10.0.18.225 ansible_user=appusr

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Eric Jolley
Your debug statement appears to not be indebted properly. > On Sep 25, 2019, at 5:46 AM, Mohtashim S wrote: > > @ej does not help ! > >- debug: > var: > USER: "{% if item.split('\t')[3] == 'FrontEnd' %}user1{% else > %}'user2'{% endif %}" with_items: "{{

[ansible-project] Ansible's plans regarding Python 2 EOL

2019-09-25 Thread Andrew Feller
We've all seen the warnings about Python 2 support ceasing on January 1st, 2020 from various projects including pip for months now. I hoped Ansible blog

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
Yes, If you look at my original post the very first post the same array item.split('\t')[3] very much prints FrontEnd and BackEnd text. On Wednesday, September 25, 2019 at 5:50:34 PM UTC+5:30, Stefan Hornburg (Racke) wrote: > > On 9/25/19 2:15 PM, Mohtashim S wrote: > > I did this but for some

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Stefan Hornburg (Racke)
On 9/25/19 2:15 PM, Mohtashim S wrote: > I did this but for some reason is is not getting user1 ... it is still > getting user2 as the value.  > > | >    -set_fact: >        USER: "user1" >      when:item.split('\t')[3]=="FrontEnd" >      with_items:"{{ command_result.stdout_lines }}" > > >    

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
I did this but for some reason is is not getting user1 ... it is still getting user2 as the value. - set_fact: USER: "user1" when: item.split('\t')[3] == "FrontEnd" with_items: "{{ command_result.stdout_lines }}" - set_fact: USER: "user2" when:

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Stefan Hornburg (Racke)
On 9/25/19 1:46 PM, Mohtashim S wrote: > @ej does not help ! > > | >    -debug: >      var: >         USER:"{% if item.split('\t')[3] == 'FrontEnd' %}user1{% else > %}'user2'{% endif %}"     with_items:"{{ > command_result.stdout_lines }}" > | > It's better to split this into two tasks, IMHO

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
@ej does not help ! - debug: var: USER: "{% if item.split('\t')[3] == 'FrontEnd' %}user1{% else %}'user2'{% endif %}" with_items: "{{ command_result.stdout_lines }}" ERROR! 'var' is not a valid attribute for a Task The error appears to be in '/app/testinclude.yml.bkp':

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
@ej does not help ! - debug: var: USER: "{% if item.split('\t')[3] == 'FrontEnd' %}user1{% else %}'user2'{% endif %}" with_items: "{{ command_result.stdout_lines }}" ERROR! 'var' is not a valid attribute for a Task The error appears to be in

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Eric Jolley
Hello Mohtashim, In your debug statement, try “var” instead of “vars”. > On Sep 25, 2019, at 5:13 AM, Mohtashim S wrote: > > There are two issues that i see. > > 1. I do not know how-to assign a variable USER value based on condition in > the loop > > Thus, instead of printing

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
There are two issues that i see. 1. I do not know how-to assign a variable USER value based on condition in the loop Thus, instead of printing msg: "{% if item.split('\t')[3] == 'FrontEnd' %}user1{% else %}'user2'{% endif %}" i wish to print "{{ USER }}" 2. msg: "{% if

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
There are two issues that i see. 1. I do not know how-to assign a variable USER value based on condition in the loop Thus, instead of printing msg: "{% if item.split('\t')[3] == 'FrontEnd' %}user1{% else %}'user2'{% endif %}" i wish to print "{{ USER }}" 2. msg: "{% if

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
There are two issues that i see. 1. I do not know how-to assign a variable USER value based on condition in the loop Thus, instead of printing msg: "{% if item.split('\t')[3] == 'FrontEnd' %}user1{% else %}'user2'{% endif %}" i wish to print "{{ USER }}" 2. msg: "{% if

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
There are two issues that i see. 1. I do not know how-to assign a variable USER value based on condition in the loop Thus, instead of printing msg: "{% if item.split('\t')[3] == 'FrontEnd' %}user1{% else %}'user2'{% endif %}" i wish to print "{{ USER }}" 2. msg: "{% if

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Stefan Hornburg (Racke)
On 9/25/19 11:13 AM, Mohtashim S wrote: > @Stefan. The information provided by me is complete.  > > The variable if not assigned a value defaults as "Hello World" > > Reference: https://docs.ansible.com/ansible/latest/modules/debug_module.html > Ha - I never ran in that one. Alas, you need to

Re: [ansible-project] Connection via Citrix

2019-09-25 Thread Srinivas Naram
Hello, Can you please provide more details on how you are moving forward with the setup ? Is any documentation available to understand how this can be achieved ? TIA -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
Here is my entire playbook: --- - name: "Play 1" hosts: localhost gather_facts: no tasks: - name: "Search database" command: > mysql --user=root --password=p@ssword deployment --host=localhost -Ns -e "SELECT dest_ip,file_dets,install_dir,layer FROM deploy_dets"

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
Here is my entire playbook: --- - name: "Play 1" hosts: localhost gather_facts: no tasks: - name: "Search database" command: > mysql --user=root --password=p@ssword deployment --host=localhost -Ns -e "SELECT dest_ip,file_dets,install_dir,layer FROM deploy_dets"

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
Here is my entire playbook: --- - name: "Play 1" hosts: localhost gather_facts: no tasks: - name: "Search database" command: > mysql --user=root --password=p@ssword deployment --host=localhost -Ns -e "SELECT dest_ip,file_dets,install_dir,layer FROM deploy_dets"

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
@Stefan. The information provided by me is complete. The variable if not assigned a value defaults as "Hello World" Reference: https://docs.ansible.com/ansible/latest/modules/debug_module.html You can recreate the playbook output. On Wednesday, September 25, 2019 at 2:23:22 PM UTC+5:30,

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Stefan Hornburg (Racke)
On 9/25/19 10:44 AM, Mohtashim S wrote: > @Stefan here is the output > Sorry but there is no "Hello world" in the tasks you posted. Providing inaccurate information isn't helpful. Regards Racke > TASK [debug] > >

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
@Stefan here is the output TASK [debug] > > ok: [localhost] => (item=10.12.1.13 10.12.1.13\n-rw-rw-r-- user1 > 2019-09-13 15:39

Re: [ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Stefan Hornburg (Racke)
On 9/25/19 9:58 AM, Mohtashim S wrote: > |   - debug: >        msg: "User was {{ item.split('\t')[3] }}" >      with_items: "{{ command_result.stdout_lines }}"| > > > The above give me the below output: > > "msg": "User was FrontEnd" > "msg": "User was BackEnd" > > > I now wish to set

[ansible-project] Assign and print variable inside a with_items loop based on condition.

2019-09-25 Thread Mohtashim S
- debug: msg: "User was {{ item.split('\t')[3] }}" with_items: "{{ command_result.stdout_lines }}" The above give me the below output: "msg": "User was FrontEnd" > "msg": "User was BackEnd" I now wish to set USER variable as user1 is returned value is FrontEnd else USER value

[ansible-project] Assign and print variable in Ansible loop with_items on consition.

2019-09-25 Thread Mohtashim S
- debug: msg: "User was {{ item.split('\t')[3] }}" with_items: "{{ command_result.stdout_lines }}" The above give me the below output: "msg": "User was FrontEnd" > "msg": "User was BackEnd" I now wish to set USER variable as user1 is returned value is FrontEnd else USER value