2018-11-16 12:44:59 +00:00
|
|
|
- hosts: localhost
|
|
|
|
connection: local
|
|
|
|
gather_facts: no
|
|
|
|
vars:
|
|
|
|
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
|
|
|
recreate_crd_default_merge_expectation: recreate_crd is failed
|
|
|
|
playbook_namespace: ansible-test-k8s-older-openshift
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- python_requirements_facts:
|
|
|
|
dependencies:
|
|
|
|
- openshift==0.6.0
|
|
|
|
- kubernetes==6.0.0
|
|
|
|
|
|
|
|
# append_hash
|
|
|
|
- name: use append_hash with ConfigMap
|
|
|
|
k8s:
|
|
|
|
definition:
|
|
|
|
metadata:
|
|
|
|
name: config-map-test
|
|
|
|
namespace: "{{ playbook_namespace }}"
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
data:
|
|
|
|
hello: world
|
|
|
|
append_hash: yes
|
|
|
|
ignore_errors: yes
|
|
|
|
register: k8s_append_hash
|
|
|
|
|
|
|
|
- name: assert that append_hash fails gracefully
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- k8s_append_hash is failed
|
2018-11-22 08:14:43 +00:00
|
|
|
- "k8s_append_hash.msg == 'openshift >= 0.7.2 is required for append_hash'"
|
2018-11-16 12:44:59 +00:00
|
|
|
|
|
|
|
# merge_type
|
|
|
|
- include_role:
|
|
|
|
name: k8s
|
|
|
|
tasks_from: crd
|
|
|
|
|
|
|
|
# validate
|
|
|
|
- name: attempt to use validate with older openshift
|
|
|
|
k8s:
|
|
|
|
definition:
|
|
|
|
metadata:
|
|
|
|
name: config-map-test
|
|
|
|
namespace: "{{ playbook_namespace }}"
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
data:
|
|
|
|
hello: world
|
|
|
|
validate:
|
|
|
|
fail_on_error: yes
|
|
|
|
ignore_errors: yes
|
|
|
|
register: k8s_validate
|
|
|
|
|
|
|
|
- name: assert that validate fails gracefully
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- k8s_validate is failed
|
2018-11-22 08:14:43 +00:00
|
|
|
- "k8s_validate.msg == 'openshift >= 0.8.0 is required for validate'"
|