summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/etcd/templates/etcd.conf.j24
-rw-r--r--roles/fluentd_master/tasks/main.yml3
-rw-r--r--roles/openshift_examples/files/examples/db-templates/mongodb-persistent-template.json4
-rw-r--r--roles/openshift_examples/files/examples/db-templates/mysql-persistent-template.json4
-rw-r--r--roles/openshift_examples/files/examples/db-templates/postgresql-ephemeral-template.json2
-rw-r--r--roles/openshift_examples/files/examples/db-templates/postgresql-persistent-template.json6
-rw-r--r--roles/openshift_examples/files/examples/image-streams/image-streams-centos7.json23
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/cakephp-mysql.json34
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/cakephp.json16
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/dancer-mysql.json32
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/dancer.json16
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/django-postgresql.json32
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/django.json16
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/nodejs-mongodb.json32
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/nodejs.json16
-rw-r--r--roles/openshift_examples/files/examples/quickstart-templates/rails-postgresql.json34
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/amq6-persistent.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/amq6.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-persistent-sti.json29
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-sti.json29
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-basic-sti.json13
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json15
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-persistent-sti.json16
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-sti.json16
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-persistent-sti.json16
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-sti.json16
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-persistent-sti.json16
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-sti.json16
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-basic-sti.json11
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-https-sti.json13
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-persistent-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-persistent-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-persistent-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-basic-sti.json11
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-https-sti.json13
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-persistent-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-persistent-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-persistent-sti.json14
-rw-r--r--roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-sti.json14
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py3
-rw-r--r--roles/openshift_master/tasks/main.yml1
-rw-r--r--roles/openshift_master/templates/master.yaml.v1.j23
-rw-r--r--roles/openshift_master/templates/v1_partials/oauthConfig.j214
-rw-r--r--roles/openshift_master_certificates/tasks/main.yml16
-rw-r--r--roles/openshift_node/tasks/main.yml5
-rw-r--r--roles/openshift_node_certificates/tasks/main.yml2
-rw-r--r--roles/os_zabbix/library/__init__.py0
-rw-r--r--roles/os_zabbix/library/test.yml92
-rw-r--r--roles/os_zabbix/library/zbx_host.py162
-rw-r--r--roles/os_zabbix/library/zbx_hostgroup.py116
-rw-r--r--roles/os_zabbix/library/zbx_item.py160
-rw-r--r--roles/os_zabbix/library/zbx_mediatype.py149
-rw-r--r--roles/os_zabbix/library/zbx_template.py126
-rw-r--r--roles/os_zabbix/library/zbx_trigger.py175
-rw-r--r--roles/os_zabbix/library/zbx_user.py146
-rw-r--r--roles/os_zabbix/library/zbx_usergroup.py160
-rwxr-xr-xroles/os_zabbix/library/zbxapi.py382
62 files changed, 1693 insertions, 719 deletions
diff --git a/roles/etcd/templates/etcd.conf.j2 b/roles/etcd/templates/etcd.conf.j2
index 801be2c97..9ac23b1dd 100644
--- a/roles/etcd/templates/etcd.conf.j2
+++ b/roles/etcd/templates/etcd.conf.j2
@@ -16,8 +16,8 @@ ETCD_NAME=default
{% endif %}
ETCD_DATA_DIR={{ etcd_data_dir }}
#ETCD_SNAPSHOT_COUNTER="10000"
-#ETCD_HEARTBEAT_INTERVAL="100"
-#ETCD_ELECTION_TIMEOUT="1000"
+ETCD_HEARTBEAT_INTERVAL="500"
+ETCD_ELECTION_TIMEOUT="2500"
ETCD_LISTEN_CLIENT_URLS={{ etcd_listen_client_urls }}
#ETCD_MAX_SNAPSHOTS="5"
#ETCD_MAX_WALS="5"
diff --git a/roles/fluentd_master/tasks/main.yml b/roles/fluentd_master/tasks/main.yml
index d828db52a..d64900eb0 100644
--- a/roles/fluentd_master/tasks/main.yml
+++ b/roles/fluentd_master/tasks/main.yml
@@ -39,6 +39,9 @@
owner: 'td-agent'
mode: 0444
+- name: "Pause before restarting td-agent and openshift-master, depending on the number of nodes."
+ pause: seconds={{ num_nodes|int * 5 }}
+
- name: ensure td-agent is running
service:
name: 'td-agent'
diff --git a/roles/openshift_examples/files/examples/db-templates/mongodb-persistent-template.json b/roles/openshift_examples/files/examples/db-templates/mongodb-persistent-template.json
index ff19a4834..c05e81e56 100644
--- a/roles/openshift_examples/files/examples/db-templates/mongodb-persistent-template.json
+++ b/roles/openshift_examples/files/examples/db-templates/mongodb-persistent-template.json
@@ -47,7 +47,7 @@
},
"spec": {
"accessModes": [
- "ReadWriteMany"
+ "ReadWriteOnce"
],
"resources": {
"requests": {
@@ -148,7 +148,7 @@
{
"name": "${DATABASE_SERVICE_NAME}-data",
"persistentVolumeClaim": {
- "claimName": "mongodb"
+ "claimName": "${DATABASE_SERVICE_NAME}"
}
}
],
diff --git a/roles/openshift_examples/files/examples/db-templates/mysql-persistent-template.json b/roles/openshift_examples/files/examples/db-templates/mysql-persistent-template.json
index 90225e9c3..33e1cebb1 100644
--- a/roles/openshift_examples/files/examples/db-templates/mysql-persistent-template.json
+++ b/roles/openshift_examples/files/examples/db-templates/mysql-persistent-template.json
@@ -47,7 +47,7 @@
},
"spec": {
"accessModes": [
- "ReadWriteMany"
+ "ReadWriteOnce"
],
"resources": {
"requests": {
@@ -144,7 +144,7 @@
{
"name": "${DATABASE_SERVICE_NAME}-data",
"persistentVolumeClaim": {
- "claimName": "mysql"
+ "claimName": "${DATABASE_SERVICE_NAME}"
}
}
],
diff --git a/roles/openshift_examples/files/examples/db-templates/postgresql-ephemeral-template.json b/roles/openshift_examples/files/examples/db-templates/postgresql-ephemeral-template.json
index 6922baa12..faf626475 100644
--- a/roles/openshift_examples/files/examples/db-templates/postgresql-ephemeral-template.json
+++ b/roles/openshift_examples/files/examples/db-templates/postgresql-ephemeral-template.json
@@ -143,7 +143,7 @@
{
"name": "DATABASE_SERVICE_NAME",
"description": "Database service name",
- "value": "mysql"
+ "value": "postgresql"
},
{
"name": "POSTGRESQL_USER",
diff --git a/roles/openshift_examples/files/examples/db-templates/postgresql-persistent-template.json b/roles/openshift_examples/files/examples/db-templates/postgresql-persistent-template.json
index 43162d8bb..398e288bf 100644
--- a/roles/openshift_examples/files/examples/db-templates/postgresql-persistent-template.json
+++ b/roles/openshift_examples/files/examples/db-templates/postgresql-persistent-template.json
@@ -47,7 +47,7 @@
},
"spec": {
"accessModes": [
- "ReadWriteMany"
+ "ReadWriteOnce"
],
"resources": {
"requests": {
@@ -144,7 +144,7 @@
{
"name": "${DATABASE_SERVICE_NAME}-data",
"persistentVolumeClaim": {
- "claimName": "postgresql"
+ "claimName": "${DATABASE_SERVICE_NAME}"
}
}
],
@@ -160,7 +160,7 @@
{
"name": "DATABASE_SERVICE_NAME",
"description": "Database service name",
- "value": "mysql"
+ "value": "postgresql"
},
{
"name": "POSTGRESQL_USER",
diff --git a/roles/openshift_examples/files/examples/image-streams/image-streams-centos7.json b/roles/openshift_examples/files/examples/image-streams/image-streams-centos7.json
index 712a43a11..459b841c1 100644
--- a/roles/openshift_examples/files/examples/image-streams/image-streams-centos7.json
+++ b/roles/openshift_examples/files/examples/image-streams/image-streams-centos7.json
@@ -251,6 +251,29 @@
}
]
}
+ },
+ {
+ "kind": "ImageStream",
+ "apiVersion": "v1beta3",
+ "metadata": {
+ "name": "jenkins",
+ "creationTimestamp": null
+ },
+ "spec": {
+ "dockerImageRepository": "openshift/jenkins-16-centos7",
+ "tags": [
+ {
+ "name": "latest"
+ },
+ {
+ "name": "1.6",
+ "from": {
+ "Kind": "ImageStreamTag",
+ "Name": "latest"
+ }
+ }
+ ]
+ }
}
]
}
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/cakephp-mysql.json b/roles/openshift_examples/files/examples/quickstart-templates/cakephp-mysql.json
index e5699bce7..b722a05ae 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/cakephp-mysql.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/cakephp-mysql.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "cakephp-frontend",
+ "name": "cakephp-mysql-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "cakephp-frontend"
+ "name": "cakephp-mysql-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "cakephp-route"
+ "name": "cakephp-mysql-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "cakephp-frontend"
+ "name": "cakephp-mysql-example"
}
}
},
@@ -53,7 +53,7 @@
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
- "name": "cakephp-example",
+ "name": "cakephp-mysql-example",
"annotations": {
"description": "Keeps track of changes in the application image"
}
@@ -63,7 +63,7 @@
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
- "name": "cakephp-example",
+ "name": "cakephp-mysql-example",
"annotations": {
"description": "Defines how to build the application"
}
@@ -90,7 +90,7 @@
"output": {
"to": {
"kind": "ImageStreamTag",
- "name": "cakephp-example:latest"
+ "name": "cakephp-mysql-example:latest"
}
},
"triggers": [
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "cakephp-frontend",
+ "name": "cakephp-mysql-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -125,7 +125,7 @@
"command": [
"./migrate-database.sh"
],
- "containerName": "cakephp-example"
+ "containerName": "cakephp-mysql-example"
}
}
}
@@ -136,11 +136,11 @@
"imageChangeParams": {
"automatic": true,
"containerNames": [
- "cakephp-example"
+ "cakephp-mysql-example"
],
"from": {
"kind": "ImageStreamTag",
- "name": "cakephp-example:latest"
+ "name": "cakephp-mysql-example:latest"
}
}
},
@@ -150,20 +150,20 @@
],
"replicas": 1,
"selector": {
- "name": "cakephp-frontend"
+ "name": "cakephp-mysql-example"
},
"template": {
"metadata": {
- "name": "cakephp-frontend",
+ "name": "cakephp-mysql-example",
"labels": {
- "name": "cakephp-frontend"
+ "name": "cakephp-mysql-example"
}
},
"spec": {
"containers": [
{
- "name": "cakephp-example",
- "image": "cakephp-example",
+ "name": "cakephp-mysql-example",
+ "image": "cakephp-mysql-example",
"ports": [
{
"containerPort": 8080
@@ -308,7 +308,7 @@
{
"name": "APPLICATION_DOMAIN",
"description": "The exposed hostname that will route to the CakePHP service",
- "value": "cakephp-example.openshiftapps.com"
+ "value": "cakephp-mysql-example.openshiftapps.com"
},
{
"name": "GITHUB_WEBHOOK_SECRET",
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/cakephp.json b/roles/openshift_examples/files/examples/quickstart-templates/cakephp.json
index 09521add4..532b9bd2b 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/cakephp.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/cakephp.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "cakephp-frontend",
+ "name": "cakephp-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "cakephp-frontend"
+ "name": "cakephp-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "cakephp-route"
+ "name": "cakephp-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "cakephp-frontend"
+ "name": "cakephp-example"
}
}
},
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "cakephp-frontend",
+ "name": "cakephp-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -139,13 +139,13 @@
],
"replicas": 1,
"selector": {
- "name": "cakephp-frontend"
+ "name": "cakephp-example"
},
"template": {
"metadata": {
- "name": "cakephp-frontend",
+ "name": "cakephp-example",
"labels": {
- "name": "cakephp-frontend"
+ "name": "cakephp-example"
}
},
"spec": {
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/dancer-mysql.json b/roles/openshift_examples/files/examples/quickstart-templates/dancer-mysql.json
index fc92a1d6c..b46abfbb5 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/dancer-mysql.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/dancer-mysql.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "dancer-frontend",
+ "name": "dancer-mysql-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "dancer-frontend"
+ "name": "dancer-mysql-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "dancer-route"
+ "name": "dancer-mysql-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "dancer-frontend"
+ "name": "dancer-mysql-example"
}
}
},
@@ -53,7 +53,7 @@
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
- "name": "dancer-example",
+ "name": "dancer-mysql-example",
"annotations": {
"description": "Keeps track of changes in the application image"
}
@@ -63,7 +63,7 @@
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
- "name": "dancer-example",
+ "name": "dancer-mysql-example",
"annotations": {
"description": "Defines how to build the application"
}
@@ -90,7 +90,7 @@
"output": {
"to": {
"kind": "ImageStreamTag",
- "name": "dancer-example:latest"
+ "name": "dancer-mysql-example:latest"
}
},
"triggers": [
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "dancer-frontend",
+ "name": "dancer-mysql-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -122,11 +122,11 @@
"imageChangeParams": {
"automatic": true,
"containerNames": [
- "dancer-example"
+ "dancer-mysql-example"
],
"from": {
"kind": "ImageStreamTag",
- "name": "dancer-example:latest"
+ "name": "dancer-mysql-example:latest"
}
}
},
@@ -136,20 +136,20 @@
],
"replicas": 1,
"selector": {
- "name": "dancer-frontend"
+ "name": "dancer-mysql-example"
},
"template": {
"metadata": {
- "name": "dancer-frontend",
+ "name": "dancer-mysql-example",
"labels": {
- "name": "dancer-frontend"
+ "name": "dancer-mysql-example"
}
},
"spec": {
"containers": [
{
- "name": "dancer-example",
- "image": "dancer-example",
+ "name": "dancer-mysql-example",
+ "image": "dancer-mysql-example",
"ports": [
{
"containerPort": 8080
@@ -282,7 +282,7 @@
{
"name": "APPLICATION_DOMAIN",
"description": "The exposed hostname that will route to the Dancer service",
- "value": "dancer-example.openshiftapps.com"
+ "value": "dancer-mysql-example.openshiftapps.com"
},
{
"name": "GITHUB_WEBHOOK_SECRET",
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/dancer.json b/roles/openshift_examples/files/examples/quickstart-templates/dancer.json
index 829f50bae..6f49a7d64 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/dancer.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/dancer.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "dancer-frontend",
+ "name": "dancer-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "dancer-frontend"
+ "name": "dancer-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "dancer-route"
+ "name": "dancer-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "dancer-frontend"
+ "name": "dancer-example"
}
}
},
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "dancer-frontend",
+ "name": "dancer-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -139,13 +139,13 @@
],
"replicas": 1,
"selector": {
- "name": "dancer-frontend"
+ "name": "dancer-example"
},
"template": {
"metadata": {
- "name": "dancer-frontend",
+ "name": "dancer-example",
"labels": {
- "name": "dancer-frontend"
+ "name": "dancer-example"
}
},
"spec": {
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/django-postgresql.json b/roles/openshift_examples/files/examples/quickstart-templates/django-postgresql.json
index c46476e8a..64522ce76 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/django-postgresql.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/django-postgresql.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "django-frontend",
+ "name": "django-postgresql-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "django-frontend"
+ "name": "django-postgresql-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "django-route"
+ "name": "django-postgresql-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "django-frontend"
+ "name": "django-postgresql-example"
}
}
},
@@ -53,7 +53,7 @@
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
- "name": "django-example",
+ "name": "django-postgresql-example",
"annotations": {
"description": "Keeps track of changes in the application image"
}
@@ -63,7 +63,7 @@
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
- "name": "django-example",
+ "name": "django-postgresql-example",
"annotations": {
"description": "Defines how to build the application"
}
@@ -90,7 +90,7 @@
"output": {
"to": {
"kind": "ImageStreamTag",
- "name": "django-example:latest"
+ "name": "django-postgresql-example:latest"
}
},
"triggers": [
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "django-frontend",
+ "name": "django-postgresql-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -125,11 +125,11 @@
"imageChangeParams": {
"automatic": true,
"containerNames": [
- "django-example"
+ "django-postgresql-example"
],
"from": {
"kind": "ImageStreamTag",
- "name": "django-example:latest"
+ "name": "django-postgresql-example:latest"
}
}
},
@@ -139,20 +139,20 @@
],
"replicas": 1,
"selector": {
- "name": "django-frontend"
+ "name": "django-postgresql-example"
},
"template": {
"metadata": {
- "name": "django-frontend",
+ "name": "django-postgresql-example",
"labels": {
- "name": "django-frontend"
+ "name": "django-postgresql-example"
}
},
"spec": {
"containers": [
{
- "name": "django-example",
- "image": "django-example",
+ "name": "django-postgresql-example",
+ "image": "django-postgresql-example",
"ports": [
{
"containerPort": 8080
@@ -293,7 +293,7 @@
{
"name": "APPLICATION_DOMAIN",
"description": "The exposed hostname that will route to the Django service",
- "value": "django-example.openshiftapps.com"
+ "value": "django-postgresql-example.openshiftapps.com"
},
{
"name": "GITHUB_WEBHOOK_SECRET",
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/django.json b/roles/openshift_examples/files/examples/quickstart-templates/django.json
index 74bbea163..1794d196c 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/django.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/django.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "django-frontend",
+ "name": "django-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "django-frontend"
+ "name": "django-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "django-route"
+ "name": "django-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "django-frontend"
+ "name": "django-example"
}
}
},
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "django-frontend",
+ "name": "django-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -139,13 +139,13 @@
],
"replicas": 1,
"selector": {
- "name": "django-frontend"
+ "name": "django-example"
},
"template": {
"metadata": {
- "name": "django-frontend",
+ "name": "django-example",
"labels": {
- "name": "django-frontend"
+ "name": "django-example"
}
},
"spec": {
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/nodejs-mongodb.json b/roles/openshift_examples/files/examples/quickstart-templates/nodejs-mongodb.json
index cd9e5faf0..e281feecf 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/nodejs-mongodb.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/nodejs-mongodb.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "nodejs-frontend",
+ "name": "nodejs-mongodb-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "nodejs-frontend"
+ "name": "nodejs-mongodb-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "nodejs-route"
+ "name": "nodejs-mongodb-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "nodejs-frontend"
+ "name": "nodejs-mongodb-example"
}
}
},
@@ -53,7 +53,7 @@
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
- "name": "nodejs-example",
+ "name": "nodejs-mongodb-example",
"annotations": {
"description": "Keeps track of changes in the application image"
}
@@ -63,7 +63,7 @@
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
- "name": "nodejs-example",
+ "name": "nodejs-mongodb-example",
"annotations": {
"description": "Defines how to build the application"
}
@@ -90,7 +90,7 @@
"output": {
"to": {
"kind": "ImageStreamTag",
- "name": "nodejs-example:latest"
+ "name": "nodejs-mongodb-example:latest"
}
},
"triggers": [
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "nodejs-frontend",
+ "name": "nodejs-mongodb-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -125,11 +125,11 @@
"imageChangeParams": {
"automatic": true,
"containerNames": [
- "nodejs-example"
+ "nodejs-mongodb-example"
],
"from": {
"kind": "ImageStreamTag",
- "name": "nodejs-example:latest"
+ "name": "nodejs-mongodb-example:latest"
}
}
},
@@ -139,20 +139,20 @@
],
"replicas": 1,
"selector": {
- "name": "nodejs-frontend"
+ "name": "nodejs-mongodb-example"
},
"template": {
"metadata": {
- "name": "nodejs-frontend",
+ "name": "nodejs-mongodb-example",
"labels": {
- "name": "nodejs-frontend"
+ "name": "nodejs-mongodb-example"
}
},
"spec": {
"containers": [
{
- "name": "nodejs-example",
- "image": "nodejs-example",
+ "name": "nodejs-mongodb-example",
+ "image": "nodejs-mongodb-example",
"ports": [
{
"containerPort": 8080
@@ -289,7 +289,7 @@
{
"name": "APPLICATION_DOMAIN",
"description": "The exposed hostname that will route to the Node.js service",
- "value": "nodejs-example.openshiftapps.com"
+ "value": "nodejs-mongodb-example.openshiftapps.com"
},
{
"name": "GITHUB_WEBHOOK_SECRET",
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/nodejs.json b/roles/openshift_examples/files/examples/quickstart-templates/nodejs.json
index ff7dd574e..dd38571eb 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/nodejs.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/nodejs.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "nodejs-frontend",
+ "name": "nodejs-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "nodejs-frontend"
+ "name": "nodejs-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "nodejs-route"
+ "name": "nodejs-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "nodejs-frontend"
+ "name": "nodejs-example"
}
}
},
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "nodejs-frontend",
+ "name": "nodejs-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -139,13 +139,13 @@
],
"replicas": 1,
"selector": {
- "name": "nodejs-frontend"
+ "name": "nodejs-example"
},
"template": {
"metadata": {
- "name": "nodejs-frontend",
+ "name": "nodejs-example",
"labels": {
- "name": "nodejs-frontend"
+ "name": "nodejs-example"
}
},
"spec": {
diff --git a/roles/openshift_examples/files/examples/quickstart-templates/rails-postgresql.json b/roles/openshift_examples/files/examples/quickstart-templates/rails-postgresql.json
index ec7da77e3..3b83d3f5b 100644
--- a/roles/openshift_examples/files/examples/quickstart-templates/rails-postgresql.json
+++ b/roles/openshift_examples/files/examples/quickstart-templates/rails-postgresql.json
@@ -17,7 +17,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
- "name": "rails-frontend",
+ "name": "rails-postgresql-example",
"annotations": {
"description": "Exposes and load balances the application pods"
}
@@ -31,7 +31,7 @@
}
],
"selector": {
- "name": "rails-frontend"
+ "name": "rails-postgresql-example"
}
}
},
@@ -39,13 +39,13 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
- "name": "rails-route"
+ "name": "rails-postgresql-example"
},
"spec": {
"host": "${APPLICATION_DOMAIN}",
"to": {
"kind": "Service",
- "name": "rails-frontend"
+ "name": "rails-postgresql-example"
}
}
},
@@ -53,7 +53,7 @@
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
- "name": "rails-example",
+ "name": "rails-postgresql-example",
"annotations": {
"description": "Keeps track of changes in the application image"
}
@@ -63,7 +63,7 @@
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
- "name": "rails-example",
+ "name": "rails-postgresql-example",
"annotations": {
"description": "Defines how to build the application"
}
@@ -90,7 +90,7 @@
"output": {
"to": {
"kind": "ImageStreamTag",
- "name": "rails-example:latest"
+ "name": "rails-postgresql-example:latest"
}
},
"triggers": [
@@ -110,7 +110,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
- "name": "rails-frontend",
+ "name": "rails-postgresql-example",
"annotations": {
"description": "Defines how to deploy the application server"
}
@@ -125,7 +125,7 @@
"command": [
"./migrate-database.sh"
],
- "containerName": "rails-example"
+ "containerName": "rails-postgresql-example"
}
}
}
@@ -136,11 +136,11 @@
"imageChangeParams": {
"automatic": true,
"containerNames": [
- "rails-example"
+ "rails-postgresql-example"
],
"from": {
"kind": "ImageStreamTag",
- "name": "rails-example:latest"
+ "name": "rails-postgresql-example:latest"
}
}
},
@@ -150,20 +150,20 @@
],
"replicas": 1,
"selector": {
- "name": "rails-frontend"
+ "name": "rails-postgresql-example"
},
"template": {
"metadata": {
- "name": "rails-frontend",
+ "name": "rails-postgresql-example",
"labels": {
- "name": "rails-frontend"
+ "name": "rails-postgresql-example"
}
},
"spec": {
"containers": [
{
- "name": "rails-example",
- "image": "rails-example",
+ "name": "rails-postgresql-example",
+ "image": "rails-postgresql-example",
"ports": [
{
"containerPort": 8080
@@ -328,7 +328,7 @@
{
"name": "APPLICATION_DOMAIN",
"description": "The exposed hostname that will route to the Rails service",
- "value": "rails-example.openshiftapps.com"
+ "value": "rails-postgresql-example.openshiftapps.com"
},
{
"name": "GITHUB_WEBHOOK_SECRET",
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/amq6-persistent.json b/roles/openshift_examples/files/examples/xpaas-templates/amq6-persistent.json
index c0925b453..5cbc7ee7e 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/amq6-persistent.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/amq6-persistent.json
@@ -320,37 +320,37 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-amq-amqp",
+ "name": "amqp",
"containerPort": 5672,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-amqp-ssl",
+ "name": "amqp-ssl",
"containerPort": 5671,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-mqtt",
+ "name": "mqtt",
"containerPort": 1883,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-stomp",
+ "name": "stomp",
"containerPort": 61613,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-stomp-ssl",
+ "name": "stomp-ssl",
"containerPort": 61612,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-tcp",
+ "name": "tcp",
"containerPort": 61616,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-tcp-ssl",
+ "name": "tcp-ssl",
"containerPort": 61617,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/amq6.json b/roles/openshift_examples/files/examples/xpaas-templates/amq6.json
index 63ec9a235..7decdfe52 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/amq6.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/amq6.json
@@ -311,37 +311,37 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-amq-amqp",
+ "name": "amqp",
"containerPort": 5672,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-amqp-ssl",
+ "name": "amqp-ssl",
"containerPort": 5671,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-mqtt",
+ "name": "mqtt",
"containerPort": 1883,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-stomp",
+ "name": "stomp",
"containerPort": 61613,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-stomp-ssl",
+ "name": "stomp-ssl",
"containerPort": 61612,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-tcp",
+ "name": "tcp",
"containerPort": 61616,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-tcp-ssl",
+ "name": "tcp-ssl",
"containerPort": 61617,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-persistent-sti.json
index 0790d6546..b64acae8b 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-persistent-sti.json
@@ -309,24 +309,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -397,17 +398,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
@@ -538,37 +539,37 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-amq-amqp",
+ "name": "amqp",
"containerPort": 5672,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-amqp-ssl",
+ "name": "amqp-ssl",
"containerPort": 5671,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-mqtt",
+ "name": "mqtt",
"containerPort": 1883,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-stomp",
+ "name": "stomp",
"containerPort": 61613,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-stomp-ssl",
+ "name": "stomp-ssl",
"containerPort": 61612,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-tcp",
+ "name": "tcp",
"containerPort": 61616,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-tcp-ssl",
+ "name": "tcp-ssl",
"containerPort": 61617,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-sti.json
index a0505f81e..20b234bd0 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-amq-sti.json
@@ -304,24 +304,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -392,17 +393,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
@@ -533,37 +534,37 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-amq-amqp",
+ "name": "amqp",
"containerPort": 5672,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-amqp-ssl",
+ "name": "amqp-ssl",
"containerPort": 5671,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-mqtt",
+ "name": "mqtt",
"containerPort": 1883,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-stomp",
+ "name": "stomp",
"containerPort": 61613,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-stomp-ssl",
+ "name": "stomp-ssl",
"containerPort": 61612,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-tcp",
+ "name": "tcp",
"containerPort": 61616,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-amq-tcp-ssl",
+ "name": "tcp-ssl",
"containerPort": 61617,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-basic-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-basic-sti.json
index d894deda0..146bfb1ee 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-basic-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-basic-sti.json
@@ -181,24 +181,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -261,12 +262,12 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json
index 14585d60f..0497e6824 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json
@@ -248,24 +248,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -336,17 +337,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-persistent-sti.json
index 13d4289ae..289ab284f 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-persistent-sti.json
@@ -328,24 +328,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -416,17 +417,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
@@ -568,7 +569,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-mongodb-tcp-27017",
"containerPort": 27017,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-sti.json
index 690b918a1..22b301aa9 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-mongodb-sti.json
@@ -323,24 +323,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -411,17 +412,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
@@ -563,7 +564,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-mongodb-tcp-27017",
"containerPort": 27017,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-persistent-sti.json
index 27062596f..648a53199 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-persistent-sti.json
@@ -330,24 +330,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -418,17 +419,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
@@ -570,7 +571,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-mysql-tcp-3306",
"containerPort": 3306,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-sti.json
index 69537e697..83d5c8b18 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-mysql-sti.json
@@ -325,24 +325,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -413,17 +414,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
@@ -565,7 +566,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-mysql-tcp-3306",
"containerPort": 3306,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-persistent-sti.json
index 1325e26de..53b953b7e 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-persistent-sti.json
@@ -318,24 +318,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -406,17 +407,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
@@ -558,7 +559,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-postgresql-tcp-5432",
"containerPort": 5432,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-sti.json
index 83921c57e..9d660cb42 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-postgresql-sti.json
@@ -313,24 +313,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -401,17 +402,17 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-ping-8888",
+ "name": "ping",
"containerPort": 8888,
"protocol": "TCP"
}
@@ -553,7 +554,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-postgresql-tcp-5432",
"containerPort": 5432,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-basic-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-basic-sti.json
index a3947593c..d74c2dfe3 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-basic-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-basic-sti.json
@@ -151,24 +151,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -231,7 +232,7 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-https-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-https-sti.json
index 1f9c17cf2..b94142135 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-https-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-https-sti.json
@@ -218,24 +218,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -306,12 +307,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-persistent-sti.json
index 55746fc11..0c7b7d8e3 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-persistent-sti.json
@@ -299,24 +299,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -387,12 +388,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -522,7 +523,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-mongodb-tcp-27017",
"containerPort": 27017,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-sti.json
index f540c885c..892f27fe3 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mongodb-sti.json
@@ -294,24 +294,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -382,12 +383,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -517,7 +518,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-mongodb-tcp-27017",
"containerPort": 27017,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-persistent-sti.json
index 984b075a2..547449010 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-persistent-sti.json
@@ -301,24 +301,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -389,12 +390,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -519,7 +520,6 @@
"image": "mysql",
"ports": [
{
- "name": "${APPLICATION_NAME}-mysql-tcp-3306",
"containerPort": 3306,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-sti.json
index af9c7c17c..2ae59ec71 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-mysql-sti.json
@@ -296,24 +296,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -384,12 +385,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -514,7 +515,6 @@
"image": "mysql",
"ports": [
{
- "name": "${APPLICATION_NAME}-mysql-tcp-3306",
"containerPort": 3306,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-persistent-sti.json
index ec59a6a5b..b871b48d0 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-persistent-sti.json
@@ -289,24 +289,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -377,12 +378,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -507,7 +508,6 @@
"image": "postgresql",
"ports": [
{
- "name": "${APPLICATION_NAME}-postgresql-tcp-5432",
"containerPort": 5432,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-sti.json
index 6040f7208..384ff1b8f 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat7-postgresql-sti.json
@@ -284,24 +284,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -372,12 +373,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -502,7 +503,6 @@
"image": "postgresql",
"ports": [
{
- "name": "${APPLICATION_NAME}-postgresql-tcp-5432",
"containerPort": 5432,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-basic-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-basic-sti.json
index 25b6497b2..3c7812b69 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-basic-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-basic-sti.json
@@ -151,24 +151,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -231,7 +232,7 @@
},
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-https-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-https-sti.json
index af4c94ae0..d725e0606 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-https-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-https-sti.json
@@ -218,24 +218,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -306,12 +307,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-persistent-sti.json
index b5975b646..cf35d0024 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-persistent-sti.json
@@ -299,24 +299,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -387,12 +388,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -522,7 +523,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-mongodb-tcp-27017",
"containerPort": 27017,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-sti.json
index 8145ee34e..a993024f4 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mongodb-sti.json
@@ -294,24 +294,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -382,12 +383,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -517,7 +518,6 @@
"imagePullPolicy": "Always",
"ports": [
{
- "name": "${APPLICATION_NAME}-mongodb-tcp-27017",
"containerPort": 27017,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-persistent-sti.json
index b0808949c..0692817bf 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-persistent-sti.json
@@ -301,24 +301,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -389,12 +390,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -519,7 +520,6 @@
"image": "mysql",
"ports": [
{
- "name": "${APPLICATION_NAME}-mysql-tcp-3306",
"containerPort": 3306,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-sti.json
index 46ad18b91..226a983b7 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-mysql-sti.json
@@ -296,24 +296,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -384,12 +385,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -514,7 +515,6 @@
"image": "mysql",
"ports": [
{
- "name": "${APPLICATION_NAME}-mysql-tcp-3306",
"containerPort": 3306,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-persistent-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-persistent-sti.json
index 19cd2be30..b4644ac08 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-persistent-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-persistent-sti.json
@@ -289,24 +289,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -377,12 +378,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -507,7 +508,6 @@
"image": "postgresql",
"ports": [
{
- "name": "${APPLICATION_NAME}-postgresql-tcp-5432",
"containerPort": 5432,
"protocol": "TCP"
}
diff --git a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-sti.json
index 185808baf..b46f23225 100644
--- a/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-sti.json
+++ b/roles/openshift_examples/files/examples/xpaas-templates/jws-tomcat8-postgresql-sti.json
@@ -284,24 +284,25 @@
},
"output": {
"to": {
- "name": "${APPLICATION_NAME}"
+ "kind": "ImageStreamTag",
+ "name": "${APPLICATION_NAME}:latest"
}
},
"triggers": [
{
- "type": "github",
+ "type": "GitHub",
"github": {
"secret": "${GITHUB_TRIGGER_SECRET}"
}
},
{
- "type": "generic",
+ "type": "Generic",
"generic": {
"secret": "${GENERIC_TRIGGER_SECRET}"
}
},
{
- "type": "imageChange",
+ "type": "ImageChange",
"imageChange": {}
}
]
@@ -372,12 +373,12 @@
],
"ports": [
{
- "name": "${APPLICATION_NAME}-tcp-8080",
+ "name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
- "name": "${APPLICATION_NAME}-tcp-8443",
+ "name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
@@ -502,7 +503,6 @@
"image": "postgresql",
"ports": [
{
- "name": "${APPLICATION_NAME}-postgresql-tcp-5432",
"containerPort": 5432,
"protocol": "TCP"
}
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index d733639c3..4e0989c5f 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -300,8 +300,7 @@ def set_registry_url_if_unset(facts):
if deployment_type == 'enterprise':
registry_url = "openshift3/ose-${component}:${version}"
elif deployment_type == 'online':
- registry_url = ("docker-registry.ops.rhcloud.com/"
- "openshift3/ose-${component}:${version}")
+ registry_url = ("openshift3/ose-${component}:${version}")
facts[role]['registry_url'] = registry_url
return facts
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index 057daabf9..8d6c02e7f 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -53,6 +53,7 @@
oauth_grant_method: "{{ openshift_master_oauth_grant_method | default(None) }}"
sdn_cluster_network_cidr: "{{ osm_cluster_network_cidr | default(None) }}"
sdn_host_subnet_length: "{{ osm_host_subnet_length | default(None) }}"
+ default_subdomain: "{{ osm_default_subdomain | default(None) }}"
# TODO: These values need to be configurable
- name: Set dns OpenShift facts
diff --git a/roles/openshift_master/templates/master.yaml.v1.j2 b/roles/openshift_master/templates/master.yaml.v1.j2
index bc766ec9b..01c0ea7e4 100644
--- a/roles/openshift_master/templates/master.yaml.v1.j2
+++ b/roles/openshift_master/templates/master.yaml.v1.j2
@@ -101,12 +101,13 @@ projectConfig:
mcsLabelsPerProject: 5
uidAllocatorRange: 1000000000-1999999999/10000
routingConfig:
- subdomain: router.default.local
+ subdomain: "{{ openshift.master.default_subdomain | default("") }}"
serviceAccountConfig:
managedNames:
- default
- builder
- deployer
+ masterCA: ca.crt
privateKeyFile: serviceaccounts.private.key
publicKeyFiles:
- serviceaccounts.public.key
diff --git a/roles/openshift_master/templates/v1_partials/oauthConfig.j2 b/roles/openshift_master/templates/v1_partials/oauthConfig.j2
index f6fd88c65..4ca644876 100644
--- a/roles/openshift_master/templates/v1_partials/oauthConfig.j2
+++ b/roles/openshift_master/templates/v1_partials/oauthConfig.j2
@@ -10,6 +10,20 @@
{{ key }}: {{ identity_provider[key] }}"
{% endif %}
{% endfor %}
+{% elif identity_provider.kind == 'LDAPPasswordIdentityProvider' %}
+ attributes:
+{% for attribute_key in identity_provider.attributes %}
+ {{ attribute_key }}:
+{% for attribute_value in identity_provider.attributes[attribute_key] %}
+ - {{ attribute_value }}
+{% endfor %}
+{% endfor %}
+{% for key in ('bindDN', 'bindPassword', 'ca') %}
+ {{ key }}: "{{ identity_provider[key] }}"
+{% endfor %}
+{% for key in ('insecure', 'url') %}
+ {{ key }}: {{ identity_provider[key] }}
+{% endfor %}
{% elif identity_provider.kind == 'RequestHeaderIdentityProvider' %}
headers: {{ identity_provider.headers }}
{% if 'clientCA' in identity_provider %}
diff --git a/roles/openshift_master_certificates/tasks/main.yml b/roles/openshift_master_certificates/tasks/main.yml
index 297d53bcd..bb23cf4f4 100644
--- a/roles/openshift_master_certificates/tasks/main.yml
+++ b/roles/openshift_master_certificates/tasks/main.yml
@@ -15,6 +15,22 @@
- - ca.crt
- ca.key
- ca.serial.txt
+ - admin.crt
+ - admin.key
+ - admin.kubeconfig
+ - master.kubelet-client.crt
+ - master.kubelet-client.key
+ - openshift-master.crt
+ - openshift-master.key
+ - openshift-master.kubeconfig
+ - openshift-registry.crt
+ - openshift-registry.key
+ - openshift-registry.kubeconfig
+ - openshift-router.crt
+ - openshift-router.key
+ - openshift-router.kubeconfig
+ - serviceaccounts.private.key
+ - serviceaccounts.public.key
- name: Create the master certificates if they do not already exist
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index e18846db8..e84e74b40 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -71,3 +71,8 @@
- name: Start and enable openshift-node
service: name=openshift-node enabled=yes state=started
+ register: start_result
+
+- name: pause to prevent service restart from interfering with bootstrapping
+ pause: seconds=30
+ when: start_result | changed
diff --git a/roles/openshift_node_certificates/tasks/main.yml b/roles/openshift_node_certificates/tasks/main.yml
index c9f02aaf0..57f71887b 100644
--- a/roles/openshift_node_certificates/tasks/main.yml
+++ b/roles/openshift_node_certificates/tasks/main.yml
@@ -25,7 +25,7 @@
command: >
{{ openshift.common.admin_binary }} create-server-cert
--cert=server.crt --key=server.key --overwrite=true
- --hostnames={{ openshift.common.all_hostnames |join(",") }}
+ --hostnames={{ item.openshift.common.all_hostnames |join(",") }}
--signer-cert={{ openshift_master_ca_cert }}
--signer-key={{ openshift_master_ca_key }}
--signer-serial={{ openshift_master_ca_serial }}
diff --git a/roles/os_zabbix/library/__init__.py b/roles/os_zabbix/library/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roles/os_zabbix/library/__init__.py
diff --git a/roles/os_zabbix/library/test.yml b/roles/os_zabbix/library/test.yml
new file mode 100644
index 000000000..f585bcbb2
--- /dev/null
+++ b/roles/os_zabbix/library/test.yml
@@ -0,0 +1,92 @@
+---
+# This is a test playbook to create one of each of the zabbix ansible modules.
+# ensure that the zbxapi module is installed
+# ansible-playbook test.yml
+- name: Test zabbix ansible module
+ hosts: localhost
+ gather_facts: no
+ vars:
+ zbx_server: http://localhost/zabbix/api_jsonrpc.php
+ zbx_user: Admin
+ zbx_password: zabbix
+
+ pre_tasks:
+ - name: Create a template
+ zbx_template:
+ server: "{{ zbx_server }}"
+ user: "{{ zbx_user }}"
+ password: "{{ zbx_password }}"
+ name: 'test template'
+ register: template_output
+
+ - debug: var=template_output
+
+ - name: Create an item
+ zbx_item:
+ server: "{{ zbx_server }}"
+ user: "{{ zbx_user }}"
+ password: "{{ zbx_password }}"
+ name: 'test item'
+ key: 'kenny.item.1'
+ template_name: "{{ template_output.results[0].host }}"
+ register: item_output
+
+ - debug: var=item_output
+
+ - name: Create an trigger
+ zbx_trigger:
+ server: "{{ zbx_server }}"
+ user: "{{ zbx_user }}"
+ password: "{{ zbx_password }}"
+ expression: '{test template:kenny.item.1.last()}>2'
+ desc: 'Kenny desc'
+ register: trigger_output
+
+ - debug: var=trigger_output
+
+ - name: Create a hostgroup
+ zbx_hostgroup:
+ server: "{{ zbx_server }}"
+ user: "{{ zbx_user }}"
+ password: "{{ zbx_password }}"
+ name: 'kenny hostgroup'
+ register: hostgroup_output
+
+ - debug: var=hostgroup_output
+
+ - name: Create a host
+ zbx_host:
+ server: "{{ zbx_server }}"
+ user: "{{ zbx_user }}"
+ password: "{{ zbx_password }}"
+ name: 'kenny host'
+ hostgroups:
+ - 'kenny hostgroup'
+ register: host_output
+
+ - debug: var=host_output
+
+ - name: Create a usergroup
+ zbx_usergroup:
+ server: "{{ zbx_server }}"
+ user: "{{ zbx_user }}"
+ password: "{{ zbx_password }}"
+ name: kenny usergroup
+ rights:
+ - 'kenny hostgroup': rw
+ register: usergroup_output
+
+ - debug: var=usergroup_output
+
+ - name: Create a user
+ zbx_user:
+ server: "{{ zbx_server }}"
+ user: "{{ zbx_user }}"
+ password: "{{ zbx_password }}"
+ alias: kenny user
+ passwd: zabbix
+ usergroups:
+ - kenny usergroup
+ register: user_output
+
+ - debug: var=user_output
diff --git a/roles/os_zabbix/library/zbx_host.py b/roles/os_zabbix/library/zbx_host.py
new file mode 100644
index 000000000..d75dfdea1
--- /dev/null
+++ b/roles/os_zabbix/library/zbx_host.py
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+'''
+Zabbix host ansible module
+'''
+# vim: expandtab:tabstop=4:shiftwidth=4
+#
+# Copyright 2015 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is in place because each module looks similar to each other.
+# These need duplicate code as their behavior is very similar
+# but different for each zabbix class.
+# pylint: disable=duplicate-code
+
+# pylint: disable=import-error
+from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection
+
+def exists(content, key='result'):
+ ''' Check if key exists in content or the size of content[key] > 0
+ '''
+ if not content.has_key(key):
+ return False
+
+ if not content[key]:
+ return False
+
+ return True
+
+def get_group_ids(zapi, hostgroup_names):
+ '''
+ get hostgroups
+ '''
+ # Fetch groups by name
+ group_ids = []
+ for hgr in hostgroup_names:
+ content = zapi.get_content('hostgroup', 'get', {'search': {'name': hgr}})
+ if content.has_key('result'):
+ group_ids.append({'groupid': content['result'][0]['groupid']})
+
+ return group_ids
+
+def get_template_ids(zapi, template_names):
+ '''
+ get related templates
+ '''
+ template_ids = []
+ # Fetch templates by name
+ for template_name in template_names:
+ content = zapi.get_content('template', 'get', {'search': {'host': template_name}})
+ if content.has_key('result'):
+ template_ids.append({'templateid': content['results'][0]['templateid']})
+ return template_ids
+
+def main():
+ '''
+ Ansible module for zabbix host
+ '''
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
+ user=dict(default=None, type='str'),
+ password=dict(default=None, type='str'),
+ name=dict(default=None, type='str'),
+ hostgroup_names=dict(default=[], type='list'),
+ template_names=dict(default=[], type='list'),
+ debug=dict(default=False, type='bool'),
+ state=dict(default='present', type='str'),
+ interfaces=dict(default=[], type='list'),
+ ),
+ #supports_check_mode=True
+ )
+
+ user = module.params.get('user', os.environ['ZABBIX_USER'])
+ passwd = module.params.get('password', os.environ['ZABBIX_PASSWORD'])
+
+ zapi = ZabbixAPI(ZabbixConnection(module.params['server'], user, passwd, module.params['debug']))
+
+ #Set the instance and the template for the rest of the calls
+ zbx_class_name = 'host'
+ idname = "hostid"
+ hname = module.params['name']
+ state = module.params['state']
+
+ # selectInterfaces doesn't appear to be working but is needed.
+ content = zapi.get_content(zbx_class_name,
+ 'get',
+ {'search': {'host': hname},
+ 'selectGroups': 'groupid',
+ 'selectParentTemplates': 'templateid',
+ 'selectInterfaces': 'interfaceid',
+ })
+ if state == 'list':
+ module.exit_json(changed=False, results=content['result'], state="list")
+
+ if state == 'absent':
+ if not exists(content):
+ module.exit_json(changed=False, state="absent")
+
+ content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
+ module.exit_json(changed=True, results=content['result'], state="absent")
+
+ if state == 'present':
+ params = {'host': hname,
+ 'groups': get_group_ids(zapi, module.params('hostgroup_names')),
+ 'templates': get_template_ids(zapi, module.params('template_names')),
+ 'interfaces': module.params.get('interfaces', [{'type': 1, # interface type, 1 = agent
+ 'main': 1, # default interface? 1 = true
+ 'useip': 1, # default interface? 1 = true
+ 'ip': '127.0.0.1', # default interface? 1 = true
+ 'dns': '', # dns for host
+ 'port': '10050', # port for interface? 10050
+ }])
+ }
+
+ if not exists(content):
+ # if we didn't find it, create it
+ content = zapi.get_content(zbx_class_name, 'create', params)
+ module.exit_json(changed=True, results=content['result'], state='present')
+ # already exists, we need to update it
+ # let's compare properties
+ differences = {}
+ zab_results = content['result'][0]
+ for key, value in params.items():
+
+ if key == 'templates' and zab_results.has_key('parentTemplates'):
+ if zab_results['parentTemplates'] != value:
+ differences[key] = value
+
+ elif zab_results[key] != value and zab_results[key] != str(value):
+ differences[key] = value
+
+ if not differences:
+ module.exit_json(changed=False, results=zab_results, state="present")
+
+ # We have differences and need to update
+ differences[idname] = zab_results[idname]
+ content = zapi.get_content(zbx_class_name, 'update', differences)
+ module.exit_json(changed=True, results=content['result'], state="present")
+
+ module.exit_json(failed=True,
+ changed=False,
+ results='Unknown state passed. %s' % state,
+ state="unknown")
+
+# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
+# import module snippets. This are required
+from ansible.module_utils.basic import *
+
+main()
diff --git a/roles/os_zabbix/library/zbx_hostgroup.py b/roles/os_zabbix/library/zbx_hostgroup.py
new file mode 100644
index 000000000..a1eb875d4
--- /dev/null
+++ b/roles/os_zabbix/library/zbx_hostgroup.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+''' Ansible module for hostgroup
+'''
+# vim: expandtab:tabstop=4:shiftwidth=4
+#
+# Zabbix hostgroup ansible module
+#
+#
+# Copyright 2015 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is in place because each module looks similar to each other.
+# These need duplicate code as their behavior is very similar
+# but different for each zabbix class.
+# pylint: disable=duplicate-code
+
+# pylint: disable=import-error
+from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection
+
+def exists(content, key='result'):
+ ''' Check if key exists in content or the size of content[key] > 0
+ '''
+ if not content.has_key(key):
+ return False
+
+ if not content[key]:
+ return False
+
+ return True
+
+def main():
+ ''' ansible module for hostgroup
+ '''
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
+ user=dict(default=None, type='str'),
+ password=dict(default=None, type='str'),
+ name=dict(default=None, type='str'),
+ debug=dict(default=False, type='bool'),
+ state=dict(default='present', type='str'),
+ ),
+ #supports_check_mode=True
+ )
+
+ user = module.params.get('user', os.environ['ZABBIX_USER'])
+ passwd = module.params.get('password', os.environ['ZABBIX_PASSWORD'])
+
+ zapi = ZabbixAPI(ZabbixConnection(module.params['server'], user, passwd, module.params['debug']))
+
+ #Set the instance and the template for the rest of the calls
+ zbx_class_name = 'hostgroup'
+ idname = "groupid"
+ hname = module.params['name']
+ state = module.params['state']
+
+ content = zapi.get_content(zbx_class_name,
+ 'get',
+ {'search': {'name': hname},
+ })
+ if state == 'list':
+ module.exit_json(changed=False, results=content['result'], state="list")
+
+ if state == 'absent':
+ if not exists(content):
+ module.exit_json(changed=False, state="absent")
+
+ content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
+ module.exit_json(changed=True, results=content['result'], state="absent")
+
+ if state == 'present':
+ params = {'name': hname}
+
+ if not exists(content):
+ # if we didn't find it, create it
+ content = zapi.get_content(zbx_class_name, 'create', params)
+ module.exit_json(changed=True, results=content['result'], state='present')
+ # already exists, we need to update it
+ # let's compare properties
+ differences = {}
+ zab_results = content['result'][0]
+ for key, value in params.items():
+ if zab_results[key] != value and zab_results[key] != str(value):
+ differences[key] = value
+
+ if not differences:
+ module.exit_json(changed=False, results=zab_results, state="present")
+
+ # We have differences and need to update
+ differences[idname] = zab_results[idname]
+ content = zapi.get_content(zbx_class_name, 'update', differences)
+ module.exit_json(changed=True, results=content['result'], state="present")
+
+ module.exit_json(failed=True,
+ changed=False,
+ results='Unknown state passed. %s' % state,
+ state="unknown")
+
+# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
+# import module snippets. This are required
+from ansible.module_utils.basic import *
+
+main()
diff --git a/roles/os_zabbix/library/zbx_item.py b/roles/os_zabbix/library/zbx_item.py
new file mode 100644
index 000000000..6cfb16d48
--- /dev/null
+++ b/roles/os_zabbix/library/zbx_item.py
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+'''
+ Ansible module for zabbix items
+'''
+# vim: expandtab:tabstop=4:shiftwidth=4
+#
+# Zabbix item ansible module
+#
+#
+# Copyright 2015 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is in place because each module looks similar to each other.
+# These need duplicate code as their behavior is very similar
+# but different for each zabbix class.
+# pylint: disable=duplicate-code
+
+# pylint: disable=import-error
+from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection
+
+def exists(content, key='result'):
+ ''' Check if key exists in content or the size of content[key] > 0
+ '''
+ if not content.has_key(key):
+ return False
+
+ if not content[key]:
+ return False
+
+ return True
+
+def get_value_type(value_type):
+ '''
+ Possible values:
+ 0 - numeric float;
+ 1 - character;
+ 2 - log;
+ 3 - numeric unsigned;
+ 4 - text
+ '''
+ vtype = 0
+ if 'int' in value_type:
+ vtype = 3
+ elif 'char' in value_type:
+ vtype = 1
+ elif 'str' in value_type:
+ vtype = 4
+
+ return vtype
+
+def main():
+ '''
+ ansible zabbix module for zbx_item
+ '''
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
+ user=dict(default=None, type='str'),
+ password=dict(default=None, type='str'),
+ name=dict(default=None, type='str'),
+ key=dict(default=None, type='str'),
+ template_name=dict(default=None, type='str'),
+ zabbix_type=dict(default=2, type='int'),
+ value_type=dict(default='int', type='str'),
+ applications=dict(default=[], type='list'),
+ debug=dict(default=False, type='bool'),
+ state=dict(default='present', type='str'),
+ ),
+ #supports_check_mode=True
+ )
+
+ user = module.params.get('user', os.environ['ZABBIX_USER'])
+ passwd = module.params.get('password', os.environ['ZABBIX_PASSWORD'])
+
+ zapi = ZabbixAPI(ZabbixConnection(module.params['server'], user, passwd, module.params['debug']))
+
+ #Set the instance and the template for the rest of the calls
+ zbx_class_name = 'item'
+ idname = "itemid"
+ state = module.params['state']
+ key = module.params['key']
+ template_name = module.params['template_name']
+
+ content = zapi.get_content('template', 'get', {'search': {'host': template_name}})
+ templateid = None
+ if content['result']:
+ templateid = content['result'][0]['templateid']
+ else:
+ module.exit_json(changed=False,
+ results='Error: Could find template with name %s for item.' % template_name,
+ state="Unkown")
+
+ content = zapi.get_content(zbx_class_name,
+ 'get',
+ {'search': {'key_': key},
+ 'selectApplications': 'applicationid',
+ })
+ if state == 'list':
+ module.exit_json(changed=False, results=content['result'], state="list")
+
+ if state == 'absent':
+ if not exists(content):
+ module.exit_json(changed=False, state="absent")
+
+ content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
+ module.exit_json(changed=True, results=content['result'], state="absent")
+
+ if state == 'present':
+ params = {'name': module.params['name'],
+ 'key_': key,
+ 'hostid': templateid,
+ 'type': module.params['zabbix_type'],
+ 'value_type': get_value_type(module.params['value_type']),
+ 'applications': module.params['applications'],
+ }
+
+ if not exists(content):
+ # if we didn't find it, create it
+ content = zapi.get_content(zbx_class_name, 'create', params)
+ module.exit_json(changed=True, results=content['result'], state='present')
+ # already exists, we need to update it
+ # let's compare properties
+ differences = {}
+ zab_results = content['result'][0]
+ for key, value in params.items():
+
+ if zab_results[key] != value and zab_results[key] != str(value):
+ differences[key] = value
+
+ if not differences:
+ module.exit_json(changed=False, results=zab_results, state="present")
+
+ # We have differences and need to update
+ differences[idname] = zab_results[idname]
+ content = zapi.get_content(zbx_class_name, 'update', differences)
+ module.exit_json(changed=True, results=content['result'], state="present")
+
+ module.exit_json(failed=True,
+ changed=False,
+ results='Unknown state passed. %s' % state,
+ state="unknown")
+
+# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
+# import module snippets. This are required
+from ansible.module_utils.basic import *
+
+main()
diff --git a/roles/os_zabbix/library/zbx_mediatype.py b/roles/os_zabbix/library/zbx_mediatype.py
new file mode 100644
index 000000000..a49aecd0f
--- /dev/null
+++ b/roles/os_zabbix/library/zbx_mediatype.py
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+'''
+ Ansible module for mediatype
+'''
+# vim: expandtab:tabstop=4:shiftwidth=4
+#
+# Zabbix mediatype ansible module
+#
+#
+# Copyright 2015 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is in place because each module looks similar to each other.
+# These need duplicate code as their behavior is very similar
+# but different for each zabbix class.
+# pylint: disable=duplicate-code
+
+# pylint: disable=import-error
+from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection
+
+def exists(content, key='result'):
+ ''' Check if key exists in content or the size of content[key] > 0
+ '''
+ if not content.has_key(key):
+ return False
+
+ if not content[key]:
+ return False
+
+ return True
+def get_mtype(mtype):
+ '''
+ Transport used by the media type.
+ Possible values:
+ 0 - email;
+ 1 - script;
+ 2 - SMS;
+ 3 - Jabber;
+ 100 - Ez Texting.
+ '''
+ mtype = mtype.lower()
+ media_type = None
+ if mtype == 'script':
+ media_type = 1
+ elif mtype == 'sms':
+ media_type = 2
+ elif mtype == 'jabber':
+ media_type = 3
+ elif mtype == 'script':
+ media_type = 100
+ else:
+ media_type = 0
+
+ return media_type
+
+def main():
+ '''
+ Ansible zabbix module for mediatype
+ '''
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
+ user=dict(default=None, type='str'),
+ password=dict(default=None, type='str'),
+ description=dict(default=None, type='str'),
+ mtype=dict(default=None, type='str'),
+ smtp_server=dict(default=None, type='str'),
+ smtp_helo=dict(default=None, type='str'),
+ smtp_email=dict(default=None, type='str'),
+ debug=dict(default=False, type='bool'),
+ state=dict(default='present', type='str'),
+ ),
+ #supports_check_mode=True
+ )
+
+ user = module.params.get('user', os.environ['ZABBIX_USER'])
+ passwd = module.params.get('password', os.environ['ZABBIX_PASSWORD'])
+
+ zapi = ZabbixAPI(ZabbixConnection(module.params['server'], user, passwd, module.params['debug']))
+
+ #Set the instance and the template for the rest of the calls
+ zbx_class_name = 'mediatype'
+ idname = "mediatypeid"
+ description = module.params['description']
+ state = module.params['state']
+
+ content = zapi.get_content(zbx_class_name, 'get', {'search': {'description': description}})
+ if state == 'list':
+ module.exit_json(changed=False, results=content['result'], state="list")
+
+ if state == 'absent':
+ if not exists(content):
+ module.exit_json(changed=False, state="absent")
+
+ content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
+ module.exit_json(changed=True, results=content['result'], state="absent")
+
+ if state == 'present':
+ params = {'description': description,
+ 'type': get_mtype(module.params['media_type']),
+ 'smtp_server': module.params['smtp_server'],
+ 'smtp_helo': module.params['smtp_helo'],
+ 'smtp_email': module.params['smtp_email'],
+ }
+
+ if not exists(content):
+ # if we didn't find it, create it
+ content = zapi.get_content(zbx_class_name, 'create', params)
+ module.exit_json(changed=True, results=content['result'], state='present')
+ # already exists, we need to update it
+ # let's compare properties
+ differences = {}
+ zab_results = content['result'][0]
+ for key, value in params.items():
+ if zab_results[key] != value and \
+ zab_results[key] != str(value):
+ differences[key] = value
+
+ if not differences:
+ module.exit_json(changed=False, results=zab_results, state="present")
+
+ # We have differences and need to update
+ differences[idname] = zab_results[idname]
+ content = zapi.get_content(zbx_class_name, 'update', differences)
+ module.exit_json(changed=True, results=content['result'], state="present")
+
+ module.exit_json(failed=True,
+ changed=False,
+ results='Unknown state passed. %s' % state,
+ state="unknown")
+
+# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
+# import module snippets. This are required
+from ansible.module_utils.basic import *
+
+main()
diff --git a/roles/os_zabbix/library/zbx_template.py b/roles/os_zabbix/library/zbx_template.py
new file mode 100644
index 000000000..676fa7e49
--- /dev/null
+++ b/roles/os_zabbix/library/zbx_template.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+'''
+Ansible module for template
+'''
+# vim: expandtab:tabstop=4:shiftwidth=4
+#
+# Zabbix template ansible module
+#
+#
+# Copyright 2015 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is in place because each module looks similar to each other.
+# These need duplicate code as their behavior is very similar
+# but different for each zabbix class.
+# pylint: disable=duplicate-code
+
+# pylint: disable=import-error
+from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection
+
+def exists(content, key='result'):
+ ''' Check if key exists in content or the size of content[key] > 0
+ '''
+ if not content.has_key(key):
+ return False
+
+ if not content[key]:
+ return False
+
+ return True
+
+def main():
+ ''' Ansible module for template
+ '''
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
+ user=dict(default=None, type='str'),
+ password=dict(default=None, type='str'),
+ name=dict(default=None, type='str'),
+ debug=dict(default=False, type='bool'),
+ state=dict(default='present', type='str'),
+ ),
+ #supports_check_mode=True
+ )
+
+ user = module.params.get('user', os.environ['ZABBIX_USER'])
+ passwd = module.params.get('password', os.environ['ZABBIX_PASSWORD'])
+
+ zbc = ZabbixConnection(module.params['server'], user, passwd, module.params['debug'])
+ zapi = ZabbixAPI(zbc)
+
+ #Set the instance and the template for the rest of the calls
+ zbx_class_name = 'template'
+ idname = 'templateid'
+ tname = module.params['name']
+ state = module.params['state']
+ # get a template, see if it exists
+ content = zapi.get_content(zbx_class_name,
+ 'get',
+ {'search': {'host': tname},
+ 'selectParentTemplates': 'templateid',
+ 'selectGroups': 'groupid',
+ #'selectApplications': extend,
+ })
+ if state == 'list':
+ module.exit_json(changed=False, results=content['result'], state="list")
+
+ if state == 'absent':
+ if not exists(content):
+ module.exit_json(changed=False, state="absent")
+
+ content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
+ module.exit_json(changed=True, results=content['result'], state="absent")
+
+ if state == 'present':
+ params = {'groups': module.params.get('groups', [{'groupid': '1'}]),
+ 'host': tname,
+ }
+
+ if not exists(content):
+ # if we didn't find it, create it
+ content = zapi.get_content(zbx_class_name, 'create', params)
+ module.exit_json(changed=True, results=content['result'], state='present')
+ # already exists, we need to update it
+ # let's compare properties
+ differences = {}
+ zab_results = content['result'][0]
+ for key, value in params.items():
+ if key == 'templates' and zab_results.has_key('parentTemplates'):
+ if zab_results['parentTemplates'] != value:
+ differences[key] = value
+ elif zab_results[key] != str(value) and zab_results[key] != value:
+ differences[key] = value
+
+ if not differences:
+ module.exit_json(changed=False, results=content['result'], state="present")
+
+ # We have differences and need to update
+ differences[idname] = zab_results[idname]
+ content = zapi.get_content(zbx_class_name, 'update', differences)
+ module.exit_json(changed=True, results=content['result'], state="present")
+
+ module.exit_json(failed=True,
+ changed=False,
+ results='Unknown state passed. %s' % state,
+ state="unknown")
+
+# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
+# import module snippets. This are required
+from ansible.module_utils.basic import *
+
+main()
diff --git a/roles/os_zabbix/library/zbx_trigger.py b/roles/os_zabbix/library/zbx_trigger.py
new file mode 100644
index 000000000..7cc9356c8
--- /dev/null
+++ b/roles/os_zabbix/library/zbx_trigger.py
@@ -0,0 +1,175 @@
+#!/usr/bin/env python
+'''
+ansible module for zabbix triggers
+'''
+# vim: expandtab:tabstop=4:shiftwidth=4
+#
+# Zabbix trigger ansible module
+#
+#
+# Copyright 2015 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is in place because each module looks similar to each other.
+# These need duplicate code as their behavior is very similar
+# but different for each zabbix class.
+# pylint: disable=duplicate-code
+
+# pylint: disable=import-error
+from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection
+
+def exists(content, key='result'):
+ ''' Check if key exists in content or the size of content[key] > 0
+ '''
+ if not content.has_key(key):
+ return False
+
+ if not content[key]:
+ return False
+
+ return True
+
+
+def get_priority(priority):
+ ''' determine priority
+ '''
+ prior = 0
+ if 'info' in priority:
+ prior = 1
+ elif 'warn' in priority:
+ prior = 2
+ elif 'avg' == priority or 'ave' in priority:
+ prior = 3
+ elif 'high' in priority:
+ prior = 4
+ elif 'dis' in priority:
+ prior = 5
+
+ return prior
+
+def get_deps(zapi, deps):
+ ''' get trigger dependencies
+ '''
+ results = []
+ for desc in deps:
+ content = zapi.get_content('trigger',
+ 'get',
+ {'search': {'description': desc},
+ 'expandExpression': True,
+ 'selectDependencies': 'triggerid',
+ })
+ if content.has_key('result'):
+ results.append({'triggerid': content['result'][0]['triggerid']})
+
+ return results
+
+def main():
+ '''
+ Create a trigger in zabbix
+
+ Example:
+ "params": {
+ "description": "Processor load is too high on {HOST.NAME}",
+ "expression": "{Linux server:system.cpu.load[percpu,avg1].last()}>5",
+ "dependencies": [
+ {
+ "triggerid": "14062"
+ }
+ ]
+ },
+
+ '''
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
+ user=dict(default=None, type='str'),
+ password=dict(default=None, type='str'),
+ expression=dict(default=None, type='str'),
+ description=dict(default=None, type='str'),
+ dependencies=dict(default=[], type='list'),
+ priority=dict(default='avg', type='str'),
+ debug=dict(default=False, type='bool'),
+ state=dict(default='present', type='str'),
+ ),
+ #supports_check_mode=True
+ )
+
+ user = module.params.get('user', os.environ['ZABBIX_USER'])
+ passwd = module.params.get('password', os.environ['ZABBIX_PASSWORD'])
+
+
+ zapi = ZabbixAPI(ZabbixConnection(module.params['server'], user, passwd, module.params['debug']))
+
+ #Set the instance and the template for the rest of the calls
+ zbx_class_name = 'trigger'
+ idname = "triggerid"
+ state = module.params['state']
+ description = module.params['description']
+
+ content = zapi.get_content(zbx_class_name,
+ 'get',
+ {'search': {'description': description},
+ 'expandExpression': True,
+ 'selectDependencies': 'triggerid',
+ })
+ if state == 'list':
+ module.exit_json(changed=False, results=content['result'], state="list")
+
+ if state == 'absent':
+ if not exists(content):
+ module.exit_json(changed=False, state="absent")
+ content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
+ module.exit_json(changed=True, results=content['result'], state="absent")
+
+ if state == 'present':
+ params = {'description': description,
+ 'expression': module.params['expression'],
+ 'dependencies': get_deps(zapi, module.params['dependencies']),
+ 'priority': get_priority(module.params['priority']),
+ }
+
+ if not exists(content):
+ # if we didn't find it, create it
+ content = zapi.get_content(zbx_class_name, 'create', params)
+ module.exit_json(changed=True, results=content['result'], state='present')
+ # already exists, we need to update it
+ # let's compare properties
+ differences = {}
+ zab_results = content['result'][0]
+ for key, value in params.items():
+
+ if zab_results[key] != value and zab_results[key] != str(value):
+ differences[key] = value
+
+ if not differences:
+ module.exit_json(changed=False, results=zab_results, state="present")
+
+ # We have differences and need to update
+ differences[idname] = zab_results[idname]
+ content = zapi.get_content(zbx_class_name, 'update', differences)
+ module.exit_json(changed=True, results=content['result'], state="present")
+
+
+ module.exit_json(failed=True,
+ changed=False,
+ results='Unknown state passed. %s' % state,
+ state="unknown")
+
+# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
+# import module snippets. This are required
+from ansible.module_utils.basic import *
+
+main()
diff --git a/roles/os_zabbix/library/zbx_user.py b/roles/os_zabbix/library/zbx_user.py
new file mode 100644
index 000000000..489023407
--- /dev/null
+++ b/roles/os_zabbix/library/zbx_user.py
@@ -0,0 +1,146 @@
+#!/usr/bin/env python
+'''
+ansible module for zabbix users
+'''
+# vim: expandtab:tabstop=4:shiftwidth=4
+#
+# Zabbix user ansible module
+#
+#
+# Copyright 2015 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# This is in place because each module looks similar to each other.
+# These need duplicate code as their behavior is very similar
+# but different for each zabbix class.
+# pylint: disable=duplicate-code
+
+# pylint: disable=import-error
+from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection
+
+def exists(content, key='result'):
+ ''' Check if key exists in content or the size of content[key] > 0
+ '''
+ if not content.has_key(key):
+ return False
+
+ if not content[key]:
+ return False
+
+ return True
+
+def get_usergroups(zapi, usergroups):
+ ''' Get usergroups
+ '''
+ ugroups = []
+ for ugr in usergroups:
+ content = zapi.get_content('usergroup',
+ 'get',
+ {'search': {'name': ugr},
+ #'selectUsers': 'userid',
+ #'getRights': 'extend'
+ })
+ if content['result']:
+ ugroups.append({'usrgrpid': content['result'][0]['usrgrpid']})
+
+ return ugroups
+
+def main():
+ '''
+ ansible zabbix module for users
+ '''
+
+ ##def user(self, name, state='present', params=None):
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
+ user=dict(default=None, type='str'),
+ password=dict(default=None, type='str'),
+ alias=dict(default=None, type='str'),
+ passwd=dict(default=None, type='str'),
+ usergroups=dict(default=None, type='list'),
+ debug=dict(default=False, type='bool'),
+ state=dict(default='present', type='str'),
+ ),
+ #supports_check_mode=True
+ )
+
+ user = module.params.get('user', os.environ['ZABBIX_USER'])
+ password = module.params.get('password', os.environ['ZABBIX_PASSWORD'])
+
+ zbc = ZabbixConnection(module.params['server'], user, password, module.params['debug'])
+ zapi = ZabbixAPI(zbc)
+
+ ## before we can create a user media and users with media types we need media
+ zbx_class_name = 'user'
+ idname = "userid"
+ alias = module.params['alias']
+ state = module.params['state']
+
+ content = zapi.get_content(zbx_class_name,
+ 'get',
+ {'output': 'extend',
+ 'search': {'alias': alias},
+ "selectUsrgrps": 'usergrpid',
+ })
+ if state == 'list':
+ module.exit_json(changed=False, results=content['result'], state="list")
+
+ if state == 'absent':
+ if not exists(content):
+ module.exit_json(changed=False, state="absent")
+
+ content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
+ module.exit_json(changed=True, results=content['result'], state="absent")
+
+ if state == 'present':
+ params = {'alias': alias,
+ 'passwd': module.params['passwd'],
+ 'usrgrps': get_usergroups(zapi, module.params['usergroups']),
+ }
+
+ if not exists(content):
+ # if we didn't find it, create it
+ content = zapi.get_content(zbx_class_name, 'create', params)
+ module.exit_json(changed=True, results=content['result'], state='present')
+ # already exists, we need to update it
+ # let's compare properties
+ differences = {}
+ zab_results = content['result'][0]
+ for key, value in params.items():
+ if key == 'passwd':
+ differences[key] = value
+
+ elif zab_results[key] != value and zab_results[key] != str(value):
+ differences[key] = value
+
+ if not differences:
+ module.exit_json(changed=False, results=zab_results, state="present")
+
+ # We have differences and need to update
+ differences[idname] = zab_results[idname]
+ content = zapi.get_content(zbx_class_name, 'update', differences)
+ module.exit_json(changed=True, results=content['result'], state="present")
+
+ module.exit_json(failed=True,
+ changed=False,
+ results='Unknown state passed. %s' % state,
+ state="unknown")
+
+# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
+# import module snippets. This are required
+from ansible.module_utils.basic import *
+
+main()
diff --git a/roles/os_zabbix/library/zbx_usergroup.py b/roles/os_zabbix/library/zbx_usergroup.py
new file mode 100644
index 000000000..ede4c9df1
--- /dev/null
+++ b/roles/os_zabbix/library/zbx_usergroup.py
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+'''
+zabbix ansible module for usergroups
+'''
+# vim: expandtab:tabstop=4:shiftwidth=4
+#
+# Zabbix usergroup ansible module
+#
+#
+# Copyright 2015 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is in place because each module looks similar to each other.
+# These need duplicate code as their behavior is very similar
+# but different for each zabbix class.
+# pylint: disable=duplicate-code
+
+# pylint: disable=import-error
+from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection
+
+def exists(content, key='result'):
+ ''' Check if key exists in content or the size of content[key] > 0
+ '''
+ if not content.has_key(key):
+ return False
+
+ if not content[key]:
+ return False
+
+ return True
+
+def get_rights(zapi, rights):
+ '''Get rights
+ '''
+ perms = []
+ for right in rights:
+ hstgrp = right.keys()[0]
+ perm = right.values()[0]
+ content = zapi.get_content('hostgroup', 'get', {'search': {'name': hstgrp}})
+ if content['result']:
+ permission = 0
+ if perm == 'ro':
+ permission = 2
+ elif perm == 'rw':
+ permission = 3
+ perms.append({'id': content['result'][0]['groupid'],
+ 'permission': permission})
+ return perms
+
+def get_userids(zapi, users):
+ ''' Get userids from user aliases
+ '''
+ userids = []
+ for alias in users:
+ content = zapi.get_content('user', 'get', {'search': {'alias': alias}})
+ if content['result']:
+ userids.append(content['result'][0]['userid'])
+
+ return userids
+
+def main():
+ ''' Ansible module for usergroup
+ '''
+
+ ##def usergroup(self, name, rights=None, users=None, state='present', params=None):
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
+ user=dict(default=None, type='str'),
+ password=dict(default=None, type='str'),
+ name=dict(default=None, type='str'),
+ rights=dict(default=[], type='list'),
+ users=dict(default=[], type='list'),
+ debug=dict(default=False, type='bool'),
+ state=dict(default='present', type='str'),
+ ),
+ #supports_check_mode=True
+ )
+
+ user = module.params.get('user', os.environ['ZABBIX_USER'])
+ passwd = module.params.get('password', os.environ['ZABBIX_PASSWORD'])
+
+ zapi = ZabbixAPI(ZabbixConnection(module.params['server'], user, passwd, module.params['debug']))
+
+ zbx_class_name = 'usergroup'
+ idname = "usrgrpid"
+ uname = module.params['name']
+ state = module.params['state']
+
+ content = zapi.get_content(zbx_class_name,
+ 'get',
+ {'search': {'name': uname},
+ 'selectUsers': 'userid',
+ })
+ if state == 'list':
+ module.exit_json(changed=False, results=content['result'], state="list")
+
+ if state == 'absent':
+ if not exists(content):
+ module.exit_json(changed=False, state="absent")
+
+ content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
+ module.exit_json(changed=True, results=content['result'], state="absent")
+
+ if state == 'present':
+ params = {'name': uname,
+ 'rights': get_rights(zapi, module.params['rights']),
+ 'userids': get_userids(zapi, module.params['users']),
+ }
+
+ if not exists(content):
+ # if we didn't find it, create it
+ content = zapi.get_content(zbx_class_name, 'create', params)
+ module.exit_json(changed=True, results=content['result'], state='present')
+ # already exists, we need to update it
+ # let's compare properties
+ differences = {}
+ zab_results = content['result'][0]
+ for key, value in params.items():
+ if key == 'rights':
+ differences['rights'] = value
+
+ elif key == 'userids' and zab_results.has_key('users'):
+ if zab_results['users'] != value:
+ differences['userids'] = value
+
+ elif zab_results[key] != value and zab_results[key] != str(value):
+ differences[key] = value
+
+ if not differences:
+ module.exit_json(changed=False, results=zab_results, state="present")
+
+ # We have differences and need to update
+ differences[idname] = zab_results[idname]
+ content = zapi.get_content(zbx_class_name, 'update', differences)
+ module.exit_json(changed=True, results=content['result'], state="present")
+
+ module.exit_json(failed=True,
+ changed=False,
+ results='Unknown state passed. %s' % state,
+ state="unknown")
+
+# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
+# import module snippets. This are required
+from ansible.module_utils.basic import *
+
+main()
diff --git a/roles/os_zabbix/library/zbxapi.py b/roles/os_zabbix/library/zbxapi.py
deleted file mode 100755
index 48f294938..000000000
--- a/roles/os_zabbix/library/zbxapi.py
+++ /dev/null
@@ -1,382 +0,0 @@
-#!/usr/bin/env python
-# vim: expandtab:tabstop=4:shiftwidth=4
-'''
- ZabbixAPI ansible module
-'''
-
-# Copyright 2015 Red Hat Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Purpose: An ansible module to communicate with zabbix.
-#
-
-# pylint: disable=line-too-long
-# Disabling line length for readability
-
-import json
-import httplib2
-import sys
-import os
-import re
-import copy
-
-class ZabbixAPIError(Exception):
- '''
- ZabbixAPIError
- Exists to propagate errors up from the api
- '''
- pass
-
-class ZabbixAPI(object):
- '''
- ZabbixAPI class
- '''
- classes = {
- 'Action': ['create', 'delete', 'get', 'update'],
- 'Alert': ['get'],
- 'Application': ['create', 'delete', 'get', 'massadd', 'update'],
- 'Configuration': ['export', 'import'],
- 'Dcheck': ['get'],
- 'Dhost': ['get'],
- 'Drule': ['copy', 'create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Dservice': ['get'],
- 'Event': ['acknowledge', 'get'],
- 'Graph': ['create', 'delete', 'get', 'update'],
- 'Graphitem': ['get'],
- 'Graphprototype': ['create', 'delete', 'get', 'update'],
- 'History': ['get'],
- 'Hostgroup': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'massadd', 'massremove', 'massupdate', 'update'],
- 'Hostinterface': ['create', 'delete', 'get', 'massadd', 'massremove', 'replacehostinterfaces', 'update'],
- 'Host': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'massadd', 'massremove', 'massupdate', 'update'],
- 'Hostprototype': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Httptest': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Iconmap': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Image': ['create', 'delete', 'get', 'update'],
- 'Item': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Itemprototype': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Maintenance': ['create', 'delete', 'get', 'update'],
- 'Map': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Mediatype': ['create', 'delete', 'get', 'update'],
- 'Proxy': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Screen': ['create', 'delete', 'get', 'update'],
- 'Screenitem': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'update', 'updatebyposition'],
- 'Script': ['create', 'delete', 'execute', 'get', 'getscriptsbyhosts', 'update'],
- 'Service': ['adddependencies', 'addtimes', 'create', 'delete', 'deletedependencies', 'deletetimes', 'get', 'getsla', 'isreadable', 'iswritable', 'update'],
- 'Template': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'massadd', 'massremove', 'massupdate', 'update'],
- 'Templatescreen': ['copy', 'create', 'delete', 'get', 'isreadable', 'iswritable', 'update'],
- 'Templatescreenitem': ['get'],
- 'Trigger': ['adddependencies', 'create', 'delete', 'deletedependencies', 'get', 'isreadable', 'iswritable', 'update'],
- 'Triggerprototype': ['create', 'delete', 'get', 'update'],
- 'User': ['addmedia', 'create', 'delete', 'deletemedia', 'get', 'isreadable', 'iswritable', 'login', 'logout', 'update', 'updatemedia', 'updateprofile'],
- 'Usergroup': ['create', 'delete', 'get', 'isreadable', 'iswritable', 'massadd', 'massupdate', 'update'],
- 'Usermacro': ['create', 'createglobal', 'delete', 'deleteglobal', 'get', 'update', 'updateglobal'],
- 'Usermedia': ['get'],
- }
-
- def __init__(self, data=None):
- if not data:
- data = {}
- self.server = data.get('server', None)
- self.username = data.get('user', None)
- self.password = data.get('password', None)
- if any([value == None for value in [self.server, self.username, self.password]]):
- print 'Please specify zabbix server url, username, and password.'
- sys.exit(1)
-
- self.verbose = data.get('verbose', False)
- self.use_ssl = data.has_key('use_ssl')
- self.auth = None
-
- for cname, _ in self.classes.items():
- setattr(self, cname.lower(), getattr(self, cname)(self))
-
- # pylint: disable=no-member
- # This method does not exist until the metaprogramming executed
- results = self.user.login(user=self.username, password=self.password)
-
- if results[0]['status'] == '200':
- if results[1].has_key('result'):
- self.auth = results[1]['result']
- elif results[1].has_key('error'):
- print "Unable to authenticate with zabbix server. {0} ".format(results[1]['error'])
- sys.exit(1)
- else:
- print "Error in call to zabbix. Http status: {0}.".format(results[0]['status'])
- sys.exit(1)
-
- def perform(self, method, rpc_params):
- '''
- This method calls your zabbix server.
-
- It requires the following parameters in order for a proper request to be processed:
- jsonrpc - the version of the JSON-RPC protocol used by the API;
- the Zabbix API implements JSON-RPC version 2.0;
- method - the API method being called;
- rpc_params - parameters that will be passed to the API method;
- id - an arbitrary identifier of the request;
- auth - a user authentication token; since we don't have one yet, it's set to null.
- '''
- http_method = "POST"
- jsonrpc = "2.0"
- rid = 1
-
- http = None
- if self.use_ssl:
- http = httplib2.Http()
- else:
- http = httplib2.Http(disable_ssl_certificate_validation=True,)
-
- headers = {}
- headers["Content-type"] = "application/json"
-
- body = {
- "jsonrpc": jsonrpc,
- "method": method,
- "params": rpc_params.get('params', {}),
- "id": rid,
- 'auth': self.auth,
- }
-
- if method in ['user.login', 'api.version']:
- del body['auth']
-
- body = json.dumps(body)
-
- if self.verbose:
- print body
- print method
- print headers
- httplib2.debuglevel = 1
-
- response, content = http.request(self.server, http_method, body, headers)
-
- if response['status'] not in ['200', '201']:
- raise ZabbixAPIError('Error calling zabbix. Zabbix returned %s' % response['status'])
-
- if self.verbose:
- print response
- print content
-
- try:
- content = json.loads(content)
- except ValueError as err:
- content = {"error": err.message}
-
- return response, content
-
- @staticmethod
- def meta(cname, method_names):
- '''
- This bit of metaprogramming is where the ZabbixAPI subclasses are created.
- For each of ZabbixAPI.classes we create a class from the key and methods
- from the ZabbixAPI.classes values. We pass a reference to ZabbixAPI class
- to each subclass in order for each to be able to call the perform method.
- '''
- def meta_method(_class, method_name):
- '''
- This meta method allows a class to add methods to it.
- '''
- # This template method is a stub method for each of the subclass
- # methods.
- def template_method(self, params=None, **rpc_params):
- '''
- This template method is a stub method for each of the subclass methods.
- '''
- if params:
- rpc_params['params'] = params
- else:
- rpc_params['params'] = copy.deepcopy(rpc_params)
-
- return self.parent.perform(cname.lower()+"."+method_name, rpc_params)
-
- template_method.__doc__ = \
- "https://www.zabbix.com/documentation/2.4/manual/api/reference/%s/%s" % \
- (cname.lower(), method_name)
- template_method.__name__ = method_name
- # this is where the template method is placed inside of the subclass
- # e.g. setattr(User, "create", stub_method)
- setattr(_class, template_method.__name__, template_method)
-
- # This class call instantiates a subclass. e.g. User
- _class = type(cname,
- (object,),
- {'__doc__': \
- "https://www.zabbix.com/documentation/2.4/manual/api/reference/%s" % cname.lower()})
- def __init__(self, parent):
- '''
- This init method gets placed inside of the _class
- to allow it to be instantiated. A reference to the parent class(ZabbixAPI)
- is passed in to allow each class access to the perform method.
- '''
- self.parent = parent
-
- # This attaches the init to the subclass. e.g. Create
- setattr(_class, __init__.__name__, __init__)
- # For each of our ZabbixAPI.classes dict values
- # Create a method and attach it to our subclass.
- # e.g. 'User': ['delete', 'get', 'updatemedia', 'updateprofile',
- # 'update', 'iswritable', 'logout', 'addmedia', 'create',
- # 'login', 'deletemedia', 'isreadable'],
- # User.delete
- # User.get
- for method_name in method_names:
- meta_method(_class, method_name)
- # Return our subclass with all methods attached
- return _class
-
-# Attach all ZabbixAPI.classes to ZabbixAPI class through metaprogramming
-for _class_name, _method_names in ZabbixAPI.classes.items():
- setattr(ZabbixAPI, _class_name, ZabbixAPI.meta(_class_name, _method_names))
-
-def exists(content, key='result'):
- ''' Check if key exists in content or the size of content[key] > 0
- '''
- if not content.has_key(key):
- return False
-
- if not content[key]:
- return False
-
- return True
-
-def diff_content(from_zabbix, from_user, ignore=None):
- ''' Compare passed in object to results returned from zabbix
- '''
- terms = ['search', 'output', 'groups', 'select', 'expand', 'filter']
- if ignore:
- terms.extend(ignore)
- regex = '(' + '|'.join(terms) + ')'
- retval = {}
- for key, value in from_user.items():
- if re.findall(regex, key):
- continue
-
- # special case here for templates. You query templates and
- # the zabbix api returns parentTemplates. These will obviously fail.
- # So when its templates compare against parentTemplates.
- if key == 'templates' and from_zabbix.has_key('parentTemplates'):
- if from_zabbix['parentTemplates'] != value:
- retval[key] = value
-
- elif from_zabbix[key] != str(value):
- retval[key] = str(value)
-
- return retval
-
-def main():
- '''
- This main method runs the ZabbixAPI Ansible Module
- '''
-
- module = AnsibleModule(
- argument_spec=dict(
- server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'),
- user=dict(default=None, type='str'),
- password=dict(default=None, type='str'),
- zbx_class=dict(choices=ZabbixAPI.classes.keys()),
- params=dict(),
- debug=dict(default=False, type='bool'),
- state=dict(default='present', type='str'),
- ignore=dict(default=None, type='list'),
- ),
- #supports_check_mode=True
- )
-
- user = module.params.get('user', None)
- if not user:
- user = os.environ['ZABBIX_USER']
-
- passwd = module.params.get('password', None)
- if not passwd:
- passwd = os.environ['ZABBIX_PASSWORD']
-
-
-
- api_data = {
- 'user': user,
- 'password': passwd,
- 'server': module.params['server'],
- 'verbose': module.params['debug']
- }
-
- if not user or not passwd or not module.params['server']:
- module.fail_json(msg='Please specify the user, password, and the zabbix server.')
-
- zapi = ZabbixAPI(api_data)
-
- ignore = module.params['ignore']
- zbx_class = module.params.get('zbx_class')
- rpc_params = module.params.get('params', {})
- state = module.params.get('state')
-
-
- # Get the instance we are trying to call
- zbx_class_inst = zapi.__getattribute__(zbx_class.lower())
-
- # perform get
- # Get the instance's method we are trying to call
-
- zbx_action_method = zapi.__getattribute__(zbx_class.capitalize()).__dict__['get']
- _, content = zbx_action_method(zbx_class_inst, rpc_params)
-
- if state == 'list':
- module.exit_json(changed=False, results=content['result'], state="list")
-
- if state == 'absent':
- if not exists(content):
- module.exit_json(changed=False, state="absent")
- # If we are coming from a query, we need to pass in the correct rpc_params for delete.
- # specifically the zabbix class name + 'id'
- # if rpc_params is a list then we need to pass it. (list of ids to delete)
- idname = zbx_class.lower() + "id"
- if not isinstance(rpc_params, list) and content['result'][0].has_key(idname):
- rpc_params = [content['result'][0][idname]]
-
- zbx_action_method = zapi.__getattribute__(zbx_class.capitalize()).__dict__['delete']
- _, content = zbx_action_method(zbx_class_inst, rpc_params)
- module.exit_json(changed=True, results=content['result'], state="absent")
-
- if state == 'present':
- # It's not there, create it!
- if not exists(content):
- zbx_action_method = zapi.__getattribute__(zbx_class.capitalize()).__dict__['create']
- _, content = zbx_action_method(zbx_class_inst, rpc_params)
- module.exit_json(changed=True, results=content['result'], state='present')
-
- # It's there and the same, do nothing!
- diff_params = diff_content(content['result'][0], rpc_params, ignore)
- if not diff_params:
- module.exit_json(changed=False, results=content['result'], state="present")
-
- # Add the id to update with
- idname = zbx_class.lower() + "id"
- diff_params[idname] = content['result'][0][idname]
-
-
- ## It's there and not the same, update it!
- zbx_action_method = zapi.__getattribute__(zbx_class.capitalize()).__dict__['update']
- _, content = zbx_action_method(zbx_class_inst, diff_params)
- module.exit_json(changed=True, results=content, state="present")
-
- module.exit_json(failed=True,
- changed=False,
- results='Unknown state passed. %s' % state,
- state="unknown")
-
-# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled
-# import module snippets. This are required
-from ansible.module_utils.basic import *
-
-main()
-