Skip to content

Instantly share code, notes, and snippets.

@rjgonza
Last active April 25, 2021 00:12
Show Gist options
  • Save rjgonza/4eacebac161ec2afa2f2f219d16ac1a1 to your computer and use it in GitHub Desktop.
Save rjgonza/4eacebac161ec2afa2f2f219d16ac1a1 to your computer and use it in GitHub Desktop.
tasks/tasks_b.yml
---
- name: tasks_b - 1
tags: [never, tags_b]
debug:
msg: This is a test from the tasks_b tasks
tasks/tasks_a.yml
---
- name: tasks_a - 1
tags: [never, tags_a]
debug:
msg: This is a test from the tasks_a tasks
tasks/main.yml
---
- include_tasks: "{{ role_path }}/tasks/tasks_a.yml"
tags: [never, tags_a]
- include_tasks: "{{ role_path }}/tasks/tasks_b.yml"
tags: [never, tags_b]
ansible-playbook -i hosts playbooks/testing.yml -l worker1 -t tags_a
PLAY [all] *********************************************************************************************************************************************************************************************************
TASK [testing : include_tasks] *************************************************************************************************************************************************************************************
included: /home/ramon/code/Lab/ansible/playbooks/roles/testing/tasks/tasks_a.yml for worker1
TASK [testing : tasks_a - 1] ***************************************************************************************************************************************************************************************
ok: [worker1] => {
"msg": "This is a test from the tasks_a tasks"
}
TASK [testing : include_tasks] *************************************************************************************************************************************************************************************
included: /home/ramon/code/Lab/ansible/playbooks/roles/testing/tasks/tasks_b.yml for worker1
TASK [testing : tasks_b - 1] ***************************************************************************************************************************************************************************************
ok: [worker1] => {
"msg": "This is a test from the tasks_b tasks"
}
PLAY RECAP *********************************************************************************************************************************************************************************************************
worker1 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ramon@royrig:~/code/Lab/ansible (master)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment