- name: lookup act_transaction in database
mongo_query: >
host={{ams_ip}} user=user password={{pass}}
database=db collection=transactions
filter='{}' projection='{"_id":True}'
sort='start_time' direction=-1 limit=1
register: query
- name: login to gui
run_once: yes
uri:
url: "https://{{ ip }}/login"
method: POST
follow_redirects: all
body: "username={{amg_username}}&password={{amg_password}}&next=/"
HEADER_Origin: "https://{{ ams_ip }}"
HEADER_Content-Type: application/x-www-form-urlencoded
register: cookie
- name: create request body
set_fact:
req:
_id: "{{ query.results[0]._id['$oid'] }}"
guids: [ "{{ guid }}" ]
- debug: var=genconfig_req
- debug: msg="{{ genconfig_req }}"
- name: generate config
when: ams_deploy and do_act
uri: >
url="https://{{ ams_ip }}/generate_config"
method=POST
body="{{ req|to_nice_json }}"
follow_redirects=all
HEADER_Origin="https://{{ ams_ip }}"
HEADER_Content-Type=application/json
HEADER_Cookie="{{ cookie.set_cookie }}"