Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-10-01 Thread Kunalsing Thakur
Hi Brian, As you suggested its worked for input parameter but not for default it giving failed task - name: Reloading Service service: name: "{{ item }}" state: reloaded with_items: "{{ servicename.split(',') | ternary((servicename|default('')).split(','),[]) }}" Output result. ans

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-28 Thread Kunalsing Thakur
Brian Can you help me? what can add in with_items? On Thursday, September 27, 2018 at 10:31:08 PM UTC+5:30, Brian Coca wrote: > > just substitute for notdefined > > > > -- > -- > Brian Coca > -- You received this message because you are subscribed to the Google Groups "Ansible Proj

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
Hi Brian, i have defined like this:- - name: Reloading Service on {{ansible_fqdn}} service: name: "{{ item }}" state: reloaded with_items: "{{ servicename.split(',') | ternary((notdefined|default('')).split(','),[]) }}" fatal: [node1]: FAILED! => msg: '''list object'' has no attr

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
On Thursday, September 27, 2018 at 10:57:15 PM UTC+5:30, Kunalsing Thakur wrote: > > if i did not pass servicename while running ansible-playbook it will skipp > the service task > and if i pass servicename the service will reloaded and check whether > service is running or not. > > > On Thurs

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
if i did not pass servicename while running ansible-playbook it will skipp the service task and if i pass servicename the service will reloaded and check whether service is running or not. On Thursday, September 27, 2018 at 10:46:55 PM UTC+5:30, Kunalsing Thakur wrote: > > Like this. > - name:

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
Like this. - name: Reloading Service on {{ansible_fqdn}} service: name: "{{ item }}" state: reloaded with_items: "{{ (notdefined is defined)|ternary((notdefined|default('')).split(','),[]) }}" But i don't see servicename there. Can you just write one line of with_items so that i can

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Brian Coca
just substitute for notdefined -- -- 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+unsubscr...@googlegroups.com. To p

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
Can you help me On Thu, 27 Sep 2018, 19:49 Kunalsing Thakur, wrote: > where i can define servicename in last condition > > On Thursday, September 27, 2018 at 7:31:02 PM UTC+5:30, Brian Coca wrote: >> >> You are not using |default correctly, the split needs a defined >> variable to work on: >> >>

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
where i can define servicename in last condition On Thursday, September 27, 2018 at 7:31:02 PM UTC+5:30, Brian Coca wrote: > > You are not using |default correctly, the split needs a defined > variable to work on: > > with_items: {{ (servicename|default('')).split(',') }} > > That still create

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
Brian Can you just edit the playbook and show me how is going to work? On Thursday, September 27, 2018 at 7:31:02 PM UTC+5:30, Brian Coca wrote: > > You are not using |default correctly, the split needs a defined > variable to work on: > > with_items: {{ (servicename|default('')).split(',') }}

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Brian Coca
You are not using |default correctly, the split needs a defined variable to work on: with_items: {{ (servicename|default('')).split(',') }} That still creates a list with single blank item so you might want to add a defined check with_items: "{{ (notdefined is defined)|ternary((notdefined|defau

[ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
# SUMMARY When i want to use specific tag in playbook from role it will run all task which is defined in role. # ISSUE TYPE - Bug Report # COMPONENT NAME ansible-core # ANSIBLE VERSION ``` ansible 2.6.1 config file = /etc/ansible/playbooks/example/ansible.cfg configured mo