Reputation: 502
I try to use a vars-file with the parameter include_vars in my task. Because I will seperate the vars for interfaces/hosts and credentials. Without this option, the task run without syntax error. But if I put this option in my task I get the message:
ERROR! conflicting action statements
The error appears to have been in '/home/devops/ansible/roles/dev/nrpe_config/tasks/main.yml': line 27, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: copy Check Files for ENV from templates
^ here
The error appears to have been in
'/home/devops/ansible/roles/dev/nrpe_config/tasks/main.yml': line 27,
column 7, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: copy Check Files for ENV from templates
^ here
My Task:
- name: copy Check Files for Env from templates
template: src={{item}} dest=/home/nrpe/{{item}} owner=nrpe group=nrpe mode=u+x backup=yes
with_fileglob:
- "/etc/ansible/roles/nrpe_config/nrpe_scripts/templates/env/*"
include_vars: file='interfaces.yml' name=interfaces
Tree file
├── tasks
│ ├── main.bak
│ └── main.yml
└── vars
├── interfaces.yml
└── main.yml
Greetings niesel
Upvotes: 0
Views: 7464
Reputation: 68289
include_vars
and template
are two different modules, you can use them in one task, make two instead:
- name: include vars
include_vars: file='interfaces.yml' name=interfaces
- name: copy Check Files for Env from templates
template: src={{item}} dest=/home/nrpe/{{item}} owner=nrpe group=nrpe mode=u+x backup=yes
with_fileglob:
- "/etc/ansible/roles/nrpe_config/nrpe_scripts/templates/env/*"
Upvotes: 2