Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Anastasios Lisgaras
GitHubHistory
Commits
969693e7
Commit
969693e7
authored
Mar 28, 2016
by
Pavlos Daoglou
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #67 from pkoro/argo-393
ARGO-393 Changes in swagger role
parents
9d461ecf
84e86e54
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
44 deletions
+38
-44
roles/swagger/defaults/main.yml
roles/swagger/defaults/main.yml
+2
-4
roles/swagger/handlers/main.yml
roles/swagger/handlers/main.yml
+4
-0
roles/swagger/tasks/main.yml
roles/swagger/tasks/main.yml
+32
-40
No files found.
roles/swagger/defaults/main.yml
View file @
969693e7
---
swagger_ui_host
:
example.com
swagger_ui_port
:
8080
swagger_web_api_branch
:
devel
swagger_messaging_branch
:
devel
swagger_docs
:
-
{
github_org
:
swagger-api
,
name
:
swagger-spec
,
branch
:
master
,
path_to_yaml
:
"
examples/v2.0/yaml/petstore.yaml"
,
api_host
:
"
petstore.swagger.io"
}
roles/swagger/handlers/main.yml
0 → 100644
View file @
969693e7
---
-
name
:
restart apache
service
:
name=httpd state=restarted
roles/swagger/tasks/main.yml
View file @
969693e7
...
...
@@ -10,13 +10,10 @@
-
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
yum
:
name={{ item }} state=present
with_items
:
-
httpd
-
mod_ssl
-
name
:
Config Apache Up and Running
tags
:
swagger
...
...
@@ -32,53 +29,48 @@
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
-
name
:
Create swagger dir
ectories
tags
:
swagger
file
:
path={{item}} state=directory
with_items
:
-
/var/www/html/argo-web-api
-
/var/www/html/argo-messaging
file
:
path=/var/www/html/{{ item.name }} state=directory owner=root group=root mode=0755
with_items
:
swagger_docs
-
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
shell
:
cp -R /tmp/swagger/dist/* /var/www/html/{{ item.name }}
with_items
:
swagger_docs
-
name
:
Get latest
argo-web-api swagger.yaml from our devel repo
-
name
:
Get latest
swagger.yaml definition files
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
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
notify
:
restart apache
-
name
:
Convert
argo-web-api
swagger.yaml to swagger.json
-
name
:
Convert 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
< /tmp/swagger/{{ item.name }}_swagger.yaml > /var/www/html/{{ item.name }}/swagger.json
with_items
:
swagger_docs
-
name
:
Point argo-web-api swagger-ui to our own swagger.yaml definition
-
name
:
Make swagger.json point to corresponding api endpoint
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
lineinfile
:
>
dest=/var/www/html/{{ item.name }}/swagger.json
regexp='( +)\"host\":\ \"(.+)\"\,'
line=' \"host\": \"{{ item.api_host }}\",'
state=present backup=yes
with_items
:
swagger_docs
notify
:
restart apache
-
name
:
Get latest argo-messaging swagger.yaml from our devel repo
-
name
:
Point swagger-ui to corresponding swagger definitions on host
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
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";'
backup=yes
with_items
:
swagger_docs
-
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment