2018-02-14 21:39:42 +00:00
|
|
|
- name: Install requirements
|
|
|
|
pip:
|
|
|
|
name: openshift
|
|
|
|
|
|
|
|
- name: Create a project
|
|
|
|
openshift_raw:
|
|
|
|
name: testing
|
|
|
|
kind: project
|
|
|
|
description: My testing project
|
|
|
|
display_name: Testing Project
|
|
|
|
api_version: v1
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: show output
|
|
|
|
debug:
|
|
|
|
var: output
|
|
|
|
|
|
|
|
- name: Create a service
|
|
|
|
openshift_raw:
|
|
|
|
state: present
|
2018-02-23 15:13:09 +00:00
|
|
|
resource_definition: &svc
|
2018-02-14 21:39:42 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: web
|
|
|
|
namespace: testing
|
|
|
|
labels:
|
|
|
|
app: galaxy
|
|
|
|
service: web
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
app: galaxy
|
|
|
|
service: web
|
|
|
|
ports:
|
|
|
|
- protocol: TCP
|
|
|
|
targetPort: 8000
|
|
|
|
name: port-8000-tcp
|
|
|
|
port: 8000
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: show output
|
|
|
|
debug:
|
|
|
|
var: output
|
|
|
|
|
2018-02-23 15:13:09 +00:00
|
|
|
- name: Create the service again
|
2018-02-14 21:39:42 +00:00
|
|
|
openshift_raw:
|
2018-02-23 15:13:09 +00:00
|
|
|
state: present
|
|
|
|
resource_definition: *svc
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: Service creation should be idempotent
|
|
|
|
assert:
|
|
|
|
that: not output.changed
|
2018-02-14 21:39:42 +00:00
|
|
|
|
|
|
|
- name: Create PVC
|
|
|
|
openshift_raw:
|
|
|
|
state: present
|
|
|
|
inline: &pvc
|
|
|
|
apiVersion: v1
|
|
|
|
kind: PersistentVolumeClaim
|
|
|
|
metadata:
|
|
|
|
name: elastic-volume
|
|
|
|
namespace: testing
|
|
|
|
spec:
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: 5Gi
|
|
|
|
accessModes:
|
|
|
|
- ReadWriteOnce
|
|
|
|
|
|
|
|
- name: Show output
|
|
|
|
debug:
|
|
|
|
var: output
|
|
|
|
|
2018-02-23 15:13:09 +00:00
|
|
|
- name: Create the PVC again
|
2018-02-14 21:39:42 +00:00
|
|
|
openshift_raw:
|
|
|
|
state: present
|
|
|
|
inline: *pvc
|
|
|
|
|
2018-02-23 15:13:09 +00:00
|
|
|
- name: PVC creation should be idempotent
|
2018-02-14 21:39:42 +00:00
|
|
|
assert:
|
|
|
|
that: not output.changed
|
|
|
|
|
|
|
|
- name: Create deployment config
|
|
|
|
openshift_raw:
|
|
|
|
state: present
|
|
|
|
inline: &dc
|
|
|
|
apiVersion: v1
|
|
|
|
kind: DeploymentConfig
|
|
|
|
metadata:
|
|
|
|
name: elastic
|
|
|
|
labels:
|
|
|
|
app: galaxy
|
|
|
|
service: elastic
|
|
|
|
namespace: testing
|
|
|
|
spec:
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: galaxy
|
|
|
|
service: elastic
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: elastic
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /usr/share/elasticsearch/data
|
|
|
|
name: elastic-volume
|
|
|
|
command: ['elasticsearch']
|
|
|
|
image: 'ansible/galaxy-elasticsearch:2.4.6'
|
|
|
|
volumes:
|
|
|
|
- name: elastic-volume
|
|
|
|
persistentVolumeClaim:
|
2018-02-23 15:13:09 +00:00
|
|
|
claimName: elastic-volume
|
2018-02-14 21:39:42 +00:00
|
|
|
replicas: 1
|
|
|
|
strategy:
|
|
|
|
type: Rolling
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: Show output
|
|
|
|
debug:
|
|
|
|
var: output
|
2018-02-23 15:13:09 +00:00
|
|
|
|
|
|
|
- name: Create deployment config again
|
|
|
|
openshift_raw:
|
|
|
|
state: present
|
|
|
|
inline: *dc
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: DC creation should be idempotent
|
|
|
|
assert:
|
|
|
|
that: not output.changed
|