{"id":2229,"date":"2018-01-22T10:44:02","date_gmt":"2018-01-22T15:44:02","guid":{"rendered":"http:\/\/blog.domb.net\/?p=2229"},"modified":"2018-01-30T13:24:30","modified_gmt":"2018-01-30T18:24:30","slug":"building-an-ansible-playbook-bundle-on-openshift-container-platform","status":"publish","type":"post","link":"https:\/\/blog.domb.net\/?p=2229","title":{"rendered":"Building RocketChat as an ansible playbook bundle on OpenShift Container platform (fix for ocp 3.7)"},"content":{"rendered":"<p>The current apb-1.0.4-1.el7.noarch in OpenShift 3.7 enterprise from the rhel-7-server-ose-3.7-rpms channel is currently broken. When you try to list apb&#8217;s you will get the following error:<\/p>\n<pre class=\"lang:default decode:true \">apb push Exception occurred! unsupported operand type(s) for +: 'NoneType' and 'str'<\/pre>\n<p>Now I will show you how you can fix this. It is important to follow the steps in the order. If not you will get another &#8220;missing configuration error if you install the apb directly from the repo I am adding below. Please also check if there is a new package downstream before you follow the fix instructions.<\/p>\n<p><strong>FIX apb<\/strong><\/p>\n<p>Step 1. Enable the\u00a0rhel-7-server-ose-3.7-rpms<\/p>\n<pre class=\"lang:default decode:true\">[root@host82]# subscription-manager repos --enable=rhel-7-server-ose-3.7-rpms<\/pre>\n<p>Step 2. Install the apb package. This will also pull in some dependencies which you need!<\/p>\n<pre class=\"lang:default decode:true\">[root@host82]# yum -y install apb<\/pre>\n<p>Step 3. disable the rhel-7-server-ose-3.7-rpms repo<\/p>\n<pre class=\"lang:default decode:true\">[root@host82]# subscription-manager repos --disable=rhel-7-server-ose-3.7-rpms\r\n<\/pre>\n<p>Step 4. remove the apb you just installed. This will not remove the dependencies.<\/p>\n<pre class=\"lang:default decode:true\">[root@host82]# yum -y remove apb<\/pre>\n<p>Step 5. Add the following repo to \/etc\/yum.repos.d\/<\/p>\n<pre class=\"lang:default decode:true \">[root@host82]# wget https:\/\/copr.fedorainfracloud.org\/coprs\/g\/ansible-service-broker\/ansible-service-broker-latest\/repo\/epel-7\/group_ansible-service-broker-ansible-service-broker-latest-epel-7.repo -O \/etc\/yum.repos.d\/ansible-service-broker.repo<\/pre>\n<p>Step 6. Install the update apb<\/p>\n<pre class=\"lang:default decode:true \">[root@host82]# yum -y install apb<\/pre>\n<p><strong>Fix Done<\/strong><\/p>\n<p class=\"p1\">Step 7. Go read this awesome blog post by Dylan Murray\u00a0\u00a0<a href=\"https:\/\/blog.openshift.com\/rocket-chat-ansible-playbook-bundle-development-deployment-tutorial\/\">Rocket Chat Ansible Playbook Bundle<\/a> . We will not use the configs of it. Instead we will go and checkout the following git repository:<\/p>\n<pre class=\"lang:default decode:true\">[root@host82] https:\/\/github.com\/RocketChat\/Rocket.Chat.AnsiblePlaybookBundle.git rocketchat-apb<\/pre>\n<p>Make sure you are logged in as a user with cluster admin rights. In my case I created user during install called admin. This is how you can give admin rights to the user:<\/p>\n<pre class=\"lang:default decode:true\">[root@host82] oc adm policy add-cluster-role-to-user cluster-admin admin<\/pre>\n<p>Step 8. cd into the \/dockerhub directory<\/p>\n<pre class=\"lang:default decode:true\">[root@host82 ]# cd rocketchat-apb\/dockerhub<\/pre>\n<p class=\"p1\">Step 9. Edit the apb.yml file as described in the tutorial I linked to.<\/p>\n<p>Step 10. After you edited the roles\u00a0<span class=\"s1\">deprovision-rocketchat-apb<\/span><span class=\"s2\"><span class=\"Apple-converted-space\">\u00a0 <\/span><\/span><span class=\"s1\">provision-rocketchat-apb you can now build the apb<\/span><\/p>\n<pre class=\"lang:default decode:true\">[root@host82 rocketchat-apb]# apb build\r\nFinished writing dockerfile.\r\nBuilding APB using tag: [rocketchat-apb]\r\nSuccessfully built APB image: rocket-apb\r\n<\/pre>\n<p>Step 11. next push the image<\/p>\n<pre class=\"lang:default decode:true\">[root@host82 rocketchat-apb]# apb push\r\nDidn't find OpenShift Ansible Broker route in namespace: ansible-service-broker.                    Trying openshift-ansible-service-broker\r\nversion: 1.0\r\nname: rocketchat-apb\r\ndescription: This APB deploys RocketChat backed by MongoDB\r\nbindable: False\r\nasync: optional\r\nmetadata: \r\n  documentationUrl: https:\/\/rocket.chat\r\n  imageUrl: https:\/\/github.com\/RocketChat\/Rocket.Chat.Artwork\/blob\/master\/Logos\/rocketcat.png?raw=true\r\n  dependencies: ['registry.connect.redhat.com\/rocketchat\/rocketchat:latest', 'registry.access.redhat.com\/rhscl\/mongodb-32-rhel7']\r\n  displayName: RocketChat (APB)\r\n  longDescription: An APB that deploys RocketChat to OpenShift backed by MongoDB\r\nplans:\r\n  - name: default\r\n    description: This plan deploys a single RocketChat application backed by MongoDB\r\n    free: True\r\n    metadata:\r\n      displayName: Default\r\n      longDescription: This plan provides a RocketChat application backed by MongoDB\r\n      cost: $0.00\r\n    parameters: \r\n      - name: mongodb_user\r\n        default: rocketchat\r\n        type: string\r\n        title: MongoDB Username\r\n        required: True\r\n      - name: mongodb_pass\r\n        default: changeme\r\n        type: string\r\n        title: MongoDB Password\r\n        required: True\r\n      - name: mongodb_name\r\n        default: rocketchat\r\n        type: string\r\n        title: MongoDB Database Name\r\n        required: True\r\n      - name: mongodb_admin_pass\r\n        default: changeme\r\n        type: string\r\n        title: MongoDB Admin Password\r\n        required: True\r\n\r\nFound registry IP at: 172.30.224.145:5000\r\nBuilding image with the tag: 172.30.224.145:5000\/openshift\/rocketchatldo-apb\r\nSuccessfully pushed image: 172.30.224.145:5000\/openshift\/rocketchatldo-apb\r\nContacting the ansible-service-broker at: https:\/\/asb-1338-openshift-ansible-service-broker.apps.local.redhat-demo.com\/ansible-service-broker\/v2\/bootstrap\r\nSuccessfully bootstrapped Ansible Service Broker\r\nSuccessfully relisted the Service Catalog<\/pre>\n<p>Step 11.\u00a0 list the apb to make sure its there<\/p>\n<pre class=\"lang:default decode:true\">[root@host82 rocketchat-apb]# apb list\r\nDidn't find OpenShift Ansible Broker route in namespace: ansible-service-broker.                    Trying openshift-ansible-service-broker\r\nContacting the ansible-service-broker at: https:\/\/asb-1338-openshift-ansible-service-broker.apps.local.redhat-demo.com\/ansible-service-broker\/v2\/catalog\r\nID                                NAME                             DESCRIPTION                                    \r\n9fd4268e4b33d8d09292755f1945727c  localregistry-rocketchat-apb  This APB deploys RocketChat backed by MongoDB  \r\n2c259ddd8059b9bc65081e07bf20058f  rh-mariadb-apb                   Mariadb apb implementation                     \r\n03b69500305d9859bb9440d9f9023784  rh-mediawiki-apb                 Mediawiki123 apb implementation                \r\n73ead67495322cc462794387fa9884f5  rh-mysql-apb                     Software Collections MySQL APB                 \r\nd5915e05b253df421efe6e41fb6a66ba  rh-postgresql-apb                SCL PostgreSQL apb implementation<\/pre>\n<p>Step 12. Login to OpenShift. Please do NOT launch it yet if you do not have dynamic storage provisioning enabled as the mongo-db needs a persistent volume and you need to adjust the broker-config yet to pull from the correct registry. Go to the openshift-ansible-service-broker project.<\/p>\n<p>The installation for the ansible_service_broker in 3.7 OCP pulls the wrong image so your broker will not run. I submitted a fix here:<\/p>\n<p><a href=\"https:\/\/github.com\/openshift\/openshift-ansible\/pull\/6823\/files\">https:\/\/github.com\/openshift\/openshift-ansible\/pull\/6823\/files<\/a><\/p>\n<p>Make sure the broker is running and has the correct image.<\/p>\n<p>Step 13. Edit the broker config of the apb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2237\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-22-at-11.59.06-PM.png\" alt=\"\" width=\"472\" height=\"162\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-22-at-11.59.06-PM.png 472w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-22-at-11.59.06-PM-300x103.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/p>\n<p>Step 14. Add the following to it and save.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2245\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.53.35-AM.png\" alt=\"\" width=\"522\" height=\"412\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.53.35-AM.png 522w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.53.35-AM-300x237.png 300w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/p>\n<p>Step\u00a0 15. Re deploy the service broker. You should see a second pod coming up<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2238\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.02.02-AM.png\" alt=\"\" width=\"1208\" height=\"379\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.02.02-AM.png 1208w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.02.02-AM-300x94.png 300w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.02.02-AM-768x241.png 768w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.02.02-AM-1024x321.png 1024w\" sizes=\"auto, (max-width: 1208px) 100vw, 1208px\" \/><\/p>\n<p>Step 16. If everything os ok you should see this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2239\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.08.12-AM.png\" alt=\"\" width=\"1342\" height=\"460\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.08.12-AM.png 1342w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.08.12-AM-300x103.png 300w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.08.12-AM-768x263.png 768w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.08.12-AM-1024x351.png 1024w\" sizes=\"auto, (max-width: 1342px) 100vw, 1342px\" \/><\/p>\n<p>Step 17. If you have dynamic storage provisioning enabled you can now go ahead and build the rocketchat app. If you don&#8217;t and you have NFS storage like me, go create the pv<\/p>\n<pre class=\"lang:default decode:true\" title=\"nfs pv\">apiVersion: v1\r\nkind: PersistentVolume\r\nmetadata:\r\n  name: pv0001\r\nspec:\r\n  capacity:\r\n    storage: 1Gi\r\n  accessModes:\r\n    - ReadWriteOnce\r\n    - ReadWriteMany\r\n  persistentVolumeReclaimPolicy: Recycle\r\n  nfs:\r\n    server: 192.168.1.10\r\n    path: \/volume1\/ocpnfs\/pv0001<\/pre>\n<p>Step 18. Go and create the pv<\/p>\n<pre class=\"lang:default decode:true\">[root@host82 rocketchat-apb]# oc create -f pv.yml \r\npersistentvolume \"pv0001\" created\r\n<\/pre>\n<p>Step 19. You are now officially ready to build the rocket chat app. Go to the service catalog and click on it<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2240\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-12.12.34-AM.png\" alt=\"\" width=\"219\" height=\"155\" \/><\/p>\n<p>Step 20. Fill out all information needed. I would recommend to create a new project. Hit create.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2248\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.59.43-AM.png\" alt=\"\" width=\"897\" height=\"674\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.59.43-AM.png 897w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.59.43-AM-300x225.png 300w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.59.43-AM-768x577.png 768w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.59.43-AM-285x214.png 285w\" sizes=\"auto, (max-width: 897px) 100vw, 897px\" \/><\/p>\n<p>Step 21. Go to your project and sit back and enjoy. If everything is build ok you will see the following screen.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2246\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.54.54-AM.png\" alt=\"\" width=\"1262\" height=\"552\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.54.54-AM.png 1262w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.54.54-AM-300x131.png 300w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.54.54-AM-768x336.png 768w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.54.54-AM-1024x448.png 1024w\" sizes=\"auto, (max-width: 1262px) 100vw, 1262px\" \/><\/p>\n<p>Step 22. Click on the link to use the application<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2247\" src=\"http:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.55.38-AM.png\" alt=\"\" width=\"1265\" height=\"421\" srcset=\"https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.55.38-AM.png 1265w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.55.38-AM-300x100.png 300w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.55.38-AM-768x256.png 768w, https:\/\/blog.domb.net\/wp-content\/uploads\/Screen-Shot-2018-01-23-at-9.55.38-AM-1024x341.png 1024w\" sizes=\"auto, (max-width: 1265px) 100vw, 1265px\" \/><\/p>\n<p>Step 23. If you want to remove the apb run apb list and use the uuid with oc delete as shown below.<\/p>\n<pre class=\"lang:default decode:true\">[root@host82 rocketchat-apb]#  oc delete clusterserviceclass 244aa7f02f2b63398eaa055372d64824<\/pre>\n<p>A video of the entire process can be seen here:<\/p>\n<p><iframe loading=\"lazy\" title=\"RocketChat APB on OpenShfit\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/jhy8lfgxNg8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The current apb-1.0.4-1.el7.noarch in OpenShift 3.7 enterprise from the rhel-7-server-ose-3.7-rpms channel is currently broken. When you try to list apb&#8217;s you will get the following error: apb push Exception occurred! unsupported operand type(s) for +: &#8216;NoneType&#8217; and &#8216;str&#8217; Now I will show you how you can fix this. It is important to follow the steps&#8230;<\/p>\n","protected":false},"author":2,"featured_media":2025,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[76,1],"tags":[135,134,137,55,136],"class_list":["post-2229","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-openshift","category-uncategorized","tag-ansible-service-broker","tag-apb","tag-asb","tag-openshift","tag-rocketchat"],"_links":{"self":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/2229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2229"}],"version-history":[{"count":12,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/2229\/revisions"}],"predecessor-version":[{"id":2261,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/2229\/revisions\/2261"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/media\/2025"}],"wp:attachment":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}