forked from brahmanim/playbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_automate_workspace.yml
39 lines (36 loc) · 1.21 KB
/
update_automate_workspace.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
---
# Playbook to update attributes in the root object in automate workspace
# You can pass in extra vars to control the automate_workspace
- hosts: localhost
vars:
root_attrs: { 'name': 'Fred Flintstone', 'address': 'Bedrock' }
state_attrs: { 'name': 'Wilma Flintstone', 'friend': 'Betty Rubble' }
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: Update the root object in the workspace
uri:
url: "{{ aws_url }}"
method: POST
body:
action: edit
resource: "{ 'objects': { 'root': {{ root_attrs }} }, 'state_vars': {{ state_attrs }}}"
body_format: json
validate_certs: False
headers:
X-Auth-Token: "{{ manageiq.api_token }}"
Content-Type: "application/json"
status_code: 200
register: output