Skip to content

Commit f8b680e

Browse files
authored
Include vars for ansible version >= 2.6 (#47)
* Include vars for ansible version >= 2.6 * Remove apiVersions that don't change
1 parent ef44563 commit f8b680e

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ python:
77

88
env:
99
- OPENSHIFT_VERSION=v3.9
10-
- OPENSHIFT_VERSION=v3.10
10+
#- OPENSHIFT_VERSION=v3.10
1111
- KUBERNETES_VERSION=v1.9.0
12-
- KUBERNETES_VERSION=v1.10.0
12+
#- KUBERNETES_VERSION=v1.10.0
1313
# Allow failures on oc latest
1414
# TODO: re-enable latest when it isn't busted
1515
matrix:

tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
set_fact:
1515
cluster: "{{ 'openshift' if 'openshift' in oc_version.stdout else 'kubernetes' }}"
1616

17+
- name: 'Include variables based on ansible version'
18+
include_vars: ansible_26.yml
19+
when: ansible_version.full is version('2.6', '>=')
20+
1721
- when: apb_action == 'update'
1822
block:
1923
- name: Backup database

templates/deployment.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
22

3-
apiVersion: v1
43
{% if cluster == 'kubernetes' %}
4+
apiVersion: {{ deployment_api_version }}
55
kind: Deployment
66
{% else %}
7+
apiVersion: {{ deploymentconfig_api_version }}
78
kind: DeploymentConfig
89
{% endif %}
910
metadata:
@@ -59,14 +60,14 @@ spec:
5960
terminationMessagePath: /dev/termination-log
6061
workingDir: /
6162
ports:
62-
- container_port: 5432
63+
- containerPort: 5432
6364
protocol: TCP
6465
{% if _apb_plan_id == 'prod' %}
6566
volumeMounts:
6667
- name: postgresql
6768
mountPath: /var/lib/pgsql/data
6869
volumes:
6970
- name: postgresql
70-
persistent_volume_claim:
71-
claim_name: {{ app_name }}
71+
persistentVolumeClaim:
72+
claimName: {{ app_name }}
7273
{% endif %}

templates/service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ spec:
1515
ports:
1616
- protocol: TCP
1717
port: 5432
18-
target_port: 5432
18+
targetPort: 5432

vars/ansible_26.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
3+
deployment_api_version: apps/v1
4+
deploymentconfig_api_version: apps.openshift.io/v1
5+
route_api_version: route.openshift.io/v1

vars/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ deployment_kind: "{{ 'DeploymentConfig' if cluster == 'openshift' else 'Deployme
1818
available_status_query: "status.conditions[?type == 'Available'].status"
1919
deployment_lookup: "{{ lookup('openshift', kind=deployment_kind, namespace=namespace, resource_name=app_name) }}"
2020
deployment_query: "{{ deployment_lookup | json_query(available_status_query) | first }}"
21+
22+
# Ansible 2.5 api versions
23+
deployment_api_version: v1
24+
deploymentconfig_api_version: v1
25+
route_api_version: v1

0 commit comments

Comments
 (0)