collection 교체

This commit is contained in:
정훈 변
2024-02-23 16:37:40 +09:00
parent b494779b5b
commit 3fd554eee9
38862 changed files with 220204 additions and 6600073 deletions

View File

@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
# (c) 2016, Andrew Zenk <azenk@umn.edu>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Copyright (c) 2016, Andrew Zenk <azenk@umn.edu>
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
@@ -11,21 +12,24 @@ DOCUMENTATION = '''
- Andrew Zenk (!UNKNOWN) <azenk@umn.edu>
requirements:
- lpass (command line utility)
- must have already logged into lastpass
short_description: fetch data from lastpass
- must have already logged into LastPass
short_description: fetch data from LastPass
description:
- use the lpass command line utility to fetch specific fields from lastpass
- Use the lpass command line utility to fetch specific fields from LastPass.
options:
_terms:
description: key from which you want to retrieve the field
required: True
description: Key from which you want to retrieve the field.
required: true
type: list
elements: str
field:
description: field to return from lastpass
description: Field to return from LastPass.
default: 'password'
type: str
'''
EXAMPLES = """
- name: get 'custom_field' from lastpass entry 'entry-name'
- name: get 'custom_field' from LastPass entry 'entry-name'
ansible.builtin.debug:
msg: "{{ lookup('community.general.lastpass', 'entry-name', field='custom_field') }}"
"""
@@ -88,12 +92,14 @@ class LPass(object):
class LookupModule(LookupBase):
def run(self, terms, variables=None, **kwargs):
self.set_options(var_options=variables, direct=kwargs)
field = self.get_option('field')
lp = LPass()
if not lp.logged_in:
raise AnsibleError("Not logged into lastpass: please run 'lpass login' first")
raise AnsibleError("Not logged into LastPass: please run 'lpass login' first")
field = kwargs.get('field', 'password')
values = []
for term in terms:
values.append(lp.get_field(term, field))