Using --skip-tags does not skip the tags which are intended

Using --skip-tags does not skip the tags which are intended

Maybe I’m not understanding how skip-tags is supposed to work but in VAGRANT since there is no VMWARE provisioning I was going to skip those tags in the playbook however still getting an error on the TASKS labeled with those tags.


ansible-playbook [core 2.16.5]
config file = /vagrant/ansible.cfg
configured module search path = [‘/home/vagrant/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /home/vagrant/.local/lib/python3.11/site-packages/ansible
ansible collection location = /home/vagrant/.ansible/collections:/usr/share/ansible/collections
executable location = /home/vagrant/.local/bin/ansible-playbook
python version = 3.11.5 (main, Sep 22 2023, 15:34:29) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.11)
jinja version = 3.1.3
libyaml = True

~/.local/bin/ansible-playbook --limit= -i vagrant duoproxy.yml --skip-tags vmware-manage-tags --connection=local

After running the above

Using /vagrant/ansible.cfg as config file
[WARNING]: Unable to parse /vagrant/vagrant as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does
not match 'all'

Updated my playbook for vagrant run:

- hosts: localhost
#- hosts: duoproxy
  become: yes
    - role: common
    - role: duoproxy

Runs a lot of other tasks then odds out with the below which is supposed to be a SKIPPED tag.

TASK [vmware-manage-tags : query current guest tags settings] ***********************************************
fatal: [ -> localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'vmware_vcenter_host'. 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'vmware_vcenter_host'\n\nThe error appears to be in 
'/vagrant/roles/vmware-manage-tags/tasks/vmware-manage-tags.yml': line 18, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: query current guest tags settings\n  ^ here\n"}

Hi, perhaps it is due to the way to add tags to tasks.
How are you tagging your tasks? Also, are you using include_tasks in your roles?

1 Like

It was an ID-010-T problem…

The tags were using underscores and the tasks were using hyphens…

Too man hours looking at a screen… going to have to talk to our Ansible maintainer about this…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.