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
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
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
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
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:
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
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
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:
>>
>>
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
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(',') }}
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
# 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
12 matches
Mail list logo