toast38coza / ansible-kong-module Goto Github PK
View Code? Open in Web Editor NEWA Module to help manage a [Kong](http://getkong.com) API Gateway
License: MIT License
A Module to help manage a [Kong](http://getkong.com) API Gateway
License: MIT License
Hello
I'm trying to use this module with Ansible 2.0.2.0 and i'm getting an error.
TASK [Register APIs] ***********************************************************
task path: /home/deploy/dynenvs/new.yml:132
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: zero length field name in format
fatal: [1337.staging.dev]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n File \"/home/deploy/.ansible/tmp/ansible-tmp-1463406901.38-217520438691928/kong_api\", line 3008, in <module>\n main()\n File \"/home/deploy/.ansible/tmp/ansible-tmp-1463406901.38-217520438691928/kong_api\", line 153, in main\n response = api.add_or_update(**data)\n File \"/home/deploy/.ansible/tmp/ansible-tmp-1463406901.38-217520438691928/kong_api\", line 47, in add_or_update\n url = self.__url(\"/apis/\")\n File \"/home/deploy/.ansible/tmp/ansible-tmp-1463406901.38-217520438691928/kong_api\", line 36, in __url\n return \"{}{}\" . format (self.base_url, path)\nValueError: zero length field name in format\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}
My definition is:
- name: registrer instances in GW
hosts: launched
gather_facts: True
vars:
- kong_admin_base_url: "http://a.b.c.d:8001"
- kong_base_url: "https://gw.dev"
tasks:
- name: Register APIs
kong_api:
kong_admin_uri: "{{ kong_admin_base_url }}"
name: "mockbin"
upstream_url: "http://mockbin.com"
request_host: "mockbin.com"
request_path: "/mockbin"
strip_request_path: yes
state: present
Am I doing something wrong?
Regards
M
Any plans to open PR to official ansible repo, to add this modules as official ones?
Hi there,
Thanks for creating this module, it's of great help to a project I'm currently working on.
It's working great for me, except I am seeing changed
instead of an expected ok
on repeated Ansible playbook executions for kong_api
.
This is with no changes to the playbook or vars between runs.
My relevant playbook tasks look like this:
- kong_api:
kong_admin_uri: 111
name: 222
upstream_url: 333
request_host: 444
state: present
register: kong_api
- debug: var=kong_api
The output from debug
is identical on each playbook run.
Thanks,
Alex.
Firstly, great work on the module. It's really helpful!
I'm having trouble following how I'm supposed to use the config parameter in the playbook. I've tried many different variations of syntax with no success. I want to enable the key-auth plugin with a custom key_names
value โ the following is how I thought it might work:
...
- name: Add key authentication
kong_plugin:
kong_admin_uri: "{{kong_admin_base_url}}"
api_name: "test"
plugin_name: "key-auth"
config:
key_names: "key"
state: present
But when I try to run this I get the following error when checking the plugin was enabled properly:
TASK [Verify key auth was added] ***********************************************
fatal: [localhost]: FAILED! => {"changed": false, "connection": "close", "content": "Cannot GET /\n", "content_length": "13", "content_type": "text/html; charset=utf-8", "date": "Mon, 24 Oct 2016 16:22:24 GMT", "failed": true, "msg": "Status code was not [401]: HTTP Error 404: Not Found", "redirected": false, "status": 404, "url": "http://gateway.app/", "via": "kong/0.9.3", "x_content_type_options": "nosniff", "x_kong_proxy_latency": "0", "x_kong_upstream_latency": "26", "x_powered_by": "Express"}
As it turns out, the plugin wasn't enabled (probably due to the syntax / data type issues with the config
).
Have you got any examples of how I can use this config bit? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.