Compare commits

...

41 Commits
4.8.0 ... 4.8.2

Author SHA1 Message Date
Felix Fontein
9a66140cd3 Release 4.8.2. 2022-06-06 09:48:48 +02:00
patchback[bot]
a56cef869d remove mcodd as maintainer for newrelic_deployment and flowdock modules (#4781) (#4782)
(cherry picked from commit c6d4a0db80)

Co-authored-by: Matt Coddington <coddington@gmail.com>
2022-06-05 21:37:26 +02:00
patchback[bot]
53d45efc02 nmcli: use capital case "DNS" in documentation, improve examples (#4732) (#4770)
* nmcli: use capital case "DNS" in documentation

In documentation sometimes DNS was written in (incorrect) lower
case "dns" and sometimes in (correct) capital case "DNS". Use the
right capital case spelling in all parameter descriptions.

* nmcli: documentation language

Co-authored-by: Felix Fontein <felix@fontein.de>

* nmcli: documentation language

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 2eadedef6d)

Co-authored-by: bluikko <14869000+bluikko@users.noreply.github.com>
2022-06-04 09:00:49 +02:00
patchback[bot]
c70d79c787 fix trailing whitespace after parameter (#4765) (#4767)
(cherry picked from commit b6e652b440)

Co-authored-by: Markus Bergholz <git@osuv.de>
2022-06-03 19:01:36 +02:00
Felix Fontein
b37a0d4397 Adjust release summary. 2022-06-02 08:22:20 +02:00
patchback[bot]
bf8e788964 Add simplified_bsd.txt license file (#4759) (#4760)
* Add simplified_bsd.txt and adjust references.

* Add changelog.

(cherry picked from commit 0be68bf04b)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-02 08:01:50 +02:00
patchback[bot]
8adc746d90 keycloak_realm: fix default groups and roles (#4241) (#4719) (#4753)
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f95f7)

Co-authored-by: adam-cleo <90759784+adam-cleo@users.noreply.github.com>
2022-05-30 12:55:59 +02:00
patchback[bot]
992e14e424 fix invalid fail_json call (#4733) (#4749)
* fix invalid fail_json call

Currently causes this error:
```
TypeError: AnsibleModule.fail_json() missing 1 required positional argument: 'msg'
gitlab | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.10"
    },
    "changed": false,
    "module_stderr": "Shared connection to 10.0.3.100 closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1653579059.8318024-147674-84188943153768/AnsiballZ_redis.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1653579059.8318024-147674-84188943153768/AnsiballZ_redis.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1653579059.8318024-147674-84188943153768/AnsiballZ_redis.py\", line 47, in invoke_module\r\n    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.redis', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.redis', _modlib_path=modlib_path),\r\n  File \"/usr/lib/python3.10/runpy.py\", line 209, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_community.general.redis_payload_di15cy0s/ansible_community.general.redis_payload.zip/ansible_collections/community/general/plugins/modules/redis.py\", line 328, in <module>\r\n  File \"/tmp/ansible_community.general.redis_payload_di15cy0s/ansible_community.general.redis_payload.zip/ansible_collections/community/general/plugins/modules/redis.py\", line 195, in main\r\n  File \"/tmp/ansible_community.general.redis_payload_di15cy0s/ansible_community.general.redis_payload.zip/ansible_collections/community/general/plugins/module_utils/redis.py\", line 40, in fail_imports\r\nTypeError: AnsibleModule.fail_json() missing 1 required positional argument: 'msg'\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
```

* Add changelog.

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e55875107b)

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
2022-05-30 08:13:47 +02:00
patchback[bot]
3d6cb8fe77 DOC: Documment setting of NTP server in examples. (#4655) (#4747)
Tested on iLO 5 (HP Gen 10).
Command checked from iLO5 REST API reference at https://hewlettpackard.github.io/ilo-rest-api-docs/ilo5/#configuring-network-time-protocol-ntp

(cherry picked from commit 3b48bde84f)

Co-authored-by: Ondrej Faměra <ondrej-xa2iel8u@famera.cz>
2022-05-30 07:05:02 +02:00
patchback[bot]
c694ceaf95 Update CI matrix. (#4737) (#4738)
(cherry picked from commit dcb2e09b4a)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-27 14:21:05 +02:00
patchback[bot]
df91c522a4 redfish modules: documentation language and formatting (#4722) (#4724)
* redfish_command: documentation language and formatting

Update the documentation block with more English language
more consistent with other modules and finish each description
with a full stop.

* redfish_command: do not end short desc in full stop

* redfish_command: remove more "the" on documentation

Remove "The" from beginning of descriptions.

* redfish_command: start documentation description with capital case

* redfish_config: update documentation language and format

Add full stops at end of descriptions, small updates to language,
ensure descriptions start with a capital case letter.

* redfish_config: documentation consistency

Use "username" for description similarly to redfish_command.

* redfish_info: documentation formatting and language

Update documentation block for consistency with other modules
with full stop at end of descriptions and small language updates.

* idrac_redfish_command: documentation formatting and language

Update documentation block for consistency with other modules
with full stop at end of descriptions and small language updates.

* idrac_redfish_command: more doc consistency fixes

Call it iDRAC everywhere and not sometimes OOB controller.

* idrac_redfish_command: documentation formatting and language

Update documentation block for consistency with other modules
with full stop at end of descriptions and small language updates.

* idrac_redfish_info: documentation formatting and language

Update documentation block for consistency with other modules
with full stop at end of descriptions and small language updates.

* ilo_redfish_config: documentation formatting and language

Update documentation block for consistency with other modules
with full stop at end of descriptions and small language updates.

* ilo_redfish_info: documentation formatting and language

Update documentation block for consistency with other modules
with full stop at end of descriptions and small language updates.

* idrac_redfish_info: documentation language

Call it "HTTP request" and not "URL request".

* idrac_redfish_command: documentation language fix

Call it "HTTP request" and not "URL request".

* idrac_redfish_config: documentation language fix

Call it "HTTP request" and not "URL request".

* redfish_command: documentation language fix

Call it "HTTP request" and not "URL request".

* redfish_config: documentation language fix

Call it "HTTP request" and not "URL request".

* redfish_info: documentation language fix

Call it "HTTP request" and not "URL request".

* redfish_command: documentation language fix

Boot device should be two words.

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 88cd35fd45)

Co-authored-by: bluikko <14869000+bluikko@users.noreply.github.com>
2022-05-24 20:20:27 +02:00
patchback[bot]
35c0c10e28 redfish_command: documentation typo and language (#4718) (#4720)
Fix typo "od" to "of" and language

(cherry picked from commit d73789ba3a)

Co-authored-by: bluikko <14869000+bluikko@users.noreply.github.com>
2022-05-24 07:11:51 +02:00
patchback[bot]
c97b4e6201 consul: applied bugfix from issue (#4712) (#4715)
* applied bugfix from issue

* added changelog fragment

(cherry picked from commit 4d2bed1dde)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-05-23 07:36:50 +02:00
patchback[bot]
1cd0afd3df Add RHEL 9.0, FreeBSD 13.1, Ubuntu 22.04 and Fedora 36 to CI, fix bug in filesystem module (#4700) (#4709)
* Add RHEL 9.0 and FreeBSD 13.1 to CI.

* RHEL 9 has no pyOpenSSL apparently.

* Adjust URL for EPEL.

* Fix cargo install on FreeBSD 13.1.

* Add Ubuntu 22.04 and Fedora 36 to CI.

* Fix logic.

* filesystem: do not die output line does not contain ':'

* Skip django_manage tests on RHEL 9 as well.

* homectl tests don't work with RHEL 9.0.

* Improve error handling, improve fatresize output handling.

* Skip Fedora 36.

* Skip filesystem vfat tests on Ubuntu 22.04.

There, resizing fails with a bug:
Bug: Assertion (disk != NULL) at ../../libparted/disk.c:1620 in function ped_disk_get_partition_by_sector() failed.

* 'trusty' is 14.04. Adding 22.04 to skip list.

* Skip jail tests for FreeBSD 13.1.

* Add config for postgres on Ubuntu 22.04.

* Make CentOS 6 happy.

* Adjust postgres version.

* Try installing EPEL a bit differently.

* Skip ufw and iso_extract tests on RHEL 9.

* Skip odbc tests on RHEL 9.

* Skip RHEL 9.0 for snap tests.

* Add changelog fragment for filesystem code changes.

(cherry picked from commit 319c29c2a2)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-22 17:48:09 +02:00
patchback[bot]
6f14461d0b certifi dropped Python 2 support (#4702) (#4704)
* certifi dropped Python 2 support.

* Apparently the consul tests didn't use the constraints.

(cherry picked from commit 8421af1ea3)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-19 15:23:51 +02:00
patchback[bot]
523514713c Ignore import sanity errors until the modules can be fixed. (#4689) (#4697)
(cherry picked from commit db1010a417)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-18 22:46:53 +02:00
patchback[bot]
be0694ac21 Disable the OpenNebula integration tests. (#4692) (#4695)
(cherry picked from commit ae7f2f25cb)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-18 22:41:17 +02:00
patchback[bot]
5dde703246 Update lenovoxcc module for compatibility with the virtualMedia resource location from Manager to System (#4682) (#4684)
* Update lenovoxcc module for compatibility due to redfish spec changes the virtualMedia resource location from Managers to Systems

* Add changelogs fragment for PR 4682

* Update changelogs/fragments/4682-compatibility-virtualmedia-resource-location.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Tami YY3 Pan <panyy3@lenovo.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 8db265f99b)

Co-authored-by: jixj5 <66418293+jixj5@users.noreply.github.com>
2022-05-18 07:35:31 +02:00
Felix Fontein
c23dbb83d0 gitlab_hook: use None for non-existent attr in gitlab API response (#4668) (#4681)
* gitlab_hook: use empty string for non-existent attr in gitlab API response;

* gitlab_hook: use None for non-existent attr in gitlab API response;

* gitlab_hook: use None for non-existent attr in gitlab API response - add changelog fragment;

* gitlab_hook: update changelog fragment for #4668

* Update changelogs/fragments/4668-gitlab_hook-use-None-for-non-existent-attr.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit da2dfd0706)

Co-authored-by: Kirill Petrov <crw.inbox@gmail.com>
2022-05-17 08:35:24 +02:00
Felix Fontein
ae94c11a78 Prepare 4.8.2 release. 2022-05-16 13:16:54 +02:00
Felix Fontein
a29a365beb Remove stable-1 and stable-2 from CI, demote stable-3 to weekly CI runs.
(cherry picked from commit 97c01174a2)
2022-05-16 12:35:35 +02:00
Felix Fontein
ba9ec71dba Release 4.8.1. 2022-05-16 12:33:05 +02:00
Felix Fontein
ee4e1d997b Update with actual CPython 3.9.5 license. (#4676) 2022-05-16 06:18:22 +00:00
Felix Fontein
1327d81dd7 Add PSF-license.txt file. (#4675) 2022-05-16 07:35:47 +02:00
Felix Fontein
6ceaee2c9f Prepare 4.8.1 release. 2022-05-14 13:55:15 +02:00
patchback[bot]
502cc3900e .gitignore exclude of .DS_Store files created by macOS (#4671) (#4672)
* excludes .DS_Store files created by macOS

* properly generate .gitignore w/ toptal.com

* update previously defined jupyternotebook def to a valid one

(cherry picked from commit 7c9ad3082d)

Co-authored-by: Kamil Markowicz <geekifier@users.noreply.github.com>
2022-05-13 20:45:43 +02:00
patchback[bot]
2947acb77c gconftool2: improvements (#4647) (#4666)
* gconftool2: improvements

* added changelog fragment

* typo

* Update changelogs/fragments/4647-gconftool2-command-arg.yaml

Per recommendation from Felix. Danke!

(cherry picked from commit fbff98c5f2)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-05-12 12:48:33 +02:00
Felix Fontein
a4d8929a7e Disable failing test for CentOS 8.
(cherry picked from commit f17d2669fa)
2022-05-09 12:34:48 +02:00
patchback[bot]
e80519dc71 onepassword - Get first found config file (#4640) (#4653)
* Get first found configuration file

There are three valid places to get the configuration.

https://developer.1password.com/docs/cli/about-biometric-unlock#remove-old-account-information

* Use common config class

* Add changelog fragment

* Explicitly use new style classes for Python 2.7 compatibility

This shouldn’t matter for lookups, but does matter for module_utils
and modules since Python 2.7 is still supported on the managed node.

* Update changelogs/fragments/4065-onepassword-config.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 9e1af2d1bc)

Co-authored-by: Sam Doran <github@samdoran.com>
2022-05-09 12:31:05 +02:00
patchback[bot]
53f9958b25 Clarify ansible_pre_command_output (#4636) (#4646)
##### SUMMARY
Clarify what ansible_pre_command_output actually is

##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr

(cherry picked from commit e57fc54a10)

Co-authored-by: Jan-Piet Mens <jp@mens.de>
2022-05-08 13:35:41 +02:00
patchback[bot]
a925e020dc change list.copy() with list[:] for py2 compat in terraform module (#4621) (#4644)
* change list.copy() with list[:] for py2 compat in terraform module

* add changelog fragment

* Update changelogs/fragments/4621-terraform-py2-compat.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 4b0245355e)

Co-authored-by: Andrea Tartaglia <andrea@braingap.uk>
2022-05-08 09:18:29 +00:00
patchback[bot]
9512a389f3 [opentelemetry][callback] fix hardcoded value for ansible_task_message (#4624) (#4632)
* [opentelemetry][callback] fix hardcoded value for ansible_task_message

* opentelemetry: add changelog fragment

(cherry picked from commit 9f702946cd)

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
2022-05-05 13:15:06 +02:00
patchback[bot]
7c987d7498 [opentelemetry][callback] fix warning when using the include_tasks (#4623) (#4628)
* opentelemetry: fix include_tasks missing _task_fields

* opentelemetry: add uts for the include_tasks

* opentelemetry: add changelog fragment

* pep8: fix spaces

(cherry picked from commit 841b46ff6a)

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
2022-05-05 06:56:26 +00:00
patchback[bot]
45d461c0ec consul: fixed bug in ConsulService when storing checks (#4590) (#4630)
* consul: fixed bug in ConsulService when storing checks

* added changelog fragment

* typo

(cherry picked from commit 5a8422c8cb)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-05-05 08:34:22 +02:00
Felix Fontein
d1877e1915 [stable-4] Move in-plugin docs to sidecar for filters not named like the filename that contain them (#4626)
* Move in-plugin docs to sidecar for filters not named like the filename that contain them.

* Update BOTMETA.
2022-05-05 08:31:38 +02:00
patchback[bot]
fa67df12a9 doc: time_filter: fix duplicate (#4611) (#4617)
(cherry picked from commit 8d37591605)

Co-authored-by: René Moser <mail@renemoser.net>
2022-05-03 18:11:25 +02:00
patchback[bot]
65dde57c1a Small fixes. (#4605) (#4607)
(cherry picked from commit 5cb7c2e45e)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-02 08:16:14 +02:00
patchback[bot]
6f4167fb01 Document all filter and test plugins (#4597) (#4603)
* Fix/improve docs.

* Document the a_module test.

* Document the dict filter.

* Linting.

* Add more filter docs.

* More filters.

* Update BOTMETA.

* Add another plugin.

* Fix typos.

* Add explicit entries.

* Fix lookup documentation.

(cherry picked from commit f055f47161)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-02 07:49:06 +02:00
patchback[bot]
8e37b46912 Add docs for ansible-core 2.13 use (#4202) (#4587)
* Add docs for ansible-core 2.13 use

local testing shows fine, adding here as example for other filters/tests

* Update plugins/filter/random_mac.py

* Improve docs.

* Remove wrong 'positional'.

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e62a56e15c)

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
2022-04-28 07:45:12 +02:00
patchback[bot]
1e83d0a5a8 documenting to_seconds filter (#4203) (#4585)
* documenting to_seconds filter

example of documenting filters when multiple exist inside one file

* Update to_seconds.yml

* Apply suggestions from code review

* Extend documentation. Add BOTMETA entry.

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 378b20ac32)

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
2022-04-27 23:13:08 +02:00
Felix Fontein
329b01c7af Next expected release will be 4.8.1. 2022-04-26 12:12:32 +02:00
127 changed files with 1848 additions and 268 deletions

View File

@@ -24,15 +24,13 @@ schedules:
always: true always: true
branches: branches:
include: include:
- stable-3
- stable-4 - stable-4
- cron: 0 11 * * 0 - cron: 0 11 * * 0
displayName: Weekly (old stable branches) displayName: Weekly (old stable branches)
always: true always: true
branches: branches:
include: include:
- stable-1 - stable-3
- stable-2
variables: variables:
- name: checkoutPath - name: checkoutPath
@@ -225,12 +223,12 @@ stages:
test: macos/12.0 test: macos/12.0
- name: RHEL 7.9 - name: RHEL 7.9
test: rhel/7.9 test: rhel/7.9
- name: RHEL 8.5 - name: RHEL 9.0
test: rhel/8.5 test: rhel/9.0
- name: FreeBSD 12.3 - name: FreeBSD 12.3
test: freebsd/12.3 test: freebsd/12.3
- name: FreeBSD 13.0 - name: FreeBSD 13.1
test: freebsd/13.0 test: freebsd/13.1
groups: groups:
- 1 - 1
- 2 - 2
@@ -329,16 +327,16 @@ stages:
targets: targets:
- name: CentOS 7 - name: CentOS 7
test: centos7 test: centos7
- name: Fedora 34
test: fedora34
- name: Fedora 35 - name: Fedora 35
test: fedora35 test: fedora35
- name: Fedora 36
test: fedora36
- name: openSUSE 15 - name: openSUSE 15
test: opensuse15 test: opensuse15
- name: Ubuntu 18.04
test: ubuntu1804
- name: Ubuntu 20.04 - name: Ubuntu 20.04
test: ubuntu2004 test: ubuntu2004
- name: Ubuntu 22.04
test: ubuntu2204
- name: Alpine 3 - name: Alpine 3
test: alpine3 test: alpine3
groups: groups:
@@ -375,8 +373,8 @@ stages:
test: centos6 test: centos6
- name: Fedora 34 - name: Fedora 34
test: fedora34 test: fedora34
- name: Ubuntu 20.04 - name: Ubuntu 18.04
test: ubuntu2004 test: ubuntu1804
groups: groups:
- 1 - 1
- 2 - 2

34
.github/BOTMETA.yml vendored
View File

@@ -126,15 +126,23 @@ files:
maintainers: giner maintainers: giner
$filters/from_csv.py: $filters/from_csv.py:
maintainers: Ajpantuso maintainers: Ajpantuso
$filters/groupby: $filters/groupby.py:
maintainers: felixfontein maintainers: felixfontein
$filters/hashids: $filters/groupby_as_dict.yml:
maintainers: felixfontein
$filters/hashids.py:
maintainers: Ajpantuso
$filters/hashids_decode.yml:
maintainers: Ajpantuso
$filters/hashids_encode.yml:
maintainers: Ajpantuso maintainers: Ajpantuso
$filters/jc.py: $filters/jc.py:
maintainers: kellyjonbrazil maintainers: kellyjonbrazil
$filters/json_query.py: {} $filters/json_query.py: {}
$filters/list.py: $filters/list.py:
maintainers: vbotka maintainers: vbotka
$filters/lists_mergeby.yml:
maintainers: vbotka
$filters/path_join_shim.py: $filters/path_join_shim.py:
maintainers: felixfontein maintainers: felixfontein
$filters/random_mac.py: {} $filters/random_mac.py: {}
@@ -142,6 +150,24 @@ files:
maintainers: resmo maintainers: resmo
$filters/unicode_normalize.py: $filters/unicode_normalize.py:
maintainers: Ajpantuso maintainers: Ajpantuso
$filters/to_days.yml:
maintainers: resmo
$filters/to_hours.yml:
maintainers: resmo
$filters/to_milliseconds.yml:
maintainers: resmo
$filters/to_minutes.yml:
maintainers: resmo
$filters/to_months.yml:
maintainers: resmo
$filters/to_seconds.yml:
maintainers: resmo
$filters/to_time_unit.yml:
maintainers: resmo
$filters/to_weeks.yml:
maintainers: resmo
$filters/to_years.yml:
maintainers: resmo
$filters/version_sort.py: $filters/version_sort.py:
maintainers: ericzolf maintainers: ericzolf
$inventories/: $inventories/:
@@ -595,7 +621,7 @@ files:
$modules/monitoring/nagios.py: $modules/monitoring/nagios.py:
maintainers: tbielawa tgoetheyn maintainers: tbielawa tgoetheyn
$modules/monitoring/newrelic_deployment.py: $modules/monitoring/newrelic_deployment.py:
maintainers: mcodd ignore: mcodd
$modules/monitoring/pagerduty.py: $modules/monitoring/pagerduty.py:
maintainers: suprememoocow thaumos maintainers: suprememoocow thaumos
labels: pagerduty labels: pagerduty
@@ -687,7 +713,7 @@ files:
$modules/notification/discord.py: $modules/notification/discord.py:
maintainers: cwollinger maintainers: cwollinger
$modules/notification/flowdock.py: $modules/notification/flowdock.py:
maintainers: mcodd ignore: mcodd
$modules/notification/grove.py: $modules/notification/grove.py:
maintainers: zimbatm maintainers: zimbatm
$modules/notification/hipchat.py: $modules/notification/hipchat.py:

104
.gitignore vendored
View File

@@ -1,6 +1,6 @@
# Created by https://www.toptal.com/developers/gitignore/api/git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs,dotenv # Created by https://www.toptal.com/developers/gitignore/api/vim,git,macos,linux,pydev,emacs,dotenv,python,windows,webstorm,pycharm+all,jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs,dotenv # Edit at https://www.toptal.com/developers/gitignore?templates=vim,git,macos,linux,pydev,emacs,dotenv,python,windows,webstorm,pycharm+all,jupyternotebooks
### dotenv ### ### dotenv ###
.env .env
@@ -71,7 +71,19 @@ flycheck_*.el
*_LOCAL_*.txt *_LOCAL_*.txt
*_REMOTE_*.txt *_REMOTE_*.txt
#!! ERROR: jupyternotebook is undefined. Use list command to see defined gitignore types !!# ### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/
.ipynb_checkpoints
*/.ipynb_checkpoints/*
# IPython
profile_default/
ipython_config.py
# Remove previous ipynb_checkpoints
# git rm -r .ipynb_checkpoints/
### Linux ### ### Linux ###
@@ -87,6 +99,39 @@ flycheck_*.el
# .nfs files are created when an open file is removed but is still being accessed # .nfs files are created when an open file is removed but is still being accessed
.nfs* .nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### PyCharm+all ### ### PyCharm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
@@ -151,6 +196,9 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin # Cursive Clojure plugin
.idea/replstate.xml .idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ) # Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml com_crashlytics_export_strings.xml
crashlytics.properties crashlytics.properties
@@ -164,20 +212,13 @@ fabric.properties
.idea/caches/build_file_checksums.ser .idea/caches/build_file_checksums.ser
### PyCharm+all Patch ### ### PyCharm+all Patch ###
# Ignores the whole .idea folder and all .iml files # Ignore everything but code style settings and run configurations
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 # that are supposed to be shared within teams.
.idea/ .idea/*
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 !.idea/codeStyles
!.idea/runConfigurations
*.iml
modules.xml
.idea/misc.xml
*.ipr
# Sonarlint plugin
.idea/sonarlint
### pydev ### ### pydev ###
.pydevproject .pydevproject
@@ -260,16 +301,13 @@ docs/_build/
target/ target/
# Jupyter Notebook # Jupyter Notebook
.ipynb_checkpoints
# IPython # IPython
profile_default/
ipython_config.py
# pyenv # pyenv
# For a library or package, you might want to ignore these files since the code is # For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in: # intended to run in multiple environments; otherwise, check them in:
.python-version # .python-version
# pipenv # pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
@@ -278,7 +316,22 @@ ipython_config.py
# install all needed dependencies. # install all needed dependencies.
#Pipfile.lock #Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow # poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/ __pypackages__/
# Celery stuff # Celery stuff
@@ -320,6 +373,13 @@ dmypy.json
# Cython debug symbols # Cython debug symbols
cython_debug/ cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
### Vim ### ### Vim ###
# Swap # Swap
[._]*.s[a-v][a-z] [._]*.s[a-v][a-z]
@@ -381,6 +441,8 @@ tags
# Cursive Clojure plugin # Cursive Clojure plugin
# SonarLint plugin
# Crashlytics plugin (for Android Studio and IntelliJ) # Crashlytics plugin (for Android Studio and IntelliJ)
# Editor-based Rest Client # Editor-based Rest Client
@@ -443,4 +505,4 @@ $RECYCLE.BIN/
# Windows shortcuts # Windows shortcuts
*.lnk *.lnk
# End of https://www.toptal.com/developers/gitignore/api/git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs,dotenv # End of https://www.toptal.com/developers/gitignore/api/vim,git,macos,linux,pydev,emacs,dotenv,python,windows,webstorm,pycharm+all,jupyternotebooks

View File

@@ -6,6 +6,45 @@ Community General Release Notes
This changelog describes changes after version 3.0.0. This changelog describes changes after version 3.0.0.
v4.8.2
======
Release Summary
---------------
Regular maintenance and bugfix release.
Bugfixes
--------
- Include ``simplified_bsd.txt`` license file for various module utils, the ``lxca_common`` docs fragment, and the ``utm_utils`` unit tests.
- consul - fixed bug introduced in PR 4590 (https://github.com/ansible-collections/community.general/issues/4680).
- filesystem - handle ``fatresize --info`` output lines without ``:`` (https://github.com/ansible-collections/community.general/pull/4700).
- filesystem - improve error messages when output cannot be parsed by including newlines in escaped form (https://github.com/ansible-collections/community.general/pull/4700).
- gitlab_hook - avoid errors during idempotency check when an attribute does not exist (https://github.com/ansible-collections/community.general/pull/4668).
- keycloak_realm - fix default groups and roles (https://github.com/ansible-collections/community.general/issues/4241).
- redis* modules - fix call to ``module.fail_json`` when failing because of missing Python libraries (https://github.com/ansible-collections/community.general/pull/4733).
- xcc_redfish_command - for compatibility due to Redfish spec changes the virtualMedia resource location changed from Manager to System (https://github.com/ansible-collections/community.general/pull/4682).
v4.8.1
======
Release Summary
---------------
Regular bugfix release. From now on, only bugfix release will be made of the community.general 4.x.y release stream.
Bugfixes
--------
- Include ``PSF-license.txt`` file for ``plugins/module_utils/_version.py``.
- consul - fixed bug where class ``ConsulService`` was overwriting the field ``checks``, preventing the addition of checks to a service (https://github.com/ansible-collections/community.general/pull/4590).
- gconftool2 - properly escape values when passing them to ``gconftool-2`` (https://github.com/ansible-collections/community.general/pull/4647).
- onepassword - search all valid configuration locations and use the first found (https://github.com/ansible-collections/community.general/pull/4640).
- opentelemetry callback plugin - fix task message attribute that is reported failed regardless of the task result (https://github.com/ansible-collections/community.general/pull/4624).
- opentelemetry callback plugin - fix warning for the include_tasks (https://github.com/ansible-collections/community.general/pull/4623).
- terraform - fix list initialization to support both Python 2 and Python 3 (https://github.com/ansible-collections/community.general/issues/4531).
v4.8.0 v4.8.0
====== ======

48
PSF-license.txt Normal file
View File

@@ -0,0 +1,48 @@
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.
4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.

View File

@@ -1782,3 +1782,56 @@ releases:
name: lxd_project name: lxd_project
namespace: cloud.lxd namespace: cloud.lxd
release_date: '2022-04-26' release_date: '2022-04-26'
4.8.1:
changes:
bugfixes:
- Include ``PSF-license.txt`` file for ``plugins/module_utils/_version.py``.
- consul - fixed bug where class ``ConsulService`` was overwriting the field
``checks``, preventing the addition of checks to a service (https://github.com/ansible-collections/community.general/pull/4590).
- gconftool2 - properly escape values when passing them to ``gconftool-2`` (https://github.com/ansible-collections/community.general/pull/4647).
- onepassword - search all valid configuration locations and use the first found
(https://github.com/ansible-collections/community.general/pull/4640).
- opentelemetry callback plugin - fix task message attribute that is reported
failed regardless of the task result (https://github.com/ansible-collections/community.general/pull/4624).
- opentelemetry callback plugin - fix warning for the include_tasks (https://github.com/ansible-collections/community.general/pull/4623).
- terraform - fix list initialization to support both Python 2 and Python 3
(https://github.com/ansible-collections/community.general/issues/4531).
release_summary: Regular bugfix release. From now on, only bugfix release will
be made of the community.general 4.x.y release stream.
fragments:
- 4.8.1.yml
- 4065-onepassword-config.yml
- 4590-consul-fix-service-checks.yaml
- 4621-terraform-py2-compat.yml
- 4623-opentelemetry_bug_fix_include_tasks.yml
- 4624-opentelemetry_bug_fix_hardcoded_value.yml
- 4647-gconftool2-command-arg.yaml
- psf-license.yml
release_date: '2022-05-16'
4.8.2:
changes:
bugfixes:
- Include ``simplified_bsd.txt`` license file for various module utils, the
``lxca_common`` docs fragment, and the ``utm_utils`` unit tests.
- consul - fixed bug introduced in PR 4590 (https://github.com/ansible-collections/community.general/issues/4680).
- filesystem - handle ``fatresize --info`` output lines without ``:`` (https://github.com/ansible-collections/community.general/pull/4700).
- filesystem - improve error messages when output cannot be parsed by including
newlines in escaped form (https://github.com/ansible-collections/community.general/pull/4700).
- gitlab_hook - avoid errors during idempotency check when an attribute does
not exist (https://github.com/ansible-collections/community.general/pull/4668).
- keycloak_realm - fix default groups and roles (https://github.com/ansible-collections/community.general/issues/4241).
- redis* modules - fix call to ``module.fail_json`` when failing because of
missing Python libraries (https://github.com/ansible-collections/community.general/pull/4733).
- xcc_redfish_command - for compatibility due to Redfish spec changes the virtualMedia
resource location changed from Manager to System (https://github.com/ansible-collections/community.general/pull/4682).
release_summary: Regular maintenance and bugfix release.
fragments:
- 4.8.2.yml
- 4668-gitlab_hook-use-None-for-non-existent-attr.yml
- 4682-compatibility-virtualmedia-resource-location.yaml
- 4700-code-changes.yml
- 4712-consul-bugfix.yaml
- 4719-fix-keycloak-realm.yaml
- 4733-redis-fail.yml
- simplified-bsd-license.yml
release_date: '2022-06-06'

View File

@@ -1,6 +1,6 @@
namespace: community namespace: community
name: general name: general
version: 4.8.0 version: 4.8.2
readme: README.md readme: README.md
authors: authors:
- Ansible (https://github.com/ansible) - Ansible (https://github.com/ansible)

View File

@@ -45,7 +45,7 @@ DOCUMENTATION = r'''
version_added: 1.0.0 version_added: 1.0.0
default: ansible default: ansible
pre_command: pre_command:
description: Executes command before run and result put to ansible_pre_command_output field. description: Executes command before run and its result is added to the C(ansible_pre_command_output) logstash field.
version_added: 2.0.0 version_added: 2.0.0
ini: ini:
- section: callback_logstash - section: callback_logstash

View File

@@ -197,7 +197,7 @@ class OpenTelemetrySource(object):
task = tasks_data[task_uuid] task = tasks_data[task_uuid]
if self.ansible_version is None and result._task_fields['args'].get('_ansible_version'): if self.ansible_version is None and hasattr(result, '_task_fields') and result._task_fields['args'].get('_ansible_version'):
self.ansible_version = result._task_fields['args'].get('_ansible_version') self.ansible_version = result._task_fields['args'].get('_ansible_version')
task.add_host(HostData(host_uuid, host_name, status, result)) task.add_host(HostData(host_uuid, host_name, status, result))
@@ -258,8 +258,9 @@ class OpenTelemetrySource(object):
else: else:
res = host_data.result._result res = host_data.result._result
rc = res.get('rc', 0) rc = res.get('rc', 0)
message = self.get_error_message(res) if host_data.status == 'failed':
enriched_error_message = self.enrich_error_message(res) message = self.get_error_message(res)
enriched_error_message = self.enrich_error_message(res)
if host_data.status == 'failed': if host_data.status == 'failed':
status = Status(status_code=StatusCode.ERROR, description=message) status = Status(status_code=StatusCode.ERROR, description=message)

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2017 Lenovo, Inc. # Copyright (C) 2017 Lenovo, Inc.
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -5,6 +5,35 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: counter
short_description: Counts hashable elements in a sequence
version_added: 4.3.0
author: Rémy Keil (@keilr)
description:
- Counts hashable elements in a sequence.
options:
_input:
description: A sequence.
type: list
elements: any
required: true
'''
EXAMPLES = '''
- name: Count occurences
ansible.builtin.debug:
msg: >-
{{ [1, 'a', 2, 2, 'a', 'b', 'a'] | community.general.counter }}
# Produces: {1: 1, 'a': 3, 2: 2, 'b': 1}
'''
RETURN = '''
_value:
description: A dictionary with the elements of the sequence as keys, and their number of occurance in the sequence as values.
type: dictionary
'''
from ansible.errors import AnsibleFilterError from ansible.errors import AnsibleFilterError
from ansible.module_utils.common._collections_compat import Sequence from ansible.module_utils.common._collections_compat import Sequence
from collections import Counter from collections import Counter

View File

@@ -6,6 +6,60 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: dict
short_description: Convert a list of tuples into a dictionary
version_added: 3.0.0
author: Felix Fontein (@felixfontein)
description:
- Convert a list of tuples into a dictionary. This is a filter version of the C(dict) function.
options:
_input:
description: A list of tuples (with exactly two elements).
type: list
elements: tuple
required: true
'''
EXAMPLES = '''
- name: Convert list of tuples into dictionary
ansible.builtin.set_fact:
dictionary: "{{ [[1, 2], ['a', 'b']] | community.general.dict }}"
# Result is {1: 2, 'a': 'b'}
- name: Create a list of dictionaries with map and the community.general.dict filter
ansible.builtin.debug:
msg: >-
{{ values | map('zip', ['k1', 'k2', 'k3'])
| map('map', 'reverse')
| map('community.general.dict') }}
vars:
values:
- - foo
- 23
- a
- - bar
- 42
- b
# Produces the following list of dictionaries:
# {
# "k1": "foo",
# "k2": 23,
# "k3": "a"
# },
# {
# "k1": "bar",
# "k2": 42,
# "k3": "b"
# }
'''
RETURN = '''
_value:
description: The dictionary having the provided key-value pairs.
type: boolean
'''
def dict_filter(sequence): def dict_filter(sequence):
'''Convert a list of tuples to a dictionary. '''Convert a list of tuples to a dictionary.

View File

@@ -5,6 +5,38 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: dict_kv
short_description: Convert a value to a dictionary with a single key-value pair
version_added: 1.3.0
author: Stanislav German-Evtushenko (@giner)
description:
- Convert a value to a dictionary with a single key-value pair.
positional: key
options:
_input:
description: The value for the single key-value pair.
type: any
required: true
key:
description: The key for the single key-value pair.
type: any
required: true
'''
EXAMPLES = '''
- name: Create a one-element dictionary from a value
ansible.builtin.debug:
msg: "{{ 'myvalue' | dict_kv('mykey') }}"
# Produces the dictionary {'mykey': 'myvalue'}
'''
RETURN = '''
_value:
description: A dictionary with a single key-value pair.
type: dictionary
'''
def dict_kv(value, key): def dict_kv(value, key):
'''Return a dictionary with a single key-value pair '''Return a dictionary with a single key-value pair

View File

@@ -7,6 +7,78 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: from_csv
short_description: Converts CSV text input into list of dicts
version_added: 2.3.0
author: Andrew Pantuso (@Ajpantuso)
description:
- Converts CSV text input into list of dictionaries.
options:
_input:
description: A string containing a CSV document.
type: string
required: true
dialect:
description:
- The CSV dialect to use when parsing the CSV file.
- Possible values include C(excel), C(excel-tab) or C(unix).
type: str
default: excel
fieldnames:
description:
- A list of field names for every column.
- This is needed if the CSV does not have a header.
type: list
elements: str
delimiter:
description:
- A one-character string used to separate fields.
- When using this parameter, you change the default value used by I(dialect).
- The default value depends on the dialect used.
type: str
skipinitialspace:
description:
- Whether to ignore any whitespaces immediately following the delimiter.
- When using this parameter, you change the default value used by I(dialect).
- The default value depends on the dialect used.
type: bool
strict:
description:
- Whether to raise an exception on bad CSV input.
- When using this parameter, you change the default value used by I(dialect).
- The default value depends on the dialect used.
type: bool
'''
EXAMPLES = '''
- name: Parse a CSV file's contents
ansible.builtin.debug:
msg: >-
{{ csv_data | community.genera.from_csv(dialect='unix') }}
vars:
csv_data: |
Column 1,Value
foo,23
bar,42
# Produces the following list of dictionaries:
# {
# "Column 1": "foo",
# "Value": "23",
# },
# {
# "Column 1": "bar",
# "Value": "42",
# }
'''
RETURN = '''
_value:
description: A list with one dictionary per row.
type: list
elements: dictionary
'''
from ansible.errors import AnsibleFilterError from ansible.errors import AnsibleFilterError
from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.text.converters import to_native

View File

@@ -0,0 +1,42 @@
DOCUMENTATION:
name: groupby_as_dict
short_description: Transform a sequence of dictionaries to a dictionary where the dictionaries are indexed by an attribute
version_added: 3.1.0
author: Felix Fontein (@felixfontein)
description:
- Transform a sequence of dictionaries to a dictionary where the dictionaries are indexed by an attribute.
positional: attribute
options:
_input:
description: A list of dictionaries
type: list
elements: dictionary
required: true
attribute:
description: The attribute to use as the key.
type: str
required: true
EXAMPLES: |
- name: Arrange a list of dictionaries as a dictionary of dictionaries
ansible.builtin.debug:
msg: "{{ sequence | community.general.groupby_as_dict('key') }}"
vars:
sequence:
- key: value
foo: bar
- key: other_value
baz: bar
# Produces the following nested structure:
#
# value:
# key: value
# foo: bar
# other_value:
# key: other_value
# baz: bar
RETURN:
_value:
description: A dictionary containing the dictionaries from the list as values.
type: dictionary

View File

@@ -0,0 +1,38 @@
DOCUMENTATION:
name: hashids_decode
short_description: Decodes a sequence of numbers from a YouTube-like hash
version_added: 3.0.0
author: Andrew Pantuso (@Ajpantuso)
description:
- Decodes a sequence of numbers from a YouTube-like hash.
options:
_input:
description: A YouTube-like hash.
type: string
required: true
salt:
description:
- String to use as salt when hashing.
type: str
default: excel
alphabet:
description:
- String of 16 or more unique characters to produce a hash.
type: list
elements: str
min_length:
description:
- Minimum length of hash produced.
type: integer
EXAMPLES: |
- name: Convert hash to list of integers
ansible.builtin.debug:
msg: "{{ 'o2fXhV' | community.general.hashids_decode }}"
# Produces: [1, 2, 3]
RETURN:
_value:
description: A list of integers.
type: list
elements: integer

View File

@@ -0,0 +1,38 @@
DOCUMENTATION:
name: hashids_encode
short_description: Encodes YouTube-like hashes from a sequence of integers
version_added: 3.0.0
author: Andrew Pantuso (@Ajpantuso)
description:
- Encodes YouTube-like hashes from a sequence of integers.
options:
_input:
description: A list of integers.
type: list
elements: integer
required: true
salt:
description:
- String to use as salt when hashing.
type: str
default: excel
alphabet:
description:
- String of 16 or more unique characters to produce a hash.
type: list
elements: str
min_length:
description:
- Minimum length of hash produced.
type: integer
EXAMPLES: |
- name: Convert list of integers to hash
ansible.builtin.debug:
msg: "{{ [1, 2, 3] | community.general.hashids_encode }}"
# Produces: 'o2fXhV'
RETURN:
_value:
description: A YouTube-like hash.
type: string

View File

@@ -21,6 +21,67 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __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 exmaple C(ifconfig).
- See U(https://github.com/kellyjonbrazil/jc#parsers) for the latest list of parsers.
type: string
required: true
quiet:
description: Set to C(false) to not suppress warnings.
type: boolean
default: true
raw:
description: Set to C(true) to return pre-processed JSON.
type: boolean
default: false
requirements:
- jc (https://github.com/kellyjonbrazil/jc)
'''
EXAMPLES = '''
- 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 from ansible.errors import AnsibleError, AnsibleFilterError
import importlib import importlib

View File

@@ -19,6 +19,107 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: json_query
short_description: Select a single element or a data subset from a complex data structure
description:
- This filter lets you query a complex JSON structure and iterate over it using a loop structure.
positional: expr
options:
_input:
description:
- The JSON data to query.
type: any
required: true
expr:
description:
- The query expression.
- See U(http://jmespath.org/examples.html) for examples.
type: string
required: true
requirements:
- jmespath
'''
EXAMPLES = '''
- name: Define data to work on in the examples below
ansible.builtin.set_fact:
domain_definition:
domain:
cluster:
- name: cluster1
- name: cluster2
server:
- name: server11
cluster: cluster1
port: '8080'
- name: server12
cluster: cluster1
port: '8090'
- name: server21
cluster: cluster2
port: '9080'
- name: server22
cluster: cluster2
port: '9090'
library:
- name: lib1
target: cluster1
- name: lib2
target: cluster2
- name: Display all cluster names
ansible.builtin.debug:
var: item
loop: "{{ domain_definition | community.general.json_query('domain.cluster[*].name') }}"
- name: Display all server names
ansible.builtin.debug:
var: item
loop: "{{ domain_definition | community.general.json_query('domain.server[*].name') }}"
- name: Display all ports from cluster1
ansible.builtin.debug:
var: item
loop: "{{ domain_definition | community.general.json_query(server_name_cluster1_query) }}"
vars:
server_name_cluster1_query: "domain.server[?cluster=='cluster1'].port"
- name: Display all ports from cluster1 as a string
ansible.builtin.debug:
msg: "{{ domain_definition | community.general.json_query('domain.server[?cluster==`cluster1`].port') | join(', ') }}"
- name: Display all ports from cluster1
ansible.builtin.debug:
var: item
loop: "{{ domain_definition | community.general.json_query('domain.server[?cluster==''cluster1''].port') }}"
- name: Display all server ports and names from cluster1
ansible.builtin.debug:
var: item
loop: "{{ domain_definition | community.general.json_query(server_name_cluster1_query) }}"
vars:
server_name_cluster1_query: "domain.server[?cluster=='cluster2'].{name: name, port: port}"
- name: Display all ports from cluster1
ansible.builtin.debug:
msg: "{{ domain_definition | to_json | from_json | community.general.json_query(server_name_query) }}"
vars:
server_name_query: "domain.server[?starts_with(name,'server1')].port"
- name: Display all ports from cluster1
ansible.builtin.debug:
msg: "{{ domain_definition | to_json | from_json | community.general.json_query(server_name_query) }}"
vars:
server_name_query: "domain.server[?contains(name,'server1')].port"
'''
RETURN = '''
_value:
description: The result of the query.
type: any
'''
from ansible.errors import AnsibleError, AnsibleFilterError from ansible.errors import AnsibleError, AnsibleFilterError
try: try:

View File

@@ -0,0 +1,88 @@
DOCUMENTATION:
name: lists_mergeby
short_description: Merge two or more lists of dictionaries by a given attribute
version_added: 2.0.0
author: Vladimir Botka (@vbotka)
description:
- Merge two or more lists by attribute I(index). Optional parameters 'recursive' and 'list_merge'
control the merging of the lists in values. The function merge_hash from ansible.utils.vars
is used. To learn details on how to use the parameters 'recursive' and 'list_merge' see
Ansible User's Guide chapter "Using filters to manipulate data" section "Combining
hashes/dictionaries".
positional: another_list, index
options:
_input:
description: A list of dictionaries.
type: list
elements: dictionary
required: true
another_list:
description: Another list of dictionaries. This parameter can be specified multiple times.
type: list
elements: dictionary
index:
description:
- The dictionary key that must be present in every dictionary in every list that is used to
merge the lists.
type: string
required: true
recursive:
description:
- Should the combine recursively merge nested dictionaries (hashes).
- "B(Note:) It does not depend on the value of the C(hash_behaviour) setting in C(ansible.cfg)."
type: boolean
default: false
list_merge:
description:
- Modifies the behaviour when the dictionaries (hashes) to merge contain arrays/lists.
type: string
default: replace
choices:
- replace
- keep
- append
- prepend
- append_rp
- prepend_rp
EXAMPLES: |
- name: Merge two lists
ansible.builtin.debug:
msg: >-
{{ list1 | community.general.lists_mergeby(
list2,
'index',
recursive=True,
list_merge='append'
) }}"
vars:
list1:
- index: a
value: 123
- index: b
value: 42
list2:
- index: a
foo: bar
- index: c
foo: baz
# Produces the following list of dictionaries:
# {
# "index": "a",
# "foo": "bar",
# "value": 123
# },
# {
# "index": "b",
# "value": 42
# },
# {
# "index": "c",
# "foo": "baz"
# }
RETURN:
_value:
description: The merged list.
type: list
elements: dictionary

View File

@@ -20,6 +20,41 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: random_mac
short_description: Generate a random MAC address
description:
- Generates random networking interfaces MAC addresses for a given prefix.
options:
_input:
description: A string prefix to use as a basis for the random MAC generated.
type: string
required: true
seed:
description:
- A randomization seed to initialize the process, used to get repeatable results.
- If no seed is provided, a system random source such as C(/dev/urandom) is used.
required: false
type: string
'''
EXAMPLES = '''
- name: Random MAC given a prefix
ansible.builtin.debug:
msg: "{{ '52:54:00' | community.general.random_mac }}"
# => '52:54:00:ef:1c:03'
- name: With a seed
ansible.builtin.debug:
msg: "{{ '52:54:00' | community.general.random_mac(seed=inventory_hostname) }}"
'''
RETURN = '''
_value:
description: The generated MAC.
type: string
'''
import re import re
from random import Random, SystemRandom from random import Random, SystemRandom

View File

@@ -0,0 +1,40 @@
DOCUMENTATION:
name: to_days
short_description: Converte a duration string to days
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to days.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into days
ansible.builtin.debug:
msg: "{{ '1y 7m 5d 30h' | community.general.to_days }}"
RETURN:
_value:
description: Number of days.
type: float

View File

@@ -0,0 +1,40 @@
DOCUMENTATION:
name: to_hours
short_description: Converte a duration string to hours
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to hours.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into hours
ansible.builtin.debug:
msg: "{{ '7d 30h 20m 10s 123ms' | community.general.to_hours }}"
RETURN:
_value:
description: Number of hours.
type: float

View File

@@ -0,0 +1,40 @@
DOCUMENTATION:
name: to_milliseconds
short_description: Converte a duration string to milliseconds
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to milliseconds.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into milliseconds
ansible.builtin.debug:
msg: "{{ '30h 20m 10s 123ms' | community.general.to_milliseconds }}"
RETURN:
_value:
description: Number of milliseconds.
type: float

View File

@@ -0,0 +1,40 @@
DOCUMENTATION:
name: to_minutes
short_description: Converte a duration string to minutes
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to minutes.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into minutes
ansible.builtin.debug:
msg: "{{ '30h 20m 10s 123ms' | community.general.to_minutes }}"
RETURN:
_value:
description: Number of minutes.
type: float

View File

@@ -0,0 +1,40 @@
DOCUMENTATION:
name: to_months
short_description: Converte a duration string to months
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to months.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into months
ansible.builtin.debug:
msg: "{{ '1y 7m 5d 30h' | community.general.to_months }}"
RETURN:
_value:
description: Number of months.
type: float

View File

@@ -0,0 +1,40 @@
DOCUMENTATION:
name: to_seconds
short_description: Converte a duration string to seconds
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to seconds.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into seconds
ansible.builtin.debug:
msg: "{{ '30h 20m 10s 123ms' | community.general.to_seconds }}"
RETURN:
_value:
description: Number of seconds.
type: float

View File

@@ -0,0 +1,84 @@
DOCUMENTATION:
name: to_time_unit
short_description: Converte a duration string to the given time unit
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to the given time unit.
positional: unit
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
unit:
description:
- Time unit to convert the duration to.
default: ms
choices:
- millisecond
- milliseconds
- ms
- msec
- msecs
- msecond
- mseconds
- s
- sec
- secs
- second
- seconds
- h
- hour
- hours
- hs
- m
- min
- mins
- minute
- minutes
- d
- ds
- day
- days
- w
- ws
- week
- weeks
- mo
- mos
- month
- months
- y
- ys
- year
- years
type: string
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into seconds
ansible.builtin.debug:
msg: "{{ '1053d 17h 53m -10s 391ms' | community.general.to_time_unit('s') }}"
RETURN:
_value:
description: Number of time units.
type: float

View File

@@ -0,0 +1,40 @@
DOCUMENTATION:
name: to_weeks
short_description: Converte a duration string to weeks
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to weeks.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into weeks
ansible.builtin.debug:
msg: "{{ '1y 7m 5d 30h' | community.general.to_weeks }}"
RETURN:
_value:
description: Number of weeks.
type: float

View File

@@ -0,0 +1,40 @@
DOCUMENTATION:
name: to_years
short_description: Converte a duration string to years
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to years.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into years
ansible.builtin.debug:
msg: "{{ '1053d 30h' | community.general.to_years }}"
RETURN:
_value:
description: Number of years.
type: float

View File

@@ -6,6 +6,46 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: unicode_normalize
short_description: Normalizes unicode strings to facilitate comparison of characters with normalized forms
version_added: 3.7.0
author: Andrew Pantuso (@Ajpantuso)
description:
- Normalizes unicode strings to facilitate comparison of characters with normalized forms.
positional: form
options:
_input:
description: A unicode string.
type: string
required: true
form:
description:
- The normal form to use.
- See U(https://docs.python.org/3/library/unicodedata.html#unicodedata.normalize) for details.
type: string
default: NFC
choices:
- NFC
- NFD
- NFKC
- NFKD
'''
EXAMPLES = '''
- name: Normalize unicode string
ansible.builtin.set_fact:
dictionary: "{{ 'ä' | community.general.unicode_normalize('NFKD') }}"
# The resulting string has length 2: one letter is 'a', the other
# the diacritic combiner.
'''
RETURN = '''
_value:
description: The normalized unicode string of the specified normal form.
type: string
'''
from unicodedata import normalize from unicodedata import normalize
from ansible.errors import AnsibleFilterError, AnsibleFilterTypeError from ansible.errors import AnsibleFilterError, AnsibleFilterTypeError

View File

@@ -5,6 +5,35 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: version_sort
short_description: Sort a list according to version order instead of pure alphabetical one
version_added: 2.2.0
author: Eric L. (@ericzolf)
description:
- Sort a list according to version order instead of pure alphabetical one.
options:
_input:
description: A list of strings to sort.
type: list
elements: string
required: true
'''
EXAMPLES = '''
- name: Convert list of tuples into dictionary
ansible.builtin.set_fact:
dictionary: "{{ ['2.1', '2.10', '2.9'] | community.general.version_sort }}"
# Result is ['2.1', '2.9', '2.10']
'''
RETURN = '''
_value:
description: The list of strings sorted by version.
type: list
elements: string
'''
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion from ansible_collections.community.general.plugins.module_utils.version import LooseVersion

View File

@@ -57,14 +57,19 @@ EXAMPLES = """
""" """
RETURN = """ RETURN = """
password: _result:
description: description: A list containing one dictionary.
- The actual value stored type: list
passprops: elements: dictionary
description: properties assigned to the entry contains:
type: dictionary password:
passwordchangeinprocess: description:
description: did the password change? - The actual value stored
passprops:
description: properties assigned to the entry
type: dictionary
passwordchangeinprocess:
description: did the password change?
""" """
import os import os

View File

@@ -18,7 +18,7 @@ DOCUMENTATION = '''
''' '''
EXAMPLES = """ EXAMPLES = """
- name : output secrets to screen (BAD IDEA) - name: output secrets to screen (BAD IDEA)
ansible.builtin.debug: ansible.builtin.debug:
msg: "Password: {{item}}" msg: "Password: {{item}}"
with_community.general.keyring: with_community.general.keyring:

View File

@@ -45,8 +45,8 @@ DOCUMENTATION = '''
description: Vault containing the item to retrieve (case-insensitive). If absent will search all vaults. description: Vault containing the item to retrieve (case-insensitive). If absent will search all vaults.
notes: notes:
- This lookup will use an existing 1Password session if one exists. If not, and you have already - This lookup will use an existing 1Password session if one exists. If not, and you have already
performed an initial sign in (meaning C(~/.op/config exists)), then only the C(master_password) is required. performed an initial sign in (meaning C(~/.op/config), C(~/.config/op/config) or C(~/.config/.op/config) exists), then only the
You may optionally specify C(subdomain) in this scenario, otherwise the last used subdomain will be used by C(op). C(master_password) is required. You may optionally specify C(subdomain) in this scenario, otherwise the last used subdomain will be used by C(op).
- This lookup can perform an initial login by providing C(subdomain), C(username), C(secret_key), and C(master_password). - This lookup can perform an initial login by providing C(subdomain), C(username), C(secret_key), and C(master_password).
- Due to the B(very) sensitive nature of these credentials, it is B(highly) recommended that you only pass in the minimal credentials - Due to the B(very) sensitive nature of these credentials, it is B(highly) recommended that you only pass in the minimal credentials
needed at any given time. Also, store these credentials in an Ansible Vault using a key that is equal to or greater in strength needed at any given time. Also, store these credentials in an Ansible Vault using a key that is equal to or greater in strength
@@ -105,12 +105,12 @@ from ansible.plugins.lookup import LookupBase
from ansible.errors import AnsibleLookupError from ansible.errors import AnsibleLookupError
from ansible.module_utils.common.text.converters import to_bytes, to_text from ansible.module_utils.common.text.converters import to_bytes, to_text
from ansible_collections.community.general.plugins.module_utils.onepassword import OnePasswordConfig
class OnePass(object): class OnePass(object):
def __init__(self, path='op'): def __init__(self, path='op'):
self.cli_path = path self.cli_path = path
self.config_file_path = os.path.expanduser('~/.op/config')
self.logged_in = False self.logged_in = False
self.token = None self.token = None
self.subdomain = None self.subdomain = None
@@ -119,9 +119,11 @@ class OnePass(object):
self.secret_key = None self.secret_key = None
self.master_password = None self.master_password = None
self._config = OnePasswordConfig()
def get_token(self): def get_token(self):
# If the config file exists, assume an initial signin has taken place and try basic sign in # If the config file exists, assume an initial signin has taken place and try basic sign in
if os.path.isfile(self.config_file_path): if os.path.isfile(self._config.config_file_path):
if not self.master_password: if not self.master_password:
raise AnsibleLookupError('Unable to sign in to 1Password. master_password is required.') raise AnsibleLookupError('Unable to sign in to 1Password. master_password is required.')
@@ -281,4 +283,5 @@ class LookupModule(LookupBase):
values = [] values = []
for term in terms: for term in terms:
values.append(op.get_field(term, field, section, vault)) values.append(op.get_field(term, field, section, vault))
return values return values

View File

@@ -3,7 +3,7 @@
# Implements multiple version numbering conventions for the # Implements multiple version numbering conventions for the
# Python Module Distribution Utilities. # Python Module Distribution Utilities.
# #
# PSF License (see licenses/PSF-license.txt or https://opensource.org/licenses/Python-2.0) # PSF License (see PSF-license.txt or https://opensource.org/licenses/Python-2.0)
# #
"""Provides classes to represent module version numbers (one class for """Provides classes to represent module version numbers (one class for

View File

@@ -7,7 +7,7 @@
# #
# Copyright (c) 2017-present Alibaba Group Holding Limited. He Guimin <heguimin36@163.com> # Copyright (c) 2017-present Alibaba Group Holding Limited. He Guimin <heguimin36@163.com>
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> # Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright: (c) 2019 Gregory Thiemonge <gregory.thiemonge@gmail.com> # Copyright: (c) 2019 Gregory Thiemonge <gregory.thiemonge@gmail.com>
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project # Copyright: (c) 2018, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c), Google Inc, 2017 # Copyright (c), Google Inc, 2017
# Simplified BSD License (see licenses/simplified_bsd.txt or # Simplified BSD License (see simplified_bsd.txt or
# https://opensource.org/licenses/BSD-2-Clause) # https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)

View File

@@ -2,7 +2,7 @@
# Copyright (C) 2018 IBM CORPORATION # Copyright (C) 2018 IBM CORPORATION
# Author(s): Tzur Eliyahu <tzure@il.ibm.com> # Author(s): Tzur Eliyahu <tzure@il.ibm.com>
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project # Copyright: (c) 2017, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# Copyright (c) 2016 Thomas Krahn (@Nosmoht) # Copyright (c) 2016 Thomas Krahn (@Nosmoht)
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013 # Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# Copyright (c), Luke Murphy @decentral1se # Copyright (c), Luke Murphy @decentral1se
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -8,7 +8,7 @@
# still belong to the author of the module, and may assign their own license # still belong to the author of the module, and may assign their own license
# to the complete work. # to the complete work.
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -8,7 +8,7 @@
# still belong to the author of the module, and may assign their own license # still belong to the author of the module, and may assign their own license
# to the complete work. # to the complete work.
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# Copyright (c) 2018, Simon Weald <ansible@simonweald.com> # Copyright (c) 2018, Simon Weald <ansible@simonweald.com>
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com> # (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright: (c) 2020, Ansible Project # Copyright: (c) 2020, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type

View File

@@ -5,7 +5,7 @@
# still belong to the author of the module, and may assign their own license # still belong to the author of the module, and may assign their own license
# to the complete work. # to the complete work.
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
class OnePasswordConfig(object):
_config_file_paths = (
"~/.op/config",
"~/.config/op/config",
"~/.config/.op/config",
)
def __init__(self):
self._config_file_path = ""
@property
def config_file_path(self):
if self._config_file_path:
return self._config_file_path
for path in self._config_file_paths:
realpath = os.path.expanduser(path)
if os.path.exists(realpath):
self._config_file_path = realpath
return self._config_file_path

View File

@@ -7,7 +7,7 @@
# #
# Copyright (2016-2017) Hewlett Packard Enterprise Development LP # Copyright (2016-2017) Hewlett Packard Enterprise Development LP
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -2,7 +2,7 @@
# #
# Copyright 2018 www.privaz.io Valletech AB # Copyright 2018 www.privaz.io Valletech AB
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# to the complete work. # to the complete work.
# #
# Copyright (c), Simon Dodsley <simon@purestorage.com>,2017 # Copyright (c), Simon Dodsley <simon@purestorage.com>,2017
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013 # Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# Copyright (c), James Laska # Copyright (c), James Laska
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -37,7 +37,7 @@ def fail_imports(module, needs_certifi=True):
errors.append(missing_required_lib('certifi')) errors.append(missing_required_lib('certifi'))
traceback.append(CERTIFI_IMPORT_ERROR) traceback.append(CERTIFI_IMPORT_ERROR)
if errors: if errors:
module.fail_json(errors=errors, traceback='\n'.join(traceback)) module.fail_json(msg='\n'.join(errors), traceback='\n'.join(traceback))
def redis_auth_argument_spec(tls_default=True): def redis_auth_argument_spec(tls_default=True):

View File

@@ -6,7 +6,7 @@
# own license to the complete work. # own license to the complete work.
# #
# Copyright (C) 2017 Lenovo, Inc. # Copyright (C) 2017 Lenovo, Inc.
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
# #
# Contains LXCA common class # Contains LXCA common class
# Lenovo xClarity Administrator (LXCA) # Lenovo xClarity Administrator (LXCA)

View File

@@ -8,7 +8,7 @@
# Copyright: (c) 2020, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru> # Copyright: (c) 2020, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru>
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# (c) 2018 Luca 'remix_tj' Lorenzetto # (c) 2018 Luca 'remix_tj' Lorenzetto
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright: (c) 2018, Hewlett Packard Enterprise Development LP # Copyright: (c) 2018, Hewlett Packard Enterprise Development LP
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -9,7 +9,7 @@
# Copyright (c) 2016, Adfinis SyGroup AG # Copyright (c) 2016, Adfinis SyGroup AG
# Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch> # Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch>
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -7,7 +7,7 @@
# #
# Copyright: (c) 2018, Johannes Brunswicker <johannes.brunswicker@gmail.com> # Copyright: (c) 2018, Johannes Brunswicker <johannes.brunswicker@gmail.com>
# #
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright: (c) 2019, Sandeep Kasargod <sandeep@vexata.com> # Copyright: (c) 2019, Sandeep Kasargod <sandeep@vexata.com>
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type

View File

@@ -332,7 +332,7 @@ def build_plan(command, project_path, variables_args, state_file, targets, state
if plan_path is None: if plan_path is None:
f, plan_path = tempfile.mkstemp(suffix='.tfplan') f, plan_path = tempfile.mkstemp(suffix='.tfplan')
local_command = command.copy() local_command = command[:]
plan_command = [command[0], 'plan'] plan_command = [command[0], 'plan']

View File

@@ -333,7 +333,7 @@ def add_service(module, service):
service_id=result.id, service_id=result.id,
service_name=result.name, service_name=result.name,
service_port=result.port, service_port=result.port,
checks=[check.to_dict() for check in service.checks], checks=[check.to_dict() for check in service.checks()],
tags=result.tags) tags=result.tags)
@@ -411,7 +411,7 @@ class ConsulService(object):
self.address = address self.address = address
self.port = port self.port = port
self.tags = tags self.tags = tags
self.checks = [] self._checks = []
if loaded: if loaded:
self.id = loaded['ID'] self.id = loaded['ID']
self.name = loaded['Service'] self.name = loaded['Service']
@@ -424,8 +424,8 @@ class ConsulService(object):
if self.port: if self.port:
optional['port'] = self.port optional['port'] = self.port
if len(self.checks) > 0: if len(self._checks) > 0:
optional['check'] = self.checks[0].check optional['check'] = self._checks[0].check
consul_api.agent.service.register( consul_api.agent.service.register(
self.name, self.name,
@@ -435,13 +435,13 @@ class ConsulService(object):
**optional) **optional)
def add_check(self, check): def add_check(self, check):
self.checks.append(check) self._checks.append(check)
def checks(self): def checks(self):
return self.checks return self._checks
def has_checks(self): def has_checks(self):
return len(self.checks) > 0 return len(self._checks) > 0
def __eq__(self, other): def __eq__(self, other):
return (isinstance(other, self.__class__) and return (isinstance(other, self.__class__) and
@@ -459,8 +459,8 @@ class ConsulService(object):
data['port'] = self.port data['port'] = self.port
if self.tags and len(self.tags) > 0: if self.tags and len(self.tags) > 0:
data['tags'] = self.tags data['tags'] = self.tags
if len(self.checks) > 0: if len(self._checks) > 0:
data['check'] = self.checks[0].to_dict() data['check'] = self._checks[0].to_dict()
return data return data

View File

@@ -48,19 +48,19 @@ options:
delimiter: delimiter:
description: description:
- A one-character string used to separate fields. - A one-character string used to separate fields.
- When using this parameter, you change the default value used by C(dialect). - When using this parameter, you change the default value used by I(dialect).
- The default value depends on the dialect used. - The default value depends on the dialect used.
type: str type: str
skipinitialspace: skipinitialspace:
description: description:
- Whether to ignore any whitespaces immediately following the delimiter. - Whether to ignore any whitespaces immediately following the delimiter.
- When using this parameter, you change the default value used by C(dialect). - When using this parameter, you change the default value used by I(dialect).
- The default value depends on the dialect used. - The default value depends on the dialect used.
type: bool type: bool
strict: strict:
description: description:
- Whether to raise an exception on bad CSV input. - Whether to raise an exception on bad CSV input.
- When using this parameter, you change the default value used by C(dialect). - When using this parameter, you change the default value used by I(dialect).
- The default value depends on the dialect used. - The default value depends on the dialect used.
type: bool type: bool
notes: notes:

View File

@@ -163,7 +163,7 @@ options:
aliases: aliases:
- defaultGroups - defaultGroups
type: list type: list
elements: dict elements: str
default_locale: default_locale:
description: description:
- The realm default locale. - The realm default locale.
@@ -183,7 +183,7 @@ options:
aliases: aliases:
- defaultRoles - defaultRoles
type: list type: list
elements: dict elements: str
default_signature_algorithm: default_signature_algorithm:
description: description:
- The realm default signature algorithm. - The realm default signature algorithm.
@@ -622,10 +622,10 @@ def main():
client_authentication_flow=dict(type='str', aliases=['clientAuthenticationFlow']), client_authentication_flow=dict(type='str', aliases=['clientAuthenticationFlow']),
client_scope_mappings=dict(type='dict', aliases=['clientScopeMappings']), client_scope_mappings=dict(type='dict', aliases=['clientScopeMappings']),
default_default_client_scopes=dict(type='list', elements='str', aliases=['defaultDefaultClientScopes']), default_default_client_scopes=dict(type='list', elements='str', aliases=['defaultDefaultClientScopes']),
default_groups=dict(type='list', elements='dict', aliases=['defaultGroups']), default_groups=dict(type='list', elements='str', aliases=['defaultGroups']),
default_locale=dict(type='str', aliases=['defaultLocale']), default_locale=dict(type='str', aliases=['defaultLocale']),
default_optional_client_scopes=dict(type='list', elements='str', aliases=['defaultOptionalClientScopes']), default_optional_client_scopes=dict(type='list', elements='str', aliases=['defaultOptionalClientScopes']),
default_roles=dict(type='list', elements='dict', aliases=['defaultRoles']), default_roles=dict(type='list', elements='str', aliases=['defaultRoles']),
default_signature_algorithm=dict(type='str', aliases=['defaultSignatureAlgorithm']), default_signature_algorithm=dict(type='str', aliases=['defaultSignatureAlgorithm']),
direct_grant_flow=dict(type='str', aliases=['directGrantFlow']), direct_grant_flow=dict(type='str', aliases=['directGrantFlow']),
display_name=dict(type='str', aliases=['displayName']), display_name=dict(type='str', aliases=['displayName']),

View File

@@ -166,6 +166,8 @@ from subprocess import Popen, PIPE
from ansible.module_utils.common.text.converters import to_bytes, to_native from ansible.module_utils.common.text.converters import to_bytes, to_native
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.onepassword import OnePasswordConfig
class AnsibleModuleError(Exception): class AnsibleModuleError(Exception):
def __init__(self, results): def __init__(self, results):
@@ -179,7 +181,6 @@ class OnePasswordInfo(object):
def __init__(self): def __init__(self):
self.cli_path = module.params.get('cli_path') self.cli_path = module.params.get('cli_path')
self.config_file_path = '~/.op/config'
self.auto_login = module.params.get('auto_login') self.auto_login = module.params.get('auto_login')
self.logged_in = False self.logged_in = False
self.token = None self.token = None
@@ -187,6 +188,8 @@ class OnePasswordInfo(object):
terms = module.params.get('search_terms') terms = module.params.get('search_terms')
self.terms = self.parse_search_terms(terms) self.terms = self.parse_search_terms(terms)
self._config = OnePasswordConfig()
def _run(self, args, expected_rc=0, command_input=None, ignore_errors=False): def _run(self, args, expected_rc=0, command_input=None, ignore_errors=False):
if self.token: if self.token:
# Adds the session token to all commands if we're logged in. # Adds the session token to all commands if we're logged in.
@@ -299,7 +302,7 @@ class OnePasswordInfo(object):
def get_token(self): def get_token(self):
# If the config file exists, assume an initial signin has taken place and try basic sign in # If the config file exists, assume an initial signin has taken place and try basic sign in
if os.path.isfile(self.config_file_path): if os.path.isfile(self._config.config_file_path):
if self.auto_login is not None: if self.auto_login is not None:

View File

@@ -157,8 +157,8 @@ options:
version_added: 2.0.0 version_added: 2.0.0
dns4: dns4:
description: description:
- A list of up to 3 dns servers. - A list of up to 3 DNS servers.
- IPv4 format e.g. to add two IPv4 DNS server addresses, use C(192.0.2.53 198.51.100.53). - The entries must be IPv4 addresses, for example C(192.0.2.53).
elements: str elements: str
type: list type: list
dns4_search: dns4_search:
@@ -255,8 +255,8 @@ options:
version_added: 4.4.0 version_added: 4.4.0
dns6: dns6:
description: description:
- A list of up to 3 dns servers. - A list of up to 3 DNS servers.
- IPv6 format e.g. to add two IPv6 DNS server addresses, use C(2001:4860:4860::8888 2001:4860:4860::8844). - The entries must be IPv6 addresses, for example C(2001:4860:4860::8888).
elements: str elements: str
type: list type: list
dns6_search: dns6_search:

View File

@@ -305,6 +305,8 @@ class XCCRedfishUtils(RedfishUtils):
continue continue
if 'RDOC' in uri: if 'RDOC' in uri:
continue continue
if 'Remote' in uri:
continue
# if ejected, 'Inserted' should be False and 'ImageName' cleared # if ejected, 'Inserted' should be False and 'ImageName' cleared
if (not data.get('Inserted', False) and if (not data.get('Inserted', False) and
not data.get('ImageName')): not data.get('ImageName')):
@@ -312,13 +314,19 @@ class XCCRedfishUtils(RedfishUtils):
return None, None return None, None
def virtual_media_eject_one(self, image_url): def virtual_media_eject_one(self, image_url):
# locate and read the VirtualMedia resources # read the VirtualMedia resources from systems
response = self.get_request(self.root_uri + self.manager_uri) response = self.get_request(self.root_uri + self.systems_uri)
if response['ret'] is False: if response['ret'] is False:
return response return response
data = response['data'] data = response['data']
if 'VirtualMedia' not in data: if 'VirtualMedia' not in data:
return {'ret': False, 'msg': "VirtualMedia resource not found"} # read the VirtualMedia resources from manager
response = self.get_request(self.root_uri + self.manager_uri)
if response['ret'] is False:
return response
data = response['data']
if 'VirtualMedia' not in data:
return {'ret': False, 'msg': "VirtualMedia resource not found"}
virt_media_uri = data["VirtualMedia"]["@odata.id"] virt_media_uri = data["VirtualMedia"]["@odata.id"]
response = self.get_request(self.root_uri + virt_media_uri) response = self.get_request(self.root_uri + virt_media_uri)
if response['ret'] is False: if response['ret'] is False:
@@ -379,13 +387,20 @@ class XCCRedfishUtils(RedfishUtils):
return self.virtual_media_eject_one(image_url) return self.virtual_media_eject_one(image_url)
# eject all inserted media when no image_url specified # eject all inserted media when no image_url specified
# read all the VirtualMedia resources # read the VirtualMedia resources from systems
response = self.get_request(self.root_uri + self.manager_uri) response = self.get_request(self.root_uri + self.systems_uri)
if response['ret'] is False: if response['ret'] is False:
return response return response
data = response['data'] data = response['data']
if 'VirtualMedia' not in data: if 'VirtualMedia' not in data:
return {'ret': False, 'msg': "VirtualMedia resource not found"} # read the VirtualMedia resources from manager
response = self.get_request(self.root_uri + self.manager_uri)
if response['ret'] is False:
return response
data = response['data']
if 'VirtualMedia' not in data:
return {'ret': False, 'msg': "VirtualMedia resource not found"}
# read all the VirtualMedia resources
virt_media_uri = data["VirtualMedia"]["@odata.id"] virt_media_uri = data["VirtualMedia"]["@odata.id"]
response = self.get_request(self.root_uri + virt_media_uri) response = self.get_request(self.root_uri + virt_media_uri)
if response['ret'] is False: if response['ret'] is False:
@@ -413,6 +428,95 @@ class XCCRedfishUtils(RedfishUtils):
return {'ret': True, 'changed': True, return {'ret': True, 'changed': True,
'msg': "VirtualMedia %s ejected" % str(ejected_media_list)} 'msg': "VirtualMedia %s ejected" % str(ejected_media_list)}
def virtual_media_insert(self, options):
param_map = {
'Inserted': 'inserted',
'WriteProtected': 'write_protected',
'UserName': 'username',
'Password': 'password',
'TransferProtocolType': 'transfer_protocol_type',
'TransferMethod': 'transfer_method'
}
image_url = options.get('image_url')
if not image_url:
return {'ret': False,
'msg': "image_url option required for VirtualMediaInsert"}
media_types = options.get('media_types')
# read the VirtualMedia resources from systems
response = self.get_request(self.root_uri + self.systems_uri)
if response['ret'] is False:
return response
data = response['data']
if 'VirtualMedia' not in data:
# read the VirtualMedia resources from manager
response = self.get_request(self.root_uri + self.manager_uri)
if response['ret'] is False:
return response
data = response['data']
if 'VirtualMedia' not in data:
return {'ret': False, 'msg': "VirtualMedia resource not found"}
virt_media_uri = data["VirtualMedia"]["@odata.id"]
response = self.get_request(self.root_uri + virt_media_uri)
if response['ret'] is False:
return response
data = response['data']
virt_media_list = []
for member in data[u'Members']:
virt_media_list.append(member[u'@odata.id'])
resources, headers = self._read_virt_media_resources(virt_media_list)
# see if image already inserted; if so, nothing to do
if self._virt_media_image_inserted(resources, image_url):
return {'ret': True, 'changed': False,
'msg': "VirtualMedia '%s' already inserted" % image_url}
# find an empty slot to insert the media
# try first with strict media_type matching
uri, data = self._find_empty_virt_media_slot(
resources, media_types, media_match_strict=True)
if not uri:
# if not found, try without strict media_type matching
uri, data = self._find_empty_virt_media_slot(
resources, media_types, media_match_strict=False)
if not uri:
return {'ret': False,
'msg': "Unable to find an available VirtualMedia resource "
"%s" % ('supporting ' + str(media_types)
if media_types else '')}
# confirm InsertMedia action found
if ('Actions' not in data or
'#VirtualMedia.InsertMedia' not in data['Actions']):
# try to insert via PATCH if no InsertMedia action found
h = headers[uri]
if 'allow' in h:
methods = [m.strip() for m in h.get('allow').split(',')]
if 'PATCH' not in methods:
# if Allow header present and PATCH missing, return error
return {'ret': False,
'msg': "%s action not found and PATCH not allowed"
% '#VirtualMedia.InsertMedia'}
return self.virtual_media_insert_via_patch(options, param_map,
uri, data)
# get the action property
action = data['Actions']['#VirtualMedia.InsertMedia']
if 'target' not in action:
return {'ret': False,
'msg': "target URI missing from Action "
"#VirtualMedia.InsertMedia"}
action_uri = action['target']
# get ActionInfo or AllowableValues
ai = self._get_all_action_info_values(action)
# construct payload
payload = self._insert_virt_media_payload(options, param_map, data, ai)
# POST to action
response = self.post_request(self.root_uri + action_uri, payload)
if response['ret'] is False:
return response
return {'ret': True, 'changed': True, 'msg': "VirtualMedia inserted"}
def raw_get_resource(self, resource_uri): def raw_get_resource(self, resource_uri):
if resource_uri is None: if resource_uri is None:
return {'ret': False, 'msg': "resource_uri is missing"} return {'ret': False, 'msg': "resource_uri is missing"}
@@ -640,7 +744,11 @@ def main():
# Organize by Categories / Commands # Organize by Categories / Commands
if category == "Manager": if category == "Manager":
# execute only if we find a Manager service resource # For virtual media resource locates on Systems service
result = rf_utils._find_systems_resource()
if result['ret'] is False:
module.fail_json(msg=to_native(result['msg']))
# For virtual media resource locates on Managers service
result = rf_utils._find_managers_resource() result = rf_utils._find_managers_resource()
if result['ret'] is False: if result['ret'] is False:
module.fail_json(msg=to_native(result['msg'])) module.fail_json(msg=to_native(result['msg']))

View File

@@ -14,46 +14,46 @@ short_description: Manages Out-Of-Band controllers using iDRAC OEM Redfish APIs
description: description:
- Builds Redfish URIs locally and sends them to remote OOB controllers to - Builds Redfish URIs locally and sends them to remote OOB controllers to
perform an action. perform an action.
- For use with Dell iDRAC operations that require Redfish OEM extensions - For use with Dell iDRAC operations that require Redfish OEM extensions.
options: options:
category: category:
required: true required: true
description: description:
- Category to execute on OOB controller - Category to execute on iDRAC.
type: str type: str
command: command:
required: true required: true
description: description:
- List of commands to execute on OOB controller - List of commands to execute on iDRAC.
type: list type: list
elements: str elements: str
baseuri: baseuri:
required: true required: true
description: description:
- Base URI of OOB controller - Base URI of iDRAC.
type: str type: str
username: username:
description: description:
- User for authentication with OOB controller - Username for authenticating to iDRAC.
type: str type: str
password: password:
description: description:
- Password for authentication with OOB controller - Password for authenticating to iDRAC.
type: str type: str
auth_token: auth_token:
description: description:
- Security token for authentication with OOB controller - Security token for authenticating to iDRAC.
type: str type: str
version_added: 2.3.0 version_added: 2.3.0
timeout: timeout:
description: description:
- Timeout in seconds for URL requests to OOB controller - Timeout in seconds for HTTP requests to iDRAC.
default: 10 default: 10
type: int type: int
resource_id: resource_id:
required: false required: false
description: description:
- The ID of the System, Manager or Chassis to modify - ID of the System, Manager or Chassis to modify.
type: str type: str
version_added: '0.2.0' version_added: '0.2.0'

View File

@@ -20,50 +20,50 @@ options:
required: true required: true
type: str type: str
description: description:
- Category to execute on iDRAC - Category to execute on iDRAC.
command: command:
required: true required: true
description: description:
- List of commands to execute on iDRAC - List of commands to execute on iDRAC.
- I(SetManagerAttributes), I(SetLifecycleControllerAttributes) and - I(SetManagerAttributes), I(SetLifecycleControllerAttributes) and
I(SetSystemAttributes) are mutually exclusive commands when C(category) I(SetSystemAttributes) are mutually exclusive commands when C(category)
is I(Manager) is I(Manager).
type: list type: list
elements: str elements: str
baseuri: baseuri:
required: true required: true
description: description:
- Base URI of iDRAC - Base URI of iDRAC.
type: str type: str
username: username:
description: description:
- User for authentication with iDRAC - Username for authenticating to iDRAC.
type: str type: str
password: password:
description: description:
- Password for authentication with iDRAC - Password for authenticating to iDRAC.
type: str type: str
auth_token: auth_token:
description: description:
- Security token for authentication with OOB controller - Security token for authenticating to iDRAC.
type: str type: str
version_added: 2.3.0 version_added: 2.3.0
manager_attributes: manager_attributes:
required: false required: false
description: description:
- dictionary of iDRAC attribute name and value pairs to update - Dictionary of iDRAC attribute name and value pairs to update.
default: {} default: {}
type: 'dict' type: 'dict'
version_added: '0.2.0' version_added: '0.2.0'
timeout: timeout:
description: description:
- Timeout in seconds for URL requests to iDRAC controller - Timeout in seconds for HTTP requests to iDRAC.
default: 10 default: 10
type: int type: int
resource_id: resource_id:
required: false required: false
description: description:
- The ID of the System, Manager or Chassis to modify - ID of the System, Manager or Chassis to modify.
type: str type: str
version_added: '0.2.0' version_added: '0.2.0'

View File

@@ -14,44 +14,44 @@ short_description: Gather PowerEdge server information through iDRAC using Redfi
description: description:
- Builds Redfish URIs locally and sends them to remote iDRAC controllers to - Builds Redfish URIs locally and sends them to remote iDRAC controllers to
get information back. get information back.
- For use with Dell EMC iDRAC operations that require Redfish OEM extensions - For use with Dell EMC iDRAC operations that require Redfish OEM extensions.
- This module was called C(idrac_redfish_facts) before Ansible 2.9, returning C(ansible_facts). - This module was called C(idrac_redfish_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(community.general.idrac_redfish_info) module no longer returns C(ansible_facts)! Note that the M(community.general.idrac_redfish_info) module no longer returns C(ansible_facts)!
options: options:
category: category:
required: true required: true
description: description:
- Category to execute on iDRAC controller - Category to execute on iDRAC.
type: str type: str
command: command:
required: true required: true
description: description:
- List of commands to execute on iDRAC controller - List of commands to execute on iDRAC.
- C(GetManagerAttributes) returns the list of dicts containing iDRAC, - C(GetManagerAttributes) returns the list of dicts containing iDRAC,
LifecycleController and System attributes LifecycleController and System attributes.
type: list type: list
elements: str elements: str
baseuri: baseuri:
required: true required: true
description: description:
- Base URI of iDRAC controller - Base URI of iDRAC.
type: str type: str
username: username:
description: description:
- User for authentication with iDRAC controller - Username for authenticating to iDRAC.
type: str type: str
password: password:
description: description:
- Password for authentication with iDRAC controller - Password for authenticating to iDRAC.
type: str type: str
auth_token: auth_token:
description: description:
- Security token for authentication with OOB controller - Security token for authenticating to iDRAC.
type: str type: str
version_added: 2.3.0 version_added: 2.3.0
timeout: timeout:
description: description:
- Timeout in seconds for URL requests to OOB controller - Timeout in seconds for HTTP requests to iDRAC.
default: 10 default: 10
type: int type: int

View File

@@ -34,19 +34,19 @@ options:
type: str type: str
username: username:
description: description:
- User for authentication with iLO. - Username for authenticating to iLO.
type: str type: str
password: password:
description: description:
- Password for authentication with iLO. - Password for authenticating to iLO.
type: str type: str
auth_token: auth_token:
description: description:
- Security token for authentication with OOB controller. - Security token for authenticating to iLO.
type: str type: str
timeout: timeout:
description: description:
- Timeout in seconds for URL requests to iLO controller. - Timeout in seconds for HTTP requests to iLO.
default: 10 default: 10
type: int type: int
attribute_name: attribute_name:
@@ -82,6 +82,17 @@ EXAMPLES = '''
password: Testpass123 password: Testpass123
attribute_name: TimeZone attribute_name: TimeZone
attribute_value: Chennai attribute_value: Chennai
- name: Set NTP Servers
community.general.ilo_redfish_config:
category: Manager
command: SetNTPServers
baseuri: 15.X.X.X
username: Admin
password: Testpass123
attribute_name: StaticNTPServers
attribute_value: X.X.X.X
''' '''
RETURN = ''' RETURN = '''

View File

@@ -34,19 +34,19 @@ options:
type: str type: str
username: username:
description: description:
- User for authentication with iLO. - Username for authenticating to iLO.
type: str type: str
password: password:
description: description:
- Password for authentication with iLO. - Password for authenticating to iLO.
type: str type: str
auth_token: auth_token:
description: description:
- Security token for authentication with iLO. - Security token for authenticating to iLO.
type: str type: str
timeout: timeout:
description: description:
- Timeout in seconds for URL requests to iLO. - Timeout in seconds for HTTP requests to iLO.
default: 10 default: 10
type: int type: int
author: author:

View File

@@ -21,35 +21,35 @@ options:
category: category:
required: true required: true
description: description:
- Category to execute on OOB controller - Category to execute on OOB controller.
type: str type: str
command: command:
required: true required: true
description: description:
- List of commands to execute on OOB controller - List of commands to execute on OOB controller.
type: list type: list
elements: str elements: str
baseuri: baseuri:
required: true required: true
description: description:
- Base URI of OOB controller - Base URI of OOB controller.
type: str type: str
username: username:
description: description:
- Username for authentication with OOB controller - Username for authenticating to OOB controller.
type: str type: str
password: password:
description: description:
- Password for authentication with OOB controller - Password for authenticating to OOB controller.
type: str type: str
auth_token: auth_token:
description: description:
- Security token for authentication with OOB controller - Security token for authenticating to OOB controller.
type: str type: str
version_added: 2.3.0 version_added: 2.3.0
session_uri: session_uri:
description: description:
- URI of the session resource - URI of the session resource.
type: str type: str
version_added: 2.3.0 version_added: 2.3.0
id: id:
@@ -63,28 +63,28 @@ options:
required: false required: false
aliases: [ account_username ] aliases: [ account_username ]
description: description:
- Username of account to add/delete/modify - Username of account to add/delete/modify.
type: str type: str
new_password: new_password:
required: false required: false
aliases: [ account_password ] aliases: [ account_password ]
description: description:
- New password of account to add/modify - New password of account to add/modify.
type: str type: str
roleid: roleid:
required: false required: false
aliases: [ account_roleid ] aliases: [ account_roleid ]
description: description:
- Role of account to add/modify - Role of account to add/modify.
type: str type: str
bootdevice: bootdevice:
required: false required: false
description: description:
- bootdevice when setting boot configuration - Boot device when setting boot configuration.
type: str type: str
timeout: timeout:
description: description:
- Timeout in seconds for URL requests to OOB controller - Timeout in seconds for HTTP requests to OOB controller.
default: 10 default: 10
type: int type: int
boot_override_mode: boot_override_mode:
@@ -96,117 +96,117 @@ options:
uefi_target: uefi_target:
required: false required: false
description: description:
- UEFI target when bootdevice is "UefiTarget" - UEFI boot target when bootdevice is "UefiTarget".
type: str type: str
boot_next: boot_next:
required: false required: false
description: description:
- BootNext target when bootdevice is "UefiBootNext" - BootNext target when bootdevice is "UefiBootNext".
type: str type: str
update_username: update_username:
required: false required: false
aliases: [ account_updatename ] aliases: [ account_updatename ]
description: description:
- new update user name for account_username - New user name for updating account_username.
type: str type: str
version_added: '0.2.0' version_added: '0.2.0'
account_properties: account_properties:
required: false required: false
description: description:
- properties of account service to update - Properties of account service to update.
type: dict type: dict
version_added: '0.2.0' version_added: '0.2.0'
resource_id: resource_id:
required: false required: false
description: description:
- The ID of the System, Manager or Chassis to modify - ID of the System, Manager or Chassis to modify.
type: str type: str
version_added: '0.2.0' version_added: '0.2.0'
update_image_uri: update_image_uri:
required: false required: false
description: description:
- The URI of the image for the update - URI of the image for the update.
type: str type: str
version_added: '0.2.0' version_added: '0.2.0'
update_protocol: update_protocol:
required: false required: false
description: description:
- The protocol for the update - Protocol for the update.
type: str type: str
version_added: '0.2.0' version_added: '0.2.0'
update_targets: update_targets:
required: false required: false
description: description:
- The list of target resource URIs to apply the update to - List of target resource URIs to apply the update to.
type: list type: list
elements: str elements: str
version_added: '0.2.0' version_added: '0.2.0'
update_creds: update_creds:
required: false required: false
description: description:
- The credentials for retrieving the update image - Credentials for retrieving the update image.
type: dict type: dict
version_added: '0.2.0' version_added: '0.2.0'
suboptions: suboptions:
username: username:
required: false required: false
description: description:
- The username for retrieving the update image - Username for retrieving the update image.
type: str type: str
password: password:
required: false required: false
description: description:
- The password for retrieving the update image - Password for retrieving the update image.
type: str type: str
virtual_media: virtual_media:
required: false required: false
description: description:
- The options for VirtualMedia commands - Options for VirtualMedia commands.
type: dict type: dict
version_added: '0.2.0' version_added: '0.2.0'
suboptions: suboptions:
media_types: media_types:
required: false required: false
description: description:
- The list of media types appropriate for the image - List of media types appropriate for the image.
type: list type: list
elements: str elements: str
image_url: image_url:
required: false required: false
description: description:
- The URL od the image the insert or eject - URL of the image to insert or eject.
type: str type: str
inserted: inserted:
required: false required: false
description: description:
- Indicates if the image is treated as inserted on command completion - Indicates that the image is treated as inserted on command completion.
type: bool type: bool
default: True default: True
write_protected: write_protected:
required: false required: false
description: description:
- Indicates if the media is treated as write-protected - Indicates that the media is treated as write-protected.
type: bool type: bool
default: True default: True
username: username:
required: false required: false
description: description:
- The username for accessing the image URL - Username for accessing the image URL.
type: str type: str
password: password:
required: false required: false
description: description:
- The password for accessing the image URL - Password for accessing the image URL.
type: str type: str
transfer_protocol_type: transfer_protocol_type:
required: false required: false
description: description:
- The network protocol to use with the image - Network protocol to use with the image.
type: str type: str
transfer_method: transfer_method:
required: false required: false
description: description:
- The transfer method to use with the image - Transfer method to use with the image.
type: str type: str
strip_etag_quotes: strip_etag_quotes:
description: description:

View File

@@ -20,48 +20,48 @@ options:
category: category:
required: true required: true
description: description:
- Category to execute on OOB controller - Category to execute on OOB controller.
type: str type: str
command: command:
required: true required: true
description: description:
- List of commands to execute on OOB controller - List of commands to execute on OOB controller.
type: list type: list
elements: str elements: str
baseuri: baseuri:
required: true required: true
description: description:
- Base URI of OOB controller - Base URI of OOB controller.
type: str type: str
username: username:
description: description:
- User for authentication with OOB controller - Username for authenticating to OOB controller.
type: str type: str
password: password:
description: description:
- Password for authentication with OOB controller - Password for authenticating to OOB controller.
type: str type: str
auth_token: auth_token:
description: description:
- Security token for authentication with OOB controller - Security token for authenticating to OOB controller.
type: str type: str
version_added: 2.3.0 version_added: 2.3.0
bios_attributes: bios_attributes:
required: false required: false
description: description:
- dictionary of BIOS attributes to update - Dictionary of BIOS attributes to update.
default: {} default: {}
type: dict type: dict
version_added: '0.2.0' version_added: '0.2.0'
timeout: timeout:
description: description:
- Timeout in seconds for URL requests to OOB controller - Timeout in seconds for HTTP requests to OOB controller.
default: 10 default: 10
type: int type: int
boot_order: boot_order:
required: false required: false
description: description:
- list of BootOptionReference strings specifying the BootOrder - List of BootOptionReference strings specifying the BootOrder.
default: [] default: []
type: list type: list
elements: str elements: str
@@ -69,26 +69,26 @@ options:
network_protocols: network_protocols:
required: false required: false
description: description:
- setting dict of manager services to update - Setting dict of manager services to update.
type: dict type: dict
version_added: '0.2.0' version_added: '0.2.0'
resource_id: resource_id:
required: false required: false
description: description:
- The ID of the System, Manager or Chassis to modify - ID of the System, Manager or Chassis to modify.
type: str type: str
version_added: '0.2.0' version_added: '0.2.0'
nic_addr: nic_addr:
required: false required: false
description: description:
- EthernetInterface Address string on OOB controller - EthernetInterface Address string on OOB controller.
default: 'null' default: 'null'
type: str type: str
version_added: '0.2.0' version_added: '0.2.0'
nic_config: nic_config:
required: false required: false
description: description:
- setting dict of EthernetInterface on OOB controller - Setting dict of EthernetInterface on OOB controller.
type: dict type: dict
version_added: '0.2.0' version_added: '0.2.0'
strip_etag_quotes: strip_etag_quotes:

View File

@@ -21,37 +21,37 @@ options:
category: category:
required: false required: false
description: description:
- List of categories to execute on OOB controller - List of categories to execute on OOB controller.
default: ['Systems'] default: ['Systems']
type: list type: list
elements: str elements: str
command: command:
required: false required: false
description: description:
- List of commands to execute on OOB controller - List of commands to execute on OOB controller.
type: list type: list
elements: str elements: str
baseuri: baseuri:
required: true required: true
description: description:
- Base URI of OOB controller - Base URI of OOB controller.
type: str type: str
username: username:
description: description:
- User for authentication with OOB controller - Username for authenticating to OOB controller.
type: str type: str
password: password:
description: description:
- Password for authentication with OOB controller - Password for authenticating to OOB controller.
type: str type: str
auth_token: auth_token:
description: description:
- Security token for authentication with OOB controller - Security token for authenticating to OOB controller.
type: str type: str
version_added: 2.3.0 version_added: 2.3.0
timeout: timeout:
description: description:
- Timeout in seconds for URL requests to OOB controller - Timeout in seconds for HTTP requests to OOB controller.
default: 10 default: 10
type: int type: int

View File

@@ -257,7 +257,7 @@ class GitLabHook(object):
for arg_key, arg_value in arguments.items(): for arg_key, arg_value in arguments.items():
if arguments[arg_key] is not None: if arguments[arg_key] is not None:
if getattr(hook, arg_key) != arguments[arg_key]: if getattr(hook, arg_key, None) != arguments[arg_key]:
setattr(hook, arg_key, arguments[arg_key]) setattr(hook, arg_key, arguments[arg_key])
changed = True changed = True

View File

@@ -268,7 +268,7 @@ class Ext(Filesystem):
if None not in (block_size, block_count): if None not in (block_size, block_count):
break break
else: else:
raise ValueError(out) raise ValueError(repr(out))
return block_size * block_count return block_size * block_count
@@ -319,7 +319,7 @@ class XFS(Filesystem):
if None not in (block_size, block_count): if None not in (block_size, block_count):
break break
else: else:
raise ValueError(out) raise ValueError(repr(out))
return block_size * block_count return block_size * block_count
@@ -364,7 +364,7 @@ class Btrfs(Filesystem):
for line in stdout.splitlines(): for line in stdout.splitlines():
if "Device size" in line: if "Device size" in line:
return int(line.split()[-1]) return int(line.split()[-1])
raise ValueError(stdout) raise ValueError(repr(stdout))
class Ocfs2(Filesystem): class Ocfs2(Filesystem):
@@ -405,7 +405,7 @@ class F2fs(Filesystem):
if None not in (sector_size, sector_count): if None not in (sector_size, sector_count):
break break
else: else:
raise ValueError(out) raise ValueError(repr(out))
return sector_size * sector_count return sector_size * sector_count
@@ -428,12 +428,15 @@ class VFAT(Filesystem):
dummy, out, dummy = self.module.run_command([cmd, '--info', str(dev)], check_rc=True, environ_update=self.LANG_ENV) dummy, out, dummy = self.module.run_command([cmd, '--info', str(dev)], check_rc=True, environ_update=self.LANG_ENV)
fssize = None fssize = None
for line in out.splitlines()[1:]: for line in out.splitlines()[1:]:
param, value = line.split(':', 1) parts = line.split(':', 1)
if param.strip() == 'Size': if len(parts) < 2:
continue
param, value = parts
if param.strip() in ('Size', 'Cur size'):
fssize = int(value.strip()) fssize = int(value.strip())
break break
else: else:
raise ValueError(out) raise ValueError(repr(out))
return fssize return fssize
@@ -477,7 +480,7 @@ class UFS(Filesystem):
if None not in (fragmentsize, providersize): if None not in (fragmentsize, providersize):
break break
else: else:
raise ValueError(out) raise ValueError(repr(out))
return fragmentsize * providersize return fragmentsize * providersize

View File

@@ -99,45 +99,41 @@ class GConf2Preference(object):
def call(self, call_type, fail_onerr=True): def call(self, call_type, fail_onerr=True):
""" Helper function to perform gconftool-2 operations """ """ Helper function to perform gconftool-2 operations """
config_source = '' config_source = []
direct = '' direct = []
changed = False changed = False
out = '' out = ''
# If the configuration source is different from the default, create # If the configuration source is different from the default, create
# the argument # the argument
if self.config_source is not None and len(self.config_source) > 0: if self.config_source is not None and len(self.config_source) > 0:
config_source = "--config-source " + self.config_source config_source = ["--config-source", self.config_source]
# If direct is true, create the argument # If direct is true, create the argument
if self.direct: if self.direct:
direct = "--direct" direct = ["--direct"]
# Execute the call # Execute the call
cmd = "gconftool-2 " cmd = ["gconftool-2"]
try: try:
# If the call is "get", then we don't need as many parameters and # If the call is "get", then we don't need as many parameters and
# we can ignore some # we can ignore some
if call_type == 'get': if call_type == 'get':
cmd += "--get {0}".format(self.key) cmd.extend(["--get", self.key])
# Otherwise, we will use all relevant parameters # Otherwise, we will use all relevant parameters
elif call_type == 'set': elif call_type == 'set':
cmd += "{0} {1} --type {2} --{3} {4} \"{5}\"".format(direct, cmd.extend(direct)
config_source, cmd.extend(config_source)
self.value_type, cmd.extend(["--type", self.value_type, "--{3}".format(call_type), self.key, self.value])
call_type,
self.key,
self.value)
elif call_type == 'unset': elif call_type == 'unset':
cmd += "--unset {0}".format(self.key) cmd.extend(["--unset", self.key])
# Start external command # Start external command
rc, out, err = self.ansible.run_command(cmd, use_unsafe_shell=True) rc, out, err = self.ansible.run_command(cmd)
if len(err) > 0: if err and fail_onerr:
if fail_onerr: self.ansible.fail_json(msg='gconftool-2 failed with '
self.ansible.fail_json(msg='gconftool-2 failed with ' 'error: %s' % (str(err)))
'error: %s' % (str(err)))
else: else:
changed = True changed = True

View File

@@ -4,6 +4,39 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: a_module
short_description: Test whether a given string refers to an existing module or action plugin
version_added: 4.0.0
author: Felix Fontein (@felixfontein)
description:
- Test whether a given string refers to an existing module or action plugin.
- This can be useful in roles, which can use this to ensure that required modules are present ahead of time.
options:
_input:
description: A string denoting a fully qualified collection name (FQCN) of a module or action plugin.
type: string
required: true
'''
EXAMPLES = '''
- name: Make sure that community.aws.route53 is available
ansible.builtin.assert:
that:
- >
'community.aws.route53' is community.general.a_module
- name: Make sure that community.general.does_not_exist is not a module or action plugin
ansible.builtin.assert:
that:
- "'community.general.does_not_exist' is not community.general.a_module"
'''
RETURN = '''
_value:
description: Whether the module or action plugin denoted by the input exists.
type: boolean
'''
from ansible.plugins.loader import action_loader, module_loader from ansible.plugins.loader import action_loader, module_loader

8
simplified_bsd.txt Normal file
View File

@@ -0,0 +1,8 @@
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -7,8 +7,18 @@
- set_fact: - set_fact:
has_cargo: true has_cargo: true
when: when:
- ansible_system != 'FreeBSD' or ansible_distribution_version is version('13.0', '>') - ansible_system != 'FreeBSD'
- ansible_distribution != 'MacOSX' - ansible_distribution != 'MacOSX'
- ansible_distribution != 'RedHat' or ansible_distribution_version is version('8.0', '>=') - ansible_distribution != 'RedHat' or ansible_distribution_version is version('8.0', '>=')
- ansible_distribution != 'CentOS' or ansible_distribution_version is version('7.0', '>=') - ansible_distribution != 'CentOS' or ansible_distribution_version is version('7.0', '>=')
- ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('18', '>=') - ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('18', '>=')
- block:
- name: Install rust (containing cargo)
package:
name: rust
state: present
- set_fact:
has_cargo: true
when:
- ansible_system == 'FreeBSD' and ansible_distribution_version is version('13.0', '>')

View File

@@ -15,6 +15,7 @@
when: when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 14) - not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 14)
- not (ansible_os_family == "Suse" and ansible_distribution_major_version|int != 42 and ansible_python.version.major != 3) - not (ansible_os_family == "Suse" and ansible_distribution_major_version|int != 42 and ansible_python.version.major != 3)
- not (ansible_distribution == "CentOS" and ansible_distribution_major_version|int == 8) # TODO: cannot start service
- not (ansible_distribution == 'Archlinux') # TODO: package seems to be broken, cannot be downloaded from mirrors? - not (ansible_distribution == 'Archlinux') # TODO: package seems to be broken, cannot be downloaded from mirrors?
- not (ansible_distribution == 'Alpine') # TODO: not sure what's wrong here, the module doesn't return what the tests expect - not (ansible_distribution == 'Alpine') # TODO: not sure what's wrong here, the module doesn't return what the tests expect
block: block:

View File

@@ -3,3 +3,4 @@ dependencies:
- setup_pkg_mgr - setup_pkg_mgr
- setup_openssl - setup_openssl
- setup_remote_tmp_dir - setup_remote_tmp_dir
- setup_remote_constraints

View File

@@ -12,12 +12,14 @@
- name: Install requests<2.20 (CentOS/RHEL 6) - name: Install requests<2.20 (CentOS/RHEL 6)
pip: pip:
name: requests<2.20 name: requests<2.20
extra_args: "-c {{ remote_constraints }}"
register: result register: result
until: result is success until: result is success
when: ansible_distribution_file_variety|default() == 'RedHat' and ansible_distribution_major_version is version('6', '<=') when: ansible_distribution_file_variety|default() == 'RedHat' and ansible_distribution_major_version is version('6', '<=')
- name: Install python-consul - name: Install python-consul
pip: pip:
name: python-consul name: python-consul
extra_args: "-c {{ remote_constraints }}"
register: result register: result
until: result is success until: result is success
- name: Generate privatekey - name: Generate privatekey

Some files were not shown because too many files have changed in this diff Show More