Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags not working #189

Open
tungduong1809 opened this issue Aug 19, 2023 · 0 comments
Open

Tags not working #189

tungduong1809 opened this issue Aug 19, 2023 · 0 comments

Comments

@tungduong1809
Copy link

tungduong1809 commented Aug 19, 2023

Tag doesn't work when i run playbook

  • Playbook
    main.yml
- name: Install and configure pdns
  hosts: pdns_cluster
  become: true
  gather_facts: false
  any_errors_fatal: true
  roles:
    - role: pdns-ansible

When a matching tag is passed in, the role is run, but when running to the task containing the install tag or any other tag in the role, it is skipped

ansible-playbook -i inventories/production/hosts main.yml -t install

PLAY [Install and configure pdns] ****************************************************************************************************************************

TASK [pdns-ansible : Include OS-specific variables] **********************************************************************************************************
ok: [pdns-01] => (item=/home/idg/tungnt/roles/pdns-ansible/vars/Debian.yml)
ok: [pdns-02] => (item=/home/idg/tungnt/roles/pdns-ansible/vars/Debian.yml)

TASK [pdns-ansible : include_tasks] **************************************************************************************************************************
skipping: [pdns-01]
skipping: [pdns-02]

TASK [pdns-ansible : include_tasks] **************************************************************************************************************************
included: /home/idg/tungnt/roles/pdns-ansible/tasks/install.yml for pdns-01, pdns-02

PLAY RECAP ***************************************************************************************************************************************************
pdns-01                    : ok=5    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
pdns-02                    : ok=5    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

I researched and learned that the tag in include_tasks will not be executed if the tag is not placed both outside and in include_tasks
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_tags.html#selectively-running-tagged-tasks-in-re-usable-files

@tungduong1809 tungduong1809 changed the title Tags not executed Tags not working Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant