I am trying to create an ansible playbook which will help me download files and install it into our system using a rest call from a certain website. My current playbook looks like below.
---
- name: install apps
hosts: myserversservers
tasks:
- name: app installer
uri:
url: 'https://127.0.0.1:8089/services/apps/local'
method: POST
body: 'auth=XXXXXh&filename=true&name=https://XX.domain.com/app/2934/release/2.2.0/download'
headers:
Content-Type: application/x-www-form-urlencoded
url_username: admin
url_password: mypass
validate_certs: false
status_code: 201
register: result
is there a way to load multiple values to the URL in a while read kind of style so that instead of writing multiple tasks to install multiple apps i can simply use jinja to load all the variables in a single play so that with one task all the apps get installed? for example instead of writing the URL like below
https://XX.domain.com/app/**2934**/release/**2.2.0**/download
can i replace it using Jinja somehow by referencing a yaml file (include vars)? If possible how should the YAML file be formatted and how should it be referenced into the play?
https://XX.domain.com/app/{{ app number }}/release/{{ version number}}/download
i can maintain a file with all the variables that i need like
app1 ver3
app3 ver55
app99 ver99