I am trying to run some tasks with variable but running in this error "FAILED! => {“reason”: “Unable to retrieve file contents\nCould not find or access 'path to my .yml ’ on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option”}
the task is to check and verify a response.
can you paste the tasks? hard to tell with just the errors.
this line calls the task include_tasks: includes/find_ucp.yml ping_servers= “{{ groups.ucp }}”
- name: check
uri:
url: “https://{{ item }}.{{ domain_name }}/auth/login”
headers:
Content-Type: application/json
method: POST
status_code: 200,500
body_format: json
validate_certs: no
body: ‘{“username”:“{{ ucp_username }}”,“password”:“{{ ucp_password }}”}’
delegate_to: localhost
register: checks
failed_when: false
changed_when: false
when: checks.status !=200 and checks.status != 500
with_items: “{{ ping_servers }}”
no_log: yes
how does your directory structure looks like? are you using a role? you can add find_ucp.yml under tasks/ and when you do the include from main.yml or another .yml in the same directory it should grab it easier.
so there’s no way its going to find it because its a different total directory. I don’t know if the playbook file has like include_vars or include_tasks that points to the include/ dir but, its hard to tell with all all this directories and files. I suggest you do what I mentioned before.
copy the find_ucp.yml to the role you are trying to use and put it on the tasks/ dir. Then from one of the .yml files in the tasks/ dir do the include_tasks from there.