I have one ansible role with this structure:
── prepare-workstation.yaml
── group_vars
└── roles
├── build-nginx-proxy
│ ├── defaults
│ ├── tasks
│ └── templates
│ └── nginx.yml
│
├── ca
│ ├── defaults
│ ├── handlers
│ ├── tasks
│ └── templates
and prepare-workstation.yaml
content is:
---
- name: Prepare workstation
hosts:
- workstation
roles:
- { role: ca}
- { role: build-nginx-proxy }
I want build-nginx-proxy
role run with nginx.yml
not tasks/main.yml
.
how can I pass index.yml
to build-nginx-proxy
role?
something like this:
---
- name: Prepare workstation
hosts:
- workstation
roles:
- { role: ca}
- { role: build-nginx-proxy, 'nginx.yml' }
2
Answers
if you want something parametric, use a local var:
and in main.yml, you do
its better to put the task nginx.yml in folder tasks, no need to add
../
Try this
or try include_tasks
here is the roles documentation