summaryrefslogtreecommitdiffstats
path: root/roles/openshift_resource
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_resource')
-rw-r--r--roles/openshift_resource/tasks/patch.yml10
-rw-r--r--roles/openshift_resource/tasks/resource.yml6
-rw-r--r--roles/openshift_resource/tasks/template.yml8
3 files changed, 12 insertions, 12 deletions
diff --git a/roles/openshift_resource/tasks/patch.yml b/roles/openshift_resource/tasks/patch.yml
index e2bbcfa..501f692 100644
--- a/roles/openshift_resource/tasks/patch.yml
+++ b/roles/openshift_resource/tasks/patch.yml
@@ -1,10 +1,10 @@
---
-- name: Lookup the specified resource
+- name: "Lookup {{resource}} in {{project}}"
command: "oc get -n '{{project}}' '{{resource}}' -o json"
register: orig_result
changed_when: 0
-- name: Lookup API version of the specified resource
+- name: "Lookup API version of {{resource}} in {{project}}"
command: "oc get -n '{{project}}' '{{resource}}' --template {{'{{' + '.apiVersion' + '}}'}}"
register: api_version
changed_when: 0
@@ -13,14 +13,14 @@
- name: Escaping patch
set_fact: xpatch='{{patch | to_json | regex_replace(" ","") | regex_replace("^", " ")}}'
-- name: Generate dummy patch {{resource}} in {{project}}
+- name: "Generate dummy patch for {{resource}} in {{project}}"
command: "oc patch -n '{{project}}' --patch ' {\"apiVersion\": \"{{api_version.stdout}}\"}' --local=true -f - -o json"
args:
stdin: " {{ orig_result.stdout_lines | join('') }}"
register: dummy_result
changed_when: 0
-- name: Generate test patch {{resource}} in {{project}}
+- name: "Generate test patch {{resource}} in {{project}}"
command: "oc patch -n '{{project}}' --patch '{{xpatch}}' --local=true -f - -o json"
args:
stdin: " {{ orig_result.stdout_lines | join('') }}"
@@ -33,7 +33,7 @@
#- debug: msg="{{ patch_result.stdout }}"
# when: dummy_result.stdout != patch_result.stdout
-- name: Patch {{resource}} in {{project}}
+- name: "Patch {{resource}} in {{project}}"
command: "oc patch -n '{{project}}' '{{resource}}' --patch '{{xpatch}}'"
register: result
changed_when: (result | succeeded)
diff --git a/roles/openshift_resource/tasks/resource.yml b/roles/openshift_resource/tasks/resource.yml
index 4e6e7ac..87af5c9 100644
--- a/roles/openshift_resource/tasks/resource.yml
+++ b/roles/openshift_resource/tasks/resource.yml
@@ -3,20 +3,20 @@
- name: Find out which resources we are going to configure
set_fact: rkind="{{ tmpl.kind }}" rname="{{ tmpl.metadata.name }}"
- - name: "Lookup the specified resource {{rkind}}/{{rname}}"
+ - name: "Lookup the specified resource {{rkind}}/{{rname}} in {{project}}"
command: "oc get -n {{project}} {{rkind}}/{{rname}}"
register: find_result
changed_when: false
failed_when: false
- - name: "Detroy existing resources {{rkind}}/{{rname}}"
+ - name: "Detroy existing resources {{rkind}}/{{rname}} in {{project}}"
command: "oc delete -n {{project}} {{rkind}}/{{rname}}"
register: rm_result
failed_when: false
changed_when: (rm_result | succeeded)
when: (recreate|default(false))
- - name: "Create resources defined in {{ template }}"
+ - name: "Populate resources defined in {{ template }} to {{project}}"
command: "oc create -n {{project}} -f '{{ template_path }}/{{ template }}' {{ create_args | default('') }}"
when: (recreate|default(false)) or (find_result.rc != 0)
run_once: true
diff --git a/roles/openshift_resource/tasks/template.yml b/roles/openshift_resource/tasks/template.yml
index 6c9340b..7e74de4 100644
--- a/roles/openshift_resource/tasks/template.yml
+++ b/roles/openshift_resource/tasks/template.yml
@@ -5,7 +5,7 @@
vars:
query: "objects[*].{kind: kind, name: metadata.name}"
- - name: "{{ template }}: Lookup the specified resource"
+ - name: "{{ template }}: Lookup the specified resource in {{project}}"
command: "oc get -n {{project}} {{item.kind}}/{{item.name}}"
register: results
failed_when: false
@@ -13,13 +13,13 @@
with_items: "{{ resources | default([]) }}"
# when: not (recreate|default(false))
- - name: "{{ template }}: Detroy existing resources"
+ - name: "{{ template }}: Detroy existing resources in {{project}}"
command: "oc delete -n {{project}} {{resources[item|int].kind}}/{{resources[item|int].name}}"
failed_when: false
with_sequence: start=0 count="{{resources | default([]) | length}}"
when: ((recreate|default(false)) or (results | changed)) and (results.results[item|int].rc == 0)
- - name: "{{ template }}: Create resources defined"
- shell: "oc process -f '{{ template_path }}/{{template}}' {{ template_args | default('') }} | oc create -n {{project}} -f - {{ create_args | default('') }}"
+ - name: "{{ template }}: Populate resources to {{project}}"
+ shell: "oc process -n {{project}} -f '{{ template_path }}/{{template}}' {{ template_args | default('') }} | oc create -n {{project}} -f - {{ create_args | default('') }}"
when: (recreate|default(false)) or (results | changed)
run_once: true