{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/5952","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/5952/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/5952/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/5952/events","html_url":"https://github.com/ansible/ansible/issues/5952","id":27353255,"number":5952,"title":"--tags still executes all tasks","user":{"login":"imesias","id":150760,"avatar_url":"https://avatars.githubusercontent.com/u/150760?v=3","gravatar_id":"","url":"https://api.github.com/users/imesias","html_url":"https://github.com/imesias","followers_url":"https://api.github.com/users/imesias/followers","following_url":"https://api.github.com/users/imesias/following{/other_user}","gists_url":"https://api.github.com/users/imesias/gists{/gist_id}","starred_url":"https://api.github.com/users/imesias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imesias/subscriptions","organizations_url":"https://api.github.com/users/imesias/orgs","repos_url":"https://api.github.com/users/imesias/repos","events_url":"https://api.github.com/users/imesias/events{/privacy}","received_events_url":"https://api.github.com/users/imesias/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2014-02-11T14:48:33Z","updated_at":"2016-04-26T23:12:23Z","closed_at":"2014-02-11T17:43:10Z","body":"Hi,\r\n\r\nI appear to be having an issue running a specific set of tasks from a playbook. It appears to still be executing all the tasks in the playbook, I assume I'm doing something terribly wrong and probably require a bit of guidance...\r\n\r\nimesias@cody:~/Development/vagrant/ansible$ ansible-playbook -i vagrant site.yml --list-tasks \r\n\r\nplaybook: site.yml\r\n\r\n  play #1 (im):\r\n    create\r\n    get\r\n    unpack\r\n    install\r\n    remove\r\n\r\nimesias@cody:~/Development/vagrant/ansible$ ansible-playbook -i vagrant site.yml --list-tasks --tags=install\r\n\r\nplaybook: site.yml\r\n\r\n  play #1 (im):\r\n    create\r\n    get\r\n    unpack\r\n    install\r\n\r\nimesias@cody:~/Development/vagrant/odm/ansible$ ansible-playbook -i vagrant site.yml --list-tasks --tags=remove\r\n\r\nplaybook: site.yml\r\n\r\n  play #1 (im):\r\n    create\r\n    get\r\n    unpack\r\n    install\r\n    remove\r\n\r\nimesias@cody:~/Development/vagrant/ansible$ ansible-playbook -i vagrant site.yml --list-tasks --tags=remove --skip-tags=install\r\n\r\nplaybook: site.yml\r\n\r\n  play #1 (im):\r\n    remove\r\n\r\nimesias@cody:~/Development/vagrant/ansible$ ansible --version\r\nansible 1.4.4\r\n\r\nThe playbook just contains:\r\n\r\nimesias@cody:~/Development/vagrant/odm/ansible$ cat site.yml \r\n  ---\r\n  # file: site.yml\r\n  - hosts: im\r\n    sudo: yes\r\n    roles:\r\n      - { role: im, tags: [ \"remove\" ]}\r\n\r\nJust executing the playbook without specifying the tag also executes *all* tasks instead of just tasks tagged with remove. \r\n\r\nThis is the main.yml of the role im:\r\n  ---\r\n  # file: roles/im/tasks/main.yml \r\n  - name: create\r\n    file: path={{ temp_location }} state=directory\r\n    tags: \r\n      - install \r\n\r\nNot sure if this behavior is correct.\r\n  \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/214915525","html_url":"https://github.com/ansible/ansible/issues/5952#issuecomment-214915525","issue_url":"https://api.github.com/repos/ansible/ansible/issues/5952","id":214915525,"user":{"login":"sourabh-idoorkar","id":17063845,"avatar_url":"https://avatars.githubusercontent.com/u/17063845?v=3","gravatar_id":"","url":"https://api.github.com/users/sourabh-idoorkar","html_url":"https://github.com/sourabh-idoorkar","followers_url":"https://api.github.com/users/sourabh-idoorkar/followers","following_url":"https://api.github.com/users/sourabh-idoorkar/following{/other_user}","gists_url":"https://api.github.com/users/sourabh-idoorkar/gists{/gist_id}","starred_url":"https://api.github.com/users/sourabh-idoorkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourabh-idoorkar/subscriptions","organizations_url":"https://api.github.com/users/sourabh-idoorkar/orgs","repos_url":"https://api.github.com/users/sourabh-idoorkar/repos","events_url":"https://api.github.com/users/sourabh-idoorkar/events{/privacy}","received_events_url":"https://api.github.com/users/sourabh-idoorkar/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T23:12:23Z","updated_at":"2016-04-26T23:12:23Z","body":"+1 Faced the same issue. Created a role that does install as well as uninstall of a product. Tagged the related tasks separately as install and uninstall and created 2 playbooks with that role, and install and uninstall tag for each playbook. And when I ran the install playbook, ended up installing as well as deleting the entire product.\r\n\r\nWeird thing on top. When I ran the playbook with --tags set to install, it still went ahead and ran both install as well uninstall tasks. Its only when I passed both --tags set to install and --skip-tags to uninstall that it finally did only what it was supposed to. I would have thought atleast the --tag alone should be enough limit the execution."}}