I have setup.yml with multiple roles:
setup.yml:
- hosts: localhost
roles:
- { role: file-download, tags: files }
- { role: setup-nginx, tags: nginx}
- { role: restart-vm, tags: restartvm }
- { role: file-upload, tags: upload}
- { role: intall-vm, tags: installvm}
- { role: create-backup, tags: backup}
From command line I can run:
ansible-playbook -i inventory setup.yml --tags=nginx
ansible-playbook -i inventory setup.yml --tags=restartvm
How can I import_playbooks to new.yml playbook and run only roles which have tag nginx and restartvm?
new.yml:
- import_playbook: setup.yml --tags=nginx
- import_playbook:setup.yml --tags=restartvm
I get following error:
ERROR! Invalid variable name in vars specified for PlaybookInclude: '--tags' is not a valid variable name
Thanks for help