mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
133 lines
2.6 KiB
YAML
133 lines
2.6 KiB
YAML
|
- 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
|
||
|
resource_definition:
|
||
|
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
|
||
|
|
||
|
- name: Delete an existing PVC
|
||
|
openshift_raw:
|
||
|
name: web
|
||
|
namespace: testing
|
||
|
api: v1
|
||
|
kind: persistent_volume_claim
|
||
|
state: absent
|
||
|
|
||
|
- 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
|
||
|
|
||
|
- name: Create PVC
|
||
|
openshift_raw:
|
||
|
state: present
|
||
|
inline: *pvc
|
||
|
register: output
|
||
|
|
||
|
- name: Show output
|
||
|
debug:
|
||
|
var: output
|
||
|
|
||
|
- name: PVC should be idempotent
|
||
|
assert:
|
||
|
that: not output.changed
|
||
|
|
||
|
- name: Delete an existing deployment config
|
||
|
openshift_raw:
|
||
|
name: elastic
|
||
|
namespace: testing
|
||
|
api: v1
|
||
|
kind: DeploymentConfig
|
||
|
state: absent
|
||
|
|
||
|
- 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:
|
||
|
claimName: elastic-volume
|
||
|
replicas: 1
|
||
|
strategy:
|
||
|
type: Rolling
|
||
|
register: output
|
||
|
|
||
|
- name: Show output
|
||
|
debug:
|
||
|
var: output
|