I've got a .json file filled with hundreds of configuration values for an Axis network camera. The contents look like this:
{
"Name": "HTTPS.Port",
"Value": "443"
},
{
"Name": "Image.DateFormat",
"Value": "YYYY-MM-DD"
},
{
"Name": "Image.MaxViewers",
"Value": "20"
},
The Axis API, called Vapix, only provides an update function that updates a single value, so I have to circle through the values and trigger a new API call with every iteration:
name: update parameters
local_action:
module: uri
user: x
password: y
url: "{{ axis_snmp_role.server_url }}?action=update&{{ item }}"
with_items:
- "SNMP.V2c=yes"
- "SNMP.Enabled=yes"
- "ImageSource.I0.Sensor.ExposureValue=100"
Now the above example requires me to hardcode hundreds of config values into the loop. Is there a way to tell Ansible to go through the camera configuration json, update every value via a new api call and stop when there are no more values left within the json file?