<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 1.9.4"><pre class="notranslate"><code class="notranslate">ansible 1.9.4
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">The current version of etcd (2.x) does not support the deprecated v1 api.  The v1 api is the only one supported by the etcd ansible lookup plugin.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<ol dir="auto">
<li>Deploy a current version of etcd: <code class="notranslate">docker run --net=host --rm quay.io/coreos/etcd:v2.3.6</code></li>
<li>Add key to etcd: <code class="notranslate">etcdctl set foo bar</code></li>
<li>Create a playbook named etcd.yml as shown below</li>
<li>Run playbook: <code class="notranslate">ansible-playbook -i "localhost," etcd.yml</code></li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
- name: Test etcd lookup
  hosts: localhost
  tasks:
    - debug: msg=&quot;etcd foo = {{ lookup('etcd2', 'foo') }}&quot;"><pre class="notranslate"><code class="notranslate">
---
- name: Test etcd lookup
  hosts: localhost
  tasks:
    - debug: msg="etcd foo = {{ lookup('etcd2', 'foo') }}"
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [Test etcd lookup] *******************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [debug msg=&quot;etcd foo = bar&quot;] ********************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;etcd foo = bar&quot;
}

PLAY RECAP ********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">PLAY [Test etcd lookup] *******************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [debug msg="etcd foo = bar"] ********************************************
ok: [localhost] =&gt; {
    "msg": "etcd foo = bar"
}

PLAY RECAP ********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [Test etcd lookup] *******************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [debug msg=&quot;etcd foo = &quot;] ***********************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;etcd foo = &quot;
}

PLAY RECAP ********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">PLAY [Test etcd lookup] *******************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [debug msg="etcd foo = "] ***********************************************
ok: [localhost] =&gt; {
    "msg": "etcd foo = "
}

PLAY RECAP ********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0
</code></pre></div>
<p dir="auto">Hi,</p>
<p dir="auto">I cant get values from etcd using lookup.<br>
It looks like the API version is hardcoded in etcd.py (self.baseurl = '%s/v1/keys').</p>
<p dir="auto">Thanks,</p>
<p dir="auto">Moshe</p>