Home > database >  fatal: [localhost]: FAILED! => {"changed": false, "msg": "Could not find
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Could not find

Time:11-30

Any help in this issue is appreciated.

I am trying to copy json file using Ansible template to localhost and run curl command to import datadog dasboard.

Jenkins error:

TASK [datadog-dashboard : Import Datadog Dashboard in main] ********************
16:54:24  included: /home/jenkins/agent/workspace/5052/non_production/monitoring-as-code/src/roles/datadog-dashboard/tasks/Import.yaml for localhost
16:54:24  
16:54:24  TASK [datadog-dashboard : Copying Dashboard json file] *************************
16:54:24  fatal: [localhost]: FAILED! => {"changed": false, "msg": "Could not find or access 'src/roles/datadog-dashboard/templates/datadog-dashboard/non_production/NonProd.json'\nSearched in:\n\t/home/jenkins/agent/workspace/5052/non_production/monitoring-as-code/src/roles/datadog-dashboard/templates/src/roles/datadog-dashboard/templates/datadog-dashboard/non_production/NonProd.json\n\t/home/jenkins/agent/workspace/5052/non_production/monitoring-as-code/src/roles/datadog-dashboard/src/roles/datadog-dashboard/templates/datadog-dashboard/non_production/NonProd.json\n\t/home/jenkins/agent/workspace/5052/non_production/monitoring-as-code/src/roles/datadog-dashboard/tasks/templates/src/roles/datadog-dashboard/templates/datadog-dashboard/non_production/NonProd.json\n\t/home/jenkins/agent/workspace/5052/non_production/monitoring-as-code/src/roles/datadog-dashboard/tasks/src/roles/datadog-dashboard/templates/datadog-dashboard/non_production/NonProd.json\n\t/home/jenkins/agent/workspace/5052/non_production/monitoring-as-code/src/templates/src/roles/datadog-dashboard/templates/datadog-dashboard/non_production/NonProd.json\n\t/home/jenkins/agent/workspace/5052/non_production/monitoring-as-code/src/src/roles/datadog-dashboard/templates/datadog-dashboard/non_production/NonProd.json on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

Ansible code:

- name: Copying Dashboard json file
  template:
    src: src/roles/datadog-dashboard/templates/datadog-dashboard/{{ application_env }}/NonProd.json
    dest: /tmp/5052-dash.json
    mode: '0644'

CodePudding user response:

It worked for following path only:

 templates/datadog-dashboard/{{ application_env }}/NonProd.json
  • Related