Commit bb191340 authored by Konstantinos Kagkelidis's avatar Konstantinos Kagkelidis
Browse files

ARGO-336 Add swagger deployment for both argo-web-api and argo-messaging

parent e336f2fb
---
# Variable enabled_argo_repo specifies which RPM repository to use.
# Variable enabled_argo_repo specifies which RPM repository to use.
# To use the development repository set its value to argo-devel
enabled_argo_repo: argo-prod
......
......@@ -8,4 +8,4 @@ key_path: /etc/pki/tls/private/localhost.key
iptables_rules:
input:
- { dport: "443", proto: "tcp", policy: "accept"}
- { dport: "27017", proto: "tcp", policy: "accept"}
\ No newline at end of file
- { dport: "27017", proto: "tcp", policy: "accept"}
---
swagger_ui_host: example.com
swagger_ui_port: 8080
swagger_web_api_branch: devel
swagger_messaging_branch: devel
---
- 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=httpd state=present
- name: Config Apache to run on specified port
tags: swagger
lineinfile: dest=/etc/httpd/conf/httpd.conf regexp="^Listen "
insertafter="^#Listen " line="Listen {{ swagger_ui_port }}"
notify: restart apache
- name: Config Apache Up and Running
tags: swagger
service: name=httpd enabled=yes state=started
- name: Create /tmp/swagger folder
tags: swagger
file: path=/tmp/swagger state=directory
- name: Get swagger-ui distro tar
tags: swagger
shell: >
curl -L https://api.github.com/repos/swagger-api/swagger-ui/tarball
| tar xz -C /tmp/swagger --strip-components 1
- name: Create argo-web-api swagger dir
tags: swagger
file: path={{item}} state=directory
with_items:
- /var/www/html/argo-web-api
- /var/www/html/argo-messaging
- name: Transfer dist files to each dedicated dir at /var/www/html/
tags: swagger
shell: cp -R /tmp/swagger/dist/* {item}
with_items:
- /var/www/html/argo-web-api
- /var/www/html/argo-messaging
- name: Get latest argo-web-api swagger.yaml from our devel repo
tags: swagger
command: >
curl -L -H "Accept: application/vnd.github.raw"
https://api.github.com/repositories/17568185/contents/doc/swagger/swagger.yaml?ref={{swagger_web_api_branch}}
-o /tmp/swagger/argo-web-api_swagger.yaml
- name: Convert argo-web-api swagger.yaml to swagger.json
tags: swagger
shell: >
python -c 'import sys, yaml, json;
json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)'
< /tmp/swagger/argo-web-api_swagger.yaml > /var/www/html/argo-web-api/swagger.json
- name: Point argo-web-api swagger-ui to our own swagger.yaml definition
tags: swagger
replace: dest=/var/www/html/argo-web-api/index.html regexp='url = "http:\/\/petstore\.swagger\.io\/v2\/swagger\.json";' replace='url = "http://{{ swagger_ui_host }}:{{ swagger_ui_port }}/argo-web-api/swagger.json";' backup=yes
- name: Get latest argo-messaging swagger.yaml from our devel repo
tags: swagger
command: >
curl -L -H "Accept: application/vnd.github.raw"
https://api.github.com/repositories/17568185/contents/doc/swagger/swagger.yaml?ref={{swagger_messaging_branch}}
-o /tmp/swagger/argo-messaging_swagger.yaml
- name: Convert argo-messaging swagger.yaml to swagger.json
tags: swagger
shell: >
python -c 'import sys, yaml, json;
json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)'
< /tmp/swagger/argo-messaging_swagger.yaml > /var/www/html/argo-web-api/swagger.json
- name: Point argo-messaging swagger-ui to our own swagger.yaml definition
tags: swagger
replace: dest=/var/www/html/argo-messaging/index.html regexp='url = "http:\/\/petstore\.swagger\.io\/v2\/swagger\.json";' replace='url = "http://{{ swagger_ui_host }}:{{ swagger_ui_port }}/argo-messaging/swagger.json";' backup=yes
---
- hosts: webapi
sudo: true
roles:
- { role: swagger, tags: swagger }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment