blob: 10a1f4c8387177f4897a76c296e0ce2810c53e17 (
plain)
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
|
---
- hosts: localhost
tasks:
- name: Ensure the container provider configuration is defined
assert:
that: container_providers_config is defined
msg: |
Error: Must provide providers config path. Fix: Add '-e container_providers_config=/path/to/your/config' to the ansible-playbook command
- name: Include providers/management configuration
include_vars:
file: "{{ container_providers_config }}"
- name: Ensure this cluster is a container provider
uri:
url: "https://{{ management_server['hostname'] }}/api/providers"
body_format: json
method: POST
user: "{{ management_server['user'] }}"
password: "{{ management_server['password'] }}"
validate_certs: no
# Docs on formatting the BODY of the POST request:
# http://manageiq.org/docs/reference/latest/api/reference/providers.html#specifying-connection-configurations
body: "{{ item }}"
failed_when: false
with_items: "{{ container_providers }}"
register: results
# TODO: Make this prettier and easier to read
- name: Save results
copy:
dest: /tmp/results.json
content: "{{ results.results | to_nice_json }}"
# state: present
# debug:
# var: item.item
# with_items: "{{ results.results }}"
- name: print each result
debug:
msg: "{{ results.results | oo_filter_container_providers }}"
|