include_tasks: Unable to retrieve file contents\nCould not find or access

2,915 views
Skip to first unread message

OM Nachiketa

unread,
Aug 13, 2018, 12:54:58 PM8/13/18
to Ansible Project
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.

Jonathan Lozada De La Matta

unread,
Aug 13, 2018, 12:56:33 PM8/13/18
to ansible...@googlegroups.com
can you paste the tasks? hard to tell with just the errors.

On Mon, Aug 13, 2018 at 12:55 PM OM Nachiketa <om.nac...@gmail.com> wrote:
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.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b208da38-dffb-42f2-a2f1-7a62f0975c6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Jonathan lozada de la matta

AUTOMATION CONSULTANT - AUTOMATION PRACTICE

Red Hat Consulting Services

jloz...@redhat.com   



 

OM Nachiketa

unread,
Aug 13, 2018, 1:10:51 PM8/13/18
to ansible...@googlegroups.com
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



Jonathan Lozada De La Matta

unread,
Aug 13, 2018, 1:13:49 PM8/13/18
to ansible...@googlegroups.com
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.


For more options, visit https://groups.google.com/d/optout.

OM Nachiketa

unread,
Aug 13, 2018, 1:17:00 PM8/13/18
to ansible...@googlegroups.com

Jonathan Lozada De La Matta

unread,
Aug 13, 2018, 1:22:57 PM8/13/18
to ansible...@googlegroups.com
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.


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages