I pass a variable ACTION to site.yml as below.
ansible-playbook -v -i sslhost.txt -e "APP_NAME=ssl-perf ACTION=renewal, gen_cert" site.yml
My site.yml has ansible role called "manager" to which i m passing ACTION variable as tags. See below.
more site.yml
- hosts: "{{APP_NAME}}"
user: "{{USER}}"
roles:
- { role: manager, APPLICATION_NAME: "{{ APP_NAME }}", tags: [ '{{ ACTION }}' ] }
The manager role's tasks/main.yml looks like this
more manager/tasks/main.yml
---
# tasks file for manager
- include: manager_pull.yml
tags: renewal
- include: manager_gen.yml
tags: gen_request
- include: manager_gencert.yml
tags: gen_cert
- include: manager_push.yml
tags: install
I was expecting only manager_pull.yml and manager_gencert.yml to be included in the roles but the output shows that all the include in the manager role gets included / invoked.
My ansible version is: 2.1.0.0
Can you please explain why am i not able to pass ACTION variable as tags to ansible role ?
Alternatively can anyone also tell me if and how would it be possible to pass tags instead of ACTION variable to the site.yml and get this to work ?