PowerDNS/pdns-ansible

Tags not working

tungduong1809 opened this issue · 0 comments

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