This 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.
A Kong server which you want to configure.
If you want to configure this role with Dhall 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.
kong_servers: an array of kong_server to configure with the following configuration:kong_app_admin_urlthe kong admin API url (mandatory).kong_app_admin_apikeythe apikey to use during kong admin api calls. Defaults to""servicesan array of services to setup. Defaults to[].namethe name of the service to create for this app, mandatoryurlthe url of the backend of the app, mandatory. May refer to an upstream by its name (https://upstream_name/path)upstreamif the url reference an upstream a dict with the configuration, optionalconfthe configuration as expected by kong for an upstream creationnamemandatory name for the upstreamhealthchecksoptional healthchecks configuration as expected by kong api
targetsan array of dict defining a target for kongtargetthe host:port to reach the target, mandatory if a target is definedweightthe weight of the target, optional
pluginsAn array of plugins to activate with their name and config in a dict. (Plugin objects are defined in the Kong API documentation)nameconfig
routesAn array of routes to create for this service. (Route objects are defined in the Kong API documentation)hostspathsprotocolsmethods
None
- hosts: localhost
roles:
- role: kong-app,
kong_servers:
- kong_app_admin_url: http://localhost:8001,
services:
- name: example,
url: http://example.com,
plugins: [],
routes: [ { hosts: [my.kong.example], paths: [/] } ]The 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).
MIT (see LICENSE file for details)
Developed at Fretlink