Compare commits

...

85 Commits
5.0.0 ... 5.3.0

Author SHA1 Message Date
Felix Fontein
a7dbefcaf1 Release 5.3.0. 2022-07-12 11:18:14 +02:00
patchback[bot]
9d5490e510 proxmox inventory: fix for agent enabled (#4910) (#4947)
* Update proxmox.py

* Forgot a debug print.

* pep

* Check if int, old school way.

* pep, once again.

* Create 4910-fix-for-agent-enabled.yml

* Must check the first listentry for enabled=1

* Update changelogs/fragments/4910-fix-for-agent-enabled.yml

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

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

Co-authored-by: ube <ube@alienautopsy.net>
2022-07-12 11:17:40 +02:00
patchback[bot]
2245742255 Misc. typo fixes (#4940) (#4942)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit bf94f08bc4)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2022-07-11 22:18:22 +02:00
patchback[bot]
6058a5e5b1 added password prompt support for machinectl (#4849) (#4941)
* added password prompt support for machinectl

* include review comments

This includes the review comments as well as changelog fragment. This also gives more information about the polkit rule.

* fix yaml doc with leftover bracket

* include review comments 2

* move regex compile to global scope

(cherry picked from commit 35ddf31b5f)

Co-authored-by: Louis Seubert <louis.seubert.ls@gmail.com>
2022-07-11 22:08:53 +02:00
Felix Fontein
224567e604 Prepare 5.3.0 release. 2022-07-11 22:08:31 +02:00
patchback[bot]
1eb872ccea allow configuring opentelementry callback via config file (#4916) (#4938)
this is especially useful for the `enable_from_environment` option, as
this allows to set a default for the whole project, instead of relying
on everyone setting the environment variable

(cherry picked from commit a5ff53f2ae)

Co-authored-by: Evgeni Golov <evgeni@golov.de>
2022-07-07 22:48:20 +02:00
patchback[bot]
ba18d6232a fix lxd connection plugin inventory_hostname (#4912) (#4935)
* fixes lxd connection plugin issue #4886

remote_addr value was set to literal string 'inventory_hostname' instead
of the value for inventory_hostname variable. solution found in PR
ansible/ansible#77894

* changelog fragment - bugfix - lxd connection plugin

* correct changelog fragment

* Update changelogs/fragments/4886-fix-lxd-inventory-hostname.yml

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

* replace _host instance variable with calls to get 'remote_addr' option

suggested by felixfontein

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

Co-authored-by: antonc42 <antonc42@users.noreply.github.com>
2022-07-07 22:40:16 +02:00
patchback[bot]
6115f18837 Fix syntax in rax_clb_nodes that breaks in Python3 (#4933) (#4937)
* Use syntax that works in both Python 2 and 3 when iterating through a
    dict that's going to be mutated during iteration
  * Fixes `dictionary changed size during iteration` error
  * Fixes #4932

(cherry picked from commit 9a928d5ffb)

Co-authored-by: Teddy Caddy <tcaddy@users.noreply.github.com>
2022-07-07 22:37:10 +02:00
patchback[bot]
3f4e3dd2b6 Fix license filenames. (#4923) (#4925)
(cherry picked from commit 1c06e237c8)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-04 20:12:10 +00:00
patchback[bot]
a573661458 Do not ignore tld option in DSV lookup plugin (#4911) (#4921)
* Do not ignore tld option in DSV lookup plugin

* add changelog fragment

* Update changelogs/fragments/4911-dsv-honor-tld-option.yml

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

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

Co-authored-by: andrii-zakurenyi <85106843+andrii-zakurenyi@users.noreply.github.com>
2022-07-04 20:40:25 +02:00
patchback[bot]
0977152b39 Fix GetChassisPower when multiple chassis are present (#4902) (#4915)
* Fix GetChassisPower when multiple chassis are present

When multiple chassis are present, and one or more of those chassis do _not_
report power information, the GetChassisPower command will fail. To address
that, only report a failure if _all_ of the Chassis objects lack power
power reporting functionality.

Fixes #4901

* Update changelogs/fragments/4901-fix-redfish-chassispower.yml

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

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

Co-authored-by: Jacob Yundt <jyundt@gmail.com>
2022-06-30 21:01:52 +02:00
patchback[bot]
91fe881226 Add GetFirmwareVersion command to redfish_info (#4900) (#4913)
* Add GetManagerInventory command to redfish_info

Adding GetManagerInventory command to redfish_info, similar to
GetSystemInventory to report Manager specific information like:
- FirmwareVersion
- Model
- ManagerType

Fixes #4899

* Update changelogs/fragments/4899-add-GetManagerInventory-for-redfish_info.yml

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

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

Co-authored-by: Jacob Yundt <jyundt@gmail.com>
2022-06-30 21:01:37 +02:00
patchback[bot]
b78c0cf64f Improve hwclock support test. (#4904) (#4909)
(cherry picked from commit 674b1da8bf)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-30 07:41:56 +02:00
patchback[bot]
c79ccbbf7e Fix command variable usage in CmdRunner (#4903) (#4906)
* Fix command variable usage

* Add changelog fragment for cmd-runner bugfix (#4903)

(cherry picked from commit 265c052c27)

Co-authored-by: Álvaro García Jaén <garciajaenalvaro@gmail.com>
2022-06-30 07:30:53 +02:00
patchback[bot]
a80761a8a4 Fix various module docs. (#4887) (#4888)
(cherry picked from commit 2dcdd2faca)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-22 22:54:08 +02:00
patchback[bot]
213419fb0c Fix docs. (#4881) (#4884)
(cherry picked from commit aa4c994dfd)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-22 14:44:33 +02:00
patchback[bot]
39a1f280e3 Added additional maintainers for TSS and DSV lookup plugins (#4870) (#4875)
(cherry picked from commit cb58867b57)

Co-authored-by: Ricky White <ricky@migusgroup.com>
2022-06-21 22:55:55 +02:00
Felix Fontein
a13d407247 Next expected release is 5.3.0. 2022-06-21 22:24:51 +02:00
patchback[bot]
ba3903e6e0 Disable opentelemetry installation for unit tests. (#4871) (#4873)
(cherry picked from commit 1eee35dffb)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-21 21:39:38 +02:00
Felix Fontein
4b6b00d249 Release 5.2.0. 2022-06-21 21:24:42 +02:00
patchback[bot]
0a0b0cb42d Fix CI due to pycdlib dropping Python 2 support. (#4865) (#4869)
(cherry picked from commit 297de3011c)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-21 15:03:51 +02:00
patchback[bot]
d0b39271b3 Sudoers validate (#4794) (#4866)
* Use visudo to validate sudoers rules before use

* Replace use of subprocess.Popen with module.run_command

* Switch out apt for package

* Check file mode when verifying file to determine whether something needs to change

* Only install sudo package for debian and redhat environments (when testing)

* Attempt to install sudo on FreeBSD too

* Try just installing sudo for non-darwin machines

* Don't validate file ownership

* Attempt to install sudo on all platforms

* Revert "Attempt to install sudo on all platforms"

This reverts commit b9562a8916.

* Remove file permissions changes from this PR

* Add changelog fragment for 4794 sudoers validation

* Add option to control when sudoers validation is used

* Update changelog fragment

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

* Add version_added to validation property

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

* Also validate failed sudoers validation error message

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

* Make visudo not executable instead of trying to delete it

* Update edge case validation

* Write invalid sudoers file to alternative path to avoid breaking sudo

* Don't try to remove or otherwise modify visudo on Darwin

* Update plugins/modules/system/sudoers.py

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

* Remove trailing extra empty line to appease sanity checker

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

Co-authored-by: Jon Ellis <ellis.jp@gmail.com>
2022-06-21 12:52:21 +02:00
Felix Fontein
f07cb76b09 Prepare 5.2.0 release. 2022-06-20 20:29:04 +02:00
patchback[bot]
09031fc9e6 Add keyring and keyring_info modules (#4764) (#4864)
(cherry picked from commit 45362d39a2)

Co-authored-by: ahussey-redhat <93101976+ahussey-redhat@users.noreply.github.com>
2022-06-20 18:27:10 +00:00
patchback[bot]
4481d0a4a9 redfish_command: VirtualMediaInsert does not work with Supermicro (#4839) (#4863)
* bugfix virtual media support for supermicro hardware

* Added Changelog for PR4839

(cherry picked from commit 5e57d2af0a)

Co-authored-by: FRUCHTiii <57792137+FRUCHTiii@users.noreply.github.com>
2022-06-20 19:29:52 +02:00
patchback[bot]
5861388f11 Remove myself from team_suse (#4860) (#4862)
I do not use `zypper` anymore and can thus not help with issues regarding the zypper module.

(cherry picked from commit 652392be27)

Co-authored-by: Dan Čermák <45594031+dcermak@users.noreply.github.com>
2022-06-20 19:04:32 +02:00
patchback[bot]
c581daa48a sudoers: fix handling of state: absent (#4852) (#4853) (#4858)
* sudoers: fix handling of state: absent (#4852)

* typo fixes

(cherry picked from commit 44e21dd407)

Co-authored-by: s-hamann <10639154+s-hamann@users.noreply.github.com>
2022-06-19 15:48:50 +02:00
patchback[bot]
75e2de3581 Add PSF-license.txt for plugins/module_utils/_mount.py (#4847) (#4848)
* Add PSF-license.txt for plugins/module_utils/_mount.py.

* Move other licenses to licenses/.

* Revert "Move other licenses to licenses/."

This reverts commit eab4209889.

(cherry picked from commit dcdfc9c413)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-17 12:49:08 +02:00
patchback[bot]
6c7bee1225 Add scw_compute_private_network (#4727) (#4845)
* Add scw_compute_private_network

* fix argument required and BOTMETA

* little fix in commentary/doc

* test with link for ansible-doc check

* remove unwanted file

* fix entry missing in  meta/runtime.yml

* scaleway_compute_private_network add some check in test and  some fic in doc

* a=add missing  del os.environ

* fix whitespace

* test_scaleway_compute_private_network : fix test

* test_scaleway_compute_private_network : fix pep8

* scaleway_compute_private_network

add . in description

* scaleway_compute_private_network: fix var name

* [scaleway_compute_private_network] add name for the example's task

* Update plugins/modules/cloud/scaleway/scaleway_compute_private_network.py

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

* Update plugins/modules/cloud/scaleway/scaleway_compute_private_network.py

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

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

Co-authored-by: pastral <52627592+pastral@users.noreply.github.com>
2022-06-15 10:58:13 +02:00
patchback[bot]
eafcdfbceb cmd_runner: add __call__ method to invoke context (#4791) (#4844)
* cmd_runner: add __call__ method to invoke context

* change xfconf to use the callable form

* add changelog fragment

* Update changelogs/fragments/4791-cmd-runner-callable.yaml

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

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

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-06-15 10:58:04 +02:00
patchback[bot]
82a764446b passwordstore: Make compatible with shims (#4780) (#4846)
* passwordstore: Make compatible with shims, add backend config

This allows using the passwordstore plugin with scripts that wrap other
password managers. Also adds an explicit configuration (`backend` in
`ini` and `passwordstore_backend` in `vars`) to set the backend to `pass`
(the default) or `gopass`, which allows using gopass as the backend
without the need of a wrapper script. Please be aware that gopass
support is currently limited, but will work for basic operations.

Includes integrations tests.

Resolves #4766

* Apply suggestions from code review

(cherry picked from commit 006f3bfa89)

Co-authored-by: grembo <freebsd@grem.de>
2022-06-15 10:57:52 +02:00
Felix Fontein
a0032f3513 Next expected release is 5.2.0. 2022-06-14 18:15:59 +02:00
Felix Fontein
8444367cd0 Release 5.1.1. 2022-06-14 17:52:01 +02:00
patchback[bot]
de5fbe457f Fix alternatives module (#4836) (#4840)
* Only pass subcommands when they are specified as module arguments.

* When 'subcommands' is specified, 'link' must be given for every subcommand.

* Extend subcommand tests.

(cherry picked from commit 84d8ca9234)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-14 16:30:42 +02:00
patchback[bot]
40b35acee2 redhat_subscription: call 'remove' instead of 'unsubscribe' (#4809) (#4838)
The 'unsubscribe' command of 'subscription-manager' was deprecated
already in subscription-manager 1.11.3, shipped with RHEL 5.11.
As it was removed in subscription-manager 1.29.x, unsubscribing from
pools was thus broken.

The simple fix is to call the proper command, 'remove'.

(cherry picked from commit a45b90e93f)

Co-authored-by: Pino Toscano <ptoscano@redhat.com>
2022-06-14 07:53:49 +02:00
Felix Fontein
9835deb17f Revert "Print debug output during tests."
This reverts commit 6fe9cf11f1.
2022-06-14 07:43:38 +02:00
Felix Fontein
6fe9cf11f1 Print debug output during tests. 2022-06-14 07:35:29 +02:00
Felix Fontein
d3ebdd2874 Prepare 5.1.1 release. 2022-06-13 22:28:45 +02:00
patchback[bot]
4275bfe87b alternatives: Fix bug with priority default (#4810) (#4835)
* alternatives: Fix bug with priority default

If neigther the priority nor the subcommands where specified the module decided to update the priority with the default value anyway. This resulted in bug #4803 and #4804

* Add changelog fragment.

* Distinguish None from 0.

* Address review comments.

* Update plugins/modules/system/alternatives.py

Co-authored-by: Pilou <pierre-louis@libregerbil.fr>

* Remove unrelated issues from changelog.

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Pilou <pierre-louis@libregerbil.fr>
(cherry picked from commit 57e83ac80b)

Co-authored-by: Marius Rieder <marius.rieder@durchmesser.ch>
2022-06-13 21:51:08 +02:00
patchback[bot]
2f87b8c63f proxmox_kvm: fix typos (#4798) (#4832)
* Typofix

* Update plugins/modules/cloud/misc/proxmox_kvm.py

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

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

Co-authored-by: Wouter Schoot <wouter@schoot.org>
2022-06-13 12:13:16 +02:00
patchback[bot]
100fffb4c1 nmcli: do not convert undefined lists to empty strings (#4813) (#4834)
* do not convert undefined lists to empty strings

* add changelog fragment (#4813)

(cherry picked from commit 72faebffc6)

Co-authored-by: geichelberger <35195803+geichelberger@users.noreply.github.com>
2022-06-13 12:13:05 +02:00
patchback[bot]
1206900488 Ensure managed sudoers config files have 0440 permissions (#4814) (#4828)
* Ensure sudoers config files are created with 0440 permissions to appease visudo validation

* Remove change not required by the bugfix

* Add changelog fragment for 4814 sudoers file permissions

* Update changelogs/fragments/4814-sudoers-file-permissions.yml

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

* Have less oct casting

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

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

Co-authored-by: Jon Ellis <ellis.jp@gmail.com>
2022-06-12 08:59:53 +02:00
patchback[bot]
c28ae26636 Bump AZP container version. (#4819) (#4826)
(cherry picked from commit 42c5024b0b)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-12 08:59:34 +02:00
patchback[bot]
e1e626cdcb requests drops support for older Python (#4818) (#4822)
* requests drops support for older Python.

* Work around CentOS 6 pip bugs.

(cherry picked from commit c8a2c5d375)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-12 08:17:04 +02:00
patchback[bot]
f8d35eeb14 Added conditional to only collect qmpstatus on qemu VMs (#4816) (#4817)
* Added conditional to only collect qmpstatus on qemu VMs

* Processed feedback, added changelog

* Initial change to unit tests

* Made Sanity tests happy again

* Missed a function call, removed superfluous function

* Derp, no need to mock get_vm_status anymore

* Added detail checks whether hosts are mapped to the paused/prelaunch groups

* Fix sanity check

* Processed feedback

* Processed feedback - noqa

(cherry picked from commit 71745b8024)

Co-authored-by: Jeffrey van Pelt <jeff@vanpelt.one>
2022-06-11 13:55:15 +02:00
patchback[bot]
c44298c437 CI: Disable repo URL test for OpenSuSE 15.4 (#4805) (#4808)
* Disable repo URL test for OpenSuSE 15.4.

* Forgot some places.

(cherry picked from commit dd24c98fe5)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-08 22:21:47 +02:00
Felix Fontein
1b580476a8 Next expected release is 5.2.0. 2022-06-07 13:02:20 +02:00
Felix Fontein
44d2d62d38 Release 5.1.0. 2022-06-07 12:43:11 +02:00
patchback[bot]
82b2d294b7 add support to create L2TP and PPTP VPN connection (#4746) (#4793)
* add support to create L2TP and PPTP VPN connection

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* apply changes pointed on tests and review

- add changelog fragment
- change example code to use jinja2 in place of shell command

* removes trailing whitespace

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* removes linux command from examples

* remove unnecessary brakets

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

* remove unnecessary brakets

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

* simplify psk encoding on example

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

* Update plugins/modules/net_tools/nmcli.py

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

* Update plugins/modules/net_tools/nmcli.py

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

* add unit tests

- test unchenged l2tp and pptp vpn connections
- test create l2tp and pptp vpn connections
- fix is_connection_changed to remove default ifname attribuition

* improve tests on vpn.data param

- fix _compare_conn_params to handle vpn.data as lists

* removes block and set_fact from example

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

* makes line shortter to better reading

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

* Update plugins/modules/net_tools/nmcli.py

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

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

Co-authored-by: José Roberto Emerich Junior <jremerich@gmail.com>
2022-06-06 21:57:53 +02:00
patchback[bot]
812fbef786 xfconf module utils: providing a cmd_runner object (#4776) (#4789)
* xfconf: changed implementation to use cmd_runner

* added module_utils/xfconf.py

* xfconf_info: using cmd_runner

* added module_utils to BOTMETA.yml

* added changelog fragment

* use cmd_runner_fmt instead of deprecated form

(cherry picked from commit 8ba3d94740)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-06-06 11:11:25 +02:00
patchback[bot]
9d795c334b ModuleHelperException module utils - improved exception initialization (#4755) (#4786)
* ModuleHelperException module utils - improved exception initialization

* added changelog fragment

* Update plugins/module_utils/mh/exceptions.py

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

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

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-06-06 11:11:15 +02:00
patchback[bot]
512d412eb4 Add subcommands parameter for module alternatives. (#4654) (#4788)
* Add slaves parameter for module alternatives.

* alternatives: Improve documentation abous slaves parameter

* alternatives: Apply suggestions from code review

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

* alternatives: Add schangelog for slaves parameter

* alernatives: Add integration tests

* alternatives: Improv tests

* alternatives: Update tests/integration/targets/alternatives/tasks/slaves.yml

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

* alternatives: Rework logic to support updating priority and subcommands

* alternatives: Use more inclusive naming

* alternatives: Fix linter warnings

* alternatives: Dont fail if link is absent

* alternatives: Update changelog fragment

* alternatives: Add tests for prio change and removing

* alternatives: Apply suggestions from code review

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

* alternatives: Add `state=auto`to reset mode to auto

* alternatives: Fix linter warnings

* alternatives: Fix documentation.

* alternatives: Combine multiple messages.

* alternatives: Set command env for all commands.

* alternatives: Do not update subcommands if parameter is omited

* alternatives: Fix a bug with python 2.7 var scoping

* alternatives: Improce diff before generation

* alternatives: Fix linter warnings

* alternatives: Fix test names

* alternatives: Simplify subcommands handling and improve diffs

* aliases: Only test for subcommand changes if subcommands parameter is set.

* Update plugins/modules/system/alternatives.py

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

* Apply suggestions from code review

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

Co-authored-by: Marius Rieder <marius.rieder@durchmesser.ch>
2022-06-06 10:57:41 +02:00
patchback[bot]
8f0ee6966f Add puppet confdir option (#4740) (#4787)
* Add puppet confdir option

* Add puppet confdir option change fragment

* Improve quoting in plugins/modules/system/puppet.py

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

* Add version_added to plugins/modules/system/puppet.py

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

Co-authored-by: Georg Vogt <georg.vogt@tngtech.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 62ff263ac1)

Co-authored-by: Ge0rgi0s <34042518+Ge0rgi0s@users.noreply.github.com>
2022-06-06 10:57:37 +02:00
patchback[bot]
3af9e39043 cmd_runner: deprecate fmt as the name for the format class (#4777) (#4784)
* cmd_runner: deprecate fmt as the name for the format class

* added changelog fragment

* fixing the deprecation comment

(cherry picked from commit 2d38c8d892)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-06-06 10:57:28 +02:00
Felix Fontein
7b78512c59 Forgot to bump version. 2022-06-06 10:40:44 +02:00
patchback[bot]
9f0913bf73 cmd_runner: added flag check_mode_skip to context (#4736) (#4772)
* cmd_runner: added flag skip_if_check_mode to context

* added changelog fragment

* adjusted param name and added new one

(cherry picked from commit be69f95f63)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-06-06 10:30:32 +02:00
patchback[bot]
aea851018b gconftool2_info: new module (#4743) (#4773)
* gconftool2_info: new module

* fixed imports

* fixed docs for gconftool2_info

* fixed docs for gconftool2_info

* minor adjustment in docs

* added tests

* adjustments

(cherry picked from commit 49836bb484)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-06-06 10:30:24 +02:00
patchback[bot]
69c79f618e ansible_galaxy_install: minor improvements based on MH updates (#4752) (#4774)
* ansible_galaxy_install: minor improvements based on MH updates

* added changelog fragment

(cherry picked from commit d019e22e7d)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-06-06 10:30:15 +02:00
patchback[bot]
6a51ba5169 Proxmox Inventory: added new statuses for qemu (#4723) (#4775)
* added new statuses for qemu

* added document fragment

* lint fixes

* replaced f strings with %

* move the qmpstatus for qemu to a dedicated group

* added documentation to explain the new addition

* update changelog fragment to reflect the change correctly

* update changelog fragment to reflect the change correctly

* Apply suggestions from code review

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

* added a switch to get the qemu extended status

* Apply suggestions from code review

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

* groups created when qemu_extended_statuses is true and added tests to make sure they are there

* added test to make sure the groups are not present when qemu_extended_statuses is false

* Apply suggestions from code review

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

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

Co-authored-by: Ilija Matoski <ilijamt@gmail.com>
2022-06-06 10:30:08 +02:00
Felix Fontein
52e8e7e928 Prepare 5.1.0 release. 2022-06-06 10:28:30 +02:00
Felix Fontein
d71b90be07 Release 5.0.2. 2022-06-06 09:50:15 +02:00
patchback[bot]
1293b0ac91 remove mcodd as maintainer for newrelic_deployment and flowdock modules (#4781) (#4783)
(cherry picked from commit c6d4a0db80)

Co-authored-by: Matt Coddington <coddington@gmail.com>
2022-06-05 21:36:07 +02:00
patchback[bot]
d4330a3e54 nmcli: use capital case "DNS" in documentation, improve examples (#4732) (#4771)
* 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:52 +02:00
patchback[bot]
7c3bf118ca fix trailing whitespace after parameter (#4765) (#4768)
(cherry picked from commit b6e652b440)

Co-authored-by: Markus Bergholz <git@osuv.de>
2022-06-03 18:51:13 +02:00
Felix Fontein
742b438b32 Prepare 5.0.2 release. 2022-06-02 08:22:51 +02:00
patchback[bot]
c59ebc82cd Add simplified_bsd.txt license file (#4759) (#4761)
* 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:53 +02:00
Felix Fontein
36a4fbfe60 Next expected release is 5.0.2. 2022-05-30 19:39:31 +02:00
Felix Fontein
ad3e7bc21d Release 5.0.1. 2022-05-30 13:00:22 +02:00
patchback[bot]
66a7fdfeba keycloak_realm: fix default groups and roles (#4241) (#4719) (#4754)
* 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:41 +02:00
patchback[bot]
77e25a7503 fix invalid fail_json call (#4733) (#4750)
* 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:12:53 +02:00
Felix Fontein
05ac79cee6 Prepare 5.0.1 release. 2022-05-30 07:14:47 +02:00
patchback[bot]
22b4fc8d8b DOC: Documment setting of NTP server in examples. (#4655) (#4748)
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:04:59 +02:00
patchback[bot]
6252f3bded Fix quoting bug in zfs. (#4726) (#4744)
(cherry picked from commit 01b32fec14)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-29 07:59:03 +02:00
patchback[bot]
15c4e08295 Update CI matrix. (#4737) (#4739)
(cherry picked from commit dcb2e09b4a)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-27 14:21:03 +02:00
Felix Fontein
a77bb090b3 Remove no longer needed files.
(cherry picked from commit 1e646aad2d)
2022-05-27 11:23:33 +02:00
patchback[bot]
99958cea49 redfish modules: documentation language and formatting (#4722) (#4725)
* 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:25 +02:00
patchback[bot]
b2802dc8eb redfish_command: documentation typo and language (#4718) (#4721)
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:53 +02:00
patchback[bot]
8617568146 consul: applied bugfix from issue (#4712) (#4716)
* 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:37:08 +02:00
patchback[bot]
7569d6315c Multiple modules using ModuleHelper (#4674) (#4713)
* Multiple modules using ModuleHelper

Replaced raising exception with calling method do_raise() in MH.
Removed the importing of the exception class.

* added changelog fragment

(cherry picked from commit 6052776de1)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-05-23 07:32:54 +02:00
patchback[bot]
ab5143b15d Add RHEL 9.0, FreeBSD 13.1, Ubuntu 22.04 and Fedora 36 to CI, fix bug in filesystem module (#4700) (#4710)
* 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:34 +02:00
patchback[bot]
a71ff614f0 certifi dropped Python 2 support (#4702) (#4705)
* 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:47 +02:00
patchback[bot]
bfd3e15074 Ignore import sanity errors until the modules can be fixed. (#4689) (#4698)
(cherry picked from commit db1010a417)

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

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-18 22:41:15 +02:00
patchback[bot]
056e16baa5 Update lenovoxcc module for compatibility with the virtualMedia resource location from Manager to System (#4682) (#4685)
* 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:47:16 +02:00
Felix Fontein
890cf636a0 Next expected release is 5.1.0. 2022-05-17 16:21:18 +02:00
205 changed files with 3980 additions and 810 deletions

View File

@@ -48,7 +48,7 @@ variables:
resources: resources:
containers: containers:
- container: default - container: default
image: quay.io/ansible/azure-pipelines-test-container:1.9.0 image: quay.io/ansible/azure-pipelines-test-container:3.0.0
pool: Standard pool: Standard
@@ -177,12 +177,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
@@ -251,16 +251,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:
@@ -297,8 +297,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

27
.github/BOTMETA.yml vendored
View File

@@ -214,7 +214,7 @@ files:
$lookups/dnstxt.py: $lookups/dnstxt.py:
maintainers: jpmens maintainers: jpmens
$lookups/dsv.py: $lookups/dsv.py:
maintainers: amigus endlesstrax maintainers: amigus endlesstrax delineaKrehl tylerezimmerman
$lookups/etcd3.py: $lookups/etcd3.py:
maintainers: eric-belhomme maintainers: eric-belhomme
$lookups/etcd.py: $lookups/etcd.py:
@@ -251,9 +251,12 @@ files:
maintainers: RevBits maintainers: RevBits
$lookups/shelvefile.py: {} $lookups/shelvefile.py: {}
$lookups/tss.py: $lookups/tss.py:
maintainers: amigus endlesstrax maintainers: amigus endlesstrax delineaKrehl tylerezimmerman
$module_utils/: $module_utils/:
labels: module_utils labels: module_utils
$module_utils/gconftool2.py:
maintainers: russoz
labels: gconftool2
$module_utils/gitlab.py: $module_utils/gitlab.py:
notify: jlozadad notify: jlozadad
maintainers: $team_gitlab maintainers: $team_gitlab
@@ -304,6 +307,9 @@ files:
$module_utils/xenserver.py: $module_utils/xenserver.py:
maintainers: bvitnik maintainers: bvitnik
labels: xenserver labels: xenserver
$module_utils/xfconf.py:
maintainers: russoz
labels: xfconf
$modules/cloud/alicloud/: $modules/cloud/alicloud/:
maintainers: xiaozhu36 maintainers: xiaozhu36
$modules/cloud/atomic/atomic_container.py: $modules/cloud/atomic/atomic_container.py:
@@ -434,6 +440,8 @@ files:
maintainers: claco maintainers: claco
$modules/cloud/scaleway/: $modules/cloud/scaleway/:
maintainers: $team_scaleway maintainers: $team_scaleway
$modules/cloud/scaleway/scaleway_compute_private_network.py:
maintainers: pastral
$modules/cloud/scaleway/scaleway_database_backup.py: $modules/cloud/scaleway/scaleway_database_backup.py:
maintainers: guillaume_ro_fr maintainers: guillaume_ro_fr
$modules/cloud/scaleway/scaleway_image_info.py: $modules/cloud/scaleway/scaleway_image_info.py:
@@ -615,7 +623,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
@@ -707,7 +715,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:
@@ -1024,7 +1032,7 @@ files:
$modules/system/alternatives.py: $modules/system/alternatives.py:
maintainers: mulby maintainers: mulby
labels: alternatives labels: alternatives
ignore: DavidWittman ignore: DavidWittman jiuka
$modules/system/aix_lvol.py: $modules/system/aix_lvol.py:
maintainers: adejoux maintainers: adejoux
$modules/system/awall.py: $modules/system/awall.py:
@@ -1052,6 +1060,9 @@ files:
$modules/system/gconftool2.py: $modules/system/gconftool2.py:
maintainers: Akasurde kevensen maintainers: Akasurde kevensen
labels: gconftool2 labels: gconftool2
$modules/system/gconftool2_info.py:
maintainers: russoz
labels: gconftool2
$modules/system/homectl.py: $modules/system/homectl.py:
maintainers: jameslivulpi maintainers: jameslivulpi
$modules/system/interfaces_file.py: $modules/system/interfaces_file.py:
@@ -1059,6 +1070,10 @@ files:
labels: interfaces_file labels: interfaces_file
$modules/system/iptables_state.py: $modules/system/iptables_state.py:
maintainers: quidame maintainers: quidame
$modules/system/keyring.py:
maintainers: ahussey-redhat
$modules/system/keyring_info.py:
maintainers: ahussey-redhat
$modules/system/shutdown.py: $modules/system/shutdown.py:
maintainers: nitzmahone samdoran aminvakil maintainers: nitzmahone samdoran aminvakil
$modules/system/java_cert.py: $modules/system/java_cert.py:
@@ -1281,5 +1296,5 @@ macros:
team_rhn: FlossWare alikins barnabycourt vritant team_rhn: FlossWare alikins barnabycourt vritant
team_scaleway: remyleone abarbare team_scaleway: remyleone abarbare
team_solaris: bcoca fishman jasperla jpdasma mator scathatheworm troy2914 xen0l team_solaris: bcoca fishman jasperla jpdasma mator scathatheworm troy2914 xen0l
team_suse: commel dcermak evrardjp lrupp toabctl AnderEnder alxgu andytom sealor team_suse: commel evrardjp lrupp toabctl AnderEnder alxgu andytom sealor
team_virt: joshainglis karmab tleguern Thulium-Drake Ajpantuso team_virt: joshainglis karmab tleguern Thulium-Drake Ajpantuso

View File

@@ -105,7 +105,7 @@ body:
attributes: attributes:
label: Steps to Reproduce label: Steps to Reproduce
description: | description: |
Describe exactly how to reproduce the problem, using a minimal test-case. It would *really* help us understand your problem if you could also pased any playbooks, configs and commands you used. Describe exactly how to reproduce the problem, using a minimal test-case. It would *really* help us understand your problem if you could also passed any playbooks, configs and commands you used.
**HINT:** You can paste https://gist.github.com links for larger files. **HINT:** You can paste https://gist.github.com links for larger files.
value: | value: |

View File

@@ -6,6 +6,167 @@ Community General Release Notes
This changelog describes changes after version 4.0.0. This changelog describes changes after version 4.0.0.
v5.3.0
======
Release Summary
---------------
Regular bugfix and feature release.
Minor Changes
-------------
- machinectl become plugin - can now be used with a password from another user than root, if a polkit rule is present (https://github.com/ansible-collections/community.general/pull/4849).
- opentelemetry callback plugin - allow configuring opentelementry callback via config file (https://github.com/ansible-collections/community.general/pull/4916).
- redfish_info - add ``GetManagerInventory`` to report list of Manager inventory information (https://github.com/ansible-collections/community.general/issues/4899).
Bugfixes
--------
- cmd_runner module utils - fix bug caused by using the ``command`` variable instead of ``self.command`` when looking for binary path (https://github.com/ansible-collections/community.general/pull/4903).
- dsv lookup plugin - do not ignore the ``tld`` parameter (https://github.com/ansible-collections/community.general/pull/4911).
- lxd connection plugin - fix incorrect ``inventory_hostname`` in ``remote_addr``. This is needed for compatibility with ansible-core 2.13 (https://github.com/ansible-collections/community.general/issues/4886).
- proxmox inventory plugin - fix crash when ``enabled=1`` is used in agent config string (https://github.com/ansible-collections/community.general/pull/4910).
- rax_clb_nodes - fix code to be compatible with Python 3 (https://github.com/ansible-collections/community.general/pull/4933).
- redfish_info - fix to ``GetChassisPower`` to correctly report power information when multiple chassis exist, but not all chassis report power information (https://github.com/ansible-collections/community.general/issues/4901).
v5.2.0
======
Release Summary
---------------
Regular bugfix and feature release.
Minor Changes
-------------
- cmd_runner module utils - add ``__call__`` method to invoke context (https://github.com/ansible-collections/community.general/pull/4791).
- passwordstore lookup plugin - allow using alternative password managers by detecting wrapper scripts, allow explicit configuration of pass and gopass backends (https://github.com/ansible-collections/community.general/issues/4766).
- sudoers - will attempt to validate the proposed sudoers rule using visudo if available, optionally skipped, or required (https://github.com/ansible-collections/community.general/pull/4794, https://github.com/ansible-collections/community.general/issues/4745).
Bugfixes
--------
- Include ``PSF-license.txt`` file for ``plugins/module_utils/_mount.py``.
- redfish_command - fix the check if a virtual media is unmounted to just check for ``instered= false`` caused by Supermicro hardware that does not clear the ``ImageName`` (https://github.com/ansible-collections/community.general/pull/4839).
- redfish_command - the Supermicro Redfish implementation only supports the ``image_url`` parameter in the underlying API calls to ``VirtualMediaInsert`` and ``VirtualMediaEject``. Any values set (or the defaults) for ``write_protected`` or ``inserted`` will be ignored (https://github.com/ansible-collections/community.general/pull/4839).
- sudoers - fix incorrect handling of ``state: absent`` (https://github.com/ansible-collections/community.general/issues/4852).
New Modules
-----------
Cloud
~~~~~
scaleway
^^^^^^^^
- scaleway_compute_private_network - Scaleway compute - private network management
System
~~~~~~
- keyring - Set or delete a passphrase using the Operating System's native keyring
- keyring_info - Get a passphrase using the Operating System's native keyring
v5.1.1
======
Release Summary
---------------
Bugfix release.
Bugfixes
--------
- alternatives - do not set the priority if the priority was not set by the user (https://github.com/ansible-collections/community.general/pull/4810).
- alternatives - only pass subcommands when they are specified as module arguments (https://github.com/ansible-collections/community.general/issues/4803, https://github.com/ansible-collections/community.general/issues/4804, https://github.com/ansible-collections/community.general/pull/4836).
- alternatives - when ``subcommands`` is specified, ``link`` must be given for every subcommand. This was already mentioned in the documentation, but not enforced by the code (https://github.com/ansible-collections/community.general/pull/4836).
- nmcli - fix error caused by adding undefined module arguments for list options (https://github.com/ansible-collections/community.general/issues/4373, https://github.com/ansible-collections/community.general/pull/4813).
- proxmox inventory plugin - fixed extended status detection for qemu (https://github.com/ansible-collections/community.general/pull/4816).
- redhat_subscription - fix unsubscribing on RHEL 9 (https://github.com/ansible-collections/community.general/issues/4741).
- sudoers - ensure sudoers config files are created with the permissions requested by sudoers (0440) (https://github.com/ansible-collections/community.general/pull/4814).
v5.1.0
======
Release Summary
---------------
Regular bugfix and feature release.
Minor Changes
-------------
- ModuleHelper module utils - improved ``ModuleHelperException``, using ``to_native()`` for the exception message (https://github.com/ansible-collections/community.general/pull/4755).
- alternatives - add ``state=absent`` to be able to remove an alternative (https://github.com/ansible-collections/community.general/pull/4654).
- alternatives - add ``subcommands`` parameter (https://github.com/ansible-collections/community.general/pull/4654).
- ansible_galaxy_install - minor refactoring using latest ``ModuleHelper`` updates (https://github.com/ansible-collections/community.general/pull/4752).
- cmd_runner module util - added parameters ``check_mode_skip`` and ``check_mode_return`` to ``CmdRunner.context()``, so that the command is not executed when ``check_mode=True`` (https://github.com/ansible-collections/community.general/pull/4736).
- nmcli - adds ``vpn`` type and parameter for supporting VPN with service type L2TP and PPTP (https://github.com/ansible-collections/community.general/pull/4746).
- proxmox inventory plugin - added new flag ``qemu_extended_statuses`` and new groups ``<group_prefix>prelaunch``, ``<group_prefix>paused``. They will be populated only when ``want_facts=true``, ``qemu_extended_statuses=true`` and only for ``QEMU`` machines (https://github.com/ansible-collections/community.general/pull/4723).
- puppet - adds ``confdir`` parameter to configure a custom confir location (https://github.com/ansible-collections/community.general/pull/4740).
- xfconf - changed implementation to use ``cmd_runner`` (https://github.com/ansible-collections/community.general/pull/4776).
- xfconf module utils - created new module util ``xfconf`` providing a ``cmd_runner`` specific for ``xfconf`` modules (https://github.com/ansible-collections/community.general/pull/4776).
- xfconf_info - changed implementation to use ``cmd_runner`` (https://github.com/ansible-collections/community.general/pull/4776).
Deprecated Features
-------------------
- cmd_runner module utils - deprecated ``fmt`` in favour of ``cmd_runner_fmt`` as the parameter format object (https://github.com/ansible-collections/community.general/pull/4777).
New Modules
-----------
System
~~~~~~
- gconftool2_info - Retrieve GConf configurations
v5.0.2
======
Release Summary
---------------
Maintenance and bugfix release for Ansible 6.0.0.
Bugfixes
--------
- Include ``simplified_bsd.txt`` license file for various module utils, the ``lxca_common`` docs fragment, and the ``utm_utils`` unit tests.
v5.0.1
======
Release Summary
---------------
Regular bugfix release for inclusion in Ansible 6.0.0.
Minor Changes
-------------
- cpanm - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
- mksysb - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
- pipx - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
- snap - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
- xfconf - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
Bugfixes
--------
- 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).
- 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).
- zfs - fix wrong quoting of properties (https://github.com/ansible-collections/community.general/issues/4707, https://github.com/ansible-collections/community.general/pull/4726).
v5.0.0 v5.0.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

@@ -755,3 +755,195 @@ releases:
name: counter name: counter
namespace: null namespace: null
release_date: '2022-04-29' release_date: '2022-04-29'
5.0.1:
changes:
bugfixes:
- 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).
- 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).
- zfs - fix wrong quoting of properties (https://github.com/ansible-collections/community.general/issues/4707,
https://github.com/ansible-collections/community.general/pull/4726).
minor_changes:
- cpanm - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
modules (https://github.com/ansible-collections/community.general/pull/4674).
- mksysb - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
modules (https://github.com/ansible-collections/community.general/pull/4674).
- pipx - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
modules (https://github.com/ansible-collections/community.general/pull/4674).
- snap - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
modules (https://github.com/ansible-collections/community.general/pull/4674).
- xfconf - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
modules (https://github.com/ansible-collections/community.general/pull/4674).
release_summary: Regular bugfix release for inclusion in Ansible 6.0.0.
fragments:
- 4674-use-mh-raise.yaml
- 4682-compatibility-virtualmedia-resource-location.yaml
- 4700-code-changes.yml
- 4712-consul-bugfix.yaml
- 4719-fix-keycloak-realm.yaml
- 4726-zfs.yml
- 4733-redis-fail.yml
- 5.0.1.yml
release_date: '2022-05-30'
5.0.2:
changes:
bugfixes:
- Include ``simplified_bsd.txt`` license file for various module utils, the
``lxca_common`` docs fragment, and the ``utm_utils`` unit tests.
release_summary: Maintenance and bugfix release for Ansible 6.0.0.
fragments:
- 5.0.2.yml
- simplified-bsd-license.yml
release_date: '2022-06-06'
5.1.0:
changes:
deprecated_features:
- cmd_runner module utils - deprecated ``fmt`` in favour of ``cmd_runner_fmt``
as the parameter format object (https://github.com/ansible-collections/community.general/pull/4777).
minor_changes:
- ModuleHelper module utils - improved ``ModuleHelperException``, using ``to_native()``
for the exception message (https://github.com/ansible-collections/community.general/pull/4755).
- alternatives - add ``state=absent`` to be able to remove an alternative (https://github.com/ansible-collections/community.general/pull/4654).
- alternatives - add ``subcommands`` parameter (https://github.com/ansible-collections/community.general/pull/4654).
- ansible_galaxy_install - minor refactoring using latest ``ModuleHelper`` updates
(https://github.com/ansible-collections/community.general/pull/4752).
- cmd_runner module util - added parameters ``check_mode_skip`` and ``check_mode_return``
to ``CmdRunner.context()``, so that the command is not executed when ``check_mode=True``
(https://github.com/ansible-collections/community.general/pull/4736).
- nmcli - adds ``vpn`` type and parameter for supporting VPN with service type
L2TP and PPTP (https://github.com/ansible-collections/community.general/pull/4746).
- proxmox inventory plugin - added new flag ``qemu_extended_statuses`` and new
groups ``<group_prefix>prelaunch``, ``<group_prefix>paused``. They will be
populated only when ``want_facts=true``, ``qemu_extended_statuses=true`` and
only for ``QEMU`` machines (https://github.com/ansible-collections/community.general/pull/4723).
- puppet - adds ``confdir`` parameter to configure a custom confir location
(https://github.com/ansible-collections/community.general/pull/4740).
- xfconf - changed implementation to use ``cmd_runner`` (https://github.com/ansible-collections/community.general/pull/4776).
- xfconf module utils - created new module util ``xfconf`` providing a ``cmd_runner``
specific for ``xfconf`` modules (https://github.com/ansible-collections/community.general/pull/4776).
- xfconf_info - changed implementation to use ``cmd_runner`` (https://github.com/ansible-collections/community.general/pull/4776).
release_summary: Regular bugfix and feature release.
fragments:
- 4654-alternatives-add-subcommands.yml
- 4724-proxmox-qemu-extend.yaml
- 4736-cmd-runner-skip-if-check.yml
- 4740-puppet-feature.yaml
- 4746-add-vpn-support-nmcli.yaml
- 4752-ansible-galaxy-install-mh-updates.yml
- 4755-mhexception-improvement.yml
- 4776-xfconf-cmd-runner.yaml
- 4777-cmd-runner-deprecate-fmt.yaml
- 5.1.0.yml
modules:
- description: Retrieve GConf configurations
name: gconftool2_info
namespace: system
release_date: '2022-06-07'
5.1.1:
changes:
bugfixes:
- alternatives - do not set the priority if the priority was not set by the
user (https://github.com/ansible-collections/community.general/pull/4810).
- alternatives - only pass subcommands when they are specified as module arguments
(https://github.com/ansible-collections/community.general/issues/4803, https://github.com/ansible-collections/community.general/issues/4804,
https://github.com/ansible-collections/community.general/pull/4836).
- alternatives - when ``subcommands`` is specified, ``link`` must be given for
every subcommand. This was already mentioned in the documentation, but not
enforced by the code (https://github.com/ansible-collections/community.general/pull/4836).
- nmcli - fix error caused by adding undefined module arguments for list options
(https://github.com/ansible-collections/community.general/issues/4373, https://github.com/ansible-collections/community.general/pull/4813).
- proxmox inventory plugin - fixed extended status detection for qemu (https://github.com/ansible-collections/community.general/pull/4816).
- redhat_subscription - fix unsubscribing on RHEL 9 (https://github.com/ansible-collections/community.general/issues/4741).
- sudoers - ensure sudoers config files are created with the permissions requested
by sudoers (0440) (https://github.com/ansible-collections/community.general/pull/4814).
release_summary: Bugfix release.
fragments:
- 4809-redhat_subscription-unsubscribe.yaml
- 4810-alternatives-bug.yml
- 4813-fix-nmcli-convert-list.yaml
- 4814-sudoers-file-permissions.yml
- 4816-proxmox-fix-extended-status.yaml
- 4836-alternatives.yml
- 5.1.1.yml
release_date: '2022-06-14'
5.2.0:
changes:
bugfixes:
- Include ``PSF-license.txt`` file for ``plugins/module_utils/_mount.py``.
- redfish_command - fix the check if a virtual media is unmounted to just check
for ``instered= false`` caused by Supermicro hardware that does not clear
the ``ImageName`` (https://github.com/ansible-collections/community.general/pull/4839).
- redfish_command - the Supermicro Redfish implementation only supports the
``image_url`` parameter in the underlying API calls to ``VirtualMediaInsert``
and ``VirtualMediaEject``. Any values set (or the defaults) for ``write_protected``
or ``inserted`` will be ignored (https://github.com/ansible-collections/community.general/pull/4839).
- 'sudoers - fix incorrect handling of ``state: absent`` (https://github.com/ansible-collections/community.general/issues/4852).'
minor_changes:
- cmd_runner module utils - add ``__call__`` method to invoke context (https://github.com/ansible-collections/community.general/pull/4791).
- passwordstore lookup plugin - allow using alternative password managers by
detecting wrapper scripts, allow explicit configuration of pass and gopass
backends (https://github.com/ansible-collections/community.general/issues/4766).
- sudoers - will attempt to validate the proposed sudoers rule using visudo
if available, optionally skipped, or required (https://github.com/ansible-collections/community.general/pull/4794,
https://github.com/ansible-collections/community.general/issues/4745).
release_summary: Regular bugfix and feature release.
fragments:
- 4780-passwordstore-wrapper-compat.yml
- 4791-cmd-runner-callable.yaml
- 4794-sudoers-validation.yml
- 4839-fix-VirtualMediaInsert-Supermicro.yml
- 4852-sudoers-state-absent.yml
- 5.2.0.yml
- psf-license.yml
modules:
- description: Set or delete a passphrase using the Operating System's native
keyring
name: keyring
namespace: system
- description: Get a passphrase using the Operating System's native keyring
name: keyring_info
namespace: system
- description: Scaleway compute - private network management
name: scaleway_compute_private_network
namespace: cloud.scaleway
release_date: '2022-06-21'
5.3.0:
changes:
bugfixes:
- cmd_runner module utils - fix bug caused by using the ``command`` variable
instead of ``self.command`` when looking for binary path (https://github.com/ansible-collections/community.general/pull/4903).
- dsv lookup plugin - do not ignore the ``tld`` parameter (https://github.com/ansible-collections/community.general/pull/4911).
- lxd connection plugin - fix incorrect ``inventory_hostname`` in ``remote_addr``.
This is needed for compatibility with ansible-core 2.13 (https://github.com/ansible-collections/community.general/issues/4886).
- proxmox inventory plugin - fix crash when ``enabled=1`` is used in agent config
string (https://github.com/ansible-collections/community.general/pull/4910).
- rax_clb_nodes - fix code to be compatible with Python 3 (https://github.com/ansible-collections/community.general/pull/4933).
- redfish_info - fix to ``GetChassisPower`` to correctly report power information
when multiple chassis exist, but not all chassis report power information
(https://github.com/ansible-collections/community.general/issues/4901).
minor_changes:
- machinectl become plugin - can now be used with a password from another user
than root, if a polkit rule is present (https://github.com/ansible-collections/community.general/pull/4849).
- opentelemetry callback plugin - allow configuring opentelementry callback
via config file (https://github.com/ansible-collections/community.general/pull/4916).
- redfish_info - add ``GetManagerInventory`` to report list of Manager inventory
information (https://github.com/ansible-collections/community.general/issues/4899).
release_summary: Regular bugfix and feature release.
fragments:
- 4849-add-password-prompt-support-for-machinectl.yml
- 4886-fix-lxd-inventory-hostname.yml
- 4899-add-GetManagerInventory-for-redfish_info.yml
- 4901-fix-redfish-chassispower.yml
- 4903-cmdrunner-bugfix.yaml
- 4910-fix-for-agent-enabled.yml
- 4911-dsv-honor-tld-option.yml
- 4916-opentelemetry-ini-options.yaml
- 4933-fix-rax-clb-nodes.yaml
- 5.3.0.yml
release_date: '2022-07-12'

View File

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

View File

@@ -292,6 +292,8 @@ plugin_routing:
redirect: community.google.gce_tag redirect: community.google.gce_tag
gconftool2: gconftool2:
redirect: community.general.system.gconftool2 redirect: community.general.system.gconftool2
gconftool2_info:
redirect: community.general.system.gconftool2_info
gcp_backend_service: gcp_backend_service:
tombstone: tombstone:
removal_version: 2.0.0 removal_version: 2.0.0
@@ -606,6 +608,10 @@ plugin_routing:
redirect: community.general.identity.keycloak.keycloak_role redirect: community.general.identity.keycloak.keycloak_role
keycloak_user_federation: keycloak_user_federation:
redirect: community.general.identity.keycloak.keycloak_user_federation redirect: community.general.identity.keycloak.keycloak_user_federation
keyring:
redirect: community.general.system.keyring
keyring_info:
redirect: community.general.system.keyring_info
kibana_plugin: kibana_plugin:
redirect: community.general.database.misc.kibana_plugin redirect: community.general.database.misc.kibana_plugin
kubevirt_cdi_upload: kubevirt_cdi_upload:
@@ -1355,6 +1361,8 @@ plugin_routing:
redirect: community.general.notification.say redirect: community.general.notification.say
scaleway_compute: scaleway_compute:
redirect: community.general.cloud.scaleway.scaleway_compute redirect: community.general.cloud.scaleway.scaleway_compute
scaleway_compute_private_network:
redirect: community.general.cloud.scaleway.scaleway_compute_private_network
scaleway_database_backup: scaleway_database_backup:
redirect: community.general.cloud.scaleway.scaleway_database_backup redirect: community.general.cloud.scaleway.scaleway_database_backup
scaleway_image_facts: scaleway_image_facts:

View File

@@ -66,15 +66,46 @@ DOCUMENTATION = '''
ini: ini:
- section: machinectl_become_plugin - section: machinectl_become_plugin
key: password key: password
notes:
- When not using this plugin with user C(root), it only works correctly with a polkit rule which will alter
the behaviour of machinectl. This rule must alter the prompt behaviour to ask directly for the user credentials,
if the user is allowed to perform the action (take a look at the examples section).
If such a rule is not present the plugin only work if it is used in context with the root user,
because then no further prompt will be shown by machinectl.
''' '''
EXAMPLES = r'''
# A polkit rule needed to use the module with a non-root user.
# See the Notes section for details.
60-machinectl-fast-user-auth.rules: |
polkit.addRule(function(action, subject) {
if(action.id == "org.freedesktop.machine1.host-shell" && subject.isInGroup("wheel")) {
return polkit.Result.AUTH_SELF_KEEP;
}
});
'''
from re import compile as re_compile
from ansible.plugins.become import BecomeBase from ansible.plugins.become import BecomeBase
from ansible.module_utils._text import to_bytes
ansi_color_codes = re_compile(to_bytes(r'\x1B\[[0-9;]+m'))
class BecomeModule(BecomeBase): class BecomeModule(BecomeBase):
name = 'community.general.machinectl' name = 'community.general.machinectl'
prompt = 'Password: '
fail = ('==== AUTHENTICATION FAILED ====',)
success = ('==== AUTHENTICATION COMPLETE ====',)
@staticmethod
def remove_ansi_codes(line):
return ansi_color_codes.sub(b"", line)
def build_become_command(self, cmd, shell): def build_become_command(self, cmd, shell):
super(BecomeModule, self).build_become_command(cmd, shell) super(BecomeModule, self).build_become_command(cmd, shell)
@@ -86,3 +117,15 @@ class BecomeModule(BecomeBase):
flags = self.get_option('become_flags') flags = self.get_option('become_flags')
user = self.get_option('become_user') user = self.get_option('become_user')
return '%s -q shell %s %s@ %s' % (become, flags, user, cmd) return '%s -q shell %s %s@ %s' % (become, flags, user, cmd)
def check_success(self, b_output):
b_output = self.remove_ansi_codes(b_output)
return super().check_success(b_output)
def check_incorrect_password(self, b_output):
b_output = self.remove_ansi_codes(b_output)
return super().check_incorrect_password(b_output)
def check_missing_password(self, b_output):
b_output = self.remove_ansi_codes(b_output)
return super().check_missing_password(b_output)

View File

@@ -12,7 +12,7 @@ DOCUMENTATION = '''
type: notification type: notification
short_description: write playbook output to log file short_description: write playbook output to log file
description: description:
- This callback writes playbook output to a file per host in the `/var/log/ansible/hosts` directory - This callback writes playbook output to a file per host in the C(/var/log/ansible/hosts) directory
requirements: requirements:
- Whitelist in configuration - Whitelist in configuration
- A writeable /var/log/ansible/hosts directory by the user executing Ansible on the controller - A writeable /var/log/ansible/hosts directory by the user executing Ansible on the controller

View File

@@ -24,6 +24,10 @@ DOCUMENTATION = '''
- Hide the arguments for a task. - Hide the arguments for a task.
env: env:
- name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS - name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
ini:
- section: callback_opentelemetry
key: hide_task_arguments
version_added: 5.3.0
enable_from_environment: enable_from_environment:
type: str type: str
description: description:
@@ -34,6 +38,10 @@ DOCUMENTATION = '''
and if set to true this plugin will be enabled. and if set to true this plugin will be enabled.
env: env:
- name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT - name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
ini:
- section: callback_opentelemetry
key: enable_from_environment
version_added: 5.3.0
version_added: 3.8.0 version_added: 3.8.0
otel_service_name: otel_service_name:
default: ansible default: ansible
@@ -42,6 +50,10 @@ DOCUMENTATION = '''
- The service name resource attribute. - The service name resource attribute.
env: env:
- name: OTEL_SERVICE_NAME - name: OTEL_SERVICE_NAME
ini:
- section: callback_opentelemetry
key: otel_service_name
version_added: 5.3.0
traceparent: traceparent:
default: None default: None
type: str type: str
@@ -61,11 +73,14 @@ examples: |
Enable the plugin in ansible.cfg: Enable the plugin in ansible.cfg:
[defaults] [defaults]
callbacks_enabled = community.general.opentelemetry callbacks_enabled = community.general.opentelemetry
[callback_opentelemetry]
enable_from_environment = ANSIBLE_OPENTELEMETRY_ENABLED
Set the environment variable: Set the environment variable:
export OTEL_EXPORTER_OTLP_ENDPOINT=<your endpoint (OTLP/HTTP)> export OTEL_EXPORTER_OTLP_ENDPOINT=<your endpoint (OTLP/HTTP)>
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer your_otel_token" export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer your_otel_token"
export OTEL_SERVICE_NAME=your_service_name export OTEL_SERVICE_NAME=your_service_name
export ANSIBLE_OPENTELEMETRY_ENABLED=true
''' '''
import getpass import getpass

View File

@@ -14,9 +14,9 @@ DOCUMENTATION = '''
- set as main display callback - set as main display callback
short_description: only print certain tasks short_description: only print certain tasks
description: description:
- This callback only prints tasks that have been tagged with `print_action` or that have failed. - This callback only prints tasks that have been tagged with C(print_action) or that have failed.
This allows operators to focus on the tasks that provide value only. This allows operators to focus on the tasks that provide value only.
- Tasks that are not printed are placed with a '.'. - Tasks that are not printed are placed with a C(.).
- If you increase verbosity all tasks are printed. - If you increase verbosity all tasks are printed.
options: options:
nocolor: nocolor:

View File

@@ -18,6 +18,7 @@ DOCUMENTATION = '''
- Container identifier. - Container identifier.
default: inventory_hostname default: inventory_hostname
vars: vars:
- name: inventory_hostname
- name: ansible_host - name: ansible_host
- name: ansible_lxd_host - name: ansible_lxd_host
executable: executable:
@@ -61,7 +62,6 @@ class Connection(ConnectionBase):
def __init__(self, play_context, new_stdin, *args, **kwargs): def __init__(self, play_context, new_stdin, *args, **kwargs):
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs) super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
self._host = self._play_context.remote_addr
try: try:
self._lxc_cmd = get_bin_path("lxc") self._lxc_cmd = get_bin_path("lxc")
except ValueError: except ValueError:
@@ -75,14 +75,14 @@ class Connection(ConnectionBase):
super(Connection, self)._connect() super(Connection, self)._connect()
if not self._connected: if not self._connected:
self._display.vvv(u"ESTABLISH LXD CONNECTION FOR USER: root", host=self._host) self._display.vvv(u"ESTABLISH LXD CONNECTION FOR USER: root", host=self.get_option('remote_addr'))
self._connected = True self._connected = True
def exec_command(self, cmd, in_data=None, sudoable=True): def exec_command(self, cmd, in_data=None, sudoable=True):
""" execute a command on the lxd host """ """ execute a command on the lxd host """
super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
self._display.vvv(u"EXEC {0}".format(cmd), host=self._host) self._display.vvv(u"EXEC {0}".format(cmd), host=self.get_option('remote_addr'))
local_cmd = [self._lxc_cmd] local_cmd = [self._lxc_cmd]
if self.get_option("project"): if self.get_option("project"):
@@ -104,10 +104,10 @@ class Connection(ConnectionBase):
stderr = to_text(stderr) stderr = to_text(stderr)
if stderr == "error: Container is not running.\n": if stderr == "error: Container is not running.\n":
raise AnsibleConnectionFailure("container not running: %s" % self._host) raise AnsibleConnectionFailure("container not running: %s" % self.get_option('remote_addr'))
if stderr == "error: not found\n": if stderr == "error: not found\n":
raise AnsibleConnectionFailure("container not found: %s" % self._host) raise AnsibleConnectionFailure("container not found: %s" % self.get_option('remote_addr'))
return process.returncode, stdout, stderr return process.returncode, stdout, stderr
@@ -115,7 +115,7 @@ class Connection(ConnectionBase):
""" put a file from local to lxd """ """ put a file from local to lxd """
super(Connection, self).put_file(in_path, out_path) super(Connection, self).put_file(in_path, out_path)
self._display.vvv(u"PUT {0} TO {1}".format(in_path, out_path), host=self._host) self._display.vvv(u"PUT {0} TO {1}".format(in_path, out_path), host=self.get_option('remote_addr'))
if not os.path.isfile(to_bytes(in_path, errors='surrogate_or_strict')): if not os.path.isfile(to_bytes(in_path, errors='surrogate_or_strict')):
raise AnsibleFileNotFound("input path is not a file: %s" % in_path) raise AnsibleFileNotFound("input path is not a file: %s" % in_path)
@@ -138,7 +138,7 @@ class Connection(ConnectionBase):
""" fetch a file from lxd to local """ """ fetch a file from lxd to local """
super(Connection, self).fetch_file(in_path, out_path) super(Connection, self).fetch_file(in_path, out_path)
self._display.vvv(u"FETCH {0} TO {1}".format(in_path, out_path), host=self._host) self._display.vvv(u"FETCH {0} TO {1}".format(in_path, out_path), host=self.get_option('remote_addr'))
local_cmd = [self._lxc_cmd] local_cmd = [self._lxc_cmd]
if self.get_option("project"): if self.get_option("project"):

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

@@ -21,7 +21,7 @@ DOCUMENTATION = '''
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: Count occurences - name: Count occurrences
ansible.builtin.debug: ansible.builtin.debug:
msg: >- msg: >-
{{ [1, 'a', 2, 2, 'a', 'b', 'a'] | community.general.counter }} {{ [1, 'a', 2, 2, 'a', 'b', 'a'] | community.general.counter }}
@@ -30,7 +30,7 @@ EXAMPLES = '''
RETURN = ''' RETURN = '''
_value: _value:
description: A dictionary with the elements of the sequence as keys, and their number of occurance in the sequence as values. description: A dictionary with the elements of the sequence as keys, and their number of occurrences in the sequence as values.
type: dictionary type: dictionary
''' '''

View File

@@ -38,7 +38,7 @@ DOCUMENTATION = '''
parser: parser:
description: description:
- The correct parser for the input data. - The correct parser for the input data.
- For exmaple C(ifconfig). - For example C(ifconfig).
- See U(https://github.com/kellyjonbrazil/jc#parsers) for the latest list of parsers. - See U(https://github.com/kellyjonbrazil/jc#parsers) for the latest list of parsers.
type: string type: string
required: true required: true

View File

@@ -213,7 +213,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
self.inventory.add_child(parent_group_name, group_name) self.inventory.add_child(parent_group_name, group_name)
else: else:
self.display.vvvv('Processing profile %s without parent\n' % profile['name']) self.display.vvvv('Processing profile %s without parent\n' % profile['name'])
# Create a heirarchy of profile names # Create a hierarchy of profile names
profile_elements = profile['name'].split('-') profile_elements = profile['name'].split('-')
i = 0 i = 0
while i < len(profile_elements) - 1: while i < len(profile_elements) - 1:

View File

@@ -522,7 +522,7 @@ class InventoryModule(BaseInventoryPlugin):
"""Helper to save data """Helper to save data
Helper to save the data in self.data Helper to save the data in self.data
Detect if data is allready in branch and use dict_merge() to prevent that branch is overwritten. Detect if data is already in branch and use dict_merge() to prevent that branch is overwritten.
Args: Args:
str(instance_name): name of instance str(instance_name): name of instance

View File

@@ -92,9 +92,21 @@ DOCUMENTATION = '''
default: proxmox_ default: proxmox_
type: str type: str
want_facts: want_facts:
description: Gather LXC/QEMU configuration facts. description:
- Gather LXC/QEMU configuration facts.
- When I(want_facts) is set to C(true) more details about QEMU VM status are possible, besides the running and stopped states.
Currently if the VM is running and it is suspended, the status will be running and the machine will be in C(running) group,
but its actual state will be paused. See I(qemu_extended_statuses) for how to retrieve the real status.
default: no default: no
type: bool type: bool
qemu_extended_statuses:
description:
- Requires I(want_facts) to be set to C(true) to function. This will allow you to differentiate betweend C(paused) and C(prelaunch)
statuses of the QEMU VMs.
- This introduces multiple groups [prefixed with I(group_prefix)] C(prelaunch) and C(paused).
default: no
type: bool
version_added: 5.1.0
want_proxmox_nodes_ansible_host: want_proxmox_nodes_ansible_host:
version_added: 3.0.0 version_added: 3.0.0
description: description:
@@ -400,12 +412,20 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
properties[parsed_key] = [tag.strip() for tag in stripped_value.split(",")] properties[parsed_key] = [tag.strip() for tag in stripped_value.split(",")]
# The first field in the agent string tells you whether the agent is enabled # The first field in the agent string tells you whether the agent is enabled
# the rest of the comma separated string is extra config for the agent # the rest of the comma separated string is extra config for the agent.
if config == 'agent' and int(value.split(',')[0]): # In some (newer versions of proxmox) instances it can be 'enabled=1'.
agent_iface_value = self._get_agent_network_interfaces(node, vmid, vmtype) if config == 'agent':
if agent_iface_value: agent_enabled = 0
agent_iface_key = self.to_safe('%s%s' % (key, "_interfaces")) try:
properties[agent_iface_key] = agent_iface_value agent_enabled = int(value.split(',')[0])
except ValueError:
if value.split(',')[0] == "enabled=1":
agent_enabled = 1
if agent_enabled:
agent_iface_value = self._get_agent_network_interfaces(node, vmid, vmtype)
if agent_iface_value:
agent_iface_key = self.to_safe('%s%s' % (key, "_interfaces"))
properties[agent_iface_key] = agent_iface_value
if config == 'lxc': if config == 'lxc':
out_val = {} out_val = {}
@@ -431,6 +451,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
def _get_vm_status(self, properties, node, vmid, vmtype, name): def _get_vm_status(self, properties, node, vmid, vmtype, name):
ret = self._get_json("%s/api2/json/nodes/%s/%s/%s/status/current" % (self.proxmox_url, node, vmtype, vmid)) ret = self._get_json("%s/api2/json/nodes/%s/%s/%s/status/current" % (self.proxmox_url, node, vmtype, vmid))
properties[self._fact('status')] = ret['status'] properties[self._fact('status')] = ret['status']
if vmtype == 'qemu':
properties[self._fact('qmpstatus')] = ret['qmpstatus']
def _get_vm_snapshots(self, properties, node, vmid, vmtype, name): def _get_vm_snapshots(self, properties, node, vmid, vmtype, name):
ret = self._get_json("%s/api2/json/nodes/%s/%s/%s/snapshot" % (self.proxmox_url, node, vmtype, vmid)) ret = self._get_json("%s/api2/json/nodes/%s/%s/%s/snapshot" % (self.proxmox_url, node, vmtype, vmid))
@@ -489,7 +511,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
name, vmid = item['name'], item['vmid'] name, vmid = item['name'], item['vmid']
# get status, config and snapshots if want_facts == True # get status, config and snapshots if want_facts == True
if self.get_option('want_facts'): want_facts = self.get_option('want_facts')
if want_facts:
self._get_vm_status(properties, node, vmid, ittype, name) self._get_vm_status(properties, node, vmid, ittype, name)
self._get_vm_config(properties, node, vmid, ittype, name) self._get_vm_config(properties, node, vmid, ittype, name)
self._get_vm_snapshots(properties, node, vmid, ittype, name) self._get_vm_snapshots(properties, node, vmid, ittype, name)
@@ -503,10 +526,13 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
node_type_group = self._group('%s_%s' % (node, ittype)) node_type_group = self._group('%s_%s' % (node, ittype))
self.inventory.add_child(self._group('all_' + ittype), name) self.inventory.add_child(self._group('all_' + ittype), name)
self.inventory.add_child(node_type_group, name) self.inventory.add_child(node_type_group, name)
if item['status'] == 'stopped':
self.inventory.add_child(self._group('all_stopped'), name) item_status = item['status']
elif item['status'] == 'running': if item_status == 'running':
self.inventory.add_child(self._group('all_running'), name) if want_facts and ittype == 'qemu' and self.get_option('qemu_extended_statuses'):
# get more details about the status of the qemu VM
item_status = properties.get(self._fact('qmpstatus'), item_status)
self.inventory.add_child(self._group('all_%s' % (item_status, )), name)
return name return name
@@ -528,10 +554,14 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
def _populate(self): def _populate(self):
# create common groups # create common groups
self.inventory.add_group(self._group('all_lxc')) default_groups = ['lxc', 'qemu', 'running', 'stopped']
self.inventory.add_group(self._group('all_qemu'))
self.inventory.add_group(self._group('all_running')) if self.get_option('qemu_extended_statuses'):
self.inventory.add_group(self._group('all_stopped')) default_groups.extend(['prelaunch', 'paused'])
for group in default_groups:
self.inventory.add_group(self._group('all_%s' % (group)))
nodes_group = self._group('nodes') nodes_group = self._group('nodes')
self.inventory.add_group(nodes_group) self.inventory.add_group(nodes_group)
@@ -621,6 +651,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if proxmox_password is None and (proxmox_token_id is None or proxmox_token_secret is None): if proxmox_password is None and (proxmox_token_id is None or proxmox_token_secret is None):
raise AnsibleError('You must specify either a password or both token_id and token_secret.') raise AnsibleError('You must specify either a password or both token_id and token_secret.')
if self.get_option('qemu_extended_statuses') and not self.get_option('want_facts'):
raise AnsibleError('You must set want_facts to True if you want to use qemu_extended_statuses.')
self.cache_key = self.get_cache_key(path) self.cache_key = self.get_cache_key(path)
self.use_cache = cache and self.get_option('cache') self.use_cache = cache and self.get_option('cache')
self.host_filters = self.get_option('filters') self.host_filters = self.get_option('filters')

View File

@@ -16,7 +16,7 @@ DOCUMENTATION = '''
The lookup order mirrors the one from Chef, all folders in the base path are walked back looking for the following configuration The lookup order mirrors the one from Chef, all folders in the base path are walked back looking for the following configuration
file in order : .chef/knife.rb, ~/.chef/knife.rb, /etc/chef/client.rb" file in order : .chef/knife.rb, ~/.chef/knife.rb, /etc/chef/client.rb"
requirements: requirements:
- "pychef (python library https://pychef.readthedocs.io `pip install pychef`)" - "pychef (L(Python library, https://pychef.readthedocs.io), C(pip install pychef))"
options: options:
name: name:
description: description:

View File

@@ -122,6 +122,7 @@ class LookupModule(LookupBase):
"tenant": self.get_option("tenant"), "tenant": self.get_option("tenant"),
"client_id": self.get_option("client_id"), "client_id": self.get_option("client_id"),
"client_secret": self.get_option("client_secret"), "client_secret": self.get_option("client_secret"),
"tld": self.get_option("tld"),
"url_template": self.get_option("url_template"), "url_template": self.get_option("url_template"),
} }
) )

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

@@ -106,6 +106,22 @@ DOCUMENTATION = '''
type: str type: str
default: 15m default: 15m
version_added: 4.5.0 version_added: 4.5.0
backend:
description:
- Specify which backend to use.
- Defaults to C(pass), passwordstore.org's original pass utility.
- C(gopass) support is incomplete.
ini:
- section: passwordstore_lookup
key: backend
vars:
- name: passwordstore_backend
type: str
default: pass
choices:
- pass
- gopass
version_added: 5.2.0
''' '''
EXAMPLES = """ EXAMPLES = """
ansible.cfg: | ansible.cfg: |
@@ -231,6 +247,24 @@ def check_output2(*popenargs, **kwargs):
class LookupModule(LookupBase): class LookupModule(LookupBase):
def __init__(self, loader=None, templar=None, **kwargs):
super(LookupModule, self).__init__(loader, templar, **kwargs)
self.realpass = None
def is_real_pass(self):
if self.realpass is None:
try:
self.passoutput = to_text(
check_output2([self.pass_cmd, "--version"], env=self.env),
errors='surrogate_or_strict'
)
self.realpass = 'pass: the standard unix password manager' in self.passoutput
except (subprocess.CalledProcessError) as e:
raise AnsibleError(e)
return self.realpass
def parse_params(self, term): def parse_params(self, term):
# I went with the "traditional" param followed with space separated KV pairs. # I went with the "traditional" param followed with space separated KV pairs.
# Waiting for final implementation of lookup parameter parsing. # Waiting for final implementation of lookup parameter parsing.
@@ -270,10 +304,12 @@ class LookupModule(LookupBase):
self.env = os.environ.copy() self.env = os.environ.copy()
self.env['LANGUAGE'] = 'C' # make sure to get errors in English as required by check_output2 self.env['LANGUAGE'] = 'C' # make sure to get errors in English as required by check_output2
# Set PASSWORD_STORE_DIR if self.backend == 'gopass':
if os.path.isdir(self.paramvals['directory']): self.env['GOPASS_NO_REMINDER'] = "YES"
elif os.path.isdir(self.paramvals['directory']):
# Set PASSWORD_STORE_DIR
self.env['PASSWORD_STORE_DIR'] = self.paramvals['directory'] self.env['PASSWORD_STORE_DIR'] = self.paramvals['directory']
else: elif self.is_real_pass():
raise AnsibleError('Passwordstore directory \'{0}\' does not exist'.format(self.paramvals['directory'])) raise AnsibleError('Passwordstore directory \'{0}\' does not exist'.format(self.paramvals['directory']))
# Set PASSWORD_STORE_UMASK if umask is set # Set PASSWORD_STORE_UMASK if umask is set
@@ -288,7 +324,9 @@ class LookupModule(LookupBase):
def check_pass(self): def check_pass(self):
try: try:
self.passoutput = to_text( self.passoutput = to_text(
check_output2(["pass", "show", self.passname], env=self.env), check_output2([self.pass_cmd, 'show'] +
(['--password'] if self.backend == 'gopass' else []) +
[self.passname], env=self.env),
errors='surrogate_or_strict' errors='surrogate_or_strict'
).splitlines() ).splitlines()
self.password = self.passoutput[0] self.password = self.passoutput[0]
@@ -302,8 +340,10 @@ class LookupModule(LookupBase):
if ':' in line: if ':' in line:
name, value = line.split(':', 1) name, value = line.split(':', 1)
self.passdict[name.strip()] = value.strip() self.passdict[name.strip()] = value.strip()
if os.path.isfile(os.path.join(self.paramvals['directory'], self.passname + ".gpg")): if (self.backend == 'gopass' or
# Only accept password as found, if there a .gpg file for it (might be a tree node otherwise) os.path.isfile(os.path.join(self.paramvals['directory'], self.passname + ".gpg"))
or not self.is_real_pass()):
# When using real pass, only accept password as found if there is a .gpg file for it (might be a tree node otherwise)
return True return True
except (subprocess.CalledProcessError) as e: except (subprocess.CalledProcessError) as e:
# 'not in password store' is the expected error if a password wasn't found # 'not in password store' is the expected error if a password wasn't found
@@ -339,7 +379,7 @@ class LookupModule(LookupBase):
if self.paramvals['backup']: if self.paramvals['backup']:
msg += "lookup_pass: old password was {0} (Updated on {1})\n".format(self.password, datetime) msg += "lookup_pass: old password was {0} (Updated on {1})\n".format(self.password, datetime)
try: try:
check_output2(['pass', 'insert', '-f', '-m', self.passname], input=msg, env=self.env) check_output2([self.pass_cmd, 'insert', '-f', '-m', self.passname], input=msg, env=self.env)
except (subprocess.CalledProcessError) as e: except (subprocess.CalledProcessError) as e:
raise AnsibleError(e) raise AnsibleError(e)
return newpass return newpass
@@ -351,7 +391,7 @@ class LookupModule(LookupBase):
datetime = time.strftime("%d/%m/%Y %H:%M:%S") datetime = time.strftime("%d/%m/%Y %H:%M:%S")
msg = newpass + '\n' + "lookup_pass: First generated by ansible on {0}\n".format(datetime) msg = newpass + '\n' + "lookup_pass: First generated by ansible on {0}\n".format(datetime)
try: try:
check_output2(['pass', 'insert', '-f', '-m', self.passname], input=msg, env=self.env) check_output2([self.pass_cmd, 'insert', '-f', '-m', self.passname], input=msg, env=self.env)
except (subprocess.CalledProcessError) as e: except (subprocess.CalledProcessError) as e:
raise AnsibleError(e) raise AnsibleError(e)
return newpass return newpass
@@ -380,6 +420,8 @@ class LookupModule(LookupBase):
yield yield
def setup(self, variables): def setup(self, variables):
self.backend = self.get_option('backend')
self.pass_cmd = self.backend # pass and gopass are commands as well
self.locked = None self.locked = None
timeout = self.get_option('locktimeout') timeout = self.get_option('locktimeout')
if not re.match('^[0-9]+[smh]$', timeout): if not re.match('^[0-9]+[smh]$', timeout):
@@ -402,6 +444,7 @@ class LookupModule(LookupBase):
} }
def run(self, terms, variables, **kwargs): def run(self, terms, variables, **kwargs):
self.set_options(var_options=variables, direct=kwargs)
self.setup(variables) self.setup(variables)
result = [] result = []

View File

@@ -3,51 +3,7 @@
# This particular file snippet, and this file snippet only, is based on # This particular file snippet, and this file snippet only, is based on
# Lib/posixpath.py of cpython # Lib/posixpath.py of cpython
# It is licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 # It is licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# # (See PSF-license.txt in this collection)
# 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 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.
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function

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

@@ -191,13 +191,13 @@ class CmdRunner(object):
environ_update = {} environ_update = {}
self.environ_update = environ_update self.environ_update = environ_update
self.command[0] = module.get_bin_path(command[0], opt_dirs=path_prefix, required=True) self.command[0] = module.get_bin_path(self.command[0], opt_dirs=path_prefix, required=True)
for mod_param_name, spec in iteritems(module.argument_spec): for mod_param_name, spec in iteritems(module.argument_spec):
if mod_param_name not in self.arg_formats: if mod_param_name not in self.arg_formats:
self.arg_formats[mod_param_name] = _Format.as_default_type(spec['type'], mod_param_name) self.arg_formats[mod_param_name] = _Format.as_default_type(spec['type'], mod_param_name)
def context(self, args_order=None, output_process=None, ignore_value_none=True, **kwargs): def __call__(self, args_order=None, output_process=None, ignore_value_none=True, check_mode_skip=False, check_mode_return=None, **kwargs):
if output_process is None: if output_process is None:
output_process = _process_as_is output_process = _process_as_is
if args_order is None: if args_order is None:
@@ -209,18 +209,25 @@ class CmdRunner(object):
return _CmdRunnerContext(runner=self, return _CmdRunnerContext(runner=self,
args_order=args_order, args_order=args_order,
output_process=output_process, output_process=output_process,
ignore_value_none=ignore_value_none, **kwargs) ignore_value_none=ignore_value_none,
check_mode_skip=check_mode_skip,
check_mode_return=check_mode_return, **kwargs)
def has_arg_format(self, arg): def has_arg_format(self, arg):
return arg in self.arg_formats return arg in self.arg_formats
# not decided whether to keep it or not, but if deprecating it will happen in a farther future.
context = __call__
class _CmdRunnerContext(object): class _CmdRunnerContext(object):
def __init__(self, runner, args_order, output_process, ignore_value_none, **kwargs): def __init__(self, runner, args_order, output_process, ignore_value_none, check_mode_skip, check_mode_return, **kwargs):
self.runner = runner self.runner = runner
self.args_order = tuple(args_order) self.args_order = tuple(args_order)
self.output_process = output_process self.output_process = output_process
self.ignore_value_none = ignore_value_none self.ignore_value_none = ignore_value_none
self.check_mode_skip = check_mode_skip
self.check_mode_return = check_mode_return
self.run_command_args = dict(kwargs) self.run_command_args = dict(kwargs)
self.environ_update = runner.environ_update self.environ_update = runner.environ_update
@@ -260,6 +267,8 @@ class _CmdRunnerContext(object):
except Exception as e: except Exception as e:
raise FormatError(arg_name, value, runner.arg_formats[arg_name], e) raise FormatError(arg_name, value, runner.arg_formats[arg_name], e)
if self.check_mode_skip and module.check_mode:
return self.check_mode_return
results = module.run_command(self.cmd, **self.run_command_args) results = module.run_command(self.cmd, **self.run_command_args)
self.results_rc, self.results_out, self.results_err = results self.results_rc, self.results_out, self.results_err = results
self.results_processed = self.output_process(*results) self.results_processed = self.output_process(*results)
@@ -288,4 +297,12 @@ class _CmdRunnerContext(object):
return False return False
fmt = _Format() cmd_runner_fmt = _Format()
#
# The fmt form is deprecated and will be removed in community.general 7.0.0
# Please use:
# cmd_runner_fmt
# Or, to retain the same effect, use:
# from ansible_collections.community.general.plugins.module_utils.cmd_runner import cmd_runner_fmt as fmt
fmt = cmd_runner_fmt

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

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# (c) 2022, Alexei Znamensky <russoz@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt as fmt
def gconftool2_runner(module, **kwargs):
return CmdRunner(
module,
command='gconftool-2',
arg_formats=dict(
key=fmt.as_list(),
value_type=fmt.as_opt_val("--type"),
value=fmt.as_list(),
direct=fmt.as_bool("--direct"),
config_source=fmt.as_opt_val("--config-source"),
get=fmt.as_bool("--get"),
set_arg=fmt.as_bool("--set"),
unset=fmt.as_bool("--unset"),
),
**kwargs
)

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)
@@ -351,7 +351,7 @@ def wait_to_finish(target, pending, refresh, timeout, min_interval=1, delay=3):
if pending and status not in pending: if pending and status not in pending:
raise HwcModuleException( raise HwcModuleException(
"unexpect status(%s) occured" % status) "unexpect status(%s) occurred" % status)
if not is_last_time: if not is_last_time:
wait *= 2 wait *= 2

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) 2021-2022 Hewlett Packard Enterprise, Inc. All rights reserved. # Copyright (c) 2021-2022 Hewlett Packard Enterprise, Inc. All rights reserved.
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function 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,22 +1,18 @@
# -*- 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
from ansible.module_utils.common.text.converters import to_native
class ModuleHelperException(Exception): class ModuleHelperException(Exception):
@staticmethod def __init__(self, msg, update_output=None, *args, **kwargs):
def _get_remove(key, kwargs): self.msg = to_native(msg or "Module failed with exception: {0}".format(self))
if key in kwargs: if update_output is None:
result = kwargs[key] update_output = {}
del kwargs[key] self.update_output = update_output
return result
return None
def __init__(self, *args, **kwargs):
self.msg = self._get_remove('msg', kwargs) or "Module failed with exception: {0}".format(self)
self.update_output = self._get_remove('update_output', kwargs) or {}
super(ModuleHelperException, self).__init__(*args) super(ModuleHelperException, self).__init__(*args)

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

@@ -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

@@ -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
@@ -83,12 +83,12 @@ class OpenNebulaModule:
if self.module.params.get("api_username"): if self.module.params.get("api_username"):
username = self.module.params.get("api_username") username = self.module.params.get("api_username")
else: else:
self.fail("Either api_username or the environment vairable ONE_USERNAME must be provided") self.fail("Either api_username or the environment variable ONE_USERNAME must be provided")
if self.module.params.get("api_password"): if self.module.params.get("api_password"):
password = self.module.params.get("api_password") password = self.module.params.get("api_password")
else: else:
self.fail("Either api_password or the environment vairable ONE_PASSWORD must be provided") self.fail("Either api_password or the environment variable ONE_PASSWORD must be provided")
session = "%s:%s" % (username, password) session = "%s:%s" % (username, password)

View File

@@ -691,7 +691,7 @@ def check_and_create_resource(
:param model: Model used to create a resource. :param model: Model used to create a resource.
:param exclude_attributes: The attributes which should not be used to distinguish the resource. e.g. display_name, :param exclude_attributes: The attributes which should not be used to distinguish the resource. e.g. display_name,
dns_label. dns_label.
:param dead_states: List of states which can't transition to any of the usable states of the resource. This deafults :param dead_states: List of states which can't transition to any of the usable states of the resource. This defaults
to ["TERMINATING", "TERMINATED", "FAULTY", "FAILED", "DELETING", "DELETED", "UNKNOWN_ENUM_VALUE"] to ["TERMINATING", "TERMINATED", "FAULTY", "FAILED", "DELETING", "DELETED", "UNKNOWN_ENUM_VALUE"]
:param default_attribute_values: A dictionary containing default values for attributes. :param default_attribute_values: A dictionary containing default values for attributes.
:return: A dictionary containing the resource & the "changed" status. e.g. {"vcn":{x:y}, "changed":True} :return: A dictionary containing the resource & the "changed" status. e.g. {"vcn":{x:y}, "changed":True}
@@ -1189,7 +1189,7 @@ def are_dicts_equal(
def should_dict_attr_be_excluded(map_option_name, option_key, exclude_list): def should_dict_attr_be_excluded(map_option_name, option_key, exclude_list):
"""An entry for the Exclude list for excluding a map's key is specifed as a dict with the map option name as the """An entry for the Exclude list for excluding a map's key is specified as a dict with the map option name as the
key, and the value as a list of keys to be excluded within that map. For example, if the keys "k1" and "k2" of a map key, and the value as a list of keys to be excluded within that map. For example, if the keys "k1" and "k2" of a map
option named "m1" needs to be excluded, the exclude list must have an entry {'m1': ['k1','k2']} """ option named "m1" needs to be excluded, the exclude list must have an entry {'m1': ['k1','k2']} """
for exclude_item in exclude_list: for exclude_item in exclude_list:

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

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2017-2018 Dell EMC Inc. # Copyright (c) 2017-2018 Dell EMC Inc.
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
@@ -1888,14 +1888,13 @@ class RedfishUtils(object):
for property in properties: for property in properties:
if property in data: if property in data:
chassis_power_result[property] = data[property] chassis_power_result[property] = data[property]
else:
return {'ret': False, 'msg': 'Key PowerControl not found.'}
chassis_power_results.append(chassis_power_result) chassis_power_results.append(chassis_power_result)
else:
return {'ret': False, 'msg': 'Key Power not found.'}
result['entries'] = chassis_power_results if len(chassis_power_results) > 0:
return result result['entries'] = chassis_power_results
return result
else:
return {'ret': False, 'msg': 'Power information not found.'}
def get_chassis_thermals(self): def get_chassis_thermals(self):
result = {} result = {}
@@ -2187,9 +2186,8 @@ class RedfishUtils(object):
else: else:
if media_match_strict: if media_match_strict:
continue continue
# if ejected, 'Inserted' should be False and 'ImageName' cleared # if ejected, 'Inserted' should be False
if (not data.get('Inserted', False) and if (not data.get('Inserted', False)):
not data.get('ImageName')):
return uri, data return uri, data
return None, None return None, None
@@ -2225,7 +2223,7 @@ class RedfishUtils(object):
return resources, headers return resources, headers
@staticmethod @staticmethod
def _insert_virt_media_payload(options, param_map, data, ai): def _insert_virt_media_payload(options, param_map, data, ai, image_only=False):
payload = { payload = {
'Image': options.get('image_url') 'Image': options.get('image_url')
} }
@@ -2239,6 +2237,12 @@ class RedfishUtils(object):
options.get(option), option, options.get(option), option,
allowable)} allowable)}
payload[param] = options.get(option) payload[param] = options.get(option)
# Some hardware (such as iLO 4 or Supermicro) only supports the Image property
# Inserted and WriteProtected are not writable
if image_only:
del payload['Inserted']
del payload['WriteProtected']
return payload return payload
def virtual_media_insert_via_patch(self, options, param_map, uri, data, image_only=False): def virtual_media_insert_via_patch(self, options, param_map, uri, data, image_only=False):
@@ -2247,16 +2251,10 @@ class RedfishUtils(object):
{'AllowableValues': v}) for k, v in data.items() {'AllowableValues': v}) for k, v in data.items()
if k.endswith('@Redfish.AllowableValues')) if k.endswith('@Redfish.AllowableValues'))
# construct payload # construct payload
payload = self._insert_virt_media_payload(options, param_map, data, ai) payload = self._insert_virt_media_payload(options, param_map, data, ai, image_only)
if 'Inserted' not in payload: if 'Inserted' not in payload and not image_only:
payload['Inserted'] = True payload['Inserted'] = True
# Some hardware (such as iLO 4) only supports the Image property on the PATCH operation
# Inserted and WriteProtected are not writable
if image_only:
del payload['Inserted']
del payload['WriteProtected']
# PATCH the resource # PATCH the resource
response = self.patch_request(self.root_uri + uri, payload) response = self.patch_request(self.root_uri + uri, payload)
if response['ret'] is False: if response['ret'] is False:
@@ -2292,6 +2290,13 @@ class RedfishUtils(object):
if data["FirmwareVersion"].startswith("iLO 4"): if data["FirmwareVersion"].startswith("iLO 4"):
image_only = True image_only = True
# Supermicro does also not support Inserted and WriteProtected
# Supermicro uses as firmware version only a number so we can't check for it because we
# can't be sure that this firmware version is nut used by another vendor
# Tested with Supermicro Firmware 01.74.02
if 'Supermicro' in data['Oem']:
image_only = True
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:
@@ -2346,7 +2351,7 @@ class RedfishUtils(object):
# get ActionInfo or AllowableValues # get ActionInfo or AllowableValues
ai = self._get_all_action_info_values(action) ai = self._get_all_action_info_values(action)
# construct payload # construct payload
payload = self._insert_virt_media_payload(options, param_map, data, ai) payload = self._insert_virt_media_payload(options, param_map, data, ai, image_only)
# POST to action # POST to action
response = self.post_request(self.root_uri + action_uri, payload) response = self.post_request(self.root_uri + action_uri, payload)
if response['ret'] is False: if response['ret'] is False:
@@ -2392,6 +2397,9 @@ class RedfishUtils(object):
if data["FirmwareVersion"].startswith("iLO 4"): if data["FirmwareVersion"].startswith("iLO 4"):
image_only = True image_only = True
if 'Supermicro' in data['Oem']:
image_only = True
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:
@@ -3020,3 +3028,26 @@ class RedfishUtils(object):
if not result["entries"]: if not result["entries"]:
return {'ret': False, 'msg': "No HostInterface objects found"} return {'ret': False, 'msg': "No HostInterface objects found"}
return result return result
def get_manager_inventory(self, manager_uri):
result = {}
inventory = {}
# Get these entries, but does not fail if not found
properties = ['FirmwareVersion', 'ManagerType', 'Manufacturer', 'Model',
'PartNumber', 'PowerState', 'SerialNumber', 'Status', 'UUID']
response = self.get_request(self.root_uri + manager_uri)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
for property in properties:
if property in data:
inventory[property] = data[property]
result["entries"] = inventory
return result
def get_multi_manager_inventory(self):
return self.aggregate_managers(self.get_manager_inventory)

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

@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# (c) 2022, Alexei Znamensky <russoz@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.parsing.convert_bool import boolean
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt as fmt
@fmt.unpack_args
def _values_fmt(values, value_types):
result = []
for value, value_type in zip(values, value_types):
if value_type == 'bool':
value = boolean(value)
result.extend(['--type', '{0}'.format(value_type), '--set', '{0}'.format(value)])
return result
def xfconf_runner(module, **kwargs):
runner = CmdRunner(
module,
command='xfconf-query',
arg_formats=dict(
channel=fmt.as_opt_val("--channel"),
property=fmt.as_opt_val("--property"),
force_array=fmt.as_bool("--force-array"),
reset=fmt.as_bool("--reset"),
create=fmt.as_bool("--create"),
list_arg=fmt.as_bool("--list"),
values_and_types=fmt.as_func(_values_fmt),
),
**kwargs
)
return runner

View File

@@ -191,10 +191,10 @@ notes:
2.1, the later requires python to be installed in the instance which can 2.1, the later requires python to be installed in the instance which can
be done with the command module. be done with the command module.
- You can copy a file from the host to the instance - You can copy a file from the host to the instance
with the Ansible M(ansible.builtin.copy) and M(ansible.builtin.template) module and the `lxd` connection plugin. with the Ansible M(ansible.builtin.copy) and M(ansible.builtin.template) module and the C(community.general.lxd) connection plugin.
See the example below. See the example below.
- You can copy a file in the created instance to the localhost - You can copy a file in the created instance to the localhost
with `command=lxc file pull instance_name/dir/filename filename`. with C(command=lxc file pull instance_name/dir/filename filename).
See the first example below. See the first example below.
''' '''

View File

@@ -360,7 +360,7 @@ class LXDProfileManagement(object):
) )
def _merge_dicts(self, source, destination): def _merge_dicts(self, source, destination):
"""Merge Dictionarys """Merge Dictionaries
Get a list of filehandle numbers from logger to be handed to Get a list of filehandle numbers from logger to be handed to
DaemonContext.files_preserve DaemonContext.files_preserve

View File

@@ -303,7 +303,7 @@ class LXDProjectManagement(object):
) )
def _merge_dicts(self, source, destination): def _merge_dicts(self, source, destination):
""" Return a new dict taht merge two dict, """ Return a new dict that merge two dict,
with values in source dict overwrite destination dict with values in source dict overwrite destination dict
Args: Args:

View File

@@ -83,7 +83,7 @@ options:
version_added: 1.3.0 version_added: 1.3.0
clone: clone:
description: description:
- Name of VM to be cloned. If C(vmid) is setted, C(clone) can take arbitrary value but required for initiating the clone. - Name of VM to be cloned. If I(vmid) is set, I(clone) can take an arbitrary value but is required for initiating the clone.
type: str type: str
cores: cores:
description: description:
@@ -1204,12 +1204,12 @@ def main():
# Ensure source VM id exists when cloning # Ensure source VM id exists when cloning
proxmox.get_vm(vmid) proxmox.get_vm(vmid)
# Ensure the choosen VM name doesn't already exist when cloning # Ensure the chosen VM name doesn't already exist when cloning
existing_vmid = proxmox.get_vmid(name, ignore_missing=True) existing_vmid = proxmox.get_vmid(name, ignore_missing=True)
if existing_vmid: if existing_vmid:
module.exit_json(changed=False, vmid=existing_vmid, msg="VM with name <%s> already exists" % name) module.exit_json(changed=False, vmid=existing_vmid, msg="VM with name <%s> already exists" % name)
# Ensure the choosen VM id doesn't already exist when cloning # Ensure the chosen VM id doesn't already exist when cloning
if proxmox.get_vm(newid, ignore_missing=True): if proxmox.get_vm(newid, ignore_missing=True):
module.exit_json(changed=False, vmid=vmid, msg="vmid %s with VM name %s already exists" % (newid, name)) module.exit_json(changed=False, vmid=vmid, msg="vmid %s with VM name %s already exists" % (newid, name))

View File

@@ -107,7 +107,7 @@ state:
returned: always returned: always
command: command:
type: str type: str
description: Full `serverless` command run by this module, in case you want to re-run the command outside the module. description: Full C(serverless) command run by this module, in case you want to re-run the command outside the module.
returned: always returned: always
sample: serverless deploy --stage production sample: serverless deploy --stage production
''' '''

View File

@@ -67,7 +67,7 @@ options:
state_file: state_file:
description: description:
- The path to an existing Terraform state file to use when building plan. - The path to an existing Terraform state file to use when building plan.
If this is not specified, the default `terraform.tfstate` will be used. If this is not specified, the default C(terraform.tfstate) will be used.
- This option is ignored when plan is specified. - This option is ignored when plan is specified.
type: path type: path
variables_files: variables_files:
@@ -103,7 +103,7 @@ options:
force_init: force_init:
description: description:
- To avoid duplicating infra, if a state file can't be found this will - To avoid duplicating infra, if a state file can't be found this will
force a `terraform init`. Generally, this should be turned off unless force a C(terraform init). Generally, this should be turned off unless
you intend to provision an entirely new Terraform deployment. you intend to provision an entirely new Terraform deployment.
default: false default: false
type: bool type: bool
@@ -149,7 +149,7 @@ options:
type: int type: int
version_added: '3.8.0' version_added: '3.8.0'
notes: notes:
- To just run a `terraform plan`, use check mode. - To just run a C(terraform plan), use check mode.
requirements: [ "terraform" ] requirements: [ "terraform" ]
author: "Ryan Scott Brown (@ryansb)" author: "Ryan Scott Brown (@ryansb)"
''' '''
@@ -205,7 +205,7 @@ EXAMPLES = """
RETURN = """ RETURN = """
outputs: outputs:
type: complex type: complex
description: A dictionary of all the TF outputs by their assigned name. Use `.outputs.MyOutputName.value` to access the value. description: A dictionary of all the TF outputs by their assigned name. Use C(.outputs.MyOutputName.value) to access the value.
returned: on success returned: on success
sample: '{"bukkit_arn": {"sensitive": false, "type": "string", "value": "arn:aws:s3:::tf-test-bukkit"}' sample: '{"bukkit_arn": {"sensitive": false, "type": "string", "value": "arn:aws:s3:::tf-test-bukkit"}'
contains: contains:
@@ -223,12 +223,12 @@ outputs:
description: The value of the output as interpolated by Terraform description: The value of the output as interpolated by Terraform
stdout: stdout:
type: str type: str
description: Full `terraform` command stdout, in case you want to display it or examine the event log description: Full C(terraform) command stdout, in case you want to display it or examine the event log
returned: always returned: always
sample: '' sample: ''
command: command:
type: str type: str
description: Full `terraform` command built by this module, in case you want to re-run the command outside the module or debug a problem. description: Full C(terraform) command built by this module, in case you want to re-run the command outside the module or debug a problem.
returned: always returned: always
sample: terraform apply ... sample: terraform apply ...
""" """

View File

@@ -252,7 +252,8 @@ def main():
'weight': weight, 'weight': weight,
} }
for name, value in mutable.items(): for name in list(mutable):
value = mutable[name]
if value is None or value == getattr(node, name): if value is None or value == getattr(node, name):
mutable.pop(name) mutable.pop(name)

View File

@@ -75,15 +75,15 @@ options:
target_hostname: target_hostname:
type: str type: str
description: description:
- One of `target_hostname` and `target_alias` is required for remote.* checks, - One of I(target_hostname) and I(target_alias) is required for remote.* checks,
but prohibited for agent.* checks. The hostname this check should target. but prohibited for agent.* checks. The hostname this check should target.
Must be a valid IPv4, IPv6, or FQDN. Must be a valid IPv4, IPv6, or FQDN.
target_alias: target_alias:
type: str type: str
description: description:
- One of `target_alias` and `target_hostname` is required for remote.* checks, - One of I(target_alias) and I(target_hostname) is required for remote.* checks,
but prohibited for agent.* checks. Use the corresponding key in the entity's but prohibited for agent.* checks. Use the corresponding key in the entity's
`ip_addresses` hash to resolve an IP address to target. I(ip_addresses) hash to resolve an IP address to target.
details: details:
type: dict type: dict
description: description:

View File

@@ -0,0 +1,209 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Scaleway VPC management module
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: scaleway_compute_private_network
short_description: Scaleway compute - private network management
version_added: 5.2.0
author: Pascal MANGIN (@pastral)
description:
- This module add or remove a private network to a compute instance
(U(https://developer.scaleway.com)).
extends_documentation_fragment:
- community.general.scaleway
options:
state:
type: str
description:
- Indicate desired state of the VPC.
default: present
choices:
- present
- absent
project:
type: str
description:
- Project identifier.
required: true
region:
type: str
description:
- Scaleway region to use (for example C(par1)).
required: true
choices:
- ams1
- EMEA-NL-EVS
- par1
- EMEA-FR-PAR1
- par2
- EMEA-FR-PAR2
- waw1
- EMEA-PL-WAW1
compute_id:
type: str
description:
- ID of the compute instance (see M(community.general.scaleway_compute)).
required: true
private_network_id:
type: str
description:
- ID of the private network (see M(community.general.scaleway_private_network)).
required: true
'''
EXAMPLES = '''
- name: Plug a VM to a private network
community.general.scaleway_compute_private_network:
project: '{{ scw_project }}'
state: present
region: par1
compute_id: "12345678-f1e6-40ec-83e5-12345d67ed89"
private_network_id: "22345678-f1e6-40ec-83e5-12345d67ed89"
register: nicsvpc_creation_task
- name: Unplug a VM from a private network
community.general.scaleway_compute_private_network:
project: '{{ scw_project }}'
state: absent
region: par1
compute_id: "12345678-f1e6-40ec-83e5-12345d67ed89"
private_network_id: "22345678-f1e6-40ec-83e5-12345d67ed89"
'''
RETURN = '''
scaleway_compute_private_network:
description: Information on the VPC.
returned: success when C(state=present)
type: dict
sample:
{
"created_at": "2022-01-15T11:11:12.676445Z",
"id": "12345678-f1e6-40ec-83e5-12345d67ed89",
"name": "network",
"organization_id": "a123b4cd-ef5g-678h-90i1-jk2345678l90",
"project_id": "a123b4cd-ef5g-678h-90i1-jk2345678l90",
"tags": [
"tag1",
"tag2",
"tag3",
"tag4",
"tag5"
],
"updated_at": "2022-01-15T11:12:04.624837Z",
"zone": "fr-par-2"
}
'''
from ansible_collections.community.general.plugins.module_utils.scaleway import SCALEWAY_LOCATION, scaleway_argument_spec, Scaleway
from ansible.module_utils.basic import AnsibleModule
def get_nics_info(api, compute_id, private_network_id):
response = api.get('servers/' + compute_id + '/private_nics')
if not response.ok:
msg = "Error during get servers information: %s: '%s' (%s)" % (response.info['msg'], response.json['message'], response.json)
api.module.fail_json(msg=msg)
i = 0
list_nics = response.json['private_nics']
while i < len(list_nics):
if list_nics[i]['private_network_id'] == private_network_id:
return list_nics[i]
i += 1
return None
def present_strategy(api, compute_id, private_network_id):
changed = False
nic = get_nics_info(api, compute_id, private_network_id)
if nic is not None:
return changed, nic
data = {"private_network_id": private_network_id}
changed = True
if api.module.check_mode:
return changed, {"status": "a private network would be add to a server"}
response = api.post(path='servers/' + compute_id + '/private_nics', data=data)
if not response.ok:
api.module.fail_json(msg='Error when adding a private network to a server [{0}: {1}]'.format(response.status_code, response.json))
return changed, response.json
def absent_strategy(api, compute_id, private_network_id):
changed = False
nic = get_nics_info(api, compute_id, private_network_id)
if nic is None:
return changed, {}
changed = True
if api.module.check_mode:
return changed, {"status": "private network would be destroyed"}
response = api.delete('servers/' + compute_id + '/private_nics/' + nic['id'])
if not response.ok:
api.module.fail_json(msg='Error deleting private network from server [{0}: {1}]'.format(
response.status_code, response.json))
return changed, response.json
def core(module):
compute_id = module.params['compute_id']
pn_id = module.params['private_network_id']
region = module.params["region"]
module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
api = Scaleway(module=module)
if module.params["state"] == "absent":
changed, summary = absent_strategy(api=api, compute_id=compute_id, private_network_id=pn_id)
else:
changed, summary = present_strategy(api=api, compute_id=compute_id, private_network_id=pn_id)
module.exit_json(changed=changed, scaleway_compute_private_network=summary)
def main():
argument_spec = scaleway_argument_spec()
argument_spec.update(dict(
state=dict(default='present', choices=['absent', 'present']),
project=dict(required=True),
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
compute_id=dict(required=True),
private_network_id=dict(required=True)
))
module = AnsibleModule(
argument_spec=argument_spec,
supports_check_mode=True,
)
core(module)
if __name__ == '__main__':
main()

View File

@@ -35,7 +35,7 @@ options:
user_data: user_data:
type: dict type: dict
description: description:
- User defined data. Typically used with `cloud-init`. - User defined data. Typically used with C(cloud-init).
- Pass your cloud-init script here as a string - Pass your cloud-init script here as a string
required: false required: false

View File

@@ -1207,7 +1207,7 @@ class XenServerVM(XenServerObject):
if (self.module.params['home_server'] and if (self.module.params['home_server'] and
(not self.vm_params['affinity'] or self.module.params['home_server'] != self.vm_params['affinity']['name_label'])): (not self.vm_params['affinity'] or self.module.params['home_server'] != self.vm_params['affinity']['name_label'])):
# Check existance only. Ignore return value. # Check existence only. Ignore return value.
get_object_ref(self.module, self.module.params['home_server'], uuid=None, obj_type="home server", fail=True, get_object_ref(self.module, self.module.params['home_server'], uuid=None, obj_type="home server", fail=True,
msg_prefix="VM check home_server: ") msg_prefix="VM check home_server: ")
@@ -1371,7 +1371,7 @@ class XenServerVM(XenServerObject):
disk_sr = disk_params.get('sr') disk_sr = disk_params.get('sr')
if disk_sr_uuid is not None or disk_sr is not None: if disk_sr_uuid is not None or disk_sr is not None:
# Check existance only. Ignore return value. # Check existence only. Ignore return value.
get_object_ref(self.module, disk_sr, disk_sr_uuid, obj_type="SR", fail=True, get_object_ref(self.module, disk_sr, disk_sr_uuid, obj_type="SR", fail=True,
msg_prefix="VM check disks[%s]: " % position) msg_prefix="VM check disks[%s]: " % position)
elif self.default_sr_ref == 'OpaqueRef:NULL': elif self.default_sr_ref == 'OpaqueRef:NULL':
@@ -1448,7 +1448,7 @@ class XenServerVM(XenServerObject):
if cdrom_type == "iso": if cdrom_type == "iso":
# Check if ISO exists. # Check if ISO exists.
# Check existance only. Ignore return value. # Check existence only. Ignore return value.
get_object_ref(self.module, cdrom_iso_name, uuid=None, obj_type="ISO image", fail=True, get_object_ref(self.module, cdrom_iso_name, uuid=None, obj_type="ISO image", fail=True,
msg_prefix="VM check cdrom.iso_name: ") msg_prefix="VM check cdrom.iso_name: ")
@@ -1496,7 +1496,7 @@ class XenServerVM(XenServerObject):
self.module.fail_json(msg="VM check networks[%s]: network name cannot be an empty string!" % position) self.module.fail_json(msg="VM check networks[%s]: network name cannot be an empty string!" % position)
if network_name: if network_name:
# Check existance only. Ignore return value. # Check existence only. Ignore return value.
get_object_ref(self.module, network_name, uuid=None, obj_type="network", fail=True, get_object_ref(self.module, network_name, uuid=None, obj_type="network", fail=True,
msg_prefix="VM check networks[%s]: " % position) msg_prefix="VM check networks[%s]: " % position)

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)

View File

@@ -28,14 +28,14 @@ author:
options: options:
state: state:
description: description:
- The action to take with the supplied key and value. If the state is 'present' and `value` is set, the key - The action to take with the supplied key and value. If the state is C(present) and I(value) is set, the key
contents will be set to the value supplied and `changed` will be set to `true` only if the value was contents will be set to the value supplied and C(changed) will be set to C(true) only if the value was
different to the current contents. If the state is 'present' and `value` is not set, the existing value different to the current contents. If the state is C(present) and I(value) is not set, the existing value
associated to the key will be returned. The state 'absent' will remove the key/value pair, associated to the key will be returned. The state C(absent) will remove the key/value pair,
again 'changed' will be set to true only if the key actually existed again C(changed) will be set to true only if the key actually existed
prior to the removal. An attempt can be made to obtain or free the prior to the removal. An attempt can be made to obtain or free the
lock associated with a key/value pair with the states 'acquire' or lock associated with a key/value pair with the states C(acquire) or
'release' respectively. a valid session must be supplied to make the C(release) respectively. a valid session must be supplied to make the
attempt changed will be true if the attempt is successful, false attempt changed will be true if the attempt is successful, false
otherwise. otherwise.
type: str type: str

View File

@@ -279,7 +279,7 @@ def do_ini(module, filename, section=None, option=None, values=None,
# handling multiple instances of option=value when state is 'present' with/without exclusive is a bit complex # handling multiple instances of option=value when state is 'present' with/without exclusive is a bit complex
# #
# 1. edit all lines where we have a option=value pair with a matching value in values[] # 1. edit all lines where we have a option=value pair with a matching value in values[]
# 2. edit all the remaing lines where we have a matching option # 2. edit all the remaining lines where we have a matching option
# 3. delete remaining lines where we have a matching option # 3. delete remaining lines where we have a matching option
# 4. insert missing option line(s) at the end of the section # 4. insert missing option line(s) at the end of the section

View File

@@ -207,7 +207,7 @@ def main():
changed = True changed = True
else: else:
changed = False changed = False
out = "allready unpacked" out = "already unpacked"
if remove: if remove:
os.remove(path) os.remove(path)

View File

@@ -45,7 +45,7 @@ EXAMPLES = r'''
ipa_user: admin ipa_user: admin
ipa_pass: supersecret ipa_pass: supersecret
- name: Ensure the TOTP syncronization window is set to 86400 seconds - name: Ensure the TOTP synchronization window is set to 86400 seconds
community.general.ipa_otpconfig: community.general.ipa_otpconfig:
ipatokentotpsyncwindow: '86400' ipatokentotpsyncwindow: '86400'
ipa_host: localhost ipa_host: localhost
@@ -59,7 +59,7 @@ EXAMPLES = r'''
ipa_user: admin ipa_user: admin
ipa_pass: supersecret ipa_pass: supersecret
- name: Ensure the HOTP syncronization window is set to 100 hops - name: Ensure the HOTP synchronization window is set to 100 hops
community.general.ipa_otpconfig: community.general.ipa_otpconfig:
ipatokenhotpsyncwindow: '100' ipatokenhotpsyncwindow: '100'
ipa_host: localhost ipa_host: localhost

View File

@@ -63,7 +63,7 @@ options:
type: str type: str
replace: replace:
description: description:
- Force replace the existant vault on IPA server. - Force replace the existent vault on IPA server.
type: bool type: bool
default: False default: False
choices: ["True", "False"] choices: ["True", "False"]

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

@@ -64,7 +64,7 @@ msg:
realm_info: realm_info:
description: description:
- Representation of the realm public infomation. - Representation of the realm public information.
returned: always returned: always
type: dict type: dict
contains: contains:

View File

@@ -20,7 +20,7 @@ description:
- "Allows to post events to Datadog (www.datadoghq.com) service." - "Allows to post events to Datadog (www.datadoghq.com) service."
- "Uses http://docs.datadoghq.com/api/#events API." - "Uses http://docs.datadoghq.com/api/#events API."
author: author:
- "Artūras `arturaz` Šlajus (@arturaz)" - "Artūras 'arturaz' Šlajus (@arturaz)"
- "Naoya Nakazawa (@n0ts)" - "Naoya Nakazawa (@n0ts)"
options: options:
api_key: api_key:

View File

@@ -99,7 +99,7 @@ options:
weight: weight:
description: description:
- The value passed in argument. - The value passed in argument.
- If the value ends with the `%` sign, then the new weight will be - If the value ends with the C(%) sign, then the new weight will be
relative to the initially configured weight. relative to the initially configured weight.
- Relative weights are only permitted between 0 and 100% and absolute - Relative weights are only permitted between 0 and 100% and absolute
weights are permitted between 0 and 256. weights are permitted between 0 and 256.

View File

@@ -45,8 +45,8 @@ options:
- The interface to bind the connection to. - The interface to bind the connection to.
- The connection will only be applicable to this interface name. - The connection will only be applicable to this interface name.
- A special value of C('*') can be used for interface-independent connections. - A special value of C('*') can be used for interface-independent connections.
- The ifname argument is mandatory for all connection types except bond, team, bridge and vlan. - The ifname argument is mandatory for all connection types except bond, team, bridge, vlan and vpn.
- This parameter defaults to C(conn_name) when left unset. - This parameter defaults to C(conn_name) when left unset for all connection types except vpn that removes it.
type: str type: str
type: type:
description: description:
@@ -55,10 +55,11 @@ options:
- Type C(generic) is added in Ansible 2.5. - Type C(generic) is added in Ansible 2.5.
- Type C(infiniband) is added in community.general 2.0.0. - Type C(infiniband) is added in community.general 2.0.0.
- Type C(gsm) is added in community.general 3.7.0. - Type C(gsm) is added in community.general 3.7.0.
- Type C(wireguard) is added in community.general 4.3.0 - Type C(wireguard) is added in community.general 4.3.0.
- Type C(vpn) is added in community.general 5.1.0.
type: str type: str
choices: [ bond, bond-slave, bridge, bridge-slave, dummy, ethernet, generic, gre, infiniband, ipip, sit, team, team-slave, vlan, vxlan, wifi, gsm, choices: [ bond, bond-slave, bridge, bridge-slave, dummy, ethernet, generic, gre, infiniband, ipip, sit, team, team-slave, vlan, vxlan, wifi, gsm,
wireguard ] wireguard, vpn ]
mode: mode:
description: description:
- This is the type of device or network connection that you wish to create for a bond or bridge. - This is the type of device or network connection that you wish to create for a bond or bridge.
@@ -157,8 +158,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 +256,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:
@@ -905,6 +906,58 @@ options:
description: C(NMSettingSecretFlags) indicating how to handle the I(wireguard.private-key) property. description: C(NMSettingSecretFlags) indicating how to handle the I(wireguard.private-key) property.
type: int type: int
choices: [ 0, 1, 2 ] choices: [ 0, 1, 2 ]
vpn:
description:
- Configuration of a VPN connection (PPTP and L2TP).
- In order to use L2TP you need to be sure that C(network-manager-l2tp) - and C(network-manager-l2tp-gnome)
if host has UI - are installed on the host.
type: dict
version_added: 5.1.0
suboptions:
permissions:
description: User that will have permission to use the connection.
type: str
required: true
service-type:
description: This defines the service type of connection.
type: str
required: true
choices: [ pptp, l2tp ]
gateway:
description: The gateway to connection. It can be an IP address (for example C(192.0.2.1))
or a FQDN address (for example C(vpn.example.com)).
type: str
required: true
password-flags:
description:
- NMSettingSecretFlags indicating how to handle the I(password) property.
- 'Following choices are allowed:
C(0) B(NONE): The system is responsible for providing and storing this secret (default);
C(1) B(AGENT_OWNED): A user secret agent is responsible for providing and storing this secret; when it is required agents will be
asked to retrieve it;
C(2) B(NOT_SAVED): This secret should not be saved, but should be requested from the user each time it is needed;
C(4) B(NOT_REQUIRED): In situations where it cannot be automatically determined that the secret is required
(some VPNs and PPP providers do not require all secrets) this flag indicates that the specific secret is not required.'
type: int
choices: [ 0, 1, 2 , 4 ]
default: 0
user:
description: Username provided by VPN administrator.
type: str
required: true
ipsec-enabled:
description:
- Enable or disable IPSec tunnel to L2TP host.
- This option is need when C(service-type) is C(l2tp).
type: bool
choices: [ yes, no ]
ipsec-psk:
description:
- The pre-shared key in base64 encoding.
- >
You can encode using this Ansible jinja2 expression: C("0s{{ '[YOUR PRE-SHARED KEY]' | ansible.builtin.b64encode }}").
- This is only used when I(ipsec-enabled=true).
type: str
''' '''
EXAMPLES = r''' EXAMPLES = r'''
@@ -1288,6 +1341,23 @@ EXAMPLES = r'''
autoconnect: true autoconnect: true
state: present state: present
- name: >-
Create a VPN L2TP connection for ansible_user to connect on vpn.example.com
authenticating with user 'brittany' and pre-shared key as 'Brittany123'
community.general.nmcli:
type: vpn
conn_name: my-vpn-connection
vpn:
permissions: "{{ ansible_user }}"
service-type: l2tp
gateway: vpn.example.com
password-flags: 2
user: brittany
ipsec-enabled: true
ipsec-psk: "0s{{ 'Brittany123' | ansible.builtin.b64encode }}"
autoconnect: false
state: present
''' '''
RETURN = r"""# RETURN = r"""#
@@ -1404,6 +1474,7 @@ class Nmcli(object):
self.wifi_sec = module.params['wifi_sec'] self.wifi_sec = module.params['wifi_sec']
self.gsm = module.params['gsm'] self.gsm = module.params['gsm']
self.wireguard = module.params['wireguard'] self.wireguard = module.params['wireguard']
self.vpn = module.params['vpn']
if self.method4: if self.method4:
self.ipv4_method = self.method4 self.ipv4_method = self.method4
@@ -1430,7 +1501,7 @@ class Nmcli(object):
if self._hairpin is None: if self._hairpin is None:
self.module.deprecate( self.module.deprecate(
"Parameter 'hairpin' default value will change from true to false in community.general 7.0.0. " "Parameter 'hairpin' default value will change from true to false in community.general 7.0.0. "
"Set the value explicitly to supress this warning.", "Set the value explicitly to suppress this warning.",
version='7.0.0', collection_name='community.general', version='7.0.0', collection_name='community.general',
) )
# Should be False in 7.0.0 but then that should be in argument_specs # Should be False in 7.0.0 but then that should be in argument_specs
@@ -1592,6 +1663,29 @@ class Nmcli(object):
options.update({ options.update({
'wireguard.%s' % name: value, 'wireguard.%s' % name: value,
}) })
elif self.type == 'vpn':
if self.vpn:
vpn_data_values = ''
for name, value in self.vpn.items():
if name == 'service-type':
options.update({
'vpn-type': value,
})
elif name == 'permissions':
options.update({
'connection.permissions': value,
})
else:
if vpn_data_values != '':
vpn_data_values += ', '
if isinstance(value, bool):
value = self.bool_to_string(value)
vpn_data_values += '%s=%s' % (name, value)
options.update({
'vpn.data': vpn_data_values,
})
# Convert settings values based on the situation. # Convert settings values based on the situation.
for setting, value in options.items(): for setting, value in options.items():
setting_type = self.settings_type(setting) setting_type = self.settings_type(setting)
@@ -1742,7 +1836,10 @@ class Nmcli(object):
@staticmethod @staticmethod
def list_to_string(lst): def list_to_string(lst):
return ",".join(lst or [""]) if lst is None:
return None
else:
return ",".join(lst)
@staticmethod @staticmethod
def settings_type(setting): def settings_type(setting):
@@ -1832,6 +1929,10 @@ class Nmcli(object):
'connection.interface-name': ifname, 'connection.interface-name': ifname,
} }
# VPN doesn't need an interface but if sended it must be a valid interface.
if self.type == 'vpn' and self.ifname is None:
del options['connection.interface-name']
options.update(self.connection_options()) options.update(self.connection_options())
# Constructing the command. # Constructing the command.
@@ -1997,6 +2098,9 @@ class Nmcli(object):
current_value = current_value.strip('"') current_value = current_value.strip('"')
if key == self.mtu_setting and self.mtu is None: if key == self.mtu_setting and self.mtu is None:
self.mtu = 0 self.mtu = 0
if key == 'vpn.data':
current_value = list(map(str.strip, current_value.split(',')))
value = list(map(str.strip, value.split(',')))
else: else:
# parameter does not exist # parameter does not exist
current_value = None current_value = None
@@ -2025,6 +2129,10 @@ class Nmcli(object):
'connection.interface-name': self.ifname, 'connection.interface-name': self.ifname,
} }
# VPN doesn't need an interface but if sended it must be a valid interface.
if self.type == 'vpn' and self.ifname is None:
del options['connection.interface-name']
if not self.type: if not self.type:
current_con_type = self.show_connection().get('connection.type') current_con_type = self.show_connection().get('connection.type')
if current_con_type: if current_con_type:
@@ -2064,6 +2172,7 @@ def main():
'wifi', 'wifi',
'gsm', 'gsm',
'wireguard', 'wireguard',
'vpn',
]), ]),
ip4=dict(type='list', elements='str'), ip4=dict(type='list', elements='str'),
gw4=dict(type='str'), gw4=dict(type='str'),
@@ -2163,6 +2272,7 @@ def main():
wifi_sec=dict(type='dict', no_log=True), wifi_sec=dict(type='dict', no_log=True),
gsm=dict(type='dict'), gsm=dict(type='dict'),
wireguard=dict(type='dict'), wireguard=dict(type='dict'),
vpn=dict(type='dict'),
), ),
mutually_exclusive=[['never_default4', 'gw4'], mutually_exclusive=[['never_default4', 'gw4'],
['routes4_extended', 'routes4'], ['routes4_extended', 'routes4'],

View File

@@ -226,7 +226,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
check_rc = True check_rc = True
def _get_ansible_galaxy_version(self): def _get_ansible_galaxy_version(self):
ansible_galaxy = self.module.get_bin_path("ansible-galaxy", required=True) ansible_galaxy = self.get_bin_path("ansible-galaxy", required=True)
dummy, out, dummy = self.module.run_command([ansible_galaxy, "--version"], check_rc=True) dummy, out, dummy = self.module.run_command([ansible_galaxy, "--version"], check_rc=True)
line = out.splitlines()[0] line = out.splitlines()[0]
match = self._RE_GALAXY_VERSION.match(line) match = self._RE_GALAXY_VERSION.match(line)
@@ -242,7 +242,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
self.module.deprecate( self.module.deprecate(
"Support for Ansible 2.9 and ansible-base 2.10 is being deprecated. " "Support for Ansible 2.9 and ansible-base 2.10 is being deprecated. "
"At the same time support for them is ended, also the ack_ansible29 option will be removed. " "At the same time support for them is ended, also the ack_ansible29 option will be removed. "
"Upgrading is strongly recommended, or set 'ack_min_ansiblecore211' to supress this message.", "Upgrading is strongly recommended, or set 'ack_min_ansiblecore211' to suppress this message.",
version="8.0.0", version="8.0.0",
collection_name="community.general", collection_name="community.general",
) )
@@ -302,9 +302,9 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
self.vars.set("new_roles", {}) self.vars.set("new_roles", {})
self.vars.set("ansible29_change", False, change=True, output=False) self.vars.set("ansible29_change", False, change=True, output=False)
if not (self.vars.ack_ansible29 or self.vars.ack_min_ansiblecore211): if not (self.vars.ack_ansible29 or self.vars.ack_min_ansiblecore211):
self.module.warn("Ansible 2.9 or older: unable to retrieve lists of roles and collections already installed") self.warn("Ansible 2.9 or older: unable to retrieve lists of roles and collections already installed")
if self.vars.requirements_file is not None and self.vars.type == 'both': if self.vars.requirements_file is not None and self.vars.type == 'both':
self.module.warn("Ansible 2.9 or older: will install only roles from requirement files") self.warn("Ansible 2.9 or older: will install only roles from requirement files")
def _setup210plus(self): def _setup210plus(self):
self.vars.set("new_collections", {}, change=True) self.vars.set("new_collections", {}, change=True)

View File

@@ -81,7 +81,7 @@ options:
classmap_authoritative: classmap_authoritative:
description: description:
- Autoload classes from classmap only. - Autoload classes from classmap only.
- Implicitely enable optimize_autoloader. - Implicitly enable optimize_autoloader.
- Recommended especially for production, but can take a bit of time to run. - Recommended especially for production, but can take a bit of time to run.
default: false default: false
type: bool type: bool

View File

@@ -134,7 +134,7 @@ EXAMPLES = '''
import os import os
from ansible_collections.community.general.plugins.module_utils.module_helper import ( from ansible_collections.community.general.plugins.module_utils.module_helper import (
ModuleHelper, CmdMixin, ArgFormat, ModuleHelperException ModuleHelper, CmdMixin, ArgFormat
) )
@@ -171,10 +171,10 @@ class CPANMinus(CmdMixin, ModuleHelper):
v = self.vars v = self.vars
if v.mode == "compatibility": if v.mode == "compatibility":
if v.name_check: if v.name_check:
raise ModuleHelperException("Parameter name_check can only be used with mode=new") self.do_raise("Parameter name_check can only be used with mode=new")
else: else:
if v.name and v.from_path: if v.name and v.from_path:
raise ModuleHelperException("Parameters 'name' and 'from_path' are mutually exclusive when 'mode=new'") self.do_raise("Parameters 'name' and 'from_path' are mutually exclusive when 'mode=new'")
self.command = self.module.get_bin_path(v.executable if v.executable else self.command) self.command = self.module.get_bin_path(v.executable if v.executable else self.command)
self.vars.set("binary", self.command) self.vars.set("binary", self.command)
@@ -190,17 +190,16 @@ class CPANMinus(CmdMixin, ModuleHelper):
return rc == 0 return rc == 0
@staticmethod def sanitize_pkg_spec_version(self, pkg_spec, version):
def sanitize_pkg_spec_version(pkg_spec, version):
if version is None: if version is None:
return pkg_spec return pkg_spec
if pkg_spec.endswith('.tar.gz'): if pkg_spec.endswith('.tar.gz'):
raise ModuleHelperException(msg="parameter 'version' must not be used when installing from a file") self.do_raise(msg="parameter 'version' must not be used when installing from a file")
if os.path.isdir(pkg_spec): if os.path.isdir(pkg_spec):
raise ModuleHelperException(msg="parameter 'version' must not be used when installing from a directory") self.do_raise(msg="parameter 'version' must not be used when installing from a directory")
if pkg_spec.endswith('.git'): if pkg_spec.endswith('.git'):
if version.startswith('~'): if version.startswith('~'):
raise ModuleHelperException(msg="operator '~' not allowed in version parameter when installing from git repository") self.do_raise(msg="operator '~' not allowed in version parameter when installing from git repository")
version = version if version.startswith('@') else '@' + version version = version if version.startswith('@') else '@' + version
elif version[0] not in ('@', '~'): elif version[0] not in ('@', '~'):
version = '~' + version version = '~' + version
@@ -228,7 +227,7 @@ class CPANMinus(CmdMixin, ModuleHelper):
def process_command_output(self, rc, out, err): def process_command_output(self, rc, out, err):
if self.vars.mode == "compatibility" and rc != 0: if self.vars.mode == "compatibility" and rc != 0:
raise ModuleHelperException(msg=err, cmd=self.vars.cmd_args) self.do_raise(msg=err, cmd=self.vars.cmd_args)
return 'is up to date' not in err and 'is up to date' not in out return 'is up to date' not in err and 'is up to date' not in out

View File

@@ -17,7 +17,7 @@ options:
clients: clients:
description: description:
- A list of the pip executables that will be used to get the packages. - A list of the pip executables that will be used to get the packages.
They can be supplied with the full path or just the executable name, i.e `pip3.7`. They can be supplied with the full path or just the executable name, for example C(pip3.7).
default: ['pip'] default: ['pip']
required: False required: False
type: list type: list

View File

@@ -134,7 +134,7 @@ EXAMPLES = '''
import json import json
from ansible_collections.community.general.plugins.module_utils.module_helper import ( from ansible_collections.community.general.plugins.module_utils.module_helper import (
CmdStateModuleHelper, ArgFormat, ModuleHelperException CmdStateModuleHelper, ArgFormat
) )
from ansible.module_utils.facts.compat import ansible_facts from ansible.module_utils.facts.compat import ansible_facts
@@ -153,9 +153,8 @@ class PipX(CmdStateModuleHelper):
module = dict( module = dict(
argument_spec=dict( argument_spec=dict(
state=dict(type='str', default='install', state=dict(type='str', default='install',
choices=[ choices=['present', 'absent', 'install', 'uninstall', 'uninstall_all',
'present', 'absent', 'install', 'uninstall', 'uninstall_all', 'inject', 'upgrade', 'upgrade_all', 'reinstall', 'reinstall_all']),
'inject', 'upgrade', 'upgrade_all', 'reinstall', 'reinstall_all']),
name=dict(type='str'), name=dict(type='str'),
source=dict(type='str'), source=dict(type='str'),
install_deps=dict(type='bool', default=False), install_deps=dict(type='bool', default=False),
@@ -247,8 +246,7 @@ class PipX(CmdStateModuleHelper):
def state_upgrade(self): def state_upgrade(self):
if not self.vars.application: if not self.vars.application:
raise ModuleHelperException( self.do_raise("Trying to upgrade a non-existent application: {0}".format(self.vars.name))
"Trying to upgrade a non-existent application: {0}".format(self.vars.name))
if self.vars.force: if self.vars.force:
self.changed = True self.changed = True
if not self.module.check_mode: if not self.module.check_mode:
@@ -262,16 +260,14 @@ class PipX(CmdStateModuleHelper):
def state_reinstall(self): def state_reinstall(self):
if not self.vars.application: if not self.vars.application:
raise ModuleHelperException( self.do_raise("Trying to reinstall a non-existent application: {0}".format(self.vars.name))
"Trying to reinstall a non-existent application: {0}".format(self.vars.name))
self.changed = True self.changed = True
if not self.module.check_mode: if not self.module.check_mode:
self.run_command(params=['state', 'name', 'python']) self.run_command(params=['state', 'name', 'python'])
def state_inject(self): def state_inject(self):
if not self.vars.application: if not self.vars.application:
raise ModuleHelperException( self.do_raise("Trying to inject packages into a non-existent application: {0}".format(self.vars.name))
"Trying to inject packages into a non-existent application: {0}".format(self.vars.name))
if self.vars.force: if self.vars.force:
self.changed = True self.changed = True
if not self.module.check_mode: if not self.module.check_mode:

View File

@@ -62,8 +62,8 @@ options:
type: bool type: bool
default: no default: no
notes: notes:
- '"name" and "upgrade" are mutually exclusive.' - 'I(name) and I(upgrade) are mutually exclusive.'
- When used with a `loop:` each package will be processed individually, it is much more efficient to pass the list directly to the `name` option. - When used with a C(loop:) each package will be processed individually, it is much more efficient to pass the list directly to the I(name) option.
''' '''
EXAMPLES = ''' EXAMPLES = '''

View File

@@ -35,7 +35,7 @@ options:
elements: str elements: str
path: path:
description: description:
- "A ':' separated list of paths to search for 'brew' executable. - "A C(:) separated list of paths to search for C(brew) executable.
Since a package (I(formula) in homebrew parlance) location is prefixed relative to the actual path of I(brew) command, Since a package (I(formula) in homebrew parlance) location is prefixed relative to the actual path of I(brew) command,
providing an alternative I(brew) path enables managing different set of packages in an alternative location in the system." providing an alternative I(brew) path enables managing different set of packages in an alternative location in the system."
default: '/usr/local/bin:/opt/homebrew/bin' default: '/usr/local/bin:/opt/homebrew/bin'
@@ -70,8 +70,8 @@ options:
elements: str elements: str
version_added: '0.2.0' version_added: '0.2.0'
notes: notes:
- When used with a `loop:` each package will be processed individually, - When used with a C(loop:) each package will be processed individually,
it is much more efficient to pass the list directly to the `name` option. it is much more efficient to pass the list directly to the I(name) option.
''' '''
EXAMPLES = ''' EXAMPLES = '''

View File

@@ -70,8 +70,8 @@ options:
type: bool type: bool
default: no default: no
notes: notes:
- When used with a `loop:` each package will be processed individually, - When used with a C(loop:) each package will be processed individually,
it is much more efficient to pass the list directly to the `name` option. it is much more efficient to pass the list directly to the I(name) option.
''' '''
EXAMPLES = ''' EXAMPLES = '''

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