[ansible-project] Need help on using a variable in when condition

2020-05-26 Thread Pandu jh
I have a below task in my playbook. It checks the desired count of the process specified in vars. If a task returned 50 value and since it has 0. my condition gets satisfied which is incorrect. vars: - sap_process_count: "0" tasks: - name: Pre Check - Verifying app status

Re: [ansible-project] Need to pass variable and hostname to a playbook from CSV file.

2020-04-08 Thread Pandu jh
> localhost : ok=2 changed=1unreachable=0 > failed=0skipped=0rescued=0ignored=0 > host1 :

[ansible-project] Re: Need to pass variable and hostname to a playbook from CSV file.

2020-04-08 Thread Pandu jh
: print csv items > > debug: > > msg: "{{ip.list.2.ip}} {{ip.list.2.username}} {{ip.list.2.host}}" > > - name: > > shell: "ssh {{ip.list.2.username}}@{{ip.list.2.ip}} 'ls -la'" > > > > > > > > > On Wednesday

[ansible-project] Need to pass variable and hostname to a playbook from CSV file.

2020-03-18 Thread Pandu jh
I have a CSV file that contains the IP's and it's variables. I need to use the details to log in to the host and use the respective variable's value of the specfic IP's. Please help me out with this. # cat AnsibleTest.csv ip,var1,var2 10.1.1.1,rchantif1,mechlab 10.1.1.2,rchans01,contlab --

Re: [ansible-project] Need to filter with_items values based on specific string

2019-11-25 Thread Pandu jh
It worked. Thanks, much !! On Monday, 25 November 2019 19:23:44 UTC+5:30, Stefan Hornburg (Racke) wrote: > > On 11/25/19 2:42 PM, Pandu jh wrote: > > > > I need to reject "none" value item in ping test task. It has to take > only "non- none" va

[ansible-project] Get host name of the servers where the task failed

2019-08-21 Thread Pandu jh
I have a task in my playbook where it runs against multiple servers. I need to get the hostname of all servers where my task failed and append it to a variable as a list. Please assist how to get this. --- - name: GET OS DETAILS hosts: all tasks: - name: GET shell: lsb_release -a | grep Release

[ansible-project] Need to generate a report about the failed tasks with host names

2019-07-09 Thread Pandu jh
I have a playbook which runs on multiple servers to monitor the hung cron processes count. If the host has hung processes, the playbook will kill the processes and it will restart the crond service. My requirement is to generate the file report that should contain the hostname where it hung

Re: [ansible-project] How to filter ipaddress and hostname and store it to different variable

2019-06-25 Thread Pandu jh
Z].*)') | list }}" - debug: var=host_list On Tuesday, 25 June 2019 00:14:02 UTC+5:30, Dick Visser wrote: > > On Sun, 23 Jun 2019 at 20:08, Pandu jh > > wrote: > > >

Re: [ansible-project] How to filter ipaddress and hostname and store it to different variable

2019-06-23 Thread Pandu jh
d string or buffer"} to retry, use: --limit @/playbooks/var_check.retry On Sunday, 23 June 2019 09:11:50 UTC+5:30, Dick Visser wrote: > > And the error is...? > > On Sat, 22 Jun 2019 at 22:06, Pandu jh > > wrote: > >> My variable looks below. >> >>

Re: [ansible-project] How to filter ipaddress and hostname and store it to different variable

2019-06-23 Thread Pandu jh
: expected string or buffer"} to retry, use: --limit @/var/lib/awx/projects/solarwinds_ansible/playbooks/var_check.retry On Sunday, 23 June 2019 09:11:50 UTC+5:30, Dick Visser wrote: > > And the error is...? > > On Sat, 22 Jun 2019 at 22:06, Pandu jh > > wrote: &g

Re: [ansible-project] How to filter ipaddress and hostname and store it to different variable

2019-06-22 Thread Pandu jh
My variable looks below. ip_addr: | 1.12.6.9 myhost Myhost.example.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

Re: [ansible-project] How to filter ipaddress and hostname and store it to different variable

2019-06-22 Thread Pandu jh
host_list: "{{ ip_addr.split(\n) | regex_search('^[a-z].*') }}" - debug: var=host_list On Saturday, 22 June 2019 04:33:09 UTC+5:30, Dick Visser wrote: > > You should be able to use a regular expression to filter hostnames > > On Fri, 21 Jun 2019 at 16:54, Pandu jh &g

Re: [ansible-project] How to filter ipaddress and hostname and store it to different variable

2019-06-21 Thread Pandu jh
Ok Thanks. -- 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 post to this group, send email to

[ansible-project] How to filter ipaddress and hostname and store it to different variable

2019-06-21 Thread Pandu jh
I have a variable that contains short hostname, FQDN and IP addresses. I need to filter sort hostname/FQDNs and it should store to a variable and also IP addresses should store to an another variable(this am able to do using ipaddr) Please help me to filter hostnames and store to a variable.

Re: [ansible-project] When Condition check is not working in a list as expected.

2019-03-01 Thread Pandu jh
Thank you, It worked. On Friday, 1 March 2019 00:50:41 UTC+5:30, Kai Stian Olstad wrote: > > On 28.02.2019 13:52, Pandu jh wrote: > > When Condition check is not working in a list as expected. > > > > My requirement is > > > > Playbook should not fail

[ansible-project] When Condition check is not working in a list as expected.

2019-02-28 Thread Pandu jh
When Condition check is not working in a list as expected. My requirement is Playbook should not fail If all the three mentioned variables have "no_share" value. But it's failing not sure what causing this issue. - debug: var=open_shares_info - debug: var=linked_dirs_list -

Re: [ansible-project] Skip import playbook using when condition.

2019-02-28 Thread Pandu jh
Ok, Thank you James On Thursday, 28 February 2019 00:37:21 UTC+5:30, James Cassell wrote: > > On Wed, Feb 27, 2019, at 1:43 PM, Pandu jh wrote: > > > > If there are no hosts added to add host, subsequent plays should be > > skipped. Please let me know how t

[ansible-project] Skip import playbook using when condition.

2019-02-27 Thread Pandu jh
If there are no hosts added to add host, subsequent plays should be skipped. Please let me know how to provide when condition for this - name: hosts: rchadm01 vars_files: - var.yml tasks: - name: add_host: name: "{{ decom_host }}" groups: decom_host_group -

[ansible-project] Help to write condition to get vars from multiple imported playbooks

2019-02-27 Thread Pandu jh
I have 1 main playbook and 3 playbooks imported in the main playbook. These 3 imported playbooks are dependent on each other. 1st imported playbook will get host inventory from main play through add_host 2nd imported playbook will get host inventory from 1st play through add_host 3rd imported

Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
Thank you so much for the explanation. -- 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 post to this group,

Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
If possible could you please explain the syntax, It will be very helpful for me to use it in other cases. On Tuesday, 19 February 2019 21:36:41 UTC+5:30, Pandu jh wrote: > > Sorry my bad, it missed it. it's working perfectly now, Thanks much !! > >

Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
;rchtest01.lab.com" } On Tuesday, 19 February 2019 21:33:26 UTC+5:30, Kai Stian Olstad wrote: > > On 19.02.2019 16:57, Pandu jh wrote: > > This was

Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
of print statement', got 'string'. String: {{ host_fqdn if 'lab.com' in host_fqdn else host_fqdn '.lab.com' }}"} On Tuesday, 19 February 2019 21:24:38 UTC+5:30, Kai Stian Olstad wrote: > > On 19.02.2019 16:49, Pandu jh wrote: > > Can you please confirm, if the below syntax

Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
b.com' }}" - debug: var=host_fqdn On Tuesday, 19 February 2019 21:11:59 UTC+5:30, Kai Stian Olstad wrote: > > On 19.02.2019 15:41, Pandu jh wrote: > > Search keyword in "host_fqdn" variable. If the value has "lab.com" > > keyword > > i

[ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
Search keyword in "host_fqdn" variable. If the value has "lab.com" keyword in it, it should directly store the value to "host_fqdn" again or else it should add "lab.com" keyword to the value and store it to "host_fqdn" variable. Please assist. vars: host_fqdn: server host_fqdn: |

[ansible-project] How to pass variable of in memory inventory to next plays using hostvars

2019-02-13 Thread Pandu jh
How to pass variable of in memory inventory to following next plays using hostvars. "nfs_server" variable to be passed from play 2 to play 3 and these plays are using in-memory inventories. Play:1 - add_host: name: "{{ group1_host }}" groups: group1 Play 2: - name:

[ansible-project] Use Ansible jinja2 filter reject in stdout_lines

2019-02-12 Thread Pandu jh
I need to reject "*" from stdout lines. all values from stdout_lines except "*" symbol to be saved to "nfs_clients" variable "stdout_lines": [ "rchinnn01", "rchinnn02", "*" ] - set_fact: nfs_clients: "{{ nfs_clients_out.stdout_lines |

Re: [ansible-project] How do I exit Ansible playbook without error on a condition

2018-11-26 Thread Pandu jh
23:05:12 UTC+5:30, Kai Stian Olstad wrote: > > On Saturday, 24 November 2018 18:19:26 CET Pandu jh wrote: > > I have 3 plays in a playbook. In a task in 1st play, If the desired > value > > is not set to variable, the execution should exist with success status > and

Re: [ansible-project] How do I exit Ansible playbook without error on a condition

2018-11-26 Thread Pandu jh
uter wrote: > > https://docs.ansible.com/ansible/2.7/modules/meta_module.html > > > - meta: end_play >when: condition is true > > > > Am 24.11.18 um 18:35 schrieb Kai Stian Olstad: > > On Saturday, 24 November 2018 18:19:26 CET Pandu jh wrote: > >&

[ansible-project] How do I exit Ansible playbook without error on a condition

2018-11-24 Thread Pandu jh
I have 3 plays in a playbook. In a task in 1st play, If the desired value is not set to variable, the execution should exist with success status and remaining plays also should not get executed. -- You received this message because you are subscribed to the Google Groups "Ansible Project"

[ansible-project] Filter specific string from file content and it needs to be looped into mail module

2018-11-23 Thread Pandu jh
I have multiple files in a path and it contains mail id of the users. I need to loop the file content using with_items and filter users ID from the file content. That ID's should be passed into mail module, mail needs to be sent to those user ID's. Please help me filter only ID form the file

[ansible-project] To list the target host's name and it's IP address using facts

2018-09-06 Thread Pandu jh
I need to list the target host's name and IP address using set_fact. Below is my playbook, but it's giving error. hosts: all tasks: - set_fact: data: "{{ ansible_all_ipv4_addresses }}" - set_fact: ip: "{{ data.split(',') }}" - name: Show the devices

Re: [ansible-project] Understanding become_user Privilege Escalation

2018-08-20 Thread Pandu jh
Need below info. 1. Can you paste here, sudo entry lines of jenkins user from sudoers file. 2. From which user id you are executing the playbook? >> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

[ansible-project] Request immediate help - Need to execute playbook on hosts based on the host status from the previous playbooks.

2018-08-17 Thread Pandu jh
I have 3 playbooks in workflow template and these playbooks would execute on multiple hosts. If 1st playbook fails on few hosts and the 3rd playbook should get execute only on the failed hosts. And whatever hosts passed in 1st playbooks and 2nd playbook should get execute only on the passed