- set_fact:
version_file: "{{ lookup('file','/opt/gitlab/version-manifest.json') | from_json }}"
installed_version: version_file.build_version
TASK [gitlab-ce : set_fact] ****************************************************
[WARNING]: Unable to find '/opt/gitlab/version-manifest.json' in expected
paths.
fatal: [host.domain.com]: FAILED! => {"failed": true, "msg": "An unhandled exception occurred while running the lookup plugin 'file'. Error was a <class 'ansible.errors.AnsibleError'>, original message: could not locate file in lookup: /opt/gitlab/version-manifest.json"}
to retry, use: --limit @/var/tmp/jenkins/team_SCSCM/gitlab-ce/install-gitlab-ce/ansible-playbooks/gitlab-ce.retry
PLAY RECAP *********************************************************************
rtp-scm-lnx26.cisco.com : ok=5 changed=0 unreachable=0
--
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-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f4f129f1-bbaa-4b5e-856a-afb5f1a6e86c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
lookups only execute on the local ansible controller.You will need to use something such as the slurp module to fetch the contents of the file.- slurp:path: /opt/gitlab/version-manifest.jsonregister: version_file- set_fact:installed_version: "{{ (version_file.content|b64decode|from_json).build_version }}"
On Mon, Jan 22, 2018 at 1:32 PM, ZillaYT <zil...@gmail.com> wrote:
I following the technique suggested in how to read json file using ansible suggestion in Stackoverflow, and I do this
- set_fact:
version_file: "{{ lookup('file','/opt/gitlab/version-manifest.json') | from_json }}"
installed_version: version_file.build_version
However I get the error
TASK [gitlab-ce : set_fact] ****************************************************
[WARNING]: Unable to find '/opt/gitlab/version-manifest.json' in expected
paths.
fatal: [host.domain.com]: FAILED! => {"failed": true, "msg": "An unhandled exception occurred while running the lookup plugin 'file'. Error was a <class 'ansible.errors.AnsibleError'>, original message: could not locate file in lookup: /opt/gitlab/version-manifest.json"}
to retry, use: --limit @/var/tmp/jenkins/team_SCSCM/gitlab-ce/install-gitlab-ce/ansible-playbooks/gitlab-ce.retry
PLAY RECAP *********************************************************************
rtp-scm-lnx26.cisco.com : ok=5 changed=0 unreachable=0The file is there on the remote machine. What gives?
--
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/f4f129f1-bbaa-4b5e-856a-afb5f1a6e86c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.