consul_kv usage

206 views
Skip to first unread message

Barry Kaplan

unread,
May 26, 2015, 7:46:44 AM5/26/15
to ansible...@googlegroups.com
Just started to play with the new consul goodness.

Is it planned that the only way to specify a consul-agent is via an environment variable ANSIBLE_CONSUL_URL? 

In any case I cannot seem to get with_consul_kv to work:

$ curl -X GET localhost:8500/v1/kv/foo/bar
[{"CreateIndex":6760,"ModifyIndex":6760,"LockIndex":0,"Key":"foo/bar","Flags":0,"Value":"YmF6"}]%

$ consulkv
get foo/bar
baz

So my key exists on the localhost agent, but

- shell: "echo {{item}}"
  with_consul_kv
:
   
- 'foo/bar'

yields connection refused (where 10.0.136.87 is the same host as above)

ASK: [shell echo {{item}}] ***************************************************
fatal
: [10.0.136.87] => Error locating 'foo/bar' in kv store. Error was ('Connection aborted.', error(61, 'Connection refused'))

Anybody else play with this yet?

Barry Kaplan

unread,
May 26, 2015, 7:54:12 AM5/26/15
to ansible...@googlegroups.com
Now I'm wondering if my install might be screwed up. When I try

    - name: add a kv pair to the kv store
      consul_kv
: key=baz value=bar
     
register: new_key

I get 'ERROR: consul_kv is not a legal parameter in an Ansible task or handler'

I am running 1.9.1, and am looking at the source from the 'stable-1.9' branch.

Barry Kaplan

unread,
May 26, 2015, 8:35:39 AM5/26/15
to ansible...@googlegroups.com
Ok, went to using ansible from source, now consul_kv works -- I can insert kv's. But with_consul_kv always fails in the same way. I even copied tasks from the tests and they too fail. So maybe this is not quite ready..., or maybe I am missing something...
Reply all
Reply to author
Forward
0 new messages