O
O
oni__ino2015-08-03 14:13:05
Software Deployment
oni__ino, 2015-08-03 14:13:05

Tags not working in ansible playbook, where did I go wrong?

In the main playbook.yml, if you specify the "aaa" tag in the role and call it with the standard method without additional parameters, the template role performs all tasks with the aaa and bbb tags. Well, that is, tags do not work globally in - include, although Ansible does not swear. If tags can be used for tasks, why can't I include an additional *.yml file so that I don't write tags for each task.?
Below is what I mean.
Ansible version 1.9.2
Directory structure

-- template-role/
        -- tasks/
             - main.yml
             - aaa.yml
             - bbb.yml
 - hosts
 - playbook_test_install.yml

I start the installation with the following command
ansible-playbook -i hosts playbook_test_install.yml
File contents
#file: playbook_test_install.yml
- hosts: test-install
sudo: yes
roles:
- { role: template-role, tags: "host-aaa" }
#file : template-role/tasks/main.yml
- include: aaa.yml tags="host-aaa"
- include: bbb.yml tags="host-bbb"
# hosts
[test-install]
test-server.local ansible_ssh_host= 192.168.20.25 ansible_ssh_user=ansible
= Currently only works through variables defined in var =
Thanks for the comments.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question