Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support lookup etcd3 #42759

Open
wants to merge 4 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@caiotedim
Copy link

caiotedim commented Jul 13, 2018

SUMMARY

Add support to only read data on etcd3 kv using lookup.

ISSUE TYPE

  • Feature Pull Request

COMPONENT NAME

lookup etcd3

ANSIBLE VERSION

ansible 2.6.0
  config file = /home/caiotedim/Documents/sre/tedim-bastion/ansible.cfg
  configured module search path = [u'/home/caiotedim/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/ansible/local/lib/python2.7/site-packages/ansible
  executable location = /opt/ansible/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]

ADDITIONAL INFORMATION

Playbook used:

- name: Test
  hosts: localhost
  become: false
  tasks:
   - name: GET data using lookup etcd3
     debug:
       msg: "{{ lookup('etcd3', key='test').foo }}"

Return:

PLAY [Test] ************************************************************************************************************************************************************

TASK [GET data using lookup etcd3] *************************************************************************************************************************************
ok
ok: [localhost] => {
    "msg": "bar"
}
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Jul 13, 2018

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/plugins/lookup/etcd3.py:110:0: missing-final-newline Final newline missing

The test ansible-test sanity --test no-underscore-variable [explain] failed with 1 error:

lib/ansible/plugins/lookup/etcd3.py:87:24: use `dummy` instead of `_` for a variable name

The test ansible-test sanity --test pep8 [explain] failed with 8 errors:

lib/ansible/plugins/lookup/etcd3.py:5:12: W291 trailing whitespace
lib/ansible/plugins/lookup/etcd3.py:12:13: W291 trailing whitespace
lib/ansible/plugins/lookup/etcd3.py:23:1: W293 blank line contains whitespace
lib/ansible/plugins/lookup/etcd3.py:32:1: W293 blank line contains whitespace
lib/ansible/plugins/lookup/etcd3.py:41:1: W293 blank line contains whitespace
lib/ansible/plugins/lookup/etcd3.py:57:1: E302 expected 2 blank lines, found 1
lib/ansible/plugins/lookup/etcd3.py:107:1: E302 expected 2 blank lines, found 1
lib/ansible/plugins/lookup/etcd3.py:110:65: W292 no newline at end of file

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/plugins/lookup/etcd3.py:38:21: error RETURN: syntax error: expected <block end>, but found '<scalar>'

click here for bot help

@s-hertel s-hertel removed the needs_triage label Jul 13, 2018

@ansibot ansibot removed the needs_revision label Jul 13, 2018

@ansibot ansibot added the stale_ci label Jul 21, 2018

@vfauth

This comment has been minimized.

Copy link
Contributor

vfauth commented Aug 23, 2018

Hello, would it be possible to enable more options already supported by etcd3.client(), such asuser, password, ca_cert, client_cert, client_key and maybe timeout?
You can copy the documentation from #44383 where I have done the same for the etcd3 module.

EDIT: I have done it in #44626

lookup: etcd3
short_description: get on etcd3 server
description:
- Retrieves data from etcd3 server

This comment has been minimized.

@vfauth

vfauth Aug 23, 2018

Contributor

Couldn't you specify in the description than it search for a prefix and return a list? It isn't obvious without reading the code :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.