ACIL FM
Dark
Refresh
Current DIR:
/usr/share/ansible/collections/ansible_collections/community/general/plugins/filter
/
usr
share
ansible
collections
ansible_collections
community
general
plugins
filter
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
counter.py
1.89 MB
chmod
View
DL
Edit
Rename
Delete
crc32.py
1.6 MB
chmod
View
DL
Edit
Rename
Delete
dict.py
1.93 MB
chmod
View
DL
Edit
Rename
Delete
dict_kv.py
2.47 MB
chmod
View
DL
Edit
Rename
Delete
from_csv.py
3.62 MB
chmod
View
DL
Edit
Rename
Delete
groupby_as_dict.py
2.77 MB
chmod
View
DL
Edit
Rename
Delete
hashids.py
2.81 MB
chmod
View
DL
Edit
Rename
Delete
hashids_decode.yml
1.14 MB
chmod
View
DL
Edit
Rename
Delete
hashids_encode.yml
1.14 MB
chmod
View
DL
Edit
Rename
Delete
jc.py
4.74 MB
chmod
View
DL
Edit
Rename
Delete
json_query.py
4.96 MB
chmod
View
DL
Edit
Rename
Delete
lists_mergeby.py
6.2 MB
chmod
View
DL
Edit
Rename
Delete
random_mac.py
2.79 MB
chmod
View
DL
Edit
Rename
Delete
time.py
4.32 MB
chmod
View
DL
Edit
Rename
Delete
to_days.yml
1.53 MB
chmod
View
DL
Edit
Rename
Delete
to_hours.yml
1.54 MB
chmod
View
DL
Edit
Rename
Delete
to_milliseconds.yml
1.58 MB
chmod
View
DL
Edit
Rename
Delete
to_minutes.yml
1.55 MB
chmod
View
DL
Edit
Rename
Delete
to_months.yml
1.54 MB
chmod
View
DL
Edit
Rename
Delete
to_seconds.yml
1.55 MB
chmod
View
DL
Edit
Rename
Delete
to_time_unit.yml
2.28 MB
chmod
View
DL
Edit
Rename
Delete
to_weeks.yml
1.53 MB
chmod
View
DL
Edit
Rename
Delete
to_years.yml
1.53 MB
chmod
View
DL
Edit
Rename
Delete
unicode_normalize.py
2.36 MB
chmod
View
DL
Edit
Rename
Delete
version_sort.py
1.48 MB
chmod
View
DL
Edit
Rename
Delete
Edit file: /usr/share/ansible/collections/ansible_collections/community/general/plugins/filter/jc.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, Filipe Niero Felisbino <filipenf@gmail.com> # 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 # # contributed by Kelly Brazil <kellyjonbrazil@gmail.com> from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' name: jc short_description: Convert output of many shell commands and file-types to JSON version_added: 1.1.0 author: Kelly Brazil (@kellyjonbrazil) description: - Convert output of many shell commands and file-types to JSON. - Uses the L(jc library,https://github.com/kellyjonbrazil/jc). positional: parser options: _input: description: The data to convert. type: string required: true parser: description: - The correct parser for the input data. - For example V(ifconfig). - "Note: use underscores instead of dashes (if any) in the parser module name." - See U(https://github.com/kellyjonbrazil/jc#parsers) for the latest list of parsers. type: string required: true quiet: description: Set to V(false) to not suppress warnings. type: boolean default: true raw: description: Set to V(true) to return pre-processed JSON. type: boolean default: false requirements: - jc installed as a Python library (U(https://pypi.org/project/jc/)) ''' EXAMPLES = ''' - name: Install the prereqs of the jc filter (jc Python package) on the Ansible controller delegate_to: localhost ansible.builtin.pip: name: jc state: present - name: Run command ansible.builtin.command: uname -a register: result - name: Convert command's result to JSON ansible.builtin.debug: msg: "{{ result.stdout | community.general.jc('uname') }}" # Possible output: # # "msg": { # "hardware_platform": "x86_64", # "kernel_name": "Linux", # "kernel_release": "4.15.0-112-generic", # "kernel_version": "#113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020", # "machine": "x86_64", # "node_name": "kbrazil-ubuntu", # "operating_system": "GNU/Linux", # "processor": "x86_64" # } ''' RETURN = ''' _value: description: The processed output. type: any ''' from ansible.errors import AnsibleError, AnsibleFilterError import importlib try: import jc # noqa: F401, pylint: disable=unused-import HAS_LIB = True except ImportError: HAS_LIB = False def jc_filter(data, parser, quiet=True, raw=False): """Convert returned command output to JSON using the JC library Arguments: parser required (string) the correct parser for the input data (e.g. 'ifconfig') see https://github.com/kellyjonbrazil/jc#parsers for latest list of parsers. quiet optional (bool) True to suppress warning messages (default is True) raw optional (bool) True to return pre-processed JSON (default is False) Returns: dictionary or list of dictionaries Example: - name: run date command hosts: ubuntu tasks: - name: install the prereqs of the jc filter (jc Python package) on the Ansible controller delegate_to: localhost ansible.builtin.pip: name: jc state: present - ansible.builtin.shell: date register: result - ansible.builtin.set_fact: myvar: "{{ result.stdout | community.general.jc('date') }}" - ansible.builtin.debug: msg: "{{ myvar }}" produces: ok: [192.168.1.239] => { "msg": { "day": 9, "hour": 22, "minute": 6, "month": "Aug", "month_num": 8, "second": 22, "timezone": "UTC", "weekday": "Sun", "weekday_num": 1, "year": 2020 } } """ if not HAS_LIB: raise AnsibleError('You need to install "jc" as a Python library on the Ansible controller prior to running jc filter') try: # new API (jc v1.18.0 and higher) allows use of plugin parsers if hasattr(jc, 'parse'): return jc.parse(parser, data, quiet=quiet, raw=raw) # old API (jc v1.17.7 and lower) else: jc_parser = importlib.import_module('jc.parsers.' + parser) return jc_parser.parse(data, quiet=quiet, raw=raw) except Exception as e: raise AnsibleFilterError('Error in jc filter plugin: %s' % e) class FilterModule(object): ''' Query filter ''' def filters(self): return { 'jc': jc_filter, }
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply