My Ansible Playbook to install an OpenShift Lab
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.4 KiB

---
- debug: msg="Working on plan {{ plan.system_name }} / service {{ item.service.name }}"
- set_fact:
body_create_plan: '{{ "access_token=" ~ access_token|urlencode }}'
- set_fact:
body_create_plan: '{{ body_create_plan ~ "&" ~ (param.key|urlencode) ~ "=" ~ (param.value|urlencode) }}'
with_dict: '{{ plan }}'
loop_control:
loop_var: param
# applications is a nested hash that is used to create client applications later
when: 'param.key != ''applications'' and plan.system_name not in application_plans '
- name: Create the application plan
uri:
url: https://{{ threescale_admin_hostname }}/admin/api/services/{{ service_id }}/application_plans.json
validate_certs: no
method: POST
body: '{{ body_create_plan }}'
status_code: 201
register: response
when: 'plan.system_name not in application_plans'
- set_fact:
application_plans: '{{ application_plans|union([ plan.system_name ]) }}'
application_plans_details: '{{ application_plans_details|union([{ "system_name": plan.system_name, "id": response.json.application_plan.id }]) }}'
when: 'plan.system_name not in application_plans'
- set_fact:
plan_id: '{{ (application_plans_details|selectattr("system_name", "equalto", plan.system_name)|first)["id"] }}'
- include: create_applications.yml
with_items: '{{ plan.applications }}'
loop_control:
loop_var: app
when: 'app.name not in applications'