forked from brahmanim/playbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_automate_retry.yml
71 lines (66 loc) · 2.15 KB
/
set_automate_retry.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
# Playbook to update attributes in the root object in automate workspace
# This example shows how to set a Automate Retry and also allows you
# to preserve state attributes
# You can pass in extra vars to control the automate_workspace
- hosts: localhost
vars:
retry_attrs: { 'ae_result': 'retry', 'ae_retry_interval': 60 }
other_attrs: { 'name': 'Fred Flintstone', 'city': 'Bedrock' }
state_attrs: { 'my_task_id': 99, 'save_this': 'secret' }
tasks:
- name: Set the automate workspace url
set_fact:
aws_url: "{{ manageiq.api_url }}/api/{{ manageiq.automate_workspace }}"
- name: Fetch the Workspace
uri:
url: "{{ aws_url }}"
method: GET
validate_certs: False
headers:
X-Auth-Token: "{{ manageiq.api_token }}"
Content-Type: "application/json"
status_code: 200
register: workspace
- debug: var=workspace
- name: Set the Retry Attribute
uri:
url: "{{ aws_url }}"
method: POST
body:
action: edit
resource: "{ 'objects': { 'root': {{ retry_attrs }} }, 'state_vars': {}}"
body_format: json
validate_certs: False
headers:
X-Auth-Token: "{{ manageiq.api_token }}"
Content-Type: "application/json"
status_code: 200
register: output
- name: Set the Other Attributes
uri:
url: "{{ aws_url }}"
method: POST
body:
action: edit
resource: "{ 'objects': { 'root': {{ other_attrs }} }, 'state_vars': {}}"
body_format: json
validate_certs: False
headers:
X-Auth-Token: "{{ manageiq.api_token }}"
Content-Type: "application/json"
status_code: 200
register: output
- name: Set the Extra State Vars
uri:
url: "{{ aws_url }}"
method: POST
body:
action: edit
resource: "{ 'objects': { }, 'state_vars': {{ state_attrs }}}"
body_format: json
validate_certs: False
headers:
X-Auth-Token: "{{ manageiq.api_token }}"
Content-Type: "application/json"
status_code: 200