").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
diff --git a/roles/swagger/files/var/www/html/assets/jquery.superslides.min.js b/roles/swagger/files/var/www/html/assets/jquery.superslides.min.js
new file mode 100644
index 00000000..80baa12c
--- /dev/null
+++ b/roles/swagger/files/var/www/html/assets/jquery.superslides.min.js
@@ -0,0 +1,4 @@
+/*! Superslides - v0.6.2 - 2013-07-10
+* https://github.com/nicinabox/superslides
+* Copyright (c) 2013 Nic Aitch; Licensed MIT */
+(function(i,t){var n,e="superslides";n=function(n,e){this.options=t.extend({play:!1,animation_speed:600,animation_easing:"swing",animation:"slide",inherit_width_from:i,inherit_height_from:i,pagination:!0,hashchange:!1,scrollable:!0,elements:{preserve:".preserve",nav:".slides-navigation",container:".slides-container",pagination:".slides-pagination"}},e);var s=this,o=t("
",{"class":"slides-control"}),a=1;this.$el=t(n),this.$container=this.$el.find(this.options.elements.container);var r=function(){return a=s._findMultiplier(),s.$el.on("click",s.options.elements.nav+" a",function(i){i.preventDefault(),s.stop(),t(this).hasClass("next")?s.animate("next",function(){s.start()}):s.animate("prev",function(){s.start()})}),t(document).on("keyup",function(i){37===i.keyCode&&s.animate("prev"),39===i.keyCode&&s.animate("next")}),t(i).on("resize",function(){setTimeout(function(){var i=s.$container.children();s.width=s._findWidth(),s.height=s._findHeight(),i.css({width:s.width,left:s.width}),s.css.containers(),s.css.images()},10)}),t(i).on("hashchange",function(){var i,t=s._parseHash();i=t&&!isNaN(t)?s._upcomingSlide(t-1):s._upcomingSlide(t),i>=0&&i!==s.current&&s.animate(i)}),s.pagination._events(),s.start(),s},h={containers:function(){s.init?(s.$el.css({height:s.height}),s.$control.css({width:s.width*a,left:-s.width}),s.$container.css({})):(t("body").css({margin:0}),s.$el.css({position:"relative",overflow:"hidden",width:"100%",height:s.height}),s.$control.css({position:"relative",transform:"translate3d(0)",height:"100%",width:s.width*a,left:-s.width}),s.$container.css({display:"none",margin:"0",padding:"0",listStyle:"none",position:"relative",height:"100%"})),1===s.size()&&s.$el.find(s.options.elements.nav).hide()},images:function(){var i=s.$container.find("img").not(s.options.elements.preserve);i.removeAttr("width").removeAttr("height").css({"-webkit-backface-visibility":"hidden","-ms-interpolation-mode":"bicubic",position:"absolute",left:"0",top:"0","z-index":"-1","max-width":"none"}),i.each(function(){var i=s.image._aspectRatio(this),n=this;if(t.data(this,"processed"))s.image._scale(n,i),s.image._center(n,i);else{var e=new Image;e.onload=function(){s.image._scale(n,i),s.image._center(n,i),t.data(n,"processed",!0)},e.src=this.src}})},children:function(){var i=s.$container.children();i.is("img")&&(i.each(function(){if(t(this).is("img")){t(this).wrap("
");var i=t(this).attr("id");t(this).removeAttr("id"),t(this).parent().attr("id",i)}}),i=s.$container.children()),s.init||i.css({display:"none",left:2*s.width}),i.css({position:"absolute",overflow:"hidden",height:"100%",width:s.width,top:0,zIndex:0})}},c={slide:function(i,t){var n=s.$container.children(),e=n.eq(i.upcoming_slide);e.css({left:i.upcoming_position,display:"block"}),s.$control.animate({left:i.offset},s.options.animation_speed,s.options.animation_easing,function(){s.size()>1&&(s.$control.css({left:-s.width}),n.eq(i.upcoming_slide).css({left:s.width,zIndex:2}),i.outgoing_slide>=0&&n.eq(i.outgoing_slide).css({left:s.width,display:"none",zIndex:0})),t()})},fade:function(i,t){var n=this,e=n.$container.children(),s=e.eq(i.outgoing_slide),o=e.eq(i.upcoming_slide);o.css({left:this.width,opacity:1,display:"block"}),i.outgoing_slide>=0?s.animate({opacity:0},n.options.animation_speed,n.options.animation_easing,function(){n.size()>1&&(e.eq(i.upcoming_slide).css({zIndex:2}),i.outgoing_slide>=0&&e.eq(i.outgoing_slide).css({opacity:1,display:"none",zIndex:0})),t()}):(o.css({zIndex:2}),t())}};c=t.extend(c,t.fn.superslides.fx);var d={_centerY:function(i){var n=t(i);n.css({top:(s.height-n.height())/2})},_centerX:function(i){var n=t(i);n.css({left:(s.width-n.width())/2})},_center:function(i){s.image._centerX(i),s.image._centerY(i)},_aspectRatio:function(i){if(!i.naturalHeight&&!i.naturalWidth){var t=new Image;t.src=i.src,i.naturalHeight=t.height,i.naturalWidth=t.width}return i.naturalHeight/i.naturalWidth},_scale:function(i,n){n=n||s.image._aspectRatio(i);var e=s.height/s.width,o=t(i);e>n?o.css({height:s.height,width:s.height/n}):o.css({height:s.width*n,width:s.width})}},l={_setCurrent:function(i){if(s.$pagination){var t=s.$pagination.children();t.removeClass("current"),t.eq(i).addClass("current")}},_addItem:function(i){var n=i+1,e=n,o=s.$container.children().eq(i),a=o.attr("id");a&&(e=a);var r=t("
",{href:"#"+e,text:e});r.appendTo(s.$pagination)},_setup:function(){if(s.options.pagination&&1!==s.size()){var i=t("",{"class":s.options.elements.pagination.replace(/^\./,"")});s.$pagination=i.appendTo(s.$el);for(var n=0;s.size()>n;n++)s.pagination._addItem(n)}},_events:function(){s.$el.on("click",s.options.elements.pagination+" a",function(i){i.preventDefault();var t=s._parseHash(this.hash),n=s._upcomingSlide(t-1);n!==s.current&&s.animate(n,function(){s.start()})})}};return this.css=h,this.image=d,this.pagination=l,this.fx=c,this.animation=this.fx[this.options.animation],this.$control=this.$container.wrap(o).parent(".slides-control"),s._findPositions(),s.width=s._findWidth(),s.height=s._findHeight(),this.css.children(),this.css.containers(),this.css.images(),this.pagination._setup(),r()},n.prototype={_findWidth:function(){return t(this.options.inherit_width_from).width()},_findHeight:function(){return t(this.options.inherit_height_from).height()},_findMultiplier:function(){return 1===this.size()?1:3},_upcomingSlide:function(i){if(/next/.test(i))return this._nextInDom();if(/prev/.test(i))return this._prevInDom();if(/\d/.test(i))return+i;if(i&&/\w/.test(i)){var t=this._findSlideById(i);return t>=0?t:0}return 0},_findSlideById:function(i){return this.$container.find("#"+i).index()},_findPositions:function(i,t){t=t||this,void 0===i&&(i=-1),t.current=i,t.next=t._nextInDom(),t.prev=t._prevInDom()},_nextInDom:function(){var i=this.current+1;return i===this.size()&&(i=0),i},_prevInDom:function(){var i=this.current-1;return 0>i&&(i=this.size()-1),i},_parseHash:function(t){return t=t||i.location.hash,t=t.replace(/^#/,""),t&&!isNaN(+t)&&(t=+t),t},size:function(){return this.$container.children().length},destroy:function(){return this.$el.removeData()},update:function(){this.css.children(),this.css.containers(),this.css.images(),this.pagination._addItem(this.size()),this._findPositions(this.current),this.$el.trigger("updated.slides")},stop:function(){clearInterval(this.play_id),delete this.play_id,this.$el.trigger("stopped.slides")},start:function(){var n=this;n.options.hashchange?t(i).trigger("hashchange"):this.animate(),this.options.play&&(this.play_id&&this.stop(),this.play_id=setInterval(function(){n.animate()},this.options.play)),this.$el.trigger("started.slides")},animate:function(t,n){var e=this,s={};if(!(this.animating||(this.animating=!0,void 0===t&&(t="next"),s.upcoming_slide=this._upcomingSlide(t),s.upcoming_slide>=this.size()))){if(s.outgoing_slide=this.current,s.upcoming_position=2*this.width,s.offset=-s.upcoming_position,("prev"===t||s.outgoing_slide>t)&&(s.upcoming_position=0,s.offset=0),e.size()>1&&e.pagination._setCurrent(s.upcoming_slide),e.options.hashchange){var o=s.upcoming_slide+1,a=e.$container.children(":eq("+s.upcoming_slide+")").attr("id");i.location.hash=a?a:o}e.$el.trigger("animating.slides",[s]),e.animation(s,function(){e._findPositions(s.upcoming_slide,e),"function"==typeof n&&n(),e.animating=!1,e.$el.trigger("animated.slides"),e.init||(e.$el.trigger("init.slides"),e.init=!0,e.$container.fadeIn("fast"))})}}},t.fn[e]=function(i,s){var o=[];return this.each(function(){var a,r,h;return a=t(this),r=a.data(e),h="object"==typeof i&&i,r||(o=a.data(e,r=new n(this,h))),"string"==typeof i&&(o=r[i],"function"==typeof o)?o=o.call(r,s):void 0}),o},t.fn[e].fx={}})(this,jQuery);
\ No newline at end of file
diff --git a/roles/swagger/files/var/www/html/assets/messaging-api-mkdocs.png b/roles/swagger/files/var/www/html/assets/messaging-api-mkdocs.png
new file mode 100644
index 00000000..ed16dca5
Binary files /dev/null and b/roles/swagger/files/var/www/html/assets/messaging-api-mkdocs.png differ
diff --git a/roles/swagger/files/var/www/html/assets/messaging-api.png b/roles/swagger/files/var/www/html/assets/messaging-api.png
new file mode 100644
index 00000000..6f3cedc7
Binary files /dev/null and b/roles/swagger/files/var/www/html/assets/messaging-api.png differ
diff --git a/roles/swagger/files/var/www/html/assets/poem-2.png b/roles/swagger/files/var/www/html/assets/poem-2.png
new file mode 100644
index 00000000..c1ff4de9
Binary files /dev/null and b/roles/swagger/files/var/www/html/assets/poem-2.png differ
diff --git a/roles/swagger/files/var/www/html/assets/swagger.png b/roles/swagger/files/var/www/html/assets/swagger.png
new file mode 100644
index 00000000..26c150e1
Binary files /dev/null and b/roles/swagger/files/var/www/html/assets/swagger.png differ
diff --git a/roles/swagger/files/var/www/html/assets/validated.png b/roles/swagger/files/var/www/html/assets/validated.png
new file mode 100644
index 00000000..ae04335c
Binary files /dev/null and b/roles/swagger/files/var/www/html/assets/validated.png differ
diff --git a/roles/swagger/files/var/www/html/index.html b/roles/swagger/files/var/www/html/index.html
new file mode 100644
index 00000000..bddfc1e7
--- /dev/null
+++ b/roles/swagger/files/var/www/html/index.html
@@ -0,0 +1,151 @@
+
+
+
+ ARGO Availability and Reliability Monitoring - ARGO Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Swagger UI with access to the ARGO web api.
+
+
+
+
+
+
Swagger UI with access to the ARGO Messaging api.
+
+
+
+
+
+
Swagger UI with access to the ARGO AUTH api.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/roles/swagger/meta/main.yml b/roles/swagger/meta/main.yml
new file mode 100644
index 00000000..ba43fdd2
--- /dev/null
+++ b/roles/swagger/meta/main.yml
@@ -0,0 +1,58 @@
+---
+galaxy_info:
+ author: your name
+ description: your description
+ company: your company (optional)
+
+ # If the issue tracker for your role is not on github, uncomment the
+ # next line and provide a value
+ # issue_tracker_url: http://example.com/issue/tracker
+
+ # Some suggested licenses:
+ # - BSD (default)
+ # - MIT
+ # - GPLv2
+ # - GPLv3
+ # - Apache
+ # - CC-BY
+ license: license (GPLv2, CC-BY, etc)
+
+ min_ansible_version: 1.2
+
+ # If this a Container Enabled role, provide the minimum Ansible Container version.
+ # min_ansible_container_version:
+
+ # Optionally specify the branch Galaxy will use when accessing the GitHub
+ # repo for this role. During role install, if no tags are available,
+ # Galaxy will use this branch. During import Galaxy will access files on
+ # this branch. If Travis integration is configured, only notifications for this
+ # branch will be accepted. Otherwise, in all cases, the repo's default branch
+ # (usually master) will be used.
+ # github_branch:
+
+ #
+ # platforms is a list of platforms, and each platform has a name and a list of versions.
+ #
+ # platforms:
+ # - name: Fedora
+ # versions:
+ # - all
+ # - 25
+ # - name: SomePlatform
+ # versions:
+ # - all
+ # - 1.0
+ # - 7
+ # - 99.99
+
+ galaxy_tags: []
+ # List tags for your role here, one per line. A tag is a keyword that describes
+ # and categorizes the role. Users find roles by searching for tags. Be sure to
+ # remove the '[]' above, if you add tags to this list.
+ #
+ # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
+ # Maximum 20 tags per role.
+
+dependencies: []
+# List your role dependencies here, one per line. Be sure to remove the '[]' above,
+# if you add dependencies to this list.
diff --git a/roles/swagger/molecule/default/Dockerfile.j2 b/roles/swagger/molecule/default/Dockerfile.j2
new file mode 100644
index 00000000..19692c20
--- /dev/null
+++ b/roles/swagger/molecule/default/Dockerfile.j2
@@ -0,0 +1,14 @@
+# Molecule managed
+
+{% if item.registry is defined %}
+FROM {{ item.registry.url }}/{{ item.image }}
+{% else %}
+FROM {{ item.image }}
+{% endif %}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
+ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
+ elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
+ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
+ elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
diff --git a/roles/swagger/molecule/default/INSTALL.rst b/roles/swagger/molecule/default/INSTALL.rst
new file mode 100644
index 00000000..3904805e
--- /dev/null
+++ b/roles/swagger/molecule/default/INSTALL.rst
@@ -0,0 +1,26 @@
+*******
+Docker driver installation guide
+*******
+
+Requirements
+============
+
+* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
+* Docker Engine
+* docker-py
+* docker
+
+Install
+=======
+
+Ansible < 2.6
+
+.. code-block:: bash
+
+ $ sudo pip install docker-py
+
+Ansible >= 2.6
+
+.. code-block:: bash
+
+ $ sudo pip install docker
diff --git a/roles/swagger/molecule/default/molecule.yml b/roles/swagger/molecule/default/molecule.yml
new file mode 100644
index 00000000..f5e3b111
--- /dev/null
+++ b/roles/swagger/molecule/default/molecule.yml
@@ -0,0 +1,20 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: instance
+ image: centos:7
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+scenario:
+ name: default
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/roles/swagger/molecule/default/playbook.yml b/roles/swagger/molecule/default/playbook.yml
new file mode 100644
index 00000000..c3661bca
--- /dev/null
+++ b/roles/swagger/molecule/default/playbook.yml
@@ -0,0 +1,5 @@
+---
+- name: Converge
+ hosts: all
+ roles:
+ - role: swagger
diff --git a/roles/swagger/molecule/default/tests/test_default.py b/roles/swagger/molecule/default/tests/test_default.py
new file mode 100644
index 00000000..eedd64a1
--- /dev/null
+++ b/roles/swagger/molecule/default/tests/test_default.py
@@ -0,0 +1,14 @@
+import os
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+def test_hosts_file(host):
+ f = host.file('/etc/hosts')
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
diff --git a/roles/swagger/tasks/apache_config.yml b/roles/swagger/tasks/apache_config.yml
new file mode 100644
index 00000000..a02a4c0e
--- /dev/null
+++ b/roles/swagger/tasks/apache_config.yml
@@ -0,0 +1,46 @@
+---
+
+- name: Configure apache web service
+ blockinfile:
+ dest: /etc/httpd/conf/httpd.conf
+ insertafter: EOF
+ block: |
+
+ ServerName api-doc.argo.grnet.gr
+ Redirect permanent / https://api-doc.argo.grnet.gr/
+ ServerAdmin webmaster@localhost
+ DocumentRoot /var/www/html
+ ErrorLog logs/error.log
+ CustomLog logs/access.log combined
+
+ notify: restart apache
+
+- name: Disable SSLv3
+ lineinfile:
+ dest: /etc/httpd/conf.d/ssl.conf
+ regexp: "^SSLProtocol"
+ line: "SSLProtocol all -SSLv2 -SSLv3"
+ notify: restart apache
+
+- name: Use strong cipher suite
+ lineinfile:
+ dest: /etc/httpd/conf.d/ssl.conf
+ regexp: "^SSLCipherSuite"
+ line: 'SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"'
+ notify: restart apache
+
+- name: Respect cipher order
+ lineinfile:
+ dest: /etc/httpd/conf.d/ssl.conf
+ regexp: "^SSLHonorCipherOrder"
+ line: "SSLHonorCipherOrder on"
+ insertbefore: "^SSLCipherSuite"
+ notify: restart apache
+
+- name: Define intermediate CA
+ lineinfile:
+ dest: /etc/httpd/conf.d/ssl.conf
+ regexp: "^SSLCertificateChainFile"
+ line: "SSLCertificateChainFile /etc/grid-security/chain-aai.pem"
+ insertafter: "^#SSLCertificateChainFile"
+ notify: restart apache
diff --git a/roles/swagger/tasks/main.yml b/roles/swagger/tasks/main.yml
index 71082edb..615a81d2 100644
--- a/roles/swagger/tasks/main.yml
+++ b/roles/swagger/tasks/main.yml
@@ -1,23 +1,10 @@
---
-- name: Install Pip
- tags: swagger
- yum: name=python-pip state=present
- name: Install PyYAML
tags: swagger
pip: name=pyYAML state=latest
-- name: Install Apache
- tags: swagger
- yum: name={{ item }} state=present
- with_items:
- - httpd
- - mod_ssl
-
-- name: Config Apache Up and Running
- tags: swagger
- service: name=httpd enabled=yes state=started
- name: Create /tmp/swagger folder
tags: swagger
@@ -29,48 +16,68 @@
curl -L https://api.github.com/repos/swagger-api/swagger-ui/tarball
| tar xz -C /tmp/swagger --strip-components 1
+- name: Remove stage directory
+ shell: rm -rf /var/www/html/{{ item.name }}.old
+ with_items: '{{swagger_docs}}'
+ ignore_errors: True
+
+- name: Stage old data
+ command: mv /var/www/html/{{ item.name }} /var/www/html/{{ item.name }}.old
+ with_items: '{{swagger_docs}}'
+ ignore_errors: yes
+
- name: Create swagger directories
tags: swagger
file: path=/var/www/html/{{ item.name }} state=directory owner=root group=root mode=0755
- with_items: swagger_docs
+ with_items: '{{swagger_docs}}'
- name: Transfer dist files to each dedicated dir at /var/www/html/
tags: swagger
shell: cp -R /tmp/swagger/dist/* /var/www/html/{{ item.name }}
- with_items: swagger_docs
+ with_items: '{{swagger_docs}}'
- name: Get latest swagger.yaml definition files
- tags: swagger
+ tags: swagger-update
get_url: url=https://raw.githubusercontent.com/{{ item.github_org }}/{{ item.name }}/{{ item.branch }}/{{ item.path_to_yaml }}
dest=/tmp/swagger/{{ item.name }}_swagger.yaml force=yes
owner=root group=root mode=0644
- with_items: swagger_docs
+ with_items: '{{swagger_docs}}'
notify: restart apache
- name: Convert swagger.yaml to swagger.json
- tags: swagger
+ tags: swagger-update
shell: >
python -c 'import sys, yaml, json;
json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)'
< /tmp/swagger/{{ item.name }}_swagger.yaml > /var/www/html/{{ item.name }}/swagger.json
- with_items: swagger_docs
+ with_items: '{{swagger_docs}}'
- name: Make swagger.json point to corresponding api endpoint
- tags: swagger
+ tags: swagger-update
lineinfile: >
dest=/var/www/html/{{ item.name }}/swagger.json
regexp='( +)\"host\":\ \"(.+)\"\,'
line=' \"host\": \"{{ item.api_host }}\",'
state=present backup=yes
- with_items: swagger_docs
+ with_items: '{{swagger_docs}}'
notify: restart apache
- name: Point swagger-ui to corresponding swagger definitions on host
- tags: swagger
+ tags: swagger-update
replace: dest=/var/www/html/{{ item.name }}/index.html
- regexp='url = "http:\/\/petstore\.swagger\.io\/v2\/swagger\.json";'
- replace='url = "https://{{ inventory_hostname }}/{{ item.name }}/swagger.json";'
+ regexp='"https:\/\/petstore\.swagger\.io\/v2\/swagger\.json"'
+ replace='"https://{{ inventory_hostname }}/{{ item.name }}/swagger.json"'
backup=yes
- with_items: swagger_docs
+ with_items: '{{swagger_docs}}'
+- name: Place assets on apache directory
+ tags: swagger-index
+ copy: src=var/www/html/ dest=/var/www/html/
+ notify: restart apache
+- name: Place index.html on apache directory
+ tags: swagger
+ template:
+ src: index.html.j2
+ dest: /var/www/html/index.html
+ notify: restart apache
diff --git a/roles/swagger/tasks/messaging_api.yml b/roles/swagger/tasks/messaging_api.yml
new file mode 100644
index 00000000..db526bb1
--- /dev/null
+++ b/roles/swagger/tasks/messaging_api.yml
@@ -0,0 +1,29 @@
+---
+
+- name: Install Java openjdk
+ yum:
+ name: java-1.7.0-openjdk
+ state: present
+
+- name: Copy out messaging binary and config
+ copy: src=opt/argo-messaging/ dest=/opt/argo-messaging
+
+- name: Fetch a kafka tarball
+ unarchive:
+ src: https://archive.apache.org/dist/kafka/0.9.0.1/kafka_2.11-0.9.0.1.tgz
+ dest: /opt
+ copy: no
+
+- name: Add services in /etc/rc.local
+ blockinfile:
+ dest: /etc/rc.local
+ insertafter: EOF
+ marker: "# {mark} ANSIBLE MANAGED BLOCK"
+ block: |
+ cd /opt/kafka_2.11-0.9.0.1 && bin/zookeeper-server-start.sh config/zookeeper.properties 1>/dev/null 2>&1 &
+ sleep 9
+ cd /opt/kafka_2.11-0.9.0.1 && bin/kafka-server-start.sh config/server.properties 1>/dev/null 2>&1 &
+ sleep 9
+ cd /opt/argo-messaging && ./argo-messaging 1>/dev/null 2>&1 &
+ tags: test
+
diff --git a/roles/swagger/tasks/mongo_restore_daily.yml b/roles/swagger/tasks/mongo_restore_daily.yml
new file mode 100644
index 00000000..9f7cbcd7
--- /dev/null
+++ b/roles/swagger/tasks/mongo_restore_daily.yml
@@ -0,0 +1,47 @@
+---
+
+- name: Create folder to store the dumps
+ file: path=/backup state=directory
+ owner=root group=root mode=0600
+
+- name: Copy out dumps to be restored
+ copy: src=backup/argo_core/ dest=/backup/argo_core
+
+- name: Copy out dumps to be restored 2
+ copy: src=backup/argo_infraA/ dest=/backup/argo_infraA
+
+- name: Copy out dumps to be restored
+ copy: src=backup/argo_msg/ dest=/backup/argo_msg
+
+- name: Enable daily cron to restore swagger core data
+ cron:
+ name: Enable daily cron to restore swagger core data
+ cron_file: mongo_restores
+ job: /usr/bin/mongorestore --db argo_core --drop /backup/argo_core
+ minute: 0
+ hour: 0
+ state: present
+ user: root
+ tags: cron
+
+- name: Enable daily cron to restore swagger tenant data
+ cron:
+ name: Enable daily cron to restore swagger tenant data
+ cron_file: mongo_restores
+ job: /usr/bin/mongorestore --db argo_infraA --drop /backup/argo_infraA
+ minute: 1
+ hour: 0
+ state: present
+ user: root
+ tags: cron
+
+- name: Enable daily cron to restore messaging data
+ cron:
+ name: Enable daily cron to restore messaging data
+ cron_file: mongo_restores
+ job: /usr/bin/mongorestore --db argo_msg --drop /backup/argo_msg
+ minute: 10
+ hour: 0
+ state: present
+ user: root
+ tags: cron
\ No newline at end of file
diff --git a/roles/swagger/templates/index.html.j2 b/roles/swagger/templates/index.html.j2
new file mode 100644
index 00000000..e514ada0
--- /dev/null
+++ b/roles/swagger/templates/index.html.j2
@@ -0,0 +1,192 @@
+
+
+
+
ARGO Availability and Reliability Monitoring - ARGO Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Swagger UI with access to the ARGO web api.
+
+
+
+
+
+
Swagger UI with access to the ARGO Messaging api.
+
+
+
+
+
+
Swagger UI with access to the ARGO AUTH api.
+
+
+
+
+
+
+
+
+
+
+
+
+
Detailed documentation about the ARGO web api.
+
+
+
+
+
+
Detailed documentation about the ARGO Messaging api.
+
+
+
+
+
+
Detailed documentation about the AMS Library
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Detailed documentation about POEM Component.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/roles/swagger/vars/main.yml b/roles/swagger/vars/main.yml
new file mode 100644
index 00000000..282fdde2
--- /dev/null
+++ b/roles/swagger/vars/main.yml
@@ -0,0 +1,2 @@
+---
+# vars file for swagger
diff --git a/roles/through_http_proxy/.yamllint b/roles/through_http_proxy/.yamllint
new file mode 100644
index 00000000..ad0be760
--- /dev/null
+++ b/roles/through_http_proxy/.yamllint
@@ -0,0 +1,11 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ truthy: disable
diff --git a/roles/through_http_proxy/README.md b/roles/through_http_proxy/README.md
new file mode 100644
index 00000000..898cdf36
--- /dev/null
+++ b/roles/through_http_proxy/README.md
@@ -0,0 +1,40 @@
+Through Http Proxy
+============================
+
+Prepares a node's services: yum, wget, curl to use a designated http proxy
+
+Requirements
+------------
+
+A valid http proxy present in the local network
+
+Role Variables
+--------------
+http_proxy: url to a valid http proxy (http://example.proxy.local:3128)
+
+Dependencies
+------------
+
+
+Example Playbook
+----------------
+
+Including an example of how to use your role (for instance, with variables
+passed in as parameters) is always nice for users too:
+
+- hosts: servers
+ become: yes
+ roles:
+ - { role: through_http_proxy }
+
+
+
+License
+-------
+
+Apache 2
+
+Author Information
+------------------
+
+GRNET
diff --git a/roles/through_http_proxy/defaults/main.yml b/roles/through_http_proxy/defaults/main.yml
new file mode 100644
index 00000000..f3cf0b0b
--- /dev/null
+++ b/roles/through_http_proxy/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+# defaults file for through_http_proxy
diff --git a/roles/through_http_proxy/handlers/main.yml b/roles/through_http_proxy/handlers/main.yml
new file mode 100644
index 00000000..1f745919
--- /dev/null
+++ b/roles/through_http_proxy/handlers/main.yml
@@ -0,0 +1,2 @@
+---
+# handlers file for through_http_proxy
diff --git a/roles/through_http_proxy/meta/main.yml b/roles/through_http_proxy/meta/main.yml
new file mode 100644
index 00000000..ba43fdd2
--- /dev/null
+++ b/roles/through_http_proxy/meta/main.yml
@@ -0,0 +1,58 @@
+---
+galaxy_info:
+ author: your name
+ description: your description
+ company: your company (optional)
+
+ # If the issue tracker for your role is not on github, uncomment the
+ # next line and provide a value
+ # issue_tracker_url: http://example.com/issue/tracker
+
+ # Some suggested licenses:
+ # - BSD (default)
+ # - MIT
+ # - GPLv2
+ # - GPLv3
+ # - Apache
+ # - CC-BY
+ license: license (GPLv2, CC-BY, etc)
+
+ min_ansible_version: 1.2
+
+ # If this a Container Enabled role, provide the minimum Ansible Container version.
+ # min_ansible_container_version:
+
+ # Optionally specify the branch Galaxy will use when accessing the GitHub
+ # repo for this role. During role install, if no tags are available,
+ # Galaxy will use this branch. During import Galaxy will access files on
+ # this branch. If Travis integration is configured, only notifications for this
+ # branch will be accepted. Otherwise, in all cases, the repo's default branch
+ # (usually master) will be used.
+ # github_branch:
+
+ #
+ # platforms is a list of platforms, and each platform has a name and a list of versions.
+ #
+ # platforms:
+ # - name: Fedora
+ # versions:
+ # - all
+ # - 25
+ # - name: SomePlatform
+ # versions:
+ # - all
+ # - 1.0
+ # - 7
+ # - 99.99
+
+ galaxy_tags: []
+ # List tags for your role here, one per line. A tag is a keyword that describes
+ # and categorizes the role. Users find roles by searching for tags. Be sure to
+ # remove the '[]' above, if you add tags to this list.
+ #
+ # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
+ # Maximum 20 tags per role.
+
+dependencies: []
+# List your role dependencies here, one per line. Be sure to remove the '[]' above,
+# if you add dependencies to this list.
diff --git a/roles/through_http_proxy/molecule/default/Dockerfile.j2 b/roles/through_http_proxy/molecule/default/Dockerfile.j2
new file mode 100644
index 00000000..e6aa95d3
--- /dev/null
+++ b/roles/through_http_proxy/molecule/default/Dockerfile.j2
@@ -0,0 +1,14 @@
+# Molecule managed
+
+{% if item.registry is defined %}
+FROM {{ item.registry.url }}/{{ item.image }}
+{% else %}
+FROM {{ item.image }}
+{% endif %}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
+ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
+ elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
+ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
+ elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
diff --git a/roles/through_http_proxy/molecule/default/INSTALL.rst b/roles/through_http_proxy/molecule/default/INSTALL.rst
new file mode 100644
index 00000000..6a44bde9
--- /dev/null
+++ b/roles/through_http_proxy/molecule/default/INSTALL.rst
@@ -0,0 +1,22 @@
+*******
+Docker driver installation guide
+*******
+
+Requirements
+============
+
+* Docker Engine
+
+Install
+=======
+
+Please refer to the `Virtual environment`_ documentation for installation best
+practices. If not using a virtual environment, please consider passing the
+widely recommended `'--user' flag`_ when invoking ``pip``.
+
+.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
+.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
+
+.. code-block:: bash
+
+ $ pip install 'molecule[docker]'
diff --git a/roles/through_http_proxy/molecule/default/molecule.yml b/roles/through_http_proxy/molecule/default/molecule.yml
new file mode 100644
index 00000000..65faca2f
--- /dev/null
+++ b/roles/through_http_proxy/molecule/default/molecule.yml
@@ -0,0 +1,18 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: instance
+ image: centos:7
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/roles/through_http_proxy/molecule/default/playbook.yml b/roles/through_http_proxy/molecule/default/playbook.yml
new file mode 100644
index 00000000..d65bc6a8
--- /dev/null
+++ b/roles/through_http_proxy/molecule/default/playbook.yml
@@ -0,0 +1,5 @@
+---
+- name: Converge
+ hosts: all
+ roles:
+ - role: through_http_proxy
diff --git a/roles/through_http_proxy/molecule/default/tests/test_default.py b/roles/through_http_proxy/molecule/default/tests/test_default.py
new file mode 100644
index 00000000..eedd64a1
--- /dev/null
+++ b/roles/through_http_proxy/molecule/default/tests/test_default.py
@@ -0,0 +1,14 @@
+import os
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+def test_hosts_file(host):
+ f = host.file('/etc/hosts')
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
diff --git a/roles/through_http_proxy/molecule/default/tests/test_default.pyc b/roles/through_http_proxy/molecule/default/tests/test_default.pyc
new file mode 100644
index 00000000..38f4789e
Binary files /dev/null and b/roles/through_http_proxy/molecule/default/tests/test_default.pyc differ
diff --git a/roles/through_http_proxy/tasks/main.yml b/roles/through_http_proxy/tasks/main.yml
new file mode 100644
index 00000000..c85e950b
--- /dev/null
+++ b/roles/through_http_proxy/tasks/main.yml
@@ -0,0 +1,27 @@
+---
+# tasks file for through_http_proxy
+
+- name: Yum through http proxy
+ lineinfile:
+ path: /etc/yum.conf
+ regexp: 'proxy='
+ line: 'proxy={{http_proxy_url}}'
+
+- name: wget through http proxy
+ lineinfile:
+ path: /etc/wgetrc
+ regexp: '^http_proxy='
+ line: 'http_proxy={{http_proxy_url}}'
+
+- name: wget through http proxy 2
+ lineinfile:
+ path: /etc/wgetrc
+ regexp: '^https_proxy='
+ line: 'https_proxy={{http_proxy_url}}'
+
+- name: curl through http proxy
+ lineinfile:
+ path: /root/.curlrc
+ regexp: '^--proxy'
+ line: '--proxy {{http_proxy_url}}'
+ create: yes
\ No newline at end of file
diff --git a/roles/through_http_proxy/vars/main.yml b/roles/through_http_proxy/vars/main.yml
new file mode 100644
index 00000000..72e9be46
--- /dev/null
+++ b/roles/through_http_proxy/vars/main.yml
@@ -0,0 +1,2 @@
+---
+# vars file for through_http_proxy
diff --git a/roles/webapi/.yamllint b/roles/webapi/.yamllint
new file mode 100644
index 00000000..3a2255e4
--- /dev/null
+++ b/roles/webapi/.yamllint
@@ -0,0 +1,13 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ # NOTE(retr0h): Templates no longer fail this lint rule.
+ # Uncomment if running old Molecule templates.
+ # truthy: disable
diff --git a/roles/webapi/README.md b/roles/webapi/README.md
new file mode 100644
index 00000000..47c06a72
--- /dev/null
+++ b/roles/webapi/README.md
@@ -0,0 +1,111 @@
+Role Name
+=========
+
+Installs Argo-web-api in host along with mongodb backend store
+
+Requirements
+------------
+
+Inventory group `[webapi]` containing host with public ip, ansible `commons` and `mongodb` roles
+
+Role Variables
+--------------
+Defaults:
+- `argo_web_api_port`: 443 # port for argo web api to bind to
+- `argo_core`: "argo_core" # name of core database
+- `cors_support`: "true" # support for CORS
+
+Additional:
+- `web_api_admins` is used for defining a list of initial service admins
+example below:
+```yaml
+webapi_admins:
+ - name: "Admin name"
+ email: "some@mail.foo"
+ api_key: "s3cr3t-t0ken"
+```
+
+- `web_api_tenants` is used for defining a list of initial tenants for the service
+example below:
+```yaml
+webapi_tenants:
+ - id: "uuid-of-tenant"
+ name: FOO
+ email: foo@email.foo
+ website: foowebsite
+ db_conf:
+ - store: ar
+ server: localhost
+ port: 27017
+ database: arg_db_name1
+ username: username
+ password: "s3cret"
+ users:
+ - name: FOO_user
+ email: something@something.foo
+ token: "F00s3cretT0ken"
+ roles:
+ - admin
+ - id: "a526e22d-09c7-420a-865c-b8df38056983"
+ name: FOO2
+ email: foo2@email.foo
+ website: foowebsite2
+ db_conf:
+ - store: ar
+ server: localhost
+ port: 27017
+ database: argo_db_name2
+ username: username
+ password: "s3cr3t"
+ users:
+ - name: FOO2_user
+ email: something2@something.foo
+ token: "F00-2-s3cretT0ken"
+ roles:
+ - admin
+```
+
+Dependencies
+------------
+
+This role depends on the following roles:
+- `commons`
+- `mongodb`
+
+so the following external role variables must be set
+
+- `repo_mongo`: true # in order to deploy mongodb service
+- `repo_enabled_argo`: argo-devel # in order to deploy argo-web-api service
+
+also the following firewall variable must be set for public access to the argo-web-api
+```yaml
+firewall_services_zones:
+ - service: https
+ zone: public
+ - service: http
+ zone: public
+```
+
+Example Playbook
+----------------
+
+Example Playbook
+----------------
+
+Including an example of how to use your role (for instance, with variables
+passed in as parameters) is always nice for users too:
+
+ - hosts: servers
+ roles:
+ - { role: webapi, task: deploy }
+ - { role: webapi, task: init_api }
+
+License
+-------
+
+Apache 2
+
+Author Information
+------------------
+
+GRNET
diff --git a/roles/webapi/defaults/main.yml b/roles/webapi/defaults/main.yml
index 6635d5bf..85b77ab6 100644
--- a/roles/webapi/defaults/main.yml
+++ b/roles/webapi/defaults/main.yml
@@ -1,4 +1,7 @@
---
-
argo_web_api_port: 443
-cors_support: "false"
+argo_core: "argo_core"
+cors_support: "true"
+
+webapi_admins: []
+webapi_tenants: []
diff --git a/roles/webapi/handlers/main.yml b/roles/webapi/handlers/main.yml
index 257e5eb7..5dfe40ab 100644
--- a/roles/webapi/handlers/main.yml
+++ b/roles/webapi/handlers/main.yml
@@ -1,4 +1,4 @@
---
- name: restart argo-web-api service
- service: name=argo-web-api state=restarted
\ No newline at end of file
+ service: name=argo-web-api state=restarted
diff --git a/roles/webapi/meta/main.yml b/roles/webapi/meta/main.yml
new file mode 100644
index 00000000..ba43fdd2
--- /dev/null
+++ b/roles/webapi/meta/main.yml
@@ -0,0 +1,58 @@
+---
+galaxy_info:
+ author: your name
+ description: your description
+ company: your company (optional)
+
+ # If the issue tracker for your role is not on github, uncomment the
+ # next line and provide a value
+ # issue_tracker_url: http://example.com/issue/tracker
+
+ # Some suggested licenses:
+ # - BSD (default)
+ # - MIT
+ # - GPLv2
+ # - GPLv3
+ # - Apache
+ # - CC-BY
+ license: license (GPLv2, CC-BY, etc)
+
+ min_ansible_version: 1.2
+
+ # If this a Container Enabled role, provide the minimum Ansible Container version.
+ # min_ansible_container_version:
+
+ # Optionally specify the branch Galaxy will use when accessing the GitHub
+ # repo for this role. During role install, if no tags are available,
+ # Galaxy will use this branch. During import Galaxy will access files on
+ # this branch. If Travis integration is configured, only notifications for this
+ # branch will be accepted. Otherwise, in all cases, the repo's default branch
+ # (usually master) will be used.
+ # github_branch:
+
+ #
+ # platforms is a list of platforms, and each platform has a name and a list of versions.
+ #
+ # platforms:
+ # - name: Fedora
+ # versions:
+ # - all
+ # - 25
+ # - name: SomePlatform
+ # versions:
+ # - all
+ # - 1.0
+ # - 7
+ # - 99.99
+
+ galaxy_tags: []
+ # List tags for your role here, one per line. A tag is a keyword that describes
+ # and categorizes the role. Users find roles by searching for tags. Be sure to
+ # remove the '[]' above, if you add tags to this list.
+ #
+ # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
+ # Maximum 20 tags per role.
+
+dependencies: []
+# List your role dependencies here, one per line. Be sure to remove the '[]' above,
+# if you add dependencies to this list.
diff --git a/roles/webapi/molecule/default/Dockerfile.j2 b/roles/webapi/molecule/default/Dockerfile.j2
new file mode 100644
index 00000000..19692c20
--- /dev/null
+++ b/roles/webapi/molecule/default/Dockerfile.j2
@@ -0,0 +1,14 @@
+# Molecule managed
+
+{% if item.registry is defined %}
+FROM {{ item.registry.url }}/{{ item.image }}
+{% else %}
+FROM {{ item.image }}
+{% endif %}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
+ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
+ elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
+ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
+ elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
diff --git a/roles/webapi/molecule/default/INSTALL.rst b/roles/webapi/molecule/default/INSTALL.rst
new file mode 100644
index 00000000..3904805e
--- /dev/null
+++ b/roles/webapi/molecule/default/INSTALL.rst
@@ -0,0 +1,26 @@
+*******
+Docker driver installation guide
+*******
+
+Requirements
+============
+
+* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
+* Docker Engine
+* docker-py
+* docker
+
+Install
+=======
+
+Ansible < 2.6
+
+.. code-block:: bash
+
+ $ sudo pip install docker-py
+
+Ansible >= 2.6
+
+.. code-block:: bash
+
+ $ sudo pip install docker
diff --git a/roles/webapi/molecule/default/molecule.yml b/roles/webapi/molecule/default/molecule.yml
new file mode 100644
index 00000000..f5e3b111
--- /dev/null
+++ b/roles/webapi/molecule/default/molecule.yml
@@ -0,0 +1,20 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: instance
+ image: centos:7
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+scenario:
+ name: default
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/roles/webapi/molecule/default/playbook.yml b/roles/webapi/molecule/default/playbook.yml
new file mode 100644
index 00000000..8c980e45
--- /dev/null
+++ b/roles/webapi/molecule/default/playbook.yml
@@ -0,0 +1,5 @@
+---
+- name: Converge
+ hosts: all
+ roles:
+ - role: argo-web-api
diff --git a/roles/webapi/molecule/default/tests/test_default.py b/roles/webapi/molecule/default/tests/test_default.py
new file mode 100644
index 00000000..eedd64a1
--- /dev/null
+++ b/roles/webapi/molecule/default/tests/test_default.py
@@ -0,0 +1,14 @@
+import os
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+def test_hosts_file(host):
+ f = host.file('/etc/hosts')
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
diff --git a/roles/webapi/tasks/deploy.yml b/roles/webapi/tasks/deploy.yml
new file mode 100644
index 00000000..0ea108b5
--- /dev/null
+++ b/roles/webapi/tasks/deploy.yml
@@ -0,0 +1,78 @@
+---
+
+# Install Web Api
+
+- name: Install argo-web-api package
+ yum: name=argo-web-api state=latest enablerepo={{ repo_enabled_argo }} update_cache=yes
+ notify: restart argo-web-api service
+ tags: webapi_deploy
+
+######################[ To be handled in argo-web-api rpm ]#####################
+- name: setup argo-web-api group
+ group: name=argo-web-api system=yes
+ tags: webapi_deploy
+
+- name: Setup argo-web-api user
+ user: name=argo-web-api system=yes group=argo-web-api
+ tags: webapi_deploy
+
+- name: Create data_dir
+ file: path=/var/www/argo-web-api state=directory owner=argo-web-api group=argo-web-api mode=755
+ tags: webapi_deploy
+
+- name: Create cert dir
+ file: path=/var/www/argo-web-api/certs state=directory owner=argo-web-api group=argo-web-api mode=755
+ tags: webapi_deploy
+
+- name: Setup argo-web-api service
+ template: dest="/etc/systemd/system/argo-web-api.service" src=argo-web-api.service.j2
+ register: argowebapi_service
+ tags: webapi_deploy
+
+- name: reload systemd
+ command: /usr/bin/systemctl --system daemon-reload
+ when: argowebapi_service.changed
+ tags: webapi_deploy
+################################################################################
+
+- name: Copy localhost key
+ copy:
+ src: /etc/grid-security/hostkey.pem
+ dest: /var/www/argo-web-api/certs/localhost.key
+ owner: argo-web-api
+ group: argo-web-api
+ remote_src: true
+ tags: webapi_deploy
+
+- name: Copy localhost cert
+ copy:
+ src: /etc/grid-security/hostcert.pem
+ dest: /var/www/argo-web-api/certs/localhost.crt
+ owner: argo-web-api
+ group: argo-web-api
+ remote_src: true
+ tags: webapi_deploy
+
+- name: Configure argo-web-api
+ template: src=argo-web-api.conf.j2
+ dest=/etc/argo-web-api.conf backup=yes
+ owner=argo-web-api group=argo-web-api mode=0644
+ notify: restart argo-web-api service
+ tags: webapi_deploy
+
+######################[ To be handled in argo-web-api rpm ]#####################
+
+- file:
+ path: /var/www/argo-web-api/argo-web-api
+ owner: argo-web-api
+ group: argo-web-api
+ mode: 0755
+
+- name: allow bind port 443
+ shell: setcap 'cap_net_bind_service=+ep' /var/www/argo-web-api/argo-web-api
+ tags: webapi_deploy
+################################################################################
+
+- name: Start web api service
+ service: name=argo-web-api state=started enabled=True
+ tags: webapi_deploy
diff --git a/roles/webapi/tasks/init_api.yml b/roles/webapi/tasks/init_api.yml
new file mode 100644
index 00000000..041ec390
--- /dev/null
+++ b/roles/webapi/tasks/init_api.yml
@@ -0,0 +1,37 @@
+---
+
+- name: Move init_roles.js script
+ template: dest="/tmp/init_roles.js" owner=root group=root mode=640 src=init_roles.js.j2
+ tags:
+ - webapi_init
+ - webapi_init_roles
+
+- name: Run init_roles.js script
+ shell: mongo < /tmp/init_roles.js
+ tags:
+ - webapi_init
+ - webapi_init_roles
+
+- name: Move init_admins.js script
+ template: dest="/tmp/init_admins.js" owner=root group=root mode=640 src=init_admins.js.j2
+ tags:
+ - webapi_init
+ - webapi_init_admins
+
+- name: Run init_admins.js script
+ shell: mongo < /tmp/init_admins.js
+ tags:
+ - webapi_init
+ - webapi_init_admins
+
+- name: Move init_tenants.js script
+ template: dest="/tmp/init_tenants.js" owner=root group=root mode=640 src=init_tenants.js.j2
+ tags:
+ - webapi_init
+ - webapi_init_tenants
+
+- name: Run init_tenants.js script
+ shell: mongo < /tmp/init_tenants.js
+ tags:
+ - webapi_init
+ - webapi_init_tenants
diff --git a/roles/webapi/tasks/main.yml b/roles/webapi/tasks/main.yml
index 0b090a2b..9dcb8194 100644
--- a/roles/webapi/tasks/main.yml
+++ b/roles/webapi/tasks/main.yml
@@ -1,16 +1,2 @@
---
-
-- name: Install argo-web-api package
- yum: name=argo-web-api state=latest enablerepo={{ enabled_argo_repo }}
- notify: restart argo-web-api service
- tags: api
-
-- name: Configure argo-web-api
- template: src=argo-web-api.conf.j2
- dest=/etc/argo-web-api.conf backup=yes
- owner=root group=root mode=0644
- notify: restart argo-web-api service
-
-- name: Start web api service
- service: name=argo-web-api state=started
- tags: api
+- include: '{{task}}.yml'
diff --git a/roles/webapi/tasks/rollback.yml b/roles/webapi/tasks/rollback.yml
new file mode 100644
index 00000000..c5cf38da
--- /dev/null
+++ b/roles/webapi/tasks/rollback.yml
@@ -0,0 +1,11 @@
+---
+
+- name: Rollback argo-web-api package to specific version
+ yum: name=argo-web-api-{{ artifact_version }} state=present enablerepo={{ repo_enabled_argo }} update_cache=yes allow_downgrade=yes
+ notify: restart argo-web-api service
+ tags: webapi_rollback
+
+- name: Reload the systemd daemon
+ systemd:
+ daemon_reload: yes
+ tags: webapi_rollback
\ No newline at end of file
diff --git a/roles/webapi/tasks/update.yml b/roles/webapi/tasks/update.yml
new file mode 100644
index 00000000..b8571b01
--- /dev/null
+++ b/roles/webapi/tasks/update.yml
@@ -0,0 +1,11 @@
+---
+
+- name: Update argo-web-api package
+ yum: name=argo-web-api state=latest enablerepo={{ repo_enabled_argo }} update_cache=yes
+ notify: restart argo-web-api service
+ tags: webapi_update
+
+- name: Reload the systemd daemon
+ systemd:
+ daemon_reload: yes
+ tags: webapi_update
\ No newline at end of file
diff --git a/roles/webapi/templates/argo-web-api.conf.j2 b/roles/webapi/templates/argo-web-api.conf.j2
index 1af86d90..79cf5fb1 100644
--- a/roles/webapi/templates/argo-web-api.conf.j2
+++ b/roles/webapi/templates/argo-web-api.conf.j2
@@ -5,8 +5,8 @@ maxprocs = 4
cache = false
lrucache = 700000000
gzip = true
-cert = /etc/pki/tls/certs/localhost.crt
-privkey = /etc/pki/tls/private/localhost.key
+cert = /var/www/argo-web-api/certs/localhost.crt
+privkey = /var/www/argo-web-api/certs/localhost.key
reqsizelimit = 1073741824
enablecors = {{ cors_support }}
diff --git a/roles/webapi/templates/argo-web-api.service.j2 b/roles/webapi/templates/argo-web-api.service.j2
new file mode 100644
index 00000000..56a9f7ca
--- /dev/null
+++ b/roles/webapi/templates/argo-web-api.service.j2
@@ -0,0 +1,13 @@
+[Unit]
+Description=ARGO web api service
+After=mongod.service
+
+[Service]
+Type=simple
+User=argo-web-api
+Group=argo-web-api
+Restart=on-failure
+ExecStart=/var/www/argo-web-api/argo-web-api -conf=/etc/argo-web-api.conf
+SyslogIdentifier=argo_web_api
+[Install]
+WantedBy=multi-user.target
diff --git a/roles/webapi/templates/init_admins.js.j2 b/roles/webapi/templates/init_admins.js.j2
new file mode 100644
index 00000000..10dabda7
--- /dev/null
+++ b/roles/webapi/templates/init_admins.js.j2
@@ -0,0 +1,19 @@
+// Open Database
+use {{argo_core}}
+
+// Begin inserting new users
+
+{%- if webapi_admins is defined -%}
+
+{%- for user in webapi_admins -%}
+
+
+;
+
+db.authentication.update({"name" : "{{user.name}}"},{"name":"{{user.name}}","email" : "{{user.email}}", "api_key" : "{{user.api_key}}" },{"upsert":"true"})
+
+
+{%- endfor -%}
+
+
+{%- endif -%}
diff --git a/roles/webapi/templates/init_roles.js.j2 b/roles/webapi/templates/init_roles.js.j2
new file mode 100644
index 00000000..fc532289
--- /dev/null
+++ b/roles/webapi/templates/init_roles.js.j2
@@ -0,0 +1,55 @@
+use {{argo_core}}
+db.roles.drop()
+db.roles.insert([
+{ "resource" : "latest.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "reports.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "reports.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "reports.create", "roles" : [ "admin", "editor" ] },
+{ "resource" : "reports.delete", "roles" : [ "admin", "editor" ] },
+{ "resource" : "reports.update", "roles" : [ "admin", "editor" ] },
+{ "resource" : "metric_profiles.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "metric_profiles.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "metric_profiles.create", "roles" : [ "admin", "editor" ] },
+{ "resource" : "metric_profiles.delete", "roles" : [ "admin", "editor" ] },
+{ "resource" : "metric_profiles.update", "roles" : [ "admin", "editor" ] },
+{ "resource" : "operations_profiles.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "operations_profiles.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "operations_profiles.create", "roles" : [ "admin", "editor" ] },
+{ "resource" : "operations_profiles.delete", "roles" : [ "admin", "editor" ] },
+{ "resource" : "operations_profiles.update", "roles" : [ "admin", "editor" ] },
+{ "resource" : "aggregation_profiles.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "aggregation_profiles.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "aggregation_profiles.create", "roles" : [ "admin", "editor" ] },
+{ "resource" : "aggregation_profiles.delete", "roles" : [ "admin", "editor" ] },
+{ "resource" : "aggregation_profiles.update", "roles" : [ "admin", "editor" ] },
+{ "resource" : "results.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "results.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "status.get", "roles" : [ "admin", "editor", "viewer", "status_viewer" ] },
+{ "resource" : "status.list", "roles" : [ "admin", "editor", "viewer", "status_viewer" ] },
+{ "resource" : "factors.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "tenants.get", "roles" : [ "super_admin" ] },
+{ "resource" : "tenants.list", "roles" : [ "super_admin" ] },
+{ "resource" : "tenants.create", "roles" : [ "super_admin" ] },
+{ "resource" : "tenants.delete", "roles" : [ "super_admin" ] },
+{ "resource" : "tenants.update", "roles" : [ "super_admin" ] },
+{ "resource" : "metric_result.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "recomputations.list", "roles" : [ "admin", "editor" ] },
+{ "resource" : "recomputations.get", "roles" : [ "admin", "editor" ] },
+{ "resource" : "recomputations.submit", "roles" : [ "admin", "editor" ] },
+{ "resource" : "metricResult.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "aggregationProfiles.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "aggregationProfiles.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "aggregationProfiles.create", "roles" : [ "admin", "editor" ] },
+{ "resource" : "aggregationProfiles.delete", "roles" : [ "admin", "editor" ] },
+{ "resource" : "aggregationProfiles.update", "roles" : [ "admin", "editor" ] },
+{ "resource" : "operationsProfiles.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "operationsProfiles.get", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "operationsProfiles.update", "roles" : [ "admin", "editor" ] },
+{ "resource" : "operationsProfiles.delete", "roles" : [ "admin", "editor" ] },
+{ "resource" : "operationsProfiles.create", "roles" : [ "admin", "editor" ] },
+{ "resource" : "metricProfiles.create", "roles" : [ "admin", "editor" ] },
+{ "resource" : "metricProfiles.update", "roles" : [ "admin", "editor" ] },
+{ "resource" : "metricProfiles.delete", "roles" : [ "admin", "editor" ] },
+{ "resource" : "metricProfiles.list", "roles" : [ "admin", "editor", "viewer" ] },
+{ "resource" : "metricProfiles.get", "roles" : [ "admin", "editor", "viewer" ] }
+])
diff --git a/roles/webapi/templates/init_tenants.js.j2 b/roles/webapi/templates/init_tenants.js.j2
new file mode 100644
index 00000000..c082c19e
--- /dev/null
+++ b/roles/webapi/templates/init_tenants.js.j2
@@ -0,0 +1,30 @@
+use {{argo_core}};{% if webapi_tenants is defined %}
+{% for tenant in webapi_tenants %}
+
+db.tenants.update(
+{"id":"{{tenant.id}}"},
+{"id":"{{tenant.id}}",
+"info":{
+"name":"{{tenant.name}}",
+"email":"{{tenant.email}}",
+"website":"{{tenant.website}}",
+"created":"{{ansible_date_time.date}} {{ansible_date_time.time}}",
+"updated":"{{ansible_date_time.date}} {{ansible_date_time.time}}"},
+"db_conf":[{% for db in tenant.db_conf %}
+{"store":"{{db.store}}",
+"server":"{{db.server}}",
+"port":{{db.port}},
+"database":"{{db.database}}",
+"username":"{{db.username}}",
+"password":"{{db.password}}"}
+{% endfor %}{%if not loop.last%},{% endif %}],
+"users":[{% for user in tenant.users %}
+{"name":"{{user.name}}",
+"email":"{{user.email}}",
+"api_key":"{{user.token}}",
+"roles":[{% for role in user.roles %}
+"{{role}}"{%if not loop.last%},{% endif %}{% endfor %}
+]}{%if not loop.last%},{% endif %}
+]},
+{% endfor %}{"upsert":"true"});
+{% endfor %}{% endif %}
diff --git a/roles/webapi/vars/main.yml b/roles/webapi/vars/main.yml
new file mode 100644
index 00000000..19991cf4
--- /dev/null
+++ b/roles/webapi/vars/main.yml
@@ -0,0 +1,2 @@
+---
+# vars file for argo-web-api
diff --git a/roles/webui/defaults/main.yml b/roles/webui/defaults/main.yml
deleted file mode 100644
index 8c33d054..00000000
--- a/roles/webui/defaults/main.yml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-
-services:
- - http
- - https
-
-tenant_name: einfraname
-lavoisier_home: /var/www/lavoisier
-branch_name: master
-argo_web: argo-egi-web
-argo_api_host: example.com
-argo_api_key: some_api_key
-contact_email: foo@example.com
-
-gocdb_endpoint: goc.egi.eu
-gocdb_production: Production
-gocdb_certification: Certified
-
-cert_dir: /etc/grid-security
-cert_path: /etc/grid-security/hostcert.pem
-key_path: /etc/grid-security/hostkey.pem
-
-certificate_password: change_me_or_overwrite_me_in_vars_file
-certificate_path: /etc/grid-security/server.p12
-cache_directory: /tmp
-truststore_path: /etc/grid-security/certificates
-keystore_path: /etc/grid-security/server.p12
-keystore_password: change_me_or_overwrite_me_in_vars_file
-
-admin_password_md5: b91cd1a54781790beaa2baf741fa6789
\ No newline at end of file
diff --git a/roles/webui/handlers/main.yml b/roles/webui/handlers/main.yml
deleted file mode 100644
index 744e10ed..00000000
--- a/roles/webui/handlers/main.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-
-- name: restart webui
- command: ./bin/lavoisier.sh restart
- chdir={{ lavoisier_home }}/{{ argo_web }}-{{ branch_name }}
- ignore_errors: True
diff --git a/roles/webui/tasks/main.yml b/roles/webui/tasks/main.yml
deleted file mode 100644
index f6492577..00000000
--- a/roles/webui/tasks/main.yml
+++ /dev/null
@@ -1,73 +0,0 @@
----
-
-- name: Install requirements
- yum: name={{ item }} state=present
- with_items:
- - java-1.7.0-openjdk.x86_64
- - wget
- - unzip
- tags: install_requirements
-
-- name: Install CAs metapackage
- yum: name=ca-policy-egi-core state=latest
- tags: install_ca_bundle
- notify: restart webui
-
-- name: Copy files to setup HOME_LAVOISIER
- template: src={{ item }}.j2 dest=/etc/profile.d/{{ item }}
- owner=root group=root mode=0644
- with_items:
- - lavoisier.sh
- - lavoisier.csh
-
-- name: Create download directory
- file: path={{ lavoisier_home }} state=directory
-
-- name: Create cache directory
- file: path={{ cache_directory }} state=directory
-
-- name: Remove older downloaded lavoisier zip file
- command: rm -f {{ lavoisier_home }}/{{ branch_name }}.zip
- ignore_errors: True
-
-- name: Download lavoisier zip file
- get_url: url=https://github.com/ARGOeu/{{ argo_web }}/archive/{{ branch_name }}.zip
- dest={{ lavoisier_home }}/{{ branch_name }}.zip
- mode=0640
- register: download_out
- notify: restart webui
-
-- name: Stage old directory if download target has changed
- command: mv {{ argo_web }}-{{ branch_name }} {{ argo_web }}-{{ branch_name }}.old
- chdir={{ lavoisier_home }}
- when: download_out is defined and download_out.changed
- ignore_errors: True
-
-- name: Unzip zip file
- command: unzip {{ branch_name }}.zip
- chdir={{ lavoisier_home }}
- when: download_out is defined and download_out.changed
-
-- name: Copy etc/lavoisier-hidden.properties file
- template: src=lavoisier-hidden.properties.j2
- dest={{ lavoisier_home }}/{{ argo_web }}-{{ branch_name }}/etc/lavoisier-hidden.properties
- owner=root group=root mode=0644
- notify: restart webui
-
-- name: Copy etc/argo-config.properties file
- template: src=argo-config.properties.j2
- dest={{ lavoisier_home }}/{{ argo_web }}-{{ branch_name }}/etc/argo-config.properties
- owner=root group=root mode=0644
- notify: restart webui
-
-- name: Configure etc/security/passwords.properties
- lineinfile: dest={{ lavoisier_home }}/{{ argo_web }}-{{ branch_name }}/etc/security/passwords.properties
- line='admin={{ admin_password_md5 }}'
- regexp='^admin'
- state=present
- notify: restart webui
-
-- name: Start webui
- command: ./bin/lavoisier.sh start
- chdir={{ lavoisier_home }}/{{ argo_web }}-{{ branch_name }}
- ignore_errors: True
diff --git a/roles/webui/templates/argo-config.properties.j2 b/roles/webui/templates/argo-config.properties.j2
deleted file mode 100644
index c6b3ca23..00000000
--- a/roles/webui/templates/argo-config.properties.j2
+++ /dev/null
@@ -1,56 +0,0 @@
-############################################
-# ARGO API methods
-###########################################
-
-### Generic Url Availability
-
-api.group.availability=https://{{ argo_api_host }}/api/v2/results/
-api.service.availability=https://{{ argo_api_host }}/api/v2/results/
-api.output.details=https://{{ argo_api_host }}/api/v2/metric_result/
-
-###Generic Url STATUS
-
-api.status.url=https://{{ argo_api_host }}/api/v2/status/
-
-
-### Factors
-api.custom.factors=https://{{ argo_api_host }}/api/v2/factors
-
-
-### RECOMPUTATION
-
-api.recomputation.url=https://{{ argo_api_host }}/api/v2/recalculate
-api.recomputation.history.url=https://{{ argo_api_host }}/api/v2/get_recalculation_requests
-
-### METRICS PROFILE
-api.metrics.profile=https://{{ argo_api_host }}/api/v2/metric_profiles
-
-### PROFILES
-
-api.availabilities.profiles=http://argo.egi.eu/lavoisier/listProfilesRaw?accept=xml
-api.aggregation_profiles=https://{{ argo_api_host }}/api/v2/aggregation_profiles
-
-api.reports=https://{{ argo_api_host }}/api/v2/reports
-
-####################
-# MON.EGI.EU
-#####################
-
-api.monthly.sites.cern=http://mon.egi.eu/mywlcg/sam-pi/group_availability_in_profile/?profile_name=ROC_CRITICAL&vo_name=ops&group_type=Site&start_time=2014-05-01T00:00:00Z&end_time=2016-01-01T00:00:00Z&type=MONTHLY&output=xml
-api.monthly.sites.argo=https://{{ argo_api_host }}/api/v2/group_availability?group_type=site&start_time=2014-05-01T10:00:00Z&end_time=2016-10-02T10:00:00Z&granularity=MONTHLY&output=XML&availability_profile=test-ap1
-
-api.monthly.sites.cern.cloud=http://mon.egi.eu/mywlcg/sam-pi/group_availability_in_profile/?profile_name=CLOUD-MON&vo_name=ops&group_type=Site&start_time=2014-05-01T00:00:00Z&end_time=2016-01-01T00:00:00Z&type=MONTHLY&output=xml
-api.monthly.sites.argo.cloud=https://{{ argo_api_host }}/api/v2/group_availability?group_type=site&start_time=2014-05-01T10:00:00Z&end_time=2016-10-02T10:00:00Z&granularity=MONTHLY&output=XML&availability_profile=egi-fedcloud
-
-
-########################
-# GOC DB
-######################
-
-{% if tenant_name is defined and tenant_name|lower == "eudat" %}
-goc.siteProjects=https://{{ gocdb_endpoint }}/gocdbpi/private/?method=get_service_group
-{% endif %}
-goc.siteList=https://{{ gocdb_endpoint }}/gocdbpi/private/?method=get_site&certification_status={{ gocdb_certification }}&production_status={{ gocdb_production }}
-goc.ngiContactsList=https://{{ gocdb_endpoint }}/gocdbpi/private/?method=get_roc_contacts
-goc.serviceFlavours=https://{{ gocdb_endpoint }}/gocdbpi/public/?method=get_service_types
-goc.hostList=https://{{ gocdb_endpoint }}/gocdbpi/public/?method=get_service
diff --git a/roles/webui/templates/lavoisier-hidden.properties.j2 b/roles/webui/templates/lavoisier-hidden.properties.j2
deleted file mode 100644
index d60364c0..00000000
--- a/roles/webui/templates/lavoisier-hidden.properties.j2
+++ /dev/null
@@ -1,24 +0,0 @@
-# location of the caches for the data
-cache.baseDirectory={{ cache_directory }}
-
-# Certificate path and associated password (accepted formats p12 and pem)
-certificate.password={{ certificate_password }}
-certificate.path={{ certificate_path }}
-
-# Path to the CA , used for ssl authentication
-lavoisier.ssl.trustStore={{ truststore_path }}
-
-# Path to the host certificate for the trusted authentication , could be the same value than certificate
-lavoisier.ssl.keyStore={{ keystore_path }}
-lavoisier.ssl.keyStorePassword={{ keystore_password }}
-
-
-# Key used to interact with the ARGO API
-argo.api.key={{ argo_api_key }}
-
-
-# Host of the service, used to generate relative urls
-server.baseUrl=http://{{ inventory_hostname }}
-
-# Email contact used to send emails for recomputation
-contact.email={{ contact_email }}
diff --git a/roles/webui/templates/lavoisier.csh.j2 b/roles/webui/templates/lavoisier.csh.j2
deleted file mode 100644
index 55bc4397..00000000
--- a/roles/webui/templates/lavoisier.csh.j2
+++ /dev/null
@@ -1,2 +0,0 @@
-# File to export the variable HOME_LAVOISIER.
-setenv HOME_LAVOISIER "{{ lavoisier_home }}"
\ No newline at end of file
diff --git a/roles/webui/templates/lavoisier.sh.j2 b/roles/webui/templates/lavoisier.sh.j2
deleted file mode 100644
index d795fd8d..00000000
--- a/roles/webui/templates/lavoisier.sh.j2
+++ /dev/null
@@ -1,2 +0,0 @@
-# File to export the variable HOME_LAVOISIER.
-export HOME_LAVOISIER={{ lavoisier_home }}
\ No newline at end of file
diff --git a/roles/zookeeper/.yamllint b/roles/zookeeper/.yamllint
new file mode 100644
index 00000000..3a2255e4
--- /dev/null
+++ b/roles/zookeeper/.yamllint
@@ -0,0 +1,13 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ # NOTE(retr0h): Templates no longer fail this lint rule.
+ # Uncomment if running old Molecule templates.
+ # truthy: disable
diff --git a/roles/zookeeper/README.md b/roles/zookeeper/README.md
new file mode 100644
index 00000000..4b101fbe
--- /dev/null
+++ b/roles/zookeeper/README.md
@@ -0,0 +1,55 @@
+Zookeeper
+=========
+
+Installs a clustered zookeeper service
+
+Requirements
+------------
+
+Run commons role, Specify Cluster variables
+
+Role Variables
+--------------
+
+zookeeper_maxClientCnxns: 60
+zookeeper_myid: 1
+zookeeper_tickTime: 2000
+zookeeper_initLimit: 10
+zookeeper_syncLimit: 5
+zookeeper_dataDir: /var/lib/zookeeper
+zookeeper_data_logDir: /var/lib/zookeeper
+zookeeper_clientPort: 2181
+zookeeper_leaderPort: 2888
+zookeeper_electionPort: 3888
+
+Dependencies
+------------
+
+Private cluster Variables:
+
+You need to specify the ansible inventory group that will consist your cluster
+- cluster_group: zookeeper
+
+You need for each host to set up the following variable for the private interface
+private:
+ - hostname: foo.host.priv # private hostname alias
+ ip: 192.168.0.1 # private hostname
+ id: 1 # private
+
+
+Example Playbook
+----------------
+
+ - hosts: zookeeper
+ roles:
+ - { role: zookeeper, tags: zookeeper_install }
+
+License
+-------
+
+Apache 2
+
+Author Information
+------------------
+
+GRNET
diff --git a/roles/zookeeper/defaults/main.yml b/roles/zookeeper/defaults/main.yml
new file mode 100644
index 00000000..cdaae1f1
--- /dev/null
+++ b/roles/zookeeper/defaults/main.yml
@@ -0,0 +1,12 @@
+---
+# defaults file for zookeeper
+zookeeper_maxClientCnxns: 60
+zookeeper_myid: 1
+zookeeper_tickTime: 2000
+zookeeper_initLimit: 10
+zookeeper_syncLimit: 5
+zookeeper_dataDir: /var/lib/zookeeper
+zookeeper_data_logDir: /var/lib/zookeeper
+zookeeper_clientPort: 2181
+zookeeper_leaderPort: 2888
+zookeeper_electionPort: 3888
diff --git a/roles/zookeeper/handlers/main.yml b/roles/zookeeper/handlers/main.yml
new file mode 100644
index 00000000..de39d43b
--- /dev/null
+++ b/roles/zookeeper/handlers/main.yml
@@ -0,0 +1,6 @@
+---
+# handlers file for zookeeper
+
+- name: restart zookeeper
+ service: name=zookeeper-server state=restarted
+ become: true
diff --git a/roles/zookeeper/meta/main.yml b/roles/zookeeper/meta/main.yml
new file mode 100644
index 00000000..ba43fdd2
--- /dev/null
+++ b/roles/zookeeper/meta/main.yml
@@ -0,0 +1,58 @@
+---
+galaxy_info:
+ author: your name
+ description: your description
+ company: your company (optional)
+
+ # If the issue tracker for your role is not on github, uncomment the
+ # next line and provide a value
+ # issue_tracker_url: http://example.com/issue/tracker
+
+ # Some suggested licenses:
+ # - BSD (default)
+ # - MIT
+ # - GPLv2
+ # - GPLv3
+ # - Apache
+ # - CC-BY
+ license: license (GPLv2, CC-BY, etc)
+
+ min_ansible_version: 1.2
+
+ # If this a Container Enabled role, provide the minimum Ansible Container version.
+ # min_ansible_container_version:
+
+ # Optionally specify the branch Galaxy will use when accessing the GitHub
+ # repo for this role. During role install, if no tags are available,
+ # Galaxy will use this branch. During import Galaxy will access files on
+ # this branch. If Travis integration is configured, only notifications for this
+ # branch will be accepted. Otherwise, in all cases, the repo's default branch
+ # (usually master) will be used.
+ # github_branch:
+
+ #
+ # platforms is a list of platforms, and each platform has a name and a list of versions.
+ #
+ # platforms:
+ # - name: Fedora
+ # versions:
+ # - all
+ # - 25
+ # - name: SomePlatform
+ # versions:
+ # - all
+ # - 1.0
+ # - 7
+ # - 99.99
+
+ galaxy_tags: []
+ # List tags for your role here, one per line. A tag is a keyword that describes
+ # and categorizes the role. Users find roles by searching for tags. Be sure to
+ # remove the '[]' above, if you add tags to this list.
+ #
+ # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
+ # Maximum 20 tags per role.
+
+dependencies: []
+# List your role dependencies here, one per line. Be sure to remove the '[]' above,
+# if you add dependencies to this list.
diff --git a/roles/zookeeper/molecule/default/Dockerfile.j2 b/roles/zookeeper/molecule/default/Dockerfile.j2
new file mode 100644
index 00000000..19692c20
--- /dev/null
+++ b/roles/zookeeper/molecule/default/Dockerfile.j2
@@ -0,0 +1,14 @@
+# Molecule managed
+
+{% if item.registry is defined %}
+FROM {{ item.registry.url }}/{{ item.image }}
+{% else %}
+FROM {{ item.image }}
+{% endif %}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
+ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
+ elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
+ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
+ elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
diff --git a/roles/zookeeper/molecule/default/INSTALL.rst b/roles/zookeeper/molecule/default/INSTALL.rst
new file mode 100644
index 00000000..3904805e
--- /dev/null
+++ b/roles/zookeeper/molecule/default/INSTALL.rst
@@ -0,0 +1,26 @@
+*******
+Docker driver installation guide
+*******
+
+Requirements
+============
+
+* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
+* Docker Engine
+* docker-py
+* docker
+
+Install
+=======
+
+Ansible < 2.6
+
+.. code-block:: bash
+
+ $ sudo pip install docker-py
+
+Ansible >= 2.6
+
+.. code-block:: bash
+
+ $ sudo pip install docker
diff --git a/roles/zookeeper/molecule/default/molecule.yml b/roles/zookeeper/molecule/default/molecule.yml
new file mode 100644
index 00000000..f5e3b111
--- /dev/null
+++ b/roles/zookeeper/molecule/default/molecule.yml
@@ -0,0 +1,20 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: instance
+ image: centos:7
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+scenario:
+ name: default
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/roles/zookeeper/molecule/default/playbook.yml b/roles/zookeeper/molecule/default/playbook.yml
new file mode 100644
index 00000000..58d26bb8
--- /dev/null
+++ b/roles/zookeeper/molecule/default/playbook.yml
@@ -0,0 +1,5 @@
+---
+- name: Converge
+ hosts: all
+ roles:
+ - role: zookeeper
diff --git a/roles/zookeeper/molecule/default/tests/test_default.py b/roles/zookeeper/molecule/default/tests/test_default.py
new file mode 100644
index 00000000..eedd64a1
--- /dev/null
+++ b/roles/zookeeper/molecule/default/tests/test_default.py
@@ -0,0 +1,14 @@
+import os
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+def test_hosts_file(host):
+ f = host.file('/etc/hosts')
+
+ assert f.exists
+ assert f.user == 'root'
+ assert f.group == 'root'
diff --git a/roles/zookeeper/tasks/main.yml b/roles/zookeeper/tasks/main.yml
new file mode 100644
index 00000000..4d7ef304
--- /dev/null
+++ b/roles/zookeeper/tasks/main.yml
@@ -0,0 +1,43 @@
+---
+# tasks file for zookeeper
+
+- name: install JDK 1.8
+ yum: name=java-1.8.0-openjdk state=present
+ tags: zookeeper_install
+
+- name: install zktop
+ pip:
+ name: zktop
+ tags: zookeeper_install
+
+- name: install zookeeper
+ yum:
+ name: ['zookeeper', 'zookeeper-server']
+ state: present
+ enablerepo: cloudera-cdh5
+ tags: zookeeper_install
+
+- name: configure zookeeper
+ template: src=zoo.cfg.j2 dest=/etc/zookeeper/conf/zoo.cfg
+ owner=zookeeper group=zookeeper backup=yes
+ notify: restart zookeeper
+ tags: zookeeper_install
+
+- name: set myid
+ shell: sudo su -s /bin/bash zookeeper -c " zookeeper-server-initialize --force --myid={{ private.id }}"
+ tags: zookeeper_install
+
+- name: Zookeeper init.d script
+ template: src=zookeeper-server.j2 dest=/etc/rc.d/init.d/zookeeper-server
+ owner=root group=root backup=yes
+ notify: restart zookeeper
+ tags: zookeeper_install_initd_script
+
+- name: Run daemon-reload
+ systemd:
+ daemon-reload: true
+ tags: zookeeper_install_initd_script
+
+- name: start zookeeper service
+ service: name=zookeeper-server state=started enabled=yes
+ tags: zookeeper_install
diff --git a/roles/zookeeper/templates/environment.j2 b/roles/zookeeper/templates/environment.j2
new file mode 100644
index 00000000..5dc40a51
--- /dev/null
+++ b/roles/zookeeper/templates/environment.j2
@@ -0,0 +1,23 @@
+# Modified from http://packages.ubuntu.com/saucy/zookeeperd
+NAME=zookeeper
+ZOOCFGDIR={{zookeeper_conf_dir}}
+
+# seems, that log4j requires the log4j.properties file to be in the classpath
+CLASSPATH="$ZOOCFGDIR:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar"
+
+ZOOCFG="$ZOOCFGDIR/zoo.cfg"
+ZOO_LOG_DIR={{zookeeper_log_dir}}
+USER=$NAME
+GROUP=$NAME
+PIDDIR=/var/run/$NAME
+PIDFILE=$PIDDIR/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+JAVA=/usr/bin/java
+ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
+ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
+JMXLOCALONLY=false
+{% if zookeeper_heap_opt is defined %}
+JAVA_OPTS="{{ zookeeper_heap_opt }}"
+{% else %}
+JAVA_OPTS=""
+{% endif %}
diff --git a/roles/zookeeper/templates/java.env.j2 b/roles/zookeeper/templates/java.env.j2
new file mode 100644
index 00000000..03d773a9
--- /dev/null
+++ b/roles/zookeeper/templates/java.env.j2
@@ -0,0 +1,7 @@
+export ZOO_LOG_DIR={{zookeeper_log_dir}}
+
+{% if zookeeper_heap_opt is defined %}
+export _JAVA_OPTIONS="{{ zookeeper_heap_opt }}"
+{% endif %}
+
+export _JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true
diff --git a/roles/zookeeper/templates/log4j.properties.j2 b/roles/zookeeper/templates/log4j.properties.j2
new file mode 100644
index 00000000..3c5ab0d4
--- /dev/null
+++ b/roles/zookeeper/templates/log4j.properties.j2
@@ -0,0 +1,52 @@
+# From http://packages.ubuntu.com/saucy/zookeeperd
+
+# ZooKeeper Logging Configuration
+#
+
+# Format is "
(, )+
+
+log4j.rootLogger=${zookeeper.root.logger}
+
+# Example: console appender only
+# log4j.rootLogger=INFO, CONSOLE
+
+# Example with rolling log file
+#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE
+
+# Example with rolling log file and tracing
+#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE
+
+#
+# Log INFO level and above messages to the console
+#
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n
+
+#
+# Add ROLLINGFILE to rootLogger to get log file output
+# Log DEBUG level and above messages to a log file
+log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender
+log4j.appender.ROLLINGFILE.Threshold={{ zookeeper_log_level }}
+log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/zookeeper.log
+
+# Max log file size of 10MB
+log4j.appender.ROLLINGFILE.MaxFileSize=10MB
+# uncomment the next line to limit number of backup files
+#log4j.appender.ROLLINGFILE.MaxBackupIndex=10
+
+log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n
+
+
+#
+# Add TRACEFILE to rootLogger to get log file output
+# Log DEBUG level and above messages to a log file
+log4j.appender.TRACEFILE=org.apache.log4j.FileAppender
+log4j.appender.TRACEFILE.Threshold=TRACE
+log4j.appender.TRACEFILE.File=${zookeeper.log.dir}/zookeeper_trace.log
+
+log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout
+### Notice we are including log4j's NDC here (%x)
+log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n
diff --git a/roles/zookeeper/templates/myid.j2 b/roles/zookeeper/templates/myid.j2
new file mode 100644
index 00000000..db617e27
--- /dev/null
+++ b/roles/zookeeper/templates/myid.j2
@@ -0,0 +1,10 @@
+{%- if zookeeper_id is defined -%}
+{{ zookeeper_id }}
+{%- else -%}
+ {%- for url in zookeeper_hosts.split(',') -%}
+ {%- set url_host = url.split(':')[0] -%}
+ {%- if url_host == AMSNAME or url_host in ansible_all_ipv4_addresses -%}
+{{ loop.index0 }}
+ {%- endif -%}
+ {%- endfor -%}
+{%- endif -%}
diff --git a/roles/zookeeper/templates/zoo.cfg.j2 b/roles/zookeeper/templates/zoo.cfg.j2
new file mode 100644
index 00000000..4625a749
--- /dev/null
+++ b/roles/zookeeper/templates/zoo.cfg.j2
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+maxClientCnxns={{zookeeper_maxClientCnxns}}
+# The number of milliseconds of each tick
+tickTime={{zookeeper_tickTime}}
+# The number of ticks that the initial
+# synchronization phase can take
+initLimit={{zookeeper_initLimit}}
+# The number of ticks that can pass between
+# sending a request and getting an acknowledgement
+syncLimit={{zookeeper_syncLimit}}
+# the directory where the snapshot is stored.
+dataDir={{zookeeper_dataDir}}
+# the port at which the clients will connect
+clientPort=2181
+# the directory where the transaction logs are stored.
+dataLogDir={{zookeeper_data_logDir}}
+
+
+{% for host in groups[cluster_group] %}
+server.{{hostvars[host]['private']['id']}}={% if hostvars[host]['private']['ip'] is defined %}{{ hostvars[host]['private']['ip'] }}{% else %}{{ hostvars[host].ansible_default_ipv4.address }}{% endif %}:{{zookeeper_leaderPort}}:{{zookeeper_electionPort}}
+{% endfor %}
diff --git a/roles/zookeeper/templates/zookeeper-server.j2 b/roles/zookeeper/templates/zookeeper-server.j2
new file mode 100644
index 00000000..1c213158
--- /dev/null
+++ b/roles/zookeeper/templates/zookeeper-server.j2
@@ -0,0 +1,182 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+# chkconfig: 2345 80 20
+# description: Summary: ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications. Each time they are implemented there is a lot of work that goes into fixing the bugs and race conditions that are inevitable. Because of the difficulty of implementing these kinds of services, applications initially usually skimp on them ,which make them brittle in the presence of change and difficult to manage. Even when done correctly, different implementations of these services lead to management complexity when the applications are deployed.
+# processname: java
+# pidfile: /var/run/zookeeper/zookeeper-server.pid
+### BEGIN INIT INFO
+# Provides: zookeeper-server
+# Required-Start: $network $local_fs
+# Required-Stop:
+# Should-Start: $named
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.
+### END INIT INFO
+set -e
+
+# Autodetect JAVA_HOME if not defined
+. /usr/lib/bigtop-utils/bigtop-detect-javahome
+
+. /etc/default/zookeeper
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON_SCRIPT="/usr/bin/zookeeper-server"
+
+NAME=zookeeper-server
+DESC="ZooKeeper daemon"
+PID_FILE=/var/run/zookeeper/zookeeper-server.pid
+install -d -m 0755 -o zookeeper -g zookeeper /var/run/zookeeper/
+
+DODTIME=3
+
+
+# Checks if the given pid represents a live process.
+# Returns 0 if the pid is a live process, 1 otherwise
+hadoop_is_process_alive() {
+ local pid="$1"
+ ps -fp $pid | grep $pid | grep zookeeper > /dev/null 2>&1
+}
+
+hadoop_check_pidfile() {
+ local pidfile="$1" # IN
+ local pid
+
+ pid=`cat "$pidfile" 2>/dev/null`
+ if [ "$pid" = '' ]; then
+ # The file probably does not exist or is empty.
+ return 1
+ fi
+
+ set -- $pid
+ pid="$1"
+
+ hadoop_is_process_alive $pid
+}
+
+hadoop_process_kill() {
+ local pid="$1" # IN
+ local signal="$2" # IN
+ local second
+
+ kill -$signal $pid 2>/dev/null
+
+ # Wait a bit to see if the dirty job has really been done
+ for second in 0 1 2 3 4 5 6 7 8 9 10; do
+ if hadoop_is_process_alive "$pid"; then
+ # Success
+ return 0
+ fi
+
+ sleep 1
+ done
+
+ # Timeout
+ return 1
+}
+hadoop_stop_pidfile() {
+ local pidfile="$1" # IN
+ local pid
+
+ pid=`cat "$pidfile" 2>/dev/null`
+ if [ "$pid" = '' ]; then
+ # The file probably does not exist or is empty. Success
+ return 0
+ fi
+
+ set -- $pid
+ pid="$1"
+
+ # First try the easy way
+ if hadoop_process_kill "$pid" 15; then
+ return 0
+ fi
+
+ # Otherwise try the hard way
+ if hadoop_process_kill "$pid" 9; then
+ return 0
+ fi
+
+ return 1
+}
+
+
+start() {
+ runuser -s /bin/bash zookeeper -c "${DAEMON_SCRIPT} start"
+}
+stop() {
+ if hadoop_check_pidfile $PID_FILE ; then
+ runuser -s /bin/bash zookeeper -c "${DAEMON_SCRIPT} stop"
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ force-stop)
+ echo -n "Forcefully stopping $DESC: "
+ hadoop_stop_pidfile $PID_FILE
+ if hadoop_check_pidfile $PID_FILE ; then
+ echo "$NAME."
+ else
+ echo " ERROR."
+ fi
+ ;;
+ force-reload|condrestart|try-restart)
+ # check wether $DAEMON is running. If so, restart
+ hadoop_check_pidfile $PID_FILE && $0 restart
+ ;;
+ restart|reload)
+ echo -n "Restarting $DESC: "
+ stop
+ [ -n "$DODTIME" ] && sleep $DODTIME
+ $0 start
+ ;;
+ status)
+ echo -n "$NAME is "
+ if hadoop_check_pidfile $PID_FILE ; then
+ echo "running"
+ else
+ echo "not running."
+ exit 1
+ fi
+ ;;
+ init)
+ if hadoop_check_pidfile $PID_FILE ; then
+ echo "Error: $DESC is running. Stop it first." >&2
+ exit 1
+ else
+ shift
+ runuser -s /bin/bash zookeeper -c "zookeeper-server-initialize $*"
+ fi
+ ;;
+ *)
+ N=/etc/init.d/$NAME
+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $N {start|stop|restart|force-reload|status|force-stop|condrestart|try-restart|init}" >&2
+
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/roles/zookeeper/templates/zookeeper.service.j2 b/roles/zookeeper/templates/zookeeper.service.j2
new file mode 100644
index 00000000..7cf129eb
--- /dev/null
+++ b/roles/zookeeper/templates/zookeeper.service.j2
@@ -0,0 +1,23 @@
+[Unit]
+Description=Apache ZooKeeper
+After=network.target
+ConditionPathExists={{ zookeeper_conf_dir }}/zoo.cfg
+ConditionPathExists={{ zookeeper_conf_dir }}/log4j.properties
+
+[Service]
+Type=forking
+User=root
+SyslogIdentifier=zookeeper
+WorkingDirectory={{ zookeeper_data_dir }}
+UMask=0027
+Environment="ZOOCFGDIR={{ zookeeper_conf_dir }}"
+Environment="ZOO_LOG_DIR={{zookeeper_log_dir}}"
+Environment="JMXLOCALONLY=false"
+Environment="ZOO_LOG4J_PROP=INFO,ROLLINGFILE"
+ExecStart={{ zookeeper_dir }}/bin/zkServer.sh start
+ExecStop={{ zookeeper_dir }}/bin/zkServer.sh stop
+ExecReload={{ zookeeper_dir }}/bin/zkServer.sh restart
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/roles/zookeeper/vars/main.yml b/roles/zookeeper/vars/main.yml
new file mode 100644
index 00000000..740c7640
--- /dev/null
+++ b/roles/zookeeper/vars/main.yml
@@ -0,0 +1,2 @@
+---
+# vars file for zookeeper
diff --git a/rollback.yml b/rollback.yml
new file mode 100644
index 00000000..5d472081
--- /dev/null
+++ b/rollback.yml
@@ -0,0 +1,17 @@
+---
+
+- hosts: webapi
+ become: yes
+ roles:
+ - { role: webapi, task: rollback }
+
+- hosts: authn
+ become: yes
+ roles:
+ - { role: argo-api-authn, task: rollback }
+
+- hosts: ams
+ serial: 1
+ become: yes
+ roles:
+ - { role: ams, task: rollback }
diff --git a/standalone.yml b/standalone.yml
deleted file mode 100644
index 77304080..00000000
--- a/standalone.yml
+++ /dev/null
@@ -1,13 +0,0 @@
----
-
-- hosts: standalone
- sudo: true
- roles:
- - { role: firewall , tags: firewall }
- - { role: repos , tags: repos }
- - { role: ca_bundle , tags: ca_bundle }
- - { role: has_certificate , tags: has_certificate }
- - { role: consumer , tags: consumer }
- - { role: logging_config , tags: logging_config }
- - { role: mongodb , tags: mongodb }
- - { role: webapi , tags: webapi }
diff --git a/swagger.yml b/swagger.yml
deleted file mode 100644
index f573cb93..00000000
--- a/swagger.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-
-- hosts: webapi
- sudo: true
- roles:
- - { role: swagger, tags: swagger }
diff --git a/update.yml b/update.yml
new file mode 100644
index 00000000..a432c344
--- /dev/null
+++ b/update.yml
@@ -0,0 +1,20 @@
+---
+
+- hosts: webapi
+ become: yes
+ roles:
+ - { role: webapi, task: update }
+
+- hosts: authn
+ become: yes
+ roles:
+ - { role: argo-api-authn, task: update }
+ - { role: argo-api-authn, task: python-env-setup }
+ - { role: argo-api-authn, task: ams-create-users-gocdb-script }
+ - { role: argo-api-authn, task: ams-create-users-cloud-info-script }
+
+- hosts: ams
+ serial: 1
+ become: yes
+ roles:
+ - { role: ams, task: update }
\ No newline at end of file
diff --git a/webapi.yml b/webapi.yml
deleted file mode 100644
index 4df42d90..00000000
--- a/webapi.yml
+++ /dev/null
@@ -1,10 +0,0 @@
----
-
-- hosts: webapi
- sudo: true
- roles:
- - { role: firewall, tags: firewall }
- - { role: repos, tags: repos }
- - { role: has_certificate, tags: has_certificate }
- - { role: mongodb, tags: mongodb }
- - { role: webapi, tags: webapi }
diff --git a/webui.yml b/webui.yml
deleted file mode 100644
index d11473a7..00000000
--- a/webui.yml
+++ /dev/null
@@ -1,9 +0,0 @@
----
-
-- hosts: webui
- user: root
- roles:
- - { role: firewall, tags: firewall }
- - { role: repos, tags: repos }
- - { role: has_certificate, tags: certificate }
- - { role: webui, tags: webui }