mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Lookup docs (#30280)
* finalize lookup documentation * minor fixes to ansible-doc - actually show which file caused error on when listing plugins - removed redundant display of type and name * smart quote fixes from toshio
This commit is contained in:
parent
2ef8c5a03d
commit
24d4787b2d
40 changed files with 1715 additions and 853 deletions
|
@ -1,39 +1,43 @@
|
|||
# (c) 2016, Josh Bradley <jbradley(at)digitalocean.com>
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""
|
||||
|
||||
USAGE: {{ lookup('chef_databag', 'name=data_bag_name item=data_bag_item') }}
|
||||
|
||||
NOTES: This is a lookup plugin to provide access to chef data bags using the
|
||||
pychef package. It interfaces with the chef server api using the same
|
||||
methods to find a knife or chef-client config file to load parameters
|
||||
from, starting from either the given base path or the current working
|
||||
directory. The lookup order mirrors the one from Chef, all folders in
|
||||
the base path are walked back looking for the following configuration
|
||||
file in order : .chef/knife.rb, ~/.chef/knife.rb, /etc/chef/client.rb
|
||||
|
||||
Requires: pychef package: https://pychef.readthedocs.io `pip install pychef`
|
||||
|
||||
"""
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = """
|
||||
lookup: chef_databag
|
||||
version_added: "2.3"
|
||||
short_description: fetches data from a Chef Databag
|
||||
description:
|
||||
- "This is a lookup plugin to provide access to chef data bags using the pychef package.
|
||||
It interfaces with the chef server api using the same methods to find a knife or chef-client config file to load parameters from,
|
||||
starting from either the given base path or the current working directory.
|
||||
The lookup order mirrors the one from Chef, all folders in the base path are walked back looking for the following configuration
|
||||
file in order : .chef/knife.rb, ~/.chef/knife.rb, /etc/chef/client.rb"
|
||||
requirements:
|
||||
- "pychef (python library https://pychef.readthedocs.io `pip install pychef`"
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- Name of the databag
|
||||
required: True
|
||||
item:
|
||||
description:
|
||||
- Item to fetch
|
||||
required: True
|
||||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
- debug
|
||||
msg: {{ lookup('chef_databag', 'name=data_bag_name item=data_bag_item') }}
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
_raw:
|
||||
description:
|
||||
- The value from the databag
|
||||
"""
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
from ansible.parsing.splitter import parse_kv
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue