##### 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 module search path = [u'/root/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-28)]
```

##### CONFIGURATION

```
ansible 2.6.1
  config file = /etc/ansible/playbooks/example/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-28)]
```

##### OS / ENVIRONMENT
CentOS Linux release 7.5.1804 (Core)

##### STEPS TO REPRODUCE

```yaml
roles/common/tasks/main.yml
---
- name: Reloading Service on {{ansible_hostname}}
  service:
    name: "{{ item }}"
    state: reloaded
  with_items: {{ servicename.split(',') | default([]) }}

- name: checking the service status {{ansible_hostname}}
  service:
    name: "{{ item }}"
    state: started
  with_items: {{ servicename.split(',') | default([]) }}
```

```YAML
playbook.yaml
- name: checking service is skipped by default
  hosts: {{host}}
  vars_files:
    - /etc/ansible/inventories/group_vars/common.yaml
  serial: 1
  roles:
    - common
```

#####Ansible command
ansible-playbook -vv --vault-id sre@/opt/sre  -i 
/etc/ansible/inventories/funccphosts test.yml --extra-vars 
"host=node1,node2"

##### EXPECTED RESULTS
i wants to just skip the task of service if i am not passing any 
servicename variable

##### ACTUAL RESULTS

```
TASK [common_role_ : Reloading Service on node1] 
****************************
task path: /etc/ansible/roles/common_role_cow/tasks/main.yml:17
Thursday 27 September 2018  13:06:27 +0000 (0:00:00.529)       0:00:09.391 
****
fatal: [node1]: FAILED! =>
  msg: '''list object'' has no attribute ''split'''

```

-- 
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/9b71590b-2ca8-4670-ad63-d3e80f0ac02b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to