This is what I have now, and it is still not working.
- name: Get app version
command: curl -H application/json localhost:8088/rs
register: get_version
ignore_errors: true

Advertising

- name: Set app version as fact
set_fact:
fact_app_version:
app_version: "{{ ((get_version |
default({'stdout':'N/A'})).stdout | from_json).version }}"
ignore_errors: true
- name: Gather facts
setup:
register: ansible_facts
- name: Send facts somewhere
local_action:
module: uri
url: "{{ some_url }}"
method: PUT
body: "{{ ansible_facts | combine(fact_app_version) | to_json }}"
status_code: 204
body_format: json
The error is:
FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value
([]), and could not be converted to an dict. Error was: No JSON object
could be decoded\n\nThe error appears to have been in 'update-facts.yml':
line 18, column 7, but may\nbe elsewhere in the file depending on the exact
syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set
app version as fact\n ^ here\n"}
I am fairly certain what I am trying to do should be rather simply, however
the more I dig into it, the uglier it gets.
I want to add an optional fact to the dictionary of facts, and then send
all facts somewhere.
What is the suggested approach do accomplish this?
--
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+unsubscr...@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/64364378-949c-4013-b239-b20641ef2e84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.