Hi guys,
I am writing a number of yaml playbook to run some JSON curl command. the first part of that JSON once run returned a response which is call versionId and applicationId. something key and value.That part 2 supposed use the value of versionId “local$43d12cfd-f64a-4fa9-9367-3a0109c1721d” part one in the applications array of part 2. Is it possible rather than use the value “versionId”: “local$43d12cfd-f64a-4fa9-9367-3a0109c1721d” on applications. Something like application [“versionId”] so anytime I have a new versionId applications will pick that new value. I don’t if it makes sens. all I want to do is to make that more configurable
1- upload
- local_action: shell curl --basic -u admin:admin -F file=@/etc/ansible/playbooks/ms3-test-app-1.0.0-SNAPSHOT.zip -F name=ms3-test-app -F version=2.0 --header “Content-Type:multipart/form-data” “http://52.73.56.141:8080/mmc-console-3.6.2/api/repository”
register: upload
- name: what got saved
and here is the response :
{
“applicationId”: “local$4199473f-3106-4a13-bf4a-ae546413b689”,
“versionId”: “local$43d12cfd-f64a-4fa9-9367-3a0109c1721d”
}
2- deploy
- uri:
url=http://{{ mmc_hostname}}:{{ http_port }}/{{ mmc_version }}/api/deployments
method=POST
force_basic_auth=yes
user=admin
password=admin
body_format=json
status_code=302
body=‘{“name”:“ms3-simple-hello-world-app”,“servers”:[“local$d50bdc24-ff04-4327-9284-7bb708e21c25”],“applications”:[“versionId”]}’
headers=Content-Type=application/json
register: deployment
ignore_errors: true
- name: what got saved after deployement
debug: var=deployment