]> git.immae.eu Git - github/fretlink/ansible-kong-app.git/blame - README.md
tests: allow fake Kong server to receive PUT requests
[github/fretlink/ansible-kong-app.git] / README.md
CommitLineData
530dddec
GD
1kong-app
2=========
3
b193f750 4This role aims at creating, on a remote kong, a list of services, routes and plugins needed by an app. The API calls are made from the ansible target host. If you use `hosts: localhost` as a target from within your playbook then all API calls will be done from your local machine.
530dddec
GD
5
6Requirements
7------------
8
b193f750
PB
9A Kong server which you want to configure.
10
11If you want to configure this role with [Dhall](https://dhall-lang.org/) instead of YAML, the role publishes dhall bindings defined in the `dhall/package.dhall` file. These bindings will need Dhall version `1.29.0` or higher.
530dddec
GD
12
13Role Variables
14--------------
b193f750
PB
15* `kong_servers`: an array of kong_server to configure with the following configuration:
16 * `kong_app_admin_url` the kong admin API url (mandatory).
17 * `kong_app_admin_apikey` the apikey to use during kong admin api calls. Defaults to `""`
18 * `services` an array of services to setup. Defaults to `[]`.
19 * `name` the name of the service to create for this app, **mandatory**
20 * `url` the url of the backend of the app, **mandatory**. May refer to an upstream by its name (https://upstream_name/path)
e39a878d
GD
21 * `upstream` if the url reference an upstream a dict with the configuration, optional
22 * `conf` the configuration as expected by kong for an upstream creation
23 * `name` mandatory name for the upstream
24 * `healthchecks` optional healthchecks configuration as expected by kong api
fb5b4527 25 * `targets` an array of dict defining a target for kong
b193f750
PB
26 * `target` the host:port to reach the target, **mandatory** if a target is defined
27 * `weight` the weight of the target, optional
28 * `plugins` An array of plugins to activate with their name and config in a dict. (Plugin objects are defined in the [Kong API documentation](https://docs.konghq.com/2.1.x/admin-api/#plugin-object))
507bb99c
GD
29 * `name`
30 * `config`
b193f750 31 * `routes` An array of routes to create for this service. (Route objects are defined in the [Kong API documentation](https://docs.konghq.com/2.1.x/admin-api/#route-object))
507bb99c
GD
32 * `hosts`
33 * `paths`
34 * `protocols`
35 * `methods`
530dddec
GD
36
37Dependencies
38------------
39
b193f750 40None
530dddec
GD
41
42Example Playbook
43----------------
44
45 - hosts: localhost
46 roles:
b193f750
PB
47 - { role: kong-app,
48 kong_servers:
49 - kong_app_admin_url: http://localhost:8001,
50 services:
51 - name: example,
52 url: http://example.com,
53 plugins: [],
54 routes: [ { hosts: [my.kong.example], paths: [/] } ]
530dddec
GD
55 }
56
b193f750
PB
57Tests
58----
59
60The role is tested with automated continuous integration tests on Travis (see `tests/` directory). The test playbook targets a fake Kong server (visible in `tests/kong.py`).
61
530dddec
GD
62License
63-------
64
b193f750 65MIT (see LICENSE file for details)
530dddec
GD
66
67Author Information
68------------------
69
b193f750 70Developed at [Fretlink](https://tech.fretlink.com)