Compare commits

...

23 Commits
6.1.0 ... 6.2.0

Author SHA1 Message Date
Felix Fontein
e978fd4d61 Release 6.2.0. 2023-01-04 07:29:45 +01:00
Felix Fontein
6fc8492ecf Prepare 6.2.0 release. 2023-01-03 23:53:45 +01:00
Alexei Znamensky
95beb452a8 rax modules: deprecation notice for branch stable-6 (#5733)
* rax modules: deprecation notice for branch stable-6

* add changelog fragment

* adjust changelog message

* adjust changelog message
2023-01-03 23:35:26 +01:00
patchback[bot]
c10e9e2650 [PR #5741/06d72dfe backport][stable-6] htpasswd: improve documentation on crypt_scheme (#5749)
htpasswd: improve documentation on crypt_scheme (#5741)

* htpasswd: improve documentation on crypt_scheme

* htpasswd: formatting in documentation

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

* htpasswd: formatting in documentation

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

* Apply suggestions from code review

* Apply suggestions from code review

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

Co-authored-by: bluikko <14869000+bluikko@users.noreply.github.com>
2022-12-31 08:13:04 +01:00
patchback[bot]
ac35bf4acb [PR #5744/568e1880 backport][stable-6] unixy Callback: Fix typo using ansibles config manager (#5747)
unixy Callback: Fix typo using ansibles config manager (#5744)

Fixes typo introduced in 53da86c.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
(cherry picked from commit 568e18809c)

Co-authored-by: Fabian P. Schmidt <kerel@mailbox.org>
2022-12-31 07:54:09 +01:00
patchback[bot]
50b9855ace [PR #5714/2d4ce9f2 backport][stable-6] feat: add tags to proxmox containers (#5745)
feat: add tags to proxmox containers (#5714)

* feat: add tags to proxmox containers

* fix: correct version added

* fix: code style

* feat: changelog fragment

* fix: correct version_added

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

* feat: fail on unsupported params, rather than silently ignoring them

* fix: actually check unsupported feature presence before failing

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

Co-authored-by: GuillaumeV-cemea <101114641+GuillaumeV-cemea@users.noreply.github.com>
2022-12-30 22:18:40 +01:00
patchback[bot]
2ab26db197 [PR #5658/669d0925 backport][stable-6] Feature: Provide project field for LXD inventory plugin (#5729)
Feature: Provide project field for LXD inventory plugin (#5658)

* Provide project field for LXD inventory plugin

if field `project` exists in `lxd.yml`, the instances are searched in the
given LXD project. if project field is not defined the default project
named `default` will be used.

Signed-off-by: omani <3346207+omani@users.noreply.github.com>

* Update plugins/inventory/lxd.py

Signed-off-by: omani <3346207+omani@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 669d0925f7)

Co-authored-by: HAH! Sun <3346207+omani@users.noreply.github.com>
2022-12-23 11:47:47 +01:00
patchback[bot]
5fcf5d0c8b [PR #5720/6383c823 backport][stable-6] ssh_config: fixed sanity (#5726)
ssh_config: fixed sanity (#5720)

* ssh_config: fix sanity checks

* fixed mod utils and removed sanity ignores

* update BOTMETA

* add changelog fragment

* Update plugins/module_utils/ssh.py

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

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

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-12-23 06:41:39 +01:00
patchback[bot]
0f0ad6b6d1 [PR #5688/b3485b8f backport][stable-6] opkg module: allow installing a package in a certain version (#5724)
opkg module: allow installing a package in a certain version  (#5688)

* opkg: allow installing a package in a certain version

example:
- name: Install foo in version 1.2
  community.general.opkg:
    name: foo=1.2
    state: present

Signed-off-by: Joerg Hofrichter <joerg.hofrichter@ni.com>

* opkg: use list for passing arguments to run_command

Signed-off-by: Joerg Hofrichter <joerg.hofrichter@ni.com>

Signed-off-by: Joerg Hofrichter <joerg.hofrichter@ni.com>
(cherry picked from commit b3485b8fca)

Co-authored-by: joergho <48011876+joergho@users.noreply.github.com>
2022-12-22 20:58:43 +01:00
patchback[bot]
95f3109ddc [PR #5721/28969c61 backport][stable-6] manageiq_policies: deprecate list state (#5723)
manageiq_policies: deprecate list state (#5721)

* manageiq_policies: deprecate list state

* add changelog fragment

(cherry picked from commit 28969c61ad)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-12-22 07:11:24 +01:00
patchback[bot]
6037c5d1e6 [PR #5680/488e828f backport][stable-6] ansible_galaxy_install: use locale C tentatively, else en_US (#5722)
ansible_galaxy_install: use locale C tentatively, else en_US (#5680)

* ansible_galaxy_install: use locale C tentatively, else en_US

* use custom exception to signal unsupported locale

* add step to remove artefacts at the end of the test

* add step to remove artefacts at the beginning of the test

* comment out context controller

* trying with temporary dir as destination

* remove collection before test with reqs file

* ensure collections are installed in temp dir in tests + check_force

* simplified the change

* added extra condition for failing locale

* improved exception handling

* add changelog fragment

(cherry picked from commit 488e828f9b)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-12-22 06:00:34 +00:00
patchback[bot]
a70d9773dd [PR #5713/1f492414 backport][stable-6] CI: add extra VMs for certain tests (#5717)
CI: add extra VMs for certain tests (#5713)

* Remove superfluous VM.

* Add extra VM group.

* More platforms, add scripts.

* [REVERT THIS] Shrink matrix to only the tests we are interested in.

* Fix some tests.

* Skip snap tests on Ubuntu VMs for now.

* Skip xfs_quota tests on Alpine VMs due to ansible.posix.mount failing.

* Revert "[REVERT THIS] Shrink matrix to only the tests we are interested in."

This reverts commit 2e98e163db.

* Stick to Alpine and Ubuntu 22.04 for now.

(cherry picked from commit 1f49241481)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-12-21 08:13:06 +01:00
patchback[bot]
bc50b48205 [PR #5703/77fde030 backport][stable-6] Add support for host restriction in sudoers module (#5716)
Add support for host restriction in sudoers module (#5703)

* Add support to restrict privileges by host

* Missing comma

* Making linter happy.

* Add version 6.2.0 as when sudoers host parameter added

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

* Changelog fragment for PR #5703

* Test for sudoers host-based restriction

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

Co-authored-by: Laurence <laurence+github@entek.org.uk>
2022-12-20 12:59:26 +01:00
patchback[bot]
02e6a8608f [PR #5672/fab73a1d backport][stable-6] Bugfix: Remove redundant VMID parameters (#5709)
Bugfix: Remove redundant VMID parameters (#5672)

* Remove redundant parameters VMID

* Add changelog fragment

(cherry picked from commit fab73a1d1e)

Co-authored-by: castorsky <csky57@gmail.com>
2022-12-19 20:43:13 +01:00
patchback[bot]
82f4b51873 [PR #5705/2b39470a backport][stable-6] opkg: fix issue that force=reinstall would not reinstall an existing package (#5711)
opkg: fix issue that force=reinstall would not reinstall an existing package (#5705)

* opkg: fix issue that force=reinstall would not reinstall an existing package

Signed-off-by: Joerg Hofrichter <joerg.hofrichter@ni.com>

* changelog fragment

Signed-off-by: Joerg Hofrichter <joerg.hofrichter@ni.com>
(cherry picked from commit 2b39470a77)

Co-authored-by: joergho <48011876+joergho@users.noreply.github.com>
2022-12-19 20:43:00 +01:00
patchback[bot]
589e8fd5e1 [PR #5699/25be366c backport][stable-6] Fixed github_release docs: only module-specific returned key is tag (#5701)
Fixed `github_release` docs: only module-specific returned key is `tag` (#5699)

* Fixed github_release docs: only module-specific returned key is "tag"

* Update plugins/modules/github_release.py - added a dot

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

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

Co-authored-by: Or Bin <orbin50@gmail.com>
2022-12-18 09:25:46 +01:00
patchback[bot]
58f74b96ef [PR #5659/af53271c backport][stable-6] lxc_container: fix lxc argument when executing lxc command (#5698)
lxc_container: fix lxc argument when executing lxc command (#5659)

lxc_container fails when executing the lxc command (e.g. when creating
a new container) because PR#5358 broke the module argument
parsing. The resulting argument dict contained only the module argument name
and the argument flag but not the value. E.g.
```
- lxc_container:
    template: debian
```
would result in lxc command arguments `lxc template --template` instead of
`lxc --template debian`.

Fixes: 6f88426cf1 ("lxc_container: minor refactor (#5358)")
Fixes #5578

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
(cherry picked from commit af53271c41)

Co-authored-by: Alexander Couzens <lynxis@fe80.eu>
2022-12-17 12:22:30 +01:00
patchback[bot]
1489c080a7 [PR #5612/f95e0d77 backport][stable-6] puppet: refactored to use CmdRunner (#5686)
puppet: refactored to use CmdRunner (#5612)

* puppet: refactored to use CmdRunner

* add changelog fragment

* add more tests

(cherry picked from commit f95e0d775d)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-12-14 22:03:40 +01:00
patchback[bot]
6f845f61f0 [PR #5667/c3bc172b backport][stable-6] respect new variable property in gitlab_group_variable and gitlab_project_variable (#5679)
respect new variable property in gitlab_group_variable and gitlab_project_variable (#5667)

* draft

* add changelog fragment

* rework

* rework group variables

* add new line at end of file

* Update plugins/module_utils/gitlab.py

Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>

* rename

* revert

* return a copy

* Update plugins/modules/gitlab_project_variable.py

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

Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit c3bc172bf6)

Co-authored-by: Markus Bergholz <git@osuv.de>
2022-12-10 22:42:19 +01:00
patchback[bot]
c17f5ff3e8 [PR #5674/b5e58a3b backport][stable-6] CI: Bump CentOS Stream 8 Python from 3.8 to 3.9 (#5677)
CI: Bump CentOS Stream 8 Python from 3.8 to 3.9 (#5674)

Bump CentOS Stream 8 Python from 3.8 to 3.9.

(cherry picked from commit b5e58a3bcc)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-12-09 15:52:27 +00:00
patchback[bot]
ff21afb227 [PR #5662/471f523f backport][stable-6] redhat_subscription: add server_proxy_scheme parameter (#5671)
redhat_subscription: add `server_proxy_scheme` parameter (#5662)

Add the `server_proxy_scheme` parameter to configure the scheme used for
the proxy server. This completes the configuration parameters for the
proxy server.

(cherry picked from commit 471f523f53)

Co-authored-by: Pino Toscano <ptoscano@redhat.com>
2022-12-08 22:54:18 +01:00
patchback[bot]
c1d6e5c3c2 [PR #5668/50021d6b backport][stable-6] Fix pipx_info tests (#5670)
Fix pipx_info tests (#5668)

Update dependencies.

(cherry picked from commit 50021d6bfb)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-12-08 22:25:12 +01:00
Felix Fontein
377b5d4ccd Next expected release is 6.2.0. 2022-12-06 08:02:06 +01:00
74 changed files with 916 additions and 267 deletions

View File

@@ -189,6 +189,24 @@ stages:
- test: 3.5 - test: 3.5
## Remote ## Remote
- stage: Remote_devel_extra_vms
displayName: Remote devel extra VMs
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: devel/{0}
targets:
- name: Alpine 3.16
test: alpine/3.16
# - name: Fedora 36
# test: fedora/36
# - name: Ubuntu 20.04
# test: ubuntu/20.04
- name: Ubuntu 22.04
test: ubuntu/22.04
groups:
- vm
- stage: Remote_devel - stage: Remote_devel
displayName: Remote devel displayName: Remote devel
dependsOn: [] dependsOn: []
@@ -203,8 +221,6 @@ stages:
test: rhel/7.9 test: rhel/7.9
- name: RHEL 9.0 - name: RHEL 9.0
test: rhel/9.0 test: rhel/9.0
- name: FreeBSD 12.3
test: freebsd/12.3
- name: FreeBSD 13.1 - name: FreeBSD 13.1
test: freebsd/13.1 test: freebsd/13.1
groups: groups:
@@ -221,8 +237,8 @@ stages:
targets: targets:
- name: RHEL 9.0 - name: RHEL 9.0
test: rhel/9.0 test: rhel/9.0
- name: FreeBSD 13.1 - name: FreeBSD 12.3
test: freebsd/13.1 test: freebsd/12.3
groups: groups:
- 1 - 1
- 2 - 2
@@ -386,7 +402,7 @@ stages:
- name: ArchLinux - name: ArchLinux
test: archlinux/3.10 test: archlinux/3.10
- name: CentOS Stream 8 - name: CentOS Stream 8
test: centos-stream8/3.8 test: centos-stream8/3.9
groups: groups:
- 1 - 1
- 2 - 2
@@ -459,6 +475,7 @@ stages:
- Units_2_12 - Units_2_12
- Units_2_13 - Units_2_13
- Units_2_14 - Units_2_14
- Remote_devel_extra_vms
- Remote_devel - Remote_devel
- Remote_2_11 - Remote_2_11
- Remote_2_12 - Remote_2_12

5
.github/BOTMETA.yml vendored
View File

@@ -309,6 +309,9 @@ files:
$module_utils/pipx.py: $module_utils/pipx.py:
labels: pipx labels: pipx
maintainers: russoz maintainers: russoz
$module_utils/puppet.py:
labels: puppet
maintainers: russoz
$module_utils/pure.py: $module_utils/pure.py:
labels: pure pure_storage labels: pure pure_storage
maintainers: $team_purestorage maintainers: $team_purestorage
@@ -320,6 +323,8 @@ files:
$module_utils/scaleway.py: $module_utils/scaleway.py:
labels: cloud scaleway labels: cloud scaleway
maintainers: $team_scaleway maintainers: $team_scaleway
$module_utils/ssh.py:
maintainers: russoz
$module_utils/storage/hpe3par/hpe3par.py: $module_utils/storage/hpe3par/hpe3par.py:
maintainers: farhan7500 gautamphegde maintainers: farhan7500 gautamphegde
$module_utils/utm_utils.py: $module_utils/utm_utils.py:

View File

@@ -6,6 +6,68 @@ Community General Release Notes
This changelog describes changes after version 5.0.0. This changelog describes changes after version 5.0.0.
v6.2.0
======
Release Summary
---------------
Regular bugfix and feature release.
Minor Changes
-------------
- opkg - allow installing a package in a certain version (https://github.com/ansible-collections/community.general/pull/5688).
- proxmox - added new module parameter ``tags`` for use with PVE 7+ (https://github.com/ansible-collections/community.general/pull/5714).
- puppet - refactored module to use ``CmdRunner`` for executing ``puppet`` (https://github.com/ansible-collections/community.general/pull/5612).
- redhat_subscription - add a ``server_proxy_scheme`` parameter to configure the scheme for the proxy server (https://github.com/ansible-collections/community.general/pull/5662).
- ssh_config - refactor code to module util to fix sanity check (https://github.com/ansible-collections/community.general/pull/5720).
- sudoers - adds ``host`` parameter for setting hostname restrictions in sudoers rules (https://github.com/ansible-collections/community.general/issues/5702).
Deprecated Features
-------------------
- manageiq_policies - deprecate ``state=list`` in favour of using ``community.general.manageiq_policies_info`` (https://github.com/ansible-collections/community.general/pull/5721).
- rax - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cbs - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cbs_attachments - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cdb - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cdb_database - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cdb_user - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_clb - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_clb_nodes - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_clb_ssl - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_dns - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_dns_record - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_facts - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_files - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_files_objects - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_identity - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_keypair - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_meta - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_alarm - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_check - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_entity - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_notification - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_notification_plan - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_network - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_queue - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_scaling_group - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_scaling_policy - module relies on deprecates library ``pyrax``. Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
Bugfixes
--------
- ansible_galaxy_install - set default to raise exception if command's return code is different from zero (https://github.com/ansible-collections/community.general/pull/5680).
- ansible_galaxy_install - try ``C.UTF-8`` and then fall back to ``en_US.UTF-8`` before failing (https://github.com/ansible-collections/community.general/pull/5680).
- gitlab_group_variables - fix dropping variables accidentally when GitLab introduced new properties (https://github.com/ansible-collections/community.general/pull/5667).
- gitlab_project_variables - fix dropping variables accidentally when GitLab introduced new properties (https://github.com/ansible-collections/community.general/pull/5667).
- lxc_container - fix the arguments of the lxc command which broke the creation and cloning of containers (https://github.com/ansible-collections/community.general/issues/5578).
- opkg - fix issue that ``force=reinstall`` would not reinstall an existing package (https://github.com/ansible-collections/community.general/pull/5705).
- proxmox_disk - fixed possible issues with redundant ``vmid`` parameter (https://github.com/ansible-collections/community.general/issues/5492, https://github.com/ansible-collections/community.general/pull/5672).
- proxmox_nic - fixed possible issues with redundant ``vmid`` parameter (https://github.com/ansible-collections/community.general/issues/5492, https://github.com/ansible-collections/community.general/pull/5672).
- unixy callback plugin - fix typo introduced when updating to use Ansible's configuration manager for handling options (https://github.com/ansible-collections/community.general/issues/5600).
v6.1.0 v6.1.0
====== ======

View File

@@ -754,3 +754,132 @@ releases:
name: keycloak_clientsecret_regenerate name: keycloak_clientsecret_regenerate
namespace: '' namespace: ''
release_date: '2022-12-06' release_date: '2022-12-06'
6.2.0:
changes:
bugfixes:
- ansible_galaxy_install - set default to raise exception if command's return
code is different from zero (https://github.com/ansible-collections/community.general/pull/5680).
- ansible_galaxy_install - try ``C.UTF-8`` and then fall back to ``en_US.UTF-8``
before failing (https://github.com/ansible-collections/community.general/pull/5680).
- gitlab_group_variables - fix dropping variables accidentally when GitLab introduced
new properties (https://github.com/ansible-collections/community.general/pull/5667).
- gitlab_project_variables - fix dropping variables accidentally when GitLab
introduced new properties (https://github.com/ansible-collections/community.general/pull/5667).
- lxc_container - fix the arguments of the lxc command which broke the creation
and cloning of containers (https://github.com/ansible-collections/community.general/issues/5578).
- opkg - fix issue that ``force=reinstall`` would not reinstall an existing
package (https://github.com/ansible-collections/community.general/pull/5705).
- proxmox_disk - fixed possible issues with redundant ``vmid`` parameter (https://github.com/ansible-collections/community.general/issues/5492,
https://github.com/ansible-collections/community.general/pull/5672).
- proxmox_nic - fixed possible issues with redundant ``vmid`` parameter (https://github.com/ansible-collections/community.general/issues/5492,
https://github.com/ansible-collections/community.general/pull/5672).
- unixy callback plugin - fix typo introduced when updating to use Ansible's
configuration manager for handling options (https://github.com/ansible-collections/community.general/issues/5600).
deprecated_features:
- manageiq_policies - deprecate ``state=list`` in favour of using ``community.general.manageiq_policies_info``
(https://github.com/ansible-collections/community.general/pull/5721).
- rax - module relies on deprecates library ``pyrax``. Unless maintainers step
up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cbs - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cbs_attachments - module relies on deprecates library ``pyrax``. Unless
maintainers step up to work on the module, it will be marked as deprecated
in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cdb - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cdb_database - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_cdb_user - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_clb - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_clb_nodes - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_clb_ssl - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_dns - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_dns_record - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_facts - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_files - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_files_objects - module relies on deprecates library ``pyrax``. Unless
maintainers step up to work on the module, it will be marked as deprecated
in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_identity - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_keypair - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_meta - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_alarm - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_check - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_entity - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_notification - module relies on deprecates library ``pyrax``. Unless
maintainers step up to work on the module, it will be marked as deprecated
in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_mon_notification_plan - module relies on deprecates library ``pyrax``.
Unless maintainers step up to work on the module, it will be marked as deprecated
in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_network - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_queue - module relies on deprecates library ``pyrax``. Unless maintainers
step up to work on the module, it will be marked as deprecated in community.general
7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_scaling_group - module relies on deprecates library ``pyrax``. Unless
maintainers step up to work on the module, it will be marked as deprecated
in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
- rax_scaling_policy - module relies on deprecates library ``pyrax``. Unless
maintainers step up to work on the module, it will be marked as deprecated
in community.general 7.0.0 and removed in version 9.0.0 (https://github.com/ansible-collections/community.general/pull/5733).
minor_changes:
- opkg - allow installing a package in a certain version (https://github.com/ansible-collections/community.general/pull/5688).
- proxmox - added new module parameter ``tags`` for use with PVE 7+ (https://github.com/ansible-collections/community.general/pull/5714).
- puppet - refactored module to use ``CmdRunner`` for executing ``puppet`` (https://github.com/ansible-collections/community.general/pull/5612).
- redhat_subscription - add a ``server_proxy_scheme`` parameter to configure
the scheme for the proxy server (https://github.com/ansible-collections/community.general/pull/5662).
- ssh_config - refactor code to module util to fix sanity check (https://github.com/ansible-collections/community.general/pull/5720).
- sudoers - adds ``host`` parameter for setting hostname restrictions in sudoers
rules (https://github.com/ansible-collections/community.general/issues/5702).
release_summary: Regular bugfix and feature release.
fragments:
- 5612-puppet-cmd-runner.yml
- 5659-fix-lxc_container-command.yml
- 5662-redhat_subscription-server_proxy_scheme.yaml
- 5666-gitlab-variables.yml
- 5672-proxmox.yml
- 5680-ansible_galaxy_install-fx-locale.yaml
- 5688-opkg-module-install-certain-version.yml
- 5703-sudoers-host-support.yml
- 5705-opkg-fix-force-reinstall.yml
- 5714-proxmox-lxc-tag-support.yml
- 5720-ssh_config-plugin-sanity.yml
- 5721-manageiq-policies-deprecate-list-state.yaml
- 5733-rax-deprecation-notice.yml
- 5744-unixy-callback-fix-config-manager-typo.yml
- 6.2.0.yml
release_date: '2023-01-04'

View File

@@ -5,7 +5,7 @@
namespace: community namespace: community
name: general name: general
version: 6.1.0 version: 6.2.0
readme: README.md readme: README.md
authors: authors:
- Ansible (https://github.com/ansible) - Ansible (https://github.com/ansible)

View File

@@ -142,7 +142,7 @@ class CallbackModule(CallbackModule_default):
display_color = C.COLOR_CHANGED display_color = C.COLOR_CHANGED
task_result = self._process_result_output(result, msg) task_result = self._process_result_output(result, msg)
self._display.display(" " + task_result, display_color) self._display.display(" " + task_result, display_color)
elif self.get('display_ok_hosts'): elif self.get_option('display_ok_hosts'):
task_result = self._process_result_output(result, msg) task_result = self._process_result_output(result, msg)
self._display.display(" " + task_result, display_color) self._display.display(" " + task_result, display_color)

View File

@@ -55,6 +55,11 @@ DOCUMENTATION = r'''
type: str type: str
default: none default: none
choices: [ 'STOPPED', 'STARTING', 'RUNNING', 'none' ] choices: [ 'STOPPED', 'STARTING', 'RUNNING', 'none' ]
project:
description: Filter the instance according to the given project.
type: str
default: default
version_added: 6.2.0
type_filter: type_filter:
description: description:
- Filter the instances by type C(virtual-machine), C(container) or C(both). - Filter the instances by type C(virtual-machine), C(container) or C(both).
@@ -140,6 +145,9 @@ groupby:
vlan666: vlan666:
type: vlanid type: vlanid
attribute: 666 attribute: 666
projectInternals:
type: project
attribute: internals
''' '''
import binascii import binascii
@@ -153,6 +161,7 @@ from ansible.module_utils.common.text.converters import to_native, to_text
from ansible.module_utils.common.dict_transformations import dict_merge from ansible.module_utils.common.dict_transformations import dict_merge
from ansible.module_utils.six import raise_from from ansible.module_utils.six import raise_from
from ansible.errors import AnsibleError, AnsibleParserError from ansible.errors import AnsibleError, AnsibleParserError
from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible_collections.community.general.plugins.module_utils.lxd import LXDClient, LXDClientException from ansible_collections.community.general.plugins.module_utils.lxd import LXDClient, LXDClientException
try: try:
@@ -330,7 +339,15 @@ class InventoryModule(BaseInventoryPlugin):
# "status_code": 200, # "status_code": 200,
# "type": "sync" # "type": "sync"
# } # }
instances = self.socket.do('GET', '/1.0/instances') url = '/1.0/instances'
if self.project:
url = url + '?{0}'.format(urlencode(dict(project=self.project)))
instances = self.socket.do('GET', url)
if self.project:
return [m.split('/')[3].split('?')[0] for m in instances['metadata']]
return [m.split('/')[3] for m in instances['metadata']] return [m.split('/')[3] for m in instances['metadata']]
def _get_config(self, branch, name): def _get_config(self, branch, name):
@@ -351,9 +368,11 @@ class InventoryModule(BaseInventoryPlugin):
dict(config): Config of the instance""" dict(config): Config of the instance"""
config = {} config = {}
if isinstance(branch, (tuple, list)): if isinstance(branch, (tuple, list)):
config[name] = {branch[1]: self.socket.do('GET', '/1.0/{0}/{1}/{2}'.format(to_native(branch[0]), to_native(name), to_native(branch[1])))} config[name] = {branch[1]: self.socket.do(
'GET', '/1.0/{0}/{1}/{2}?{3}'.format(to_native(branch[0]), to_native(name), to_native(branch[1]), urlencode(dict(project=self.project))))}
else: else:
config[name] = {branch: self.socket.do('GET', '/1.0/{0}/{1}'.format(to_native(branch), to_native(name)))} config[name] = {branch: self.socket.do(
'GET', '/1.0/{0}/{1}?{2}'.format(to_native(branch), to_native(name), urlencode(dict(project=self.project))))}
return config return config
def get_instance_data(self, names): def get_instance_data(self, names):
@@ -583,6 +602,8 @@ class InventoryModule(BaseInventoryPlugin):
self._set_data_entry(instance_name, 'network_interfaces', self.extract_network_information_from_instance_config(instance_name)) self._set_data_entry(instance_name, 'network_interfaces', self.extract_network_information_from_instance_config(instance_name))
self._set_data_entry(instance_name, 'preferred_interface', self.get_prefered_instance_network_interface(instance_name)) self._set_data_entry(instance_name, 'preferred_interface', self.get_prefered_instance_network_interface(instance_name))
self._set_data_entry(instance_name, 'vlan_ids', self.get_instance_vlans(instance_name)) self._set_data_entry(instance_name, 'vlan_ids', self.get_instance_vlans(instance_name))
self._set_data_entry(instance_name, 'project', self._get_data_entry(
'instances/{0}/instances/metadata/project'.format(instance_name)))
def build_inventory_network(self, instance_name): def build_inventory_network(self, instance_name):
"""Add the network interfaces of the instance to the inventory """Add the network interfaces of the instance to the inventory
@@ -686,6 +707,8 @@ class InventoryModule(BaseInventoryPlugin):
# add VLAN_ID information # add VLAN_ID information
if self._get_data_entry('inventory/{0}/vlan_ids'.format(instance_name)): if self._get_data_entry('inventory/{0}/vlan_ids'.format(instance_name)):
self.inventory.set_variable(instance_name, 'ansible_lxd_vlan_ids', self._get_data_entry('inventory/{0}/vlan_ids'.format(instance_name))) self.inventory.set_variable(instance_name, 'ansible_lxd_vlan_ids', self._get_data_entry('inventory/{0}/vlan_ids'.format(instance_name)))
# add project
self.inventory.set_variable(instance_name, 'ansible_lxd_project', self._get_data_entry('inventory/{0}/project'.format(instance_name)))
def build_inventory_groups_location(self, group_name): def build_inventory_groups_location(self, group_name):
"""create group by attribute: location """create group by attribute: location
@@ -761,6 +784,28 @@ class InventoryModule(BaseInventoryPlugin):
# Ignore invalid IP addresses returned by lxd # Ignore invalid IP addresses returned by lxd
pass pass
def build_inventory_groups_project(self, group_name):
"""create group by attribute: project
Args:
str(group_name): Group name
Kwargs:
None
Raises:
None
Returns:
None"""
# maybe we just want to expand one group
if group_name not in self.inventory.groups:
self.inventory.add_group(group_name)
gen_instances = [
instance_name for instance_name in self.inventory.hosts
if 'ansible_lxd_project' in self.inventory.get_host(instance_name).get_vars()]
for instance_name in gen_instances:
if self.groupby[group_name].get('attribute').lower() == self.inventory.get_host(instance_name).get_vars().get('ansible_lxd_project'):
self.inventory.add_child(group_name, instance_name)
def build_inventory_groups_os(self, group_name): def build_inventory_groups_os(self, group_name):
"""create group by attribute: os """create group by attribute: os
@@ -899,6 +944,7 @@ class InventoryModule(BaseInventoryPlugin):
* 'profile' * 'profile'
* 'vlanid' * 'vlanid'
* 'type' * 'type'
* 'project'
Args: Args:
str(group_name): Group name str(group_name): Group name
@@ -926,6 +972,8 @@ class InventoryModule(BaseInventoryPlugin):
self.build_inventory_groups_vlanid(group_name) self.build_inventory_groups_vlanid(group_name)
elif self.groupby[group_name].get('type') == 'type': elif self.groupby[group_name].get('type') == 'type':
self.build_inventory_groups_type(group_name) self.build_inventory_groups_type(group_name)
elif self.groupby[group_name].get('type') == 'project':
self.build_inventory_groups_project(group_name)
else: else:
raise AnsibleParserError('Unknown group type: {0}'.format(to_native(group_name))) raise AnsibleParserError('Unknown group type: {0}'.format(to_native(group_name)))
@@ -1032,6 +1080,7 @@ class InventoryModule(BaseInventoryPlugin):
try: try:
self.client_key = self.get_option('client_key') self.client_key = self.get_option('client_key')
self.client_cert = self.get_option('client_cert') self.client_cert = self.get_option('client_cert')
self.project = self.get_option('project')
self.debug = self.DEBUG self.debug = self.DEBUG
self.data = {} # store for inventory-data self.data = {} # store for inventory-data
self.groupby = self.get_option('groupby') self.groupby = self.get_option('groupby')

View File

@@ -110,3 +110,14 @@ def gitlab_authentication(module):
GitLab remove Session API now that private tokens are removed from user API endpoints since version 10.2." % to_native(e)) GitLab remove Session API now that private tokens are removed from user API endpoints since version 10.2." % to_native(e))
return gitlab_instance return gitlab_instance
def filter_returned_variables(gitlab_variables):
# pop properties we don't know
existing_variables = [dict(x.attributes) for x in gitlab_variables]
KNOWN = ['key', 'value', 'masked', 'protected', 'variable_type', 'environment_scope']
for item in existing_variables:
for key in list(item.keys()):
if key not in KNOWN:
item.pop(key)
return existing_variables

View File

@@ -0,0 +1,114 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2022, Alexei Znamensky <russoz@gmail.com>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
_PUPPET_PATH_PREFIX = ["/opt/puppetlabs/bin"]
def get_facter_dir():
if os.getuid() == 0:
return '/etc/facter/facts.d'
else:
return os.path.expanduser('~/.facter/facts.d')
def _puppet_cmd(module):
return module.get_bin_path("puppet", False, _PUPPET_PATH_PREFIX)
# If the `timeout` CLI command feature is removed,
# Then we could add this as a fixed param to `puppet_runner`
def ensure_agent_enabled(module):
runner = CmdRunner(
module,
command="puppet",
path_prefix=_PUPPET_PATH_PREFIX,
arg_formats=dict(
_agent_disabled=cmd_runner_fmt.as_fixed(['config', 'print', 'agent_disabled_lockfile']),
),
check_rc=False,
)
rc, stdout, stderr = runner("_agent_disabled").run()
if os.path.exists(stdout.strip()):
module.fail_json(
msg="Puppet agent is administratively disabled.",
disabled=True)
elif rc != 0:
module.fail_json(
msg="Puppet agent state could not be determined.")
def puppet_runner(module):
# Keeping backward compatibility, allow for running with the `timeout` CLI command.
# If this can be replaced with ansible `timeout` parameter in playbook,
# then this function could be removed.
def _prepare_base_cmd():
_tout_cmd = module.get_bin_path("timeout", False)
if _tout_cmd:
cmd = ["timeout", "-s", "9", module.params["timeout"], _puppet_cmd(module)]
else:
cmd = ["puppet"]
return cmd
def noop_func(v):
_noop = cmd_runner_fmt.as_map({
True: "--noop",
False: "--no-noop",
})
return _noop(module.check_mode or v)
_logdest_map = {
"syslog": ["--logdest", "syslog"],
"all": ["--logdest", "syslog", "--logdest", "console"],
}
@cmd_runner_fmt.unpack_args
def execute_func(execute, manifest):
if execute:
return ["--execute", execute]
else:
return [manifest]
runner = CmdRunner(
module,
command=_prepare_base_cmd(),
path_prefix=_PUPPET_PATH_PREFIX,
arg_formats=dict(
_agent_fixed=cmd_runner_fmt.as_fixed([
"agent", "--onetime", "--no-daemonize", "--no-usecacheonfailure",
"--no-splay", "--detailed-exitcodes", "--verbose", "--color", "0",
]),
_apply_fixed=cmd_runner_fmt.as_fixed(["apply", "--detailed-exitcodes"]),
puppetmaster=cmd_runner_fmt.as_opt_val("--server"),
show_diff=cmd_runner_fmt.as_bool("--show-diff"),
confdir=cmd_runner_fmt.as_opt_val("--confdir"),
environment=cmd_runner_fmt.as_opt_val("--environment"),
tags=cmd_runner_fmt.as_func(lambda v: ["--tags", ",".join(v)]),
certname=cmd_runner_fmt.as_opt_eq_val("--certname"),
noop=cmd_runner_fmt.as_func(noop_func),
use_srv_records=cmd_runner_fmt.as_map({
True: "--usr_srv_records",
False: "--no-usr_srv_records",
}),
logdest=cmd_runner_fmt.as_map(_logdest_map, default=[]),
modulepath=cmd_runner_fmt.as_opt_eq_val("--modulepath"),
_execute=cmd_runner_fmt.as_func(execute_func),
summarize=cmd_runner_fmt.as_bool("--summarize"),
debug=cmd_runner_fmt.as_bool("--debug"),
verbose=cmd_runner_fmt.as_bool("--verbose"),
),
check_rc=False,
)
return runner

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Björn Andersson
# Copyright (c) 2021, Ansible Project
# Copyright (c) 2021, Abhijeet Kasurde <akasurde@redhat.com>
# Copyright (c) 2022, Alexei Znamensky <russoz@gmail.com>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os
def determine_config_file(user, config_file):
if user:
config_file = os.path.join(os.path.expanduser('~%s' % user), '.ssh', 'config')
elif config_file is None:
config_file = '/etc/ssh/ssh_config'
return config_file

View File

@@ -20,6 +20,10 @@ notes:
- > - >
B(Ansible 2.9/2.10): The C(ansible-galaxy) command changed significantly between Ansible 2.9 and B(Ansible 2.9/2.10): The C(ansible-galaxy) command changed significantly between Ansible 2.9 and
ansible-base 2.10 (later ansible-core 2.11). See comments in the parameters. ansible-base 2.10 (later ansible-core 2.11). See comments in the parameters.
- >
The module will try and run using the C(C.UTF-8) locale.
If that fails, it will try C(en_US.UTF-8).
If that one also fails, the module will fail.
requirements: requirements:
- Ansible 2.9, ansible-base 2.10, or ansible-core 2.11 or newer - Ansible 2.9, ansible-base 2.10, or ansible-core 2.11 or newer
options: options:
@@ -185,7 +189,7 @@ RETURN = """
import re import re
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt as fmt from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt as fmt
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper, ModuleHelperException
class AnsibleGalaxyInstall(ModuleHelper): class AnsibleGalaxyInstall(ModuleHelper):
@@ -226,11 +230,17 @@ class AnsibleGalaxyInstall(ModuleHelper):
version=fmt.as_bool("--version"), version=fmt.as_bool("--version"),
name=fmt.as_list(), name=fmt.as_list(),
) )
force_lang = "en_US.UTF-8"
check_rc = True def _make_runner(self, lang):
return CmdRunner(self.module, command=self.command, arg_formats=self.command_args_formats, force_lang=lang, check_rc=True)
def _get_ansible_galaxy_version(self): def _get_ansible_galaxy_version(self):
class UnsupportedLocale(ModuleHelperException):
pass
def process(rc, out, err): def process(rc, out, err):
if (rc != 0 and "unsupported locale setting" in err) or (rc == 0 and "cannot change locale" in err):
raise UnsupportedLocale(msg=err)
line = out.splitlines()[0] line = out.splitlines()[0]
match = self._RE_GALAXY_VERSION.match(line) match = self._RE_GALAXY_VERSION.match(line)
if not match: if not match:
@@ -239,12 +249,18 @@ class AnsibleGalaxyInstall(ModuleHelper):
version = tuple(int(x) for x in version.split('.')[:3]) version = tuple(int(x) for x in version.split('.')[:3])
return version return version
with self.runner("version", check_rc=True, output_process=process) as ctx: try:
return ctx.run(version=True) runner = self._make_runner("C.UTF-8")
with runner("version", check_rc=False, output_process=process) as ctx:
return runner, ctx.run(version=True)
except UnsupportedLocale as e:
runner = self._make_runner("en_US.UTF-8")
with runner("version", check_rc=True, output_process=process) as ctx:
return runner, ctx.run(version=True)
def __init_module__(self): def __init_module__(self):
self.runner = CmdRunner(self.module, command=self.command, arg_formats=self.command_args_formats, force_lang=self.force_lang) # self.runner = CmdRunner(self.module, command=self.command, arg_formats=self.command_args_formats, force_lang=self.force_lang)
self.ansible_version = self._get_ansible_galaxy_version() self.runner, self.ansible_version = self._get_ansible_galaxy_version()
if self.ansible_version < (2, 11) and not self.vars.ack_min_ansiblecore211: if self.ansible_version < (2, 11) and not self.vars.ack_min_ansiblecore211:
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. "
@@ -339,11 +355,12 @@ class AnsibleGalaxyInstall(ModuleHelper):
self._setup210plus() self._setup210plus()
with self.runner("type galaxy_cmd force no_deps dest requirements_file name", output_process=process) as ctx: with self.runner("type galaxy_cmd force no_deps dest requirements_file name", output_process=process) as ctx:
ctx.run(galaxy_cmd="install") ctx.run(galaxy_cmd="install")
if self.verbosity > 2:
self.vars.set("run_info", ctx.run_info)
def main(): def main():
galaxy = AnsibleGalaxyInstall() AnsibleGalaxyInstall.execute()
galaxy.run()
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -108,17 +108,8 @@ EXAMPLES = '''
''' '''
RETURN = ''' RETURN = '''
create_release: tag:
description: description: Version of the created/latest release.
- Version of the created release
- "For Ansible version 2.5 and later, if specified release version already exists, then State is unchanged"
- "For Ansible versions prior to 2.5, if specified release version already exists, then State is skipped"
type: str
returned: success
sample: 1.1.0
latest_release:
description: Version of the latest release
type: str type: str
returned: success returned: success
sample: 1.1.0 sample: 1.1.0

View File

@@ -165,7 +165,7 @@ from ansible.module_utils.six import string_types
from ansible.module_utils.six import integer_types from ansible.module_utils.six import integer_types
from ansible_collections.community.general.plugins.module_utils.gitlab import ( from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, gitlab_authentication, ensure_gitlab_package auth_argument_spec, gitlab_authentication, ensure_gitlab_package, filter_returned_variables
) )
@@ -296,11 +296,7 @@ def native_python_main(this_gitlab, purge, requested_variables, state, module):
before = [x.attributes for x in gitlab_keys] before = [x.attributes for x in gitlab_keys]
gitlab_keys = this_gitlab.list_all_group_variables() gitlab_keys = this_gitlab.list_all_group_variables()
existing_variables = [x.attributes for x in gitlab_keys] existing_variables = filter_returned_variables(gitlab_keys)
# preprocessing:filter out and enrich before compare
for item in existing_variables:
item.pop('group_id')
for item in requested_variables: for item in requested_variables:
item['key'] = item.pop('name') item['key'] = item.pop('name')
@@ -331,9 +327,7 @@ def native_python_main(this_gitlab, purge, requested_variables, state, module):
if purge: if purge:
# refetch and filter # refetch and filter
gitlab_keys = this_gitlab.list_all_group_variables() gitlab_keys = this_gitlab.list_all_group_variables()
existing_variables = [x.attributes for x in gitlab_keys] existing_variables = filter_returned_variables(gitlab_keys)
for item in existing_variables:
item.pop('group_id')
remove = [x for x in existing_variables if x not in requested_variables] remove = [x for x in existing_variables if x not in requested_variables]
for item in remove: for item in remove:

View File

@@ -189,7 +189,7 @@ except Exception:
HAS_GITLAB_PACKAGE = False HAS_GITLAB_PACKAGE = False
from ansible_collections.community.general.plugins.module_utils.gitlab import ( from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, gitlab_authentication, ensure_gitlab_package auth_argument_spec, gitlab_authentication, ensure_gitlab_package, filter_returned_variables
) )
@@ -255,9 +255,11 @@ class GitlabProjectVariables(object):
return True return True
var = { var = {
"key": var_obj.get('key'), "value": var_obj.get('value'), "key": var_obj.get('key'),
"masked": var_obj.get('masked'), "protected": var_obj.get('protected'), "value": var_obj.get('value'),
"variable_type": var_obj.get('variable_type') "masked": var_obj.get('masked'),
"protected": var_obj.get('protected'),
"variable_type": var_obj.get('variable_type'),
} }
if var_obj.get('environment_scope') is not None: if var_obj.get('environment_scope') is not None:
@@ -319,12 +321,9 @@ def native_python_main(this_gitlab, purge, requested_variables, state, module):
before = [x.attributes for x in gitlab_keys] before = [x.attributes for x in gitlab_keys]
gitlab_keys = this_gitlab.list_all_project_variables() gitlab_keys = this_gitlab.list_all_project_variables()
existing_variables = [x.attributes for x in gitlab_keys] existing_variables = filter_returned_variables(gitlab_keys)
# preprocessing:filter out and enrich before compare
for item in existing_variables:
item.pop('project_id')
# filter out and enrich before compare
for item in requested_variables: for item in requested_variables:
item['key'] = item.pop('name') item['key'] = item.pop('name')
item['value'] = str(item.get('value')) item['value'] = str(item.get('value'))
@@ -354,9 +353,7 @@ def native_python_main(this_gitlab, purge, requested_variables, state, module):
if purge: if purge:
# refetch and filter # refetch and filter
gitlab_keys = this_gitlab.list_all_project_variables() gitlab_keys = this_gitlab.list_all_project_variables()
existing_variables = [x.attributes for x in gitlab_keys] existing_variables = filter_returned_variables(gitlab_keys)
for item in existing_variables:
item.pop('project_id')
remove = [x for x in existing_variables if x not in requested_variables] remove = [x for x in existing_variables if x not in requested_variables]
for item in remove: for item in remove:
@@ -409,7 +406,7 @@ def main():
masked=dict(type='bool', default=False), masked=dict(type='bool', default=False),
protected=dict(type='bool', default=False), protected=dict(type='bool', default=False),
environment_scope=dict(type='str', default='*'), environment_scope=dict(type='str', default='*'),
variable_type=dict(type='str', default='env_var', choices=["env_var", "file"]) variable_type=dict(type='str', default='env_var', choices=["env_var", "file"]),
)), )),
state=dict(type='str', default="present", choices=["absent", "present"]), state=dict(type='str', default="present", choices=["absent", "present"]),
) )

View File

@@ -41,9 +41,12 @@ options:
description: description:
- Encryption scheme to be used. As well as the four choices listed - Encryption scheme to be used. As well as the four choices listed
here, you can also use any other hash supported by passlib, such as here, you can also use any other hash supported by passlib, such as
md5_crypt and sha256_crypt, which are linux passwd hashes. If you C(portable_apache22) and C(host_apache24); or C(md5_crypt) and C(sha256_crypt),
do so the password file will not be compatible with Apache or Nginx which are Linux passwd hashes. Only some schemes in addition to
- 'Some of the available choices might be: C(apr_md5_crypt), C(des_crypt), C(ldap_sha1), C(plaintext)' the four choices below will be compatible with Apache or Nginx, and
supported schemes depend on passlib version and its dependencies.
- See U(https://passlib.readthedocs.io/en/stable/lib/passlib.apache.html#passlib.apache.HtpasswdFile) parameter C(default_scheme).
- 'Some of the available choices might be: C(apr_md5_crypt), C(des_crypt), C(ldap_sha1), C(plaintext).'
state: state:
type: str type: str
required: false required: false

View File

@@ -677,7 +677,7 @@ class LxcContainerManagement(object):
false_values = BOOLEANS_FALSE.union([None, '']) false_values = BOOLEANS_FALSE.union([None, ''])
result = dict( result = dict(
(k, v) (v, self.module.params[k])
for k, v in variables.items() for k, v in variables.items()
if self.module.params[k] not in false_values if self.module.params[k] not in false_values
) )

View File

@@ -27,7 +27,10 @@ options:
description: description:
- C(absent) - policy_profiles should not exist, - C(absent) - policy_profiles should not exist,
- C(present) - policy_profiles should exist, - C(present) - policy_profiles should exist,
- C(list) - list current policy_profiles and policies. - >
C(list) - list current policy_profiles and policies.
This state is deprecated and will be removed 8.0.0.
Please use the module M(community.general.manageiq_policies_info) instead.
choices: ['absent', 'present', 'list'] choices: ['absent', 'present', 'list']
default: 'present' default: 'present'
policy_profiles: policy_profiles:
@@ -163,6 +166,13 @@ def main():
resource_name = module.params['resource_name'] resource_name = module.params['resource_name']
state = module.params['state'] state = module.params['state']
if state == "list":
module.deprecate(
'The value "list" for "state" is deprecated. Please use community.general.manageiq_policies_info instead.',
version='8.0.0',
collection_name='community.general'
)
# get the action and resource type # get the action and resource type
action = actions[state] action = actions[state]
resource_type = manageiq_entities()[resource_type_key] resource_type = manageiq_entities()[resource_type_key]

View File

@@ -22,6 +22,9 @@ options:
name: name:
description: description:
- Name of package(s) to install/remove. - Name of package(s) to install/remove.
- C(NAME=VERSION) syntax is also supported to install a package
in a certain version. See the examples. This is supported since
community.general 6.2.0.
aliases: [pkg] aliases: [pkg]
required: true required: true
type: list type: list
@@ -64,6 +67,11 @@ EXAMPLES = '''
name: foo name: foo
state: present state: present
- name: Install foo in version 1.2
community.general.opkg:
name: foo=1.2
state: present
- name: Update cache and install foo - name: Update cache and install foo
community.general.opkg: community.general.opkg:
name: foo name: foo
@@ -96,22 +104,39 @@ from ansible.module_utils.six.moves import shlex_quote
def update_package_db(module, opkg_path): def update_package_db(module, opkg_path):
""" Updates packages list. """ """ Updates packages list. """
rc, out, err = module.run_command("%s update" % opkg_path) rc, out, err = module.run_command([opkg_path, "update"])
if rc != 0: if rc != 0:
module.fail_json(msg="could not update package db") module.fail_json(msg="could not update package db")
def query_package(module, opkg_path, name, state="present"): def query_package(module, opkg_path, name, version=None, state="present"):
""" Returns whether a package is installed or not. """ """ Returns whether a package is installed or not. """
if state == "present": if state == "present":
rc, out, err = module.run_command([opkg_path, "list-installed", name])
if rc != 0:
return False
# variable out is one line if the package is installed:
# "NAME - VERSION - DESCRIPTION"
if version is not None:
if not out.startswith("%s - %s " % (name, version)):
return False
else:
if not out.startswith(name + " "):
return False
return True
else:
raise NotImplementedError()
rc, out, err = module.run_command("%s list-installed | grep -q \"^%s \"" % (shlex_quote(opkg_path), shlex_quote(name)), use_unsafe_shell=True)
if rc == 0:
return True
return False def split_name_and_version(module, package):
""" Split the name and the version when using the NAME=VERSION syntax """
splitted = package.split('=', 1)
if len(splitted) == 1:
return splitted[0], None
else:
return splitted[0], splitted[1]
def remove_packages(module, opkg_path, packages): def remove_packages(module, opkg_path, packages):
@@ -125,11 +150,16 @@ def remove_packages(module, opkg_path, packages):
remove_c = 0 remove_c = 0
# Using a for loop in case of error, we can report the package that failed # Using a for loop in case of error, we can report the package that failed
for package in packages: for package in packages:
package, version = split_name_and_version(module, package)
# Query the package first, to see if we even need to remove # Query the package first, to see if we even need to remove
if not query_package(module, opkg_path, package): if not query_package(module, opkg_path, package):
continue continue
rc, out, err = module.run_command("%s remove %s %s" % (opkg_path, force, package)) if force:
rc, out, err = module.run_command([opkg_path, "remove", force, package])
else:
rc, out, err = module.run_command([opkg_path, "remove", package])
if query_package(module, opkg_path, package): if query_package(module, opkg_path, package):
module.fail_json(msg="failed to remove %s: %s" % (package, out)) module.fail_json(msg="failed to remove %s: %s" % (package, out))
@@ -154,13 +184,23 @@ def install_packages(module, opkg_path, packages):
install_c = 0 install_c = 0
for package in packages: for package in packages:
if query_package(module, opkg_path, package): package, version = split_name_and_version(module, package)
if query_package(module, opkg_path, package, version) and (force != '--force-reinstall'):
continue continue
rc, out, err = module.run_command("%s install %s %s" % (opkg_path, force, package)) if version is not None:
version_str = "=%s" % version
else:
version_str = ""
if not query_package(module, opkg_path, package): if force:
module.fail_json(msg="failed to install %s: %s" % (package, out)) rc, out, err = module.run_command([opkg_path, "install", force, package + version_str])
else:
rc, out, err = module.run_command([opkg_path, "install", package + version_str])
if not query_package(module, opkg_path, package, version):
module.fail_json(msg="failed to install %s%s: %s" % (package, version_str, out))
install_c += 1 install_c += 1

View File

@@ -106,6 +106,14 @@ options:
description: description:
- sets DNS search domain for a container - sets DNS search domain for a container
type: str type: str
tags:
description:
- List of tags to apply to the container.
- Tags must start with C([a-z0-9_]) followed by zero or more of the following characters C([a-z0-9_-+.]).
- Tags are only available in Proxmox 7+.
type: list
elements: str
version_added: 6.2.0
timeout: timeout:
description: description:
- timeout for operations - timeout for operations
@@ -391,6 +399,7 @@ EXAMPLES = r'''
state: absent state: absent
''' '''
import re
import time import time
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
@@ -415,11 +424,25 @@ class ProxmoxLxcAnsible(ProxmoxAnsible):
return config['template'] return config['template']
def create_instance(self, vmid, node, disk, storage, cpus, memory, swap, timeout, clone, **kwargs): def create_instance(self, vmid, node, disk, storage, cpus, memory, swap, timeout, clone, **kwargs):
# Version limited features
minimum_version = {
'tags': 7,
}
proxmox_node = self.proxmox_api.nodes(node) proxmox_node = self.proxmox_api.nodes(node)
# Remove all empty kwarg entries # Remove all empty kwarg entries
kwargs = dict((k, v) for k, v in kwargs.items() if v is not None) kwargs = dict((k, v) for k, v in kwargs.items() if v is not None)
version = self.version()
pve_major_version = 3 if version < LooseVersion('4.0') else version.version[0]
# Fail on unsupported features
for option, version in minimum_version.items():
if pve_major_version < version and option in kwargs:
self.module.fail_json(changed=False, msg="Feature {option} is only supported in PVE {version}+, and you're using PVE {pve_major_version}".
format(option=option, version=version, pve_major_version=pve_major_version))
if VZ_TYPE == 'lxc': if VZ_TYPE == 'lxc':
kwargs['cpulimit'] = cpus kwargs['cpulimit'] = cpus
kwargs['rootfs'] = disk kwargs['rootfs'] = disk
@@ -437,6 +460,14 @@ class ProxmoxLxcAnsible(ProxmoxAnsible):
kwargs['cpus'] = cpus kwargs['cpus'] = cpus
kwargs['disk'] = disk kwargs['disk'] = disk
# LXC tags are expected to be valid and presented as a comma/semi-colon delimited string
if 'tags' in kwargs:
re_tag = re.compile(r'^[a-z0-9_][a-z0-9_\-\+\.]*$')
for tag in kwargs['tags']:
if not re_tag.match(tag):
self.module.fail_json(msg='%s is not a valid tag' % tag)
kwargs['tags'] = ",".join(kwargs['tags'])
if clone is not None: if clone is not None:
if VZ_TYPE != 'lxc': if VZ_TYPE != 'lxc':
self.module.fail_json(changed=False, msg="Clone operator is only supported for LXC enabled proxmox clusters.") self.module.fail_json(changed=False, msg="Clone operator is only supported for LXC enabled proxmox clusters.")
@@ -569,6 +600,7 @@ def main():
proxmox_default_behavior=dict(type='str', default='no_defaults', choices=['compatibility', 'no_defaults']), proxmox_default_behavior=dict(type='str', default='no_defaults', choices=['compatibility', 'no_defaults']),
clone=dict(type='int'), clone=dict(type='int'),
clone_type=dict(default='opportunistic', choices=['full', 'linked', 'opportunistic']), clone_type=dict(default='opportunistic', choices=['full', 'linked', 'opportunistic']),
tags=dict(type='list', elements='str')
) )
module_args.update(proxmox_args) module_args.update(proxmox_args)
@@ -674,7 +706,8 @@ def main():
features=",".join(module.params['features']) if module.params['features'] is not None else None, features=",".join(module.params['features']) if module.params['features'] is not None else None,
unprivileged=ansible_to_proxmox_bool(module.params['unprivileged']), unprivileged=ansible_to_proxmox_bool(module.params['unprivileged']),
description=module.params['description'], description=module.params['description'],
hookscript=module.params['hookscript']) hookscript=module.params['hookscript'],
tags=module.params['tags'])
module.exit_json(changed=True, msg="Deployed VM %s from template %s" % (vmid, module.params['ostemplate'])) module.exit_json(changed=True, msg="Deployed VM %s from template %s" % (vmid, module.params['ostemplate']))
except Exception as e: except Exception as e:

View File

@@ -699,7 +699,7 @@ def main():
module.exit_json(changed=False, vmid=vmid, msg='Disk %s already detached in VM %s' % (disk, vmid)) module.exit_json(changed=False, vmid=vmid, msg='Disk %s already detached in VM %s' % (disk, vmid))
if disk not in vm_config: if disk not in vm_config:
module.exit_json(changed=False, vmid=vmid, msg="Disk %s not present in VM %s config" % (disk, vmid)) module.exit_json(changed=False, vmid=vmid, msg="Disk %s not present in VM %s config" % (disk, vmid))
proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).unlink.put(vmid=vmid, idlist=disk, force=0) proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).unlink.put(idlist=disk, force=0)
module.exit_json(changed=True, vmid=vmid, msg="Disk %s detached from VM %s" % (disk, vmid)) module.exit_json(changed=True, vmid=vmid, msg="Disk %s detached from VM %s" % (disk, vmid))
except Exception as e: except Exception as e:
module.fail_json(msg="Failed to detach disk %s from VM %s with exception: %s" % (disk, vmid, str(e))) module.fail_json(msg="Failed to detach disk %s from VM %s with exception: %s" % (disk, vmid, str(e)))
@@ -734,7 +734,7 @@ def main():
try: try:
if disk not in vm_config: if disk not in vm_config:
module.exit_json(changed=False, vmid=vmid, msg="Disk %s is already absent in VM %s" % (disk, vmid)) module.exit_json(changed=False, vmid=vmid, msg="Disk %s is already absent in VM %s" % (disk, vmid))
proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).unlink.put(vmid=vmid, idlist=disk, force=1) proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).unlink.put(idlist=disk, force=1)
module.exit_json(changed=True, vmid=vmid, msg="Disk %s removed from VM %s" % (disk, vmid)) module.exit_json(changed=True, vmid=vmid, msg="Disk %s removed from VM %s" % (disk, vmid))
except Exception as e: except Exception as e:
module.fail_json(vmid=vmid, msg='Unable to remove disk %s from VM %s: %s' % (disk, vmid, str(e))) module.fail_json(vmid=vmid, msg='Unable to remove disk %s from VM %s: %s' % (disk, vmid, str(e)))

View File

@@ -223,7 +223,7 @@ class ProxmoxNicAnsible(ProxmoxAnsible):
if interface in vminfo: if interface in vminfo:
if not self.module.check_mode: if not self.module.check_mode:
self.proxmox_api.nodes(vm['node']).qemu(vmid).config.set(vmid=vmid, delete=interface) self.proxmox_api.nodes(vm['node']).qemu(vmid).config.set(delete=interface)
return True return True
return False return False

View File

@@ -152,15 +152,9 @@ import json
import os import os
import stat import stat
import ansible_collections.community.general.plugins.module_utils.puppet as puppet_utils
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six.moves import shlex_quote
def _get_facter_dir():
if os.getuid() == 0:
return '/etc/facter/facts.d'
else:
return os.path.expanduser('~/.facter/facts.d')
def _write_structured_data(basedir, basename, data): def _write_structured_data(basedir, basename, data):
@@ -212,16 +206,6 @@ def main():
) )
p = module.params p = module.params
global PUPPET_CMD
PUPPET_CMD = module.get_bin_path("puppet", False, ['/opt/puppetlabs/bin'])
if not PUPPET_CMD:
module.fail_json(
msg="Could not find puppet. Please ensure it is installed.")
global TIMEOUT_CMD
TIMEOUT_CMD = module.get_bin_path("timeout", False)
if p['manifest']: if p['manifest']:
if not os.path.exists(p['manifest']): if not os.path.exists(p['manifest']):
module.fail_json( module.fail_json(
@@ -230,90 +214,24 @@ def main():
# Check if puppet is disabled here # Check if puppet is disabled here
if not p['manifest']: if not p['manifest']:
rc, stdout, stderr = module.run_command( puppet_utils.ensure_agent_enabled(module)
PUPPET_CMD + " config print agent_disabled_lockfile")
if os.path.exists(stdout.strip()):
module.fail_json(
msg="Puppet agent is administratively disabled.",
disabled=True)
elif rc != 0:
module.fail_json(
msg="Puppet agent state could not be determined.")
if module.params['facts'] and not module.check_mode: if module.params['facts'] and not module.check_mode:
_write_structured_data( _write_structured_data(
_get_facter_dir(), puppet_utils.get_facter_dir(),
module.params['facter_basename'], module.params['facter_basename'],
module.params['facts']) module.params['facts'])
if TIMEOUT_CMD: runner = puppet_utils.puppet_runner(module)
base_cmd = "%(timeout_cmd)s -s 9 %(timeout)s %(puppet_cmd)s" % dict(
timeout_cmd=TIMEOUT_CMD,
timeout=shlex_quote(p['timeout']),
puppet_cmd=PUPPET_CMD)
else:
base_cmd = PUPPET_CMD
if not p['manifest'] and not p['execute']: if not p['manifest'] and not p['execute']:
cmd = ("%(base_cmd)s agent --onetime" args_order = "_agent_fixed puppetmaster show_diff confdir environment tags certname noop use_srv_records"
" --no-daemonize --no-usecacheonfailure --no-splay" with runner(args_order) as ctx:
" --detailed-exitcodes --verbose --color 0") % dict(base_cmd=base_cmd) rc, stdout, stderr = ctx.run()
if p['puppetmaster']:
cmd += " --server %s" % shlex_quote(p['puppetmaster'])
if p['show_diff']:
cmd += " --show_diff"
if p['confdir']:
cmd += " --confdir %s" % shlex_quote(p['confdir'])
if p['environment']:
cmd += " --environment '%s'" % p['environment']
if p['tags']:
cmd += " --tags '%s'" % ','.join(p['tags'])
if p['certname']:
cmd += " --certname='%s'" % p['certname']
if module.check_mode:
cmd += " --noop"
elif 'noop' in p:
if p['noop']:
cmd += " --noop"
else:
cmd += " --no-noop"
if p['use_srv_records'] is not None:
if not p['use_srv_records']:
cmd += " --no-use_srv_records"
else:
cmd += " --use_srv_records"
else: else:
cmd = "%s apply --detailed-exitcodes " % base_cmd args_order = "_apply_fixed logdest modulepath environment certname tags noop _execute summarize debug verbose"
if p['logdest'] == 'syslog': with runner(args_order) as ctx:
cmd += "--logdest syslog " rc, stdout, stderr = ctx.run(_execute=[p['execute'], p['manifest']])
if p['logdest'] == 'all':
cmd += " --logdest syslog --logdest console"
if p['modulepath']:
cmd += "--modulepath='%s'" % p['modulepath']
if p['environment']:
cmd += "--environment '%s' " % p['environment']
if p['certname']:
cmd += " --certname='%s'" % p['certname']
if p['tags']:
cmd += " --tags '%s'" % ','.join(p['tags'])
if module.check_mode:
cmd += "--noop "
elif 'noop' in p:
if p['noop']:
cmd += " --noop"
else:
cmd += " --no-noop"
if p['execute']:
cmd += " --execute '%s'" % p['execute']
else:
cmd += " %s" % shlex_quote(p['manifest'])
if p['summarize']:
cmd += " --summarize"
if p['debug']:
cmd += " --debug"
if p['verbose']:
cmd += " --verbose"
rc, stdout, stderr = module.run_command(cmd)
if rc == 0: if rc == 0:
# success # success
@@ -335,11 +253,11 @@ def main():
elif rc == 124: elif rc == 124:
# timeout # timeout
module.exit_json( module.exit_json(
rc=rc, msg="%s timed out" % cmd, stdout=stdout, stderr=stderr) rc=rc, msg="%s timed out" % ctx.cmd, stdout=stdout, stderr=stderr)
else: else:
# failure # failure
module.fail_json( module.fail_json(
rc=rc, msg="%s failed with return code: %d" % (cmd, rc), rc=rc, msg="%s failed with return code: %d" % (ctx.cmd, rc),
stdout=stdout, stderr=stderr) stdout=stdout, stderr=stderr)

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_cbs module: rax_cbs
short_description: Manipulate Rackspace Cloud Block Storage Volumes short_description: Manipulate Rackspace Cloud Block Storage Volumes
description: description:
- Manipulate Rackspace Cloud Block Storage Volumes - Manipulate Rackspace Cloud Block Storage Volumes
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
description: description:
type: str type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_cbs_attachments module: rax_cbs_attachments
short_description: Manipulate Rackspace Cloud Block Storage Volume Attachments short_description: Manipulate Rackspace Cloud Block Storage Volume Attachments
description: description:
- Manipulate Rackspace Cloud Block Storage Volume Attachments - Manipulate Rackspace Cloud Block Storage Volume Attachments
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
device: device:
type: str type: str

View File

@@ -16,6 +16,8 @@ description:
- creates / deletes or resize a Rackspace Cloud Databases instance - creates / deletes or resize a Rackspace Cloud Databases instance
and optionally waits for it to be 'running'. The name option needs to be and optionally waits for it to be 'running'. The name option needs to be
unique since it's used to identify the instance. unique since it's used to identify the instance.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
name: name:
type: str type: str

View File

@@ -13,6 +13,8 @@ module: rax_cdb_database
short_description: Create / delete a database in the Cloud Databases short_description: Create / delete a database in the Cloud Databases
description: description:
- create / delete a database in the Cloud Databases. - create / delete a database in the Cloud Databases.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
cdb_id: cdb_id:
type: str type: str

View File

@@ -14,6 +14,8 @@ module: rax_cdb_user
short_description: Create / delete a Rackspace Cloud Database short_description: Create / delete a Rackspace Cloud Database
description: description:
- create / delete a database in the Cloud Databases. - create / delete a database in the Cloud Databases.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
cdb_id: cdb_id:
type: str type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_clb module: rax_clb
short_description: Create / delete a load balancer in Rackspace Public Cloud short_description: Create / delete a load balancer in Rackspace Public Cloud
description: description:
- creates / deletes a Rackspace Public Cloud load balancer. - creates / deletes a Rackspace Public Cloud load balancer.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
algorithm: algorithm:
type: str type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_clb_nodes module: rax_clb_nodes
short_description: Add, modify and remove nodes from a Rackspace Cloud Load Balancer short_description: Add, modify and remove nodes from a Rackspace Cloud Load Balancer
description: description:
- Adds, modifies and removes nodes from a Rackspace Cloud Load Balancer - Adds, modifies and removes nodes from a Rackspace Cloud Load Balancer.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
address: address:
type: str type: str

View File

@@ -12,7 +12,9 @@ DOCUMENTATION = '''
module: rax_clb_ssl module: rax_clb_ssl
short_description: Manage SSL termination for a Rackspace Cloud Load Balancer short_description: Manage SSL termination for a Rackspace Cloud Load Balancer
description: description:
- Set up, reconfigure, or remove SSL termination for an existing load balancer. - Set up, reconfigure, or remove SSL termination for an existing load balancer.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
loadbalancer: loadbalancer:
type: str type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_dns module: rax_dns
short_description: Manage domains on Rackspace Cloud DNS short_description: Manage domains on Rackspace Cloud DNS
description: description:
- Manage domains on Rackspace Cloud DNS - Manage domains on Rackspace Cloud DNS.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
comment: comment:
type: str type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_dns_record module: rax_dns_record
short_description: Manage DNS records on Rackspace Cloud DNS short_description: Manage DNS records on Rackspace Cloud DNS
description: description:
- Manage DNS records on Rackspace Cloud DNS - Manage DNS records on Rackspace Cloud DNS.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
comment: comment:
type: str type: str

View File

@@ -14,6 +14,8 @@ module: rax_facts
short_description: Gather facts for Rackspace Cloud Servers short_description: Gather facts for Rackspace Cloud Servers
description: description:
- Gather facts for Rackspace Cloud Servers. - Gather facts for Rackspace Cloud Servers.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
address: address:
type: str type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_files module: rax_files
short_description: Manipulate Rackspace Cloud Files Containers short_description: Manipulate Rackspace Cloud Files Containers
description: description:
- Manipulate Rackspace Cloud Files Containers - Manipulate Rackspace Cloud Files Containers.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
clear_meta: clear_meta:
description: description:

View File

@@ -14,6 +14,8 @@ module: rax_files_objects
short_description: Upload, download, and delete objects in Rackspace Cloud Files short_description: Upload, download, and delete objects in Rackspace Cloud Files
description: description:
- Upload, download, and delete objects in Rackspace Cloud Files. - Upload, download, and delete objects in Rackspace Cloud Files.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
clear_meta: clear_meta:
description: description:

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_identity module: rax_identity
short_description: Load Rackspace Cloud Identity short_description: Load Rackspace Cloud Identity
description: description:
- Verifies Rackspace Cloud credentials and returns identity information - Verifies Rackspace Cloud credentials and returns identity information.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
state: state:
type: str type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_keypair module: rax_keypair
short_description: Create a keypair for use with Rackspace Cloud Servers short_description: Create a keypair for use with Rackspace Cloud Servers
description: description:
- Create a keypair for use with Rackspace Cloud Servers - Create a keypair for use with Rackspace Cloud Servers.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
name: name:
type: str type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_meta module: rax_meta
short_description: Manipulate metadata for Rackspace Cloud Servers short_description: Manipulate metadata for Rackspace Cloud Servers
description: description:
- Manipulate metadata for Rackspace Cloud Servers - Manipulate metadata for Rackspace Cloud Servers.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
address: address:
type: str type: str

View File

@@ -13,12 +13,14 @@ DOCUMENTATION = '''
module: rax_mon_alarm module: rax_mon_alarm
short_description: Create or delete a Rackspace Cloud Monitoring alarm short_description: Create or delete a Rackspace Cloud Monitoring alarm
description: description:
- Create or delete a Rackspace Cloud Monitoring alarm that associates an - Create or delete a Rackspace Cloud Monitoring alarm that associates an
existing rax_mon_entity, rax_mon_check, and rax_mon_notification_plan with existing rax_mon_entity, rax_mon_check, and rax_mon_notification_plan with
criteria that specify what conditions will trigger which levels of criteria that specify what conditions will trigger which levels of
notifications. Rackspace monitoring module flow | rax_mon_entity -> notifications. Rackspace monitoring module flow | rax_mon_entity ->
rax_mon_check -> rax_mon_notification -> rax_mon_notification_plan -> rax_mon_check -> rax_mon_notification -> rax_mon_notification_plan ->
*rax_mon_alarm* *rax_mon_alarm*.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
state: state:
type: str type: str

View File

@@ -14,12 +14,14 @@ module: rax_mon_check
short_description: Create or delete a Rackspace Cloud Monitoring check for an short_description: Create or delete a Rackspace Cloud Monitoring check for an
existing entity. existing entity.
description: description:
- Create or delete a Rackspace Cloud Monitoring check associated with an - Create or delete a Rackspace Cloud Monitoring check associated with an
existing rax_mon_entity. A check is a specific test or measurement that is existing rax_mon_entity. A check is a specific test or measurement that is
performed, possibly from different monitoring zones, on the systems you performed, possibly from different monitoring zones, on the systems you
monitor. Rackspace monitoring module flow | rax_mon_entity -> monitor. Rackspace monitoring module flow | rax_mon_entity ->
*rax_mon_check* -> rax_mon_notification -> rax_mon_notification_plan -> *rax_mon_check* -> rax_mon_notification -> rax_mon_notification_plan ->
rax_mon_alarm rax_mon_alarm
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
state: state:
type: str type: str

View File

@@ -13,11 +13,13 @@ DOCUMENTATION = '''
module: rax_mon_entity module: rax_mon_entity
short_description: Create or delete a Rackspace Cloud Monitoring entity short_description: Create or delete a Rackspace Cloud Monitoring entity
description: description:
- Create or delete a Rackspace Cloud Monitoring entity, which represents a device - Create or delete a Rackspace Cloud Monitoring entity, which represents a device
to monitor. Entities associate checks and alarms with a target system and to monitor. Entities associate checks and alarms with a target system and
provide a convenient, centralized place to store IP addresses. Rackspace provide a convenient, centralized place to store IP addresses. Rackspace
monitoring module flow | *rax_mon_entity* -> rax_mon_check -> monitoring module flow | *rax_mon_entity* -> rax_mon_check ->
rax_mon_notification -> rax_mon_notification_plan -> rax_mon_alarm rax_mon_notification -> rax_mon_notification_plan -> rax_mon_alarm.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
label: label:
type: str type: str

View File

@@ -14,10 +14,12 @@ module: rax_mon_notification_plan
short_description: Create or delete a Rackspace Cloud Monitoring notification short_description: Create or delete a Rackspace Cloud Monitoring notification
plan. plan.
description: description:
- Create or delete a Rackspace Cloud Monitoring notification plan by - Create or delete a Rackspace Cloud Monitoring notification plan by
associating existing rax_mon_notifications with severity levels. Rackspace associating existing rax_mon_notifications with severity levels. Rackspace
monitoring module flow | rax_mon_entity -> rax_mon_check -> monitoring module flow | rax_mon_entity -> rax_mon_check ->
rax_mon_notification -> *rax_mon_notification_plan* -> rax_mon_alarm rax_mon_notification -> *rax_mon_notification_plan* -> rax_mon_alarm.
- This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.
- Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.
options: options:
state: state:
type: str type: str

View File

@@ -70,6 +70,11 @@ options:
description: description:
- Specify an HTTP proxy hostname. - Specify an HTTP proxy hostname.
type: str type: str
server_proxy_scheme:
description:
- Specify an HTTP proxy scheme, for example C(http) or C(https).
type: str
version_added: 6.2.0
server_proxy_port: server_proxy_port:
description: description:
- Specify an HTTP proxy port. - Specify an HTTP proxy port.
@@ -806,6 +811,7 @@ def main():
'consumer_id': {}, 'consumer_id': {},
'force_register': {'default': False, 'type': 'bool'}, 'force_register': {'default': False, 'type': 'bool'},
'server_proxy_hostname': {}, 'server_proxy_hostname': {},
'server_proxy_scheme': {},
'server_proxy_port': {}, 'server_proxy_port': {},
'server_proxy_user': {}, 'server_proxy_user': {},
'server_proxy_password': {'no_log': True}, 'server_proxy_password': {'no_log': True},

View File

@@ -169,6 +169,7 @@ except ImportError:
from ansible.module_utils.basic import AnsibleModule, missing_required_lib from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.ssh import determine_config_file
class SSHConfig(): class SSHConfig():
@@ -188,10 +189,7 @@ class SSHConfig():
self.config.load() self.config.load()
def check_ssh_config_path(self): def check_ssh_config_path(self):
if self.user: self.config_file = determine_config_file(self.user, self.config_file)
self.config_file = os.path.join(os.path.expanduser('~%s' % self.user), '.ssh', 'config')
elif self.config_file is None:
self.config_file = '/etc/ssh/ssh_config'
# See if the identity file exists or not, relative to the config file # See if the identity file exists or not, relative to the config file
if os.path.exists(self.config_file) and self.identity_file is not None: if os.path.exists(self.config_file) and self.identity_file is not None:

View File

@@ -43,6 +43,12 @@ options:
- Whether a password will be required to run the sudo'd command. - Whether a password will be required to run the sudo'd command.
default: true default: true
type: bool type: bool
host:
description:
- Specify the host the rule is for.
default: ALL
type: str
version_added: 6.2.0
runas: runas:
description: description:
- Specify the target user the command(s) will run as. - Specify the target user the command(s) will run as.
@@ -95,10 +101,11 @@ EXAMPLES = '''
- name: >- - name: >-
Allow the monitoring group to run sudo /usr/local/bin/gather-app-metrics Allow the monitoring group to run sudo /usr/local/bin/gather-app-metrics
without requiring a password without requiring a password on the host called webserver
community.general.sudoers: community.general.sudoers:
name: monitor-app name: monitor-app
group: monitoring group: monitoring
host: webserver
commands: /usr/local/bin/gather-app-metrics commands: /usr/local/bin/gather-app-metrics
- name: >- - name: >-
@@ -136,6 +143,7 @@ class Sudoers(object):
self.group = module.params['group'] self.group = module.params['group']
self.state = module.params['state'] self.state = module.params['state']
self.nopassword = module.params['nopassword'] self.nopassword = module.params['nopassword']
self.host = module.params['host']
self.runas = module.params['runas'] self.runas = module.params['runas']
self.sudoers_path = module.params['sudoers_path'] self.sudoers_path = module.params['sudoers_path']
self.file = os.path.join(self.sudoers_path, self.name) self.file = os.path.join(self.sudoers_path, self.name)
@@ -178,7 +186,13 @@ class Sudoers(object):
commands_str = ', '.join(self.commands) commands_str = ', '.join(self.commands)
nopasswd_str = 'NOPASSWD:' if self.nopassword else '' nopasswd_str = 'NOPASSWD:' if self.nopassword else ''
runas_str = '({runas})'.format(runas=self.runas) if self.runas is not None else '' runas_str = '({runas})'.format(runas=self.runas) if self.runas is not None else ''
return "{owner} ALL={runas}{nopasswd} {commands}\n".format(owner=owner, runas=runas_str, nopasswd=nopasswd_str, commands=commands_str) return "{owner} {host}={runas}{nopasswd} {commands}\n".format(
owner=owner,
host=self.host,
runas=runas_str,
nopasswd=nopasswd_str,
commands=commands_str
)
def validate(self): def validate(self):
if self.validation == 'absent': if self.validation == 'absent':
@@ -225,6 +239,10 @@ def main():
'type': 'bool', 'type': 'bool',
'default': True, 'default': True,
}, },
'host': {
'type': 'str',
'default': 'ALL',
},
'runas': { 'runas': {
'type': 'str', 'type': 'str',
'default': None, 'default': None,

View File

@@ -10,7 +10,7 @@
name: netbox.netbox name: netbox.netbox
register: install_c0 register: install_c0
- name: Assert collection was installed - name: Assert collection netbox.netbox was installed
assert: assert:
that: that:
- install_c0 is changed - install_c0 is changed
@@ -34,7 +34,7 @@
name: ansistrano.deploy name: ansistrano.deploy
register: install_r0 register: install_r0
- name: Assert collection was installed - name: Assert collection ansistrano.deploy was installed
assert: assert:
that: that:
- install_r0 is changed - install_r0 is changed
@@ -52,7 +52,7 @@
- install_r1 is not changed - install_r1 is not changed
################################################### ###################################################
- name: - name: Set requirements file path
set_fact: set_fact:
reqs_file: '{{ remote_tmp_dir }}/reqs.yaml' reqs_file: '{{ remote_tmp_dir }}/reqs.yaml'

View File

@@ -3,3 +3,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1 azp/posix/1
azp/posix/vm

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1 azp/posix/1
azp/posix/vm
destructive destructive
skip/aix skip/aix
skip/osx skip/osx

View File

@@ -14,10 +14,14 @@
block: block:
- when: fstype == 'lvm' - when: fstype == 'lvm'
block: block:
- name: 'Show next free loop device'
ansible.builtin.command:
cmd: 'losetup -f'
register: loop_device_cmd
- name: 'Create a loop device for LVM' - name: 'Create a loop device for LVM'
ansible.builtin.command: ansible.builtin.command:
cmd: 'losetup --show -f {{ dev }}' cmd: 'losetup -f {{ dev }}'
register: loop_device_cmd
- name: 'Switch to loop device target for further tasks' - name: 'Switch to loop device target for further tasks'
ansible.builtin.set_fact: ansible.builtin.set_fact:

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1 azp/posix/1
azp/posix/vm
destructive destructive
skip/docker # kernel modules not loadable skip/docker # kernel modules not loadable
skip/freebsd # no iptables/netfilter (Linux specific) skip/freebsd # no iptables/netfilter (Linux specific)

View File

@@ -167,13 +167,12 @@
- name: "get security, raw and mangle tables states" - name: "get raw and mangle tables states"
iptables_state: iptables_state:
path: "{{ iptables_saved }}" path: "{{ iptables_saved }}"
state: saved state: saved
table: "{{ item }}" table: "{{ item }}"
loop: loop:
- security
- raw - raw
- mangle - mangle
changed_when: false changed_when: false
@@ -198,8 +197,6 @@
- "'*nat' in iptables_state.saved" - "'*nat' in iptables_state.saved"
- "'raw' in iptables_state.tables" - "'raw' in iptables_state.tables"
- "'*raw' in iptables_state.saved" - "'*raw' in iptables_state.saved"
- "'security' in iptables_state.tables"
- "'*security' in iptables_state.saved"
quiet: yes quiet: yes
@@ -233,17 +230,14 @@
- "'*mangle' in iptables_state.initial_state" - "'*mangle' in iptables_state.initial_state"
- "'*nat' in iptables_state.initial_state" - "'*nat' in iptables_state.initial_state"
- "'*raw' in iptables_state.initial_state" - "'*raw' in iptables_state.initial_state"
- "'*security' in iptables_state.initial_state"
- "'filter' in iptables_state.tables" - "'filter' in iptables_state.tables"
- "'mangle' not in iptables_state.tables" - "'mangle' not in iptables_state.tables"
- "'nat' not in iptables_state.tables" - "'nat' not in iptables_state.tables"
- "'raw' not in iptables_state.tables" - "'raw' not in iptables_state.tables"
- "'security' not in iptables_state.tables"
- "'*filter' in iptables_state.restored" - "'*filter' in iptables_state.restored"
- "'*mangle' not in iptables_state.restored" - "'*mangle' not in iptables_state.restored"
- "'*nat' not in iptables_state.restored" - "'*nat' not in iptables_state.restored"
- "'*raw' not in iptables_state.restored" - "'*raw' not in iptables_state.restored"
- "'*security' not in iptables_state.restored"
- iptables_state is not changed - iptables_state is not changed
quiet: yes quiet: yes
@@ -264,17 +258,14 @@
- "'*mangle' in iptables_state.initial_state" - "'*mangle' in iptables_state.initial_state"
- "'*nat' in iptables_state.initial_state" - "'*nat' in iptables_state.initial_state"
- "'*raw' in iptables_state.initial_state" - "'*raw' in iptables_state.initial_state"
- "'*security' in iptables_state.initial_state"
- "'filter' in iptables_state.tables" - "'filter' in iptables_state.tables"
- "'mangle' in iptables_state.tables" - "'mangle' in iptables_state.tables"
- "'nat' in iptables_state.tables" - "'nat' in iptables_state.tables"
- "'raw' in iptables_state.tables" - "'raw' in iptables_state.tables"
- "'security' in iptables_state.tables"
- "'*filter' in iptables_state.restored" - "'*filter' in iptables_state.restored"
- "'*mangle' in iptables_state.restored" - "'*mangle' in iptables_state.restored"
- "'*nat' in iptables_state.restored" - "'*nat' in iptables_state.restored"
- "'*raw' in iptables_state.restored" - "'*raw' in iptables_state.restored"
- "'*security' in iptables_state.restored"
- iptables_state is not changed - iptables_state is not changed
quiet: yes quiet: yes

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1 azp/posix/1
azp/posix/vm
destructive destructive
needs/privileged needs/privileged
skip/aix skip/aix

View File

@@ -7,12 +7,21 @@
command: "dd if=/dev/zero of={{ remote_tmp_dir }}/img{{ item }} bs=1M count=10" command: "dd if=/dev/zero of={{ remote_tmp_dir }}/img{{ item }} bs=1M count=10"
with_sequence: 'count=2' with_sequence: 'count=2'
- name: "Show next free loop device"
command: "losetup -f"
register: loop_device1
- name: "Create loop device for file" - name: "Create loop device for file"
command: "losetup --show -f {{ remote_tmp_dir }}/img{{ item }}" command: "losetup -f {{ remote_tmp_dir }}/img1"
with_sequence: 'count=2'
register: loop_devices - name: "Show next free loop device"
command: "losetup -f"
register: loop_device2
- name: "Create loop device for file"
command: "losetup -f {{ remote_tmp_dir }}/img2"
- name: "Affect name on disk to work on" - name: "Affect name on disk to work on"
set_fact: set_fact:
loop_device1: "{{ loop_devices.results[0] }}" loop_device1: "{{ loop_device1.stdout }}"
loop_device2: "{{ loop_devices.results[1] }}" loop_device2: "{{ loop_device2.stdout }}"

View File

@@ -8,15 +8,16 @@
vg: testvg vg: testvg
state: absent state: absent
- name: Detach loop device - name: Detach loop devices
command: "losetup -d {{ item.stdout }}" command: "losetup -d {{ item }}"
loop: "{{ loop_devices.results|default([]) }}" loop:
- "{{ loop_device1 | default('') }}"
- "{{ loop_device2 | default('') }}"
when: when:
- item.stdout is defined - item != ''
- item.stdout is match("/dev/.*")
- name: Remove device files - name: Remove device files
file: file:
path: "{{ remote_tmp_dir }}/img{{ item }}" path: "{{ remote_tmp_dir }}/img{{ item }}"
state: absent state: absent
with_sequence: 'count={{ loop_devices.results|length }}' with_sequence: 'count=2'

View File

@@ -6,7 +6,7 @@
- name: "Create volume group on first disk" - name: "Create volume group on first disk"
lvg: lvg:
vg: testvg vg: testvg
pvs: "{{ loop_device1.stdout }}" pvs: "{{ loop_device1 }}"
- name: "get lvm facts" - name: "get lvm facts"
setup: setup:
@@ -16,14 +16,14 @@
- name: "Assert the testvg span only on first disk" - name: "Assert the testvg span only on first disk"
assert: assert:
that: that:
- ansible_lvm.pvs[loop_device1.stdout].vg == "testvg" - ansible_lvm.pvs[loop_device1].vg == "testvg"
- 'loop_device2.stdout not in ansible_lvm.pvs or - 'loop_device2 not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device2.stdout].vg == ""' ansible_lvm.pvs[loop_device2].vg == ""'
- name: "Extend to second disk AND reduce from the first disk" - name: "Extend to second disk AND reduce from the first disk"
lvg: lvg:
vg: testvg vg: testvg
pvs: "{{ loop_device2.stdout }}" pvs: "{{ loop_device2 }}"
- name: "get lvm facts" - name: "get lvm facts"
setup: setup:
@@ -33,6 +33,6 @@
- name: "Assert the testvg span only on first disk" - name: "Assert the testvg span only on first disk"
assert: assert:
that: that:
- 'loop_device1.stdout not in ansible_lvm.pvs or - 'loop_device1 not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device1.stdout].vg == ""' ansible_lvm.pvs[loop_device1].vg == ""'
- ansible_lvm.pvs[loop_device2.stdout].vg == "testvg" - ansible_lvm.pvs[loop_device2].vg == "testvg"

View File

@@ -6,12 +6,12 @@
- name: Create volume group on disk device - name: Create volume group on disk device
lvg: lvg:
vg: testvg vg: testvg
pvs: "{{ loop_device1.stdout }}" pvs: "{{ loop_device1 }}"
- name: Create the volume group again to verify idempotence - name: Create the volume group again to verify idempotence
lvg: lvg:
vg: testvg vg: testvg
pvs: "{{ loop_device1.stdout }}" pvs: "{{ loop_device1 }}"
register: repeat_vg_create register: repeat_vg_create
- name: Do all assertions to verify expected results - name: Do all assertions to verify expected results

View File

@@ -6,7 +6,7 @@
- name: "Create volume group on first disk" - name: "Create volume group on first disk"
lvg: lvg:
vg: testvg vg: testvg
pvs: "{{ loop_device1.stdout }}" pvs: "{{ loop_device1 }}"
- name: Gets current vg size - name: Gets current vg size
shell: vgs -v testvg -o pv_size --noheading --units b | xargs shell: vgs -v testvg -o pv_size --noheading --units b | xargs
@@ -21,12 +21,12 @@
command: "dd if=/dev/zero bs=8MiB count=1 of={{ remote_tmp_dir }}/img1 conv=notrunc oflag=append" command: "dd if=/dev/zero bs=8MiB count=1 of={{ remote_tmp_dir }}/img1 conv=notrunc oflag=append"
- name: "Reread size of file associated with loop_device1" - name: "Reread size of file associated with loop_device1"
command: "losetup -c {{ loop_device1.stdout }}" command: "losetup -c {{ loop_device1 }}"
- name: "Reruns lvg with pvresize:no" - name: "Reruns lvg with pvresize:no"
lvg: lvg:
vg: testvg vg: testvg
pvs: "{{ loop_device1.stdout }}" pvs: "{{ loop_device1 }}"
pvresize: no pvresize: no
register: cmd_result register: cmd_result
@@ -46,7 +46,7 @@
- name: "Reruns lvg with pvresize:yes and check_mode:yes" - name: "Reruns lvg with pvresize:yes and check_mode:yes"
lvg: lvg:
vg: testvg vg: testvg
pvs: "{{ loop_device1.stdout }}" pvs: "{{ loop_device1 }}"
pvresize: yes pvresize: yes
check_mode: yes check_mode: yes
register: cmd_result register: cmd_result
@@ -68,7 +68,7 @@
- name: "Reruns lvg with pvresize:yes" - name: "Reruns lvg with pvresize:yes"
lvg: lvg:
vg: testvg vg: testvg
pvs: "{{ loop_device1.stdout }}" pvs: "{{ loop_device1 }}"
pvresize: yes pvresize: yes
- name: Gets current vg size - name: Gets current vg size

View File

@@ -56,7 +56,8 @@
- info_all_deps.application|length == 1 - info_all_deps.application|length == 1
- info_all_deps.application[0].name == "tox" - info_all_deps.application[0].name == "tox"
- "'version' in info_all_deps.application[0]" - "'version' in info_all_deps.application[0]"
- info_all_deps.application[0].dependencies == ["virtualenv"] - info_all_deps.application[0].dependencies == ["chardet", "virtualenv"]
or info_all_deps.application[0].dependencies == ["virtualenv"]
- "'injected' not in info_all.application[0]" - "'injected' not in info_all.application[0]"
- info_tox.application == info_all_deps.application - info_tox.application == info_all_deps.application

View File

@@ -3,8 +3,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1 azp/posix/1
azp/posix/vm
skip/aix skip/aix
skip/alpine
skip/fedora
skip/freebsd skip/freebsd
skip/osx skip/osx
skip/macos skip/macos
skip/docker skip/docker
skip/ubuntu # FIXME!

View File

@@ -3,8 +3,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1 azp/posix/1
azp/posix/vm
skip/aix skip/aix
skip/alpine
skip/fedora
skip/freebsd skip/freebsd
skip/osx skip/osx
skip/macos skip/macos
skip/docker skip/docker
skip/ubuntu # FIXME!

View File

@@ -131,6 +131,19 @@
src: "{{ sudoers_path }}/my-sudo-rule-6" src: "{{ sudoers_path }}/my-sudo-rule-6"
register: rule_6_contents register: rule_6_contents
- name: Create rule to allow user to sudo just on host-1
community.general.sudoers:
name: my-sudo-rule-7
state: present
user: alice
host: host-1
commands: /usr/local/bin/command
register: rule_7
- name: Grab contents of my-sudo-rule-7
ansible.builtin.slurp:
src: "{{ sudoers_path }}/my-sudo-rule-7"
register: rule_7_contents
- name: Revoke rule 1 - name: Revoke rule 1
community.general.sudoers: community.general.sudoers:
@@ -229,6 +242,7 @@
- "rule_4_contents['content'] | b64decode == '%students ALL=NOPASSWD: /usr/local/bin/command\n'" - "rule_4_contents['content'] | b64decode == '%students ALL=NOPASSWD: /usr/local/bin/command\n'"
- "rule_5_contents['content'] | b64decode == 'alice ALL=NOPASSWD: /usr/local/bin/command\n'" - "rule_5_contents['content'] | b64decode == 'alice ALL=NOPASSWD: /usr/local/bin/command\n'"
- "rule_6_contents['content'] | b64decode == 'alice ALL=(bob)NOPASSWD: /usr/local/bin/command\n'" - "rule_6_contents['content'] | b64decode == 'alice ALL=(bob)NOPASSWD: /usr/local/bin/command\n'"
- "rule_7_contents['content'] | b64decode == 'alice host-1=NOPASSWD: /usr/local/bin/command\n'"
- name: Check revocation stat - name: Check revocation stat
ansible.builtin.assert: ansible.builtin.assert:

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/2 azp/posix/2
azp/posix/vm
skip/aix skip/aix
skip/osx skip/osx
skip/macos skip/macos

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/2 azp/posix/2
azp/posix/vm
skip/aix skip/aix
skip/docker skip/docker
skip/freebsd skip/freebsd

View File

@@ -3,9 +3,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1 azp/posix/1
azp/posix/vm
needs/privileged needs/privileged
needs/root needs/root
skip/aix skip/aix
skip/alpine # FIXME
skip/osx skip/osx
skip/macos skip/macos
skip/freebsd skip/freebsd

View File

@@ -10,7 +10,7 @@ plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choic
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0 plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
plugins/modules/iptables_state.py validate-modules:undocumented-parameter plugins/modules/iptables_state.py validate-modules:undocumented-parameter
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
@@ -18,13 +18,11 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py use-argspec-type-path plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path plugins/modules/rax_files_objects.py use-argspec-type-path
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed plugins/modules/rax.py use-argspec-type-path # fix needed
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
plugins/modules/ssh_config.py use-argspec-type-path # Required since module uses other methods to specify path
plugins/modules/xfconf.py validate-modules:return-syntax-error plugins/modules/xfconf.py validate-modules:return-syntax-error
plugins/modules/yarn.py use-argspec-type-path plugins/modules/yarn.py use-argspec-type-path
tests/integration/targets/django_manage/files/base_test/simple_project/p1/manage.py compile-2.6 # django generated code tests/integration/targets/django_manage/files/base_test/simple_project/p1/manage.py compile-2.6 # django generated code

View File

@@ -5,7 +5,7 @@ plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choic
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0 plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
plugins/modules/iptables_state.py validate-modules:undocumented-parameter plugins/modules/iptables_state.py validate-modules:undocumented-parameter
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
@@ -13,12 +13,10 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py use-argspec-type-path plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path plugins/modules/rax_files_objects.py use-argspec-type-path
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed plugins/modules/rax.py use-argspec-type-path # fix needed
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
plugins/modules/ssh_config.py use-argspec-type-path # Required since module uses other methods to specify path
plugins/modules/xfconf.py validate-modules:return-syntax-error plugins/modules/xfconf.py validate-modules:return-syntax-error
plugins/modules/yarn.py use-argspec-type-path plugins/modules/yarn.py use-argspec-type-path

View File

@@ -5,7 +5,7 @@ plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choic
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0 plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
plugins/modules/iptables_state.py validate-modules:undocumented-parameter plugins/modules/iptables_state.py validate-modules:undocumented-parameter
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
@@ -13,12 +13,10 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py use-argspec-type-path plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path plugins/modules/rax_files_objects.py use-argspec-type-path
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed plugins/modules/rax.py use-argspec-type-path # fix needed
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
plugins/modules/ssh_config.py use-argspec-type-path # Required since module uses other methods to specify path
plugins/modules/xfconf.py validate-modules:return-syntax-error plugins/modules/xfconf.py validate-modules:return-syntax-error
plugins/modules/yarn.py use-argspec-type-path plugins/modules/yarn.py use-argspec-type-path

View File

@@ -6,7 +6,7 @@ plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt' plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
plugins/modules/iptables_state.py validate-modules:undocumented-parameter plugins/modules/iptables_state.py validate-modules:undocumented-parameter
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
@@ -14,13 +14,11 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py use-argspec-type-path plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path plugins/modules/rax_files_objects.py use-argspec-type-path
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed plugins/modules/rax.py use-argspec-type-path # fix needed
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
plugins/modules/ssh_config.py use-argspec-type-path # Required since module uses other methods to specify path
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt' plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
plugins/modules/xfconf.py validate-modules:return-syntax-error plugins/modules/xfconf.py validate-modules:return-syntax-error
plugins/modules/yarn.py use-argspec-type-path plugins/modules/yarn.py use-argspec-type-path

View File

@@ -6,7 +6,7 @@ plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt' plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
plugins/modules/iptables_state.py validate-modules:undocumented-parameter plugins/modules/iptables_state.py validate-modules:undocumented-parameter
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
@@ -14,13 +14,11 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py use-argspec-type-path plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path plugins/modules/rax_files_objects.py use-argspec-type-path
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed plugins/modules/rax.py use-argspec-type-path # fix needed
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
plugins/modules/ssh_config.py use-argspec-type-path # Required since module uses other methods to specify path
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt' plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
plugins/modules/xfconf.py validate-modules:return-syntax-error plugins/modules/xfconf.py validate-modules:return-syntax-error
plugins/modules/yarn.py use-argspec-type-path plugins/modules/yarn.py use-argspec-type-path

View File

@@ -0,0 +1,145 @@
# -*- coding: utf-8 -*-
# Author: Alexei Znamensky (russoz@gmail.com)
# Largely adapted from test_redhat_subscription by
# Jiri Hnidek (jhnidek@redhat.com)
#
# Copyright (c) Alexei Znamensky (russoz@gmail.com)
# Copyright (c) Jiri Hnidek (jhnidek@redhat.com)
#
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible_collections.community.general.plugins.modules import puppet
import pytest
TESTED_MODULE = puppet.__name__
@pytest.fixture
def patch_get_bin_path(mocker):
"""
Function used for mocking AnsibleModule.get_bin_path
"""
def mockie(self, path, *args, **kwargs):
return "/testbin/{0}".format(path)
mocker.patch("ansible.module_utils.basic.AnsibleModule.get_bin_path", mockie)
TEST_CASES = [
[
{},
{
"id": "puppet_agent_plain",
"run_command.calls": [
(
["/testbin/puppet", "config", "print", "agent_disabled_lockfile"],
{"environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}, "check_rc": False},
(0, "blah, anything", "",), # output rc, out, err
),
(
[
"/testbin/timeout", "-s", "9", "30m", "/testbin/puppet", "agent", "--onetime", "--no-daemonize",
"--no-usecacheonfailure", "--no-splay", "--detailed-exitcodes", "--verbose", "--color", "0"
],
{"environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}, "check_rc": False},
(0, "", "",), # output rc, out, err
),
],
"changed": False,
}
],
[
{
"certname": "potatobox"
},
{
"id": "puppet_agent_certname",
"run_command.calls": [
(
["/testbin/puppet", "config", "print", "agent_disabled_lockfile"],
{"environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}, "check_rc": False},
(0, "blah, anything", "",), # output rc, out, err
),
(
[
"/testbin/timeout", "-s", "9", "30m", "/testbin/puppet", "agent", "--onetime", "--no-daemonize",
"--no-usecacheonfailure", "--no-splay", "--detailed-exitcodes", "--verbose", "--color", "0", "--certname=potatobox"
],
{"environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}, "check_rc": False},
(0, "", "",), # output rc, out, err
),
],
"changed": False,
}
],
[
{
"tags": ["a", "b", "c"]
},
{
"id": "puppet_agent_tags_abc",
"run_command.calls": [
(
["/testbin/puppet", "config", "print", "agent_disabled_lockfile"],
{"environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}, "check_rc": False},
(0, "blah, anything", "",), # output rc, out, err
),
(
[
"/testbin/timeout", "-s", "9", "30m", "/testbin/puppet", "agent", "--onetime", "--no-daemonize",
"--no-usecacheonfailure", "--no-splay", "--detailed-exitcodes", "--verbose", "--color", "0", "--tags", "a,b,c"
],
{"environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}, "check_rc": False},
(0, "", "",), # output rc, out, err
),
],
"changed": False,
}
],
]
TEST_CASES_IDS = [item[1]["id"] for item in TEST_CASES]
@pytest.mark.parametrize("patch_ansible_module, testcase",
TEST_CASES,
ids=TEST_CASES_IDS,
indirect=["patch_ansible_module"])
@pytest.mark.usefixtures("patch_ansible_module")
def test_puppet(mocker, capfd, patch_get_bin_path, testcase):
"""
Run unit tests for test cases listen in TEST_CASES
"""
# Mock function used for running commands first
call_results = [item[2] for item in testcase["run_command.calls"]]
mock_run_command = mocker.patch(
"ansible.module_utils.basic.AnsibleModule.run_command",
side_effect=call_results)
# Try to run test case
with pytest.raises(SystemExit):
puppet.main()
out, err = capfd.readouterr()
results = json.loads(out)
print("results =\n%s" % results)
assert mock_run_command.call_count == len(testcase["run_command.calls"])
if mock_run_command.call_count:
call_args_list = [(item[0][0], item[1]) for item in mock_run_command.call_args_list]
expected_call_args_list = [(item[0], item[1]) for item in testcase["run_command.calls"]]
print("call args list =\n%s" % call_args_list)
print("expected args list =\n%s" % expected_call_args_list)
assert call_args_list == expected_call_args_list
assert results.get("changed", False) == testcase["changed"]
if "failed" in testcase:
assert results.get("failed", False) == testcase["failed"]
if "msg" in testcase:
assert results.get("msg", "") == testcase["msg"]

View File

@@ -308,6 +308,7 @@ TEST_CASES = [
'org_id': 'admin', 'org_id': 'admin',
'force_register': 'true', 'force_register': 'true',
'server_proxy_hostname': 'proxy.company.com', 'server_proxy_hostname': 'proxy.company.com',
'server_proxy_scheme': 'https',
'server_proxy_port': '12345', 'server_proxy_port': '12345',
'server_proxy_user': 'proxy_user', 'server_proxy_user': 'proxy_user',
'server_proxy_password': 'secret_proxy_password' 'server_proxy_password': 'secret_proxy_password'
@@ -327,6 +328,7 @@ TEST_CASES = [
'--server.proxy_hostname=proxy.company.com', '--server.proxy_hostname=proxy.company.com',
'--server.proxy_password=secret_proxy_password', '--server.proxy_password=secret_proxy_password',
'--server.proxy_port=12345', '--server.proxy_port=12345',
'--server.proxy_scheme=https',
'--server.proxy_user=proxy_user' '--server.proxy_user=proxy_user'
], ],
{'check_rc': True}, {'check_rc': True},

View File

@@ -0,0 +1 @@
remote.sh

View File

@@ -0,0 +1 @@
remote.sh

View File

@@ -0,0 +1 @@
remote.sh