I'm writing an Ansible role which will update the settings of an existing application configuration. The role must get the settings from the application's API. Alter a portion of the settings. Then POST the complete set back to the application.
- name: Get Current Settings
shell: curl -L -H "Accept: application/json" -u "{{auth}}" https://{{ server }}/api/settings
register: settings
- name: update settings
<Do something to modify settings.stdout as JSON>
register: newSettings # Save
when: settings.Changed = True
- name: Post Settings
shell: curl -L -u "{{auth}}" -X POST -H "Content-Type: application/json" -d {{newSettings}}