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.
ansible-playbook --extra-vars "host=node1 servicename=[]" test.yml
TASK [role_common : Reloading Service]
****************************************************************
task path: /etc/ansible/roles/tasks/common.yml:17
Monday 01 October 2018 07:19:09 +0000 (0:00:00.582) 0:00:12.273
********
failed: [node1] (item=[]) => changed=false
item: '[]'
msg: 'Could not find the requested service []: host'
Waiting for your response.
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 Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/527eff49-b9aa-47c4-9e02-a9d3fd51919f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.