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
## 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
displayName: Remote devel
dependsOn: []
@@ -203,8 +221,6 @@ stages:
test: rhel/7.9
- name: RHEL 9.0
test: rhel/9.0
- name: FreeBSD 12.3
test: freebsd/12.3
- name: FreeBSD 13.1
test: freebsd/13.1
groups:
@@ -221,8 +237,8 @@ stages:
targets:
- name: RHEL 9.0
test: rhel/9.0
- name: FreeBSD 13.1
test: freebsd/13.1
- name: FreeBSD 12.3
test: freebsd/12.3
groups:
- 1
- 2
@@ -386,7 +402,7 @@ stages:
- name: ArchLinux
test: archlinux/3.10
- name: CentOS Stream 8
test: centos-stream8/3.8
test: centos-stream8/3.9
groups:
- 1
- 2
@@ -459,6 +475,7 @@ stages:
- Units_2_12
- Units_2_13
- Units_2_14
- Remote_devel_extra_vms
- Remote_devel
- Remote_2_11
- Remote_2_12

5
.github/BOTMETA.yml vendored
View File

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

View File

@@ -6,6 +6,68 @@ Community General Release Notes
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
======

View File

@@ -754,3 +754,132 @@ releases:
name: keycloak_clientsecret_regenerate
namespace: ''
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
name: general
version: 6.1.0
version: 6.2.0
readme: README.md
authors:
- Ansible (https://github.com/ansible)

View File

@@ -142,7 +142,7 @@ class CallbackModule(CallbackModule_default):
display_color = C.COLOR_CHANGED
task_result = self._process_result_output(result, msg)
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)
self._display.display(" " + task_result, display_color)

View File

@@ -55,6 +55,11 @@ DOCUMENTATION = r'''
type: str
default: 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:
description:
- Filter the instances by type C(virtual-machine), C(container) or C(both).
@@ -140,6 +145,9 @@ groupby:
vlan666:
type: vlanid
attribute: 666
projectInternals:
type: project
attribute: internals
'''
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.six import raise_from
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
try:
@@ -330,7 +339,15 @@ class InventoryModule(BaseInventoryPlugin):
# "status_code": 200,
# "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']]
def _get_config(self, branch, name):
@@ -351,9 +368,11 @@ class InventoryModule(BaseInventoryPlugin):
dict(config): Config of the instance"""
config = {}
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:
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
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, '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, 'project', self._get_data_entry(
'instances/{0}/instances/metadata/project'.format(instance_name)))
def build_inventory_network(self, instance_name):
"""Add the network interfaces of the instance to the inventory
@@ -686,6 +707,8 @@ class InventoryModule(BaseInventoryPlugin):
# add VLAN_ID information
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)))
# 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):
"""create group by attribute: location
@@ -761,6 +784,28 @@ class InventoryModule(BaseInventoryPlugin):
# Ignore invalid IP addresses returned by lxd
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):
"""create group by attribute: os
@@ -899,6 +944,7 @@ class InventoryModule(BaseInventoryPlugin):
* 'profile'
* 'vlanid'
* 'type'
* 'project'
Args:
str(group_name): Group name
@@ -926,6 +972,8 @@ class InventoryModule(BaseInventoryPlugin):
self.build_inventory_groups_vlanid(group_name)
elif self.groupby[group_name].get('type') == 'type':
self.build_inventory_groups_type(group_name)
elif self.groupby[group_name].get('type') == 'project':
self.build_inventory_groups_project(group_name)
else:
raise AnsibleParserError('Unknown group type: {0}'.format(to_native(group_name)))
@@ -1032,6 +1080,7 @@ class InventoryModule(BaseInventoryPlugin):
try:
self.client_key = self.get_option('client_key')
self.client_cert = self.get_option('client_cert')
self.project = self.get_option('project')
self.debug = self.DEBUG
self.data = {} # store for inventory-data
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))
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
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:
- Ansible 2.9, ansible-base 2.10, or ansible-core 2.11 or newer
options:
@@ -185,7 +189,7 @@ RETURN = """
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.module_helper import ModuleHelper
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper, ModuleHelperException
class AnsibleGalaxyInstall(ModuleHelper):
@@ -226,11 +230,17 @@ class AnsibleGalaxyInstall(ModuleHelper):
version=fmt.as_bool("--version"),
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):
class UnsupportedLocale(ModuleHelperException):
pass
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]
match = self._RE_GALAXY_VERSION.match(line)
if not match:
@@ -239,12 +249,18 @@ class AnsibleGalaxyInstall(ModuleHelper):
version = tuple(int(x) for x in version.split('.')[:3])
return version
with self.runner("version", check_rc=True, output_process=process) as ctx:
return ctx.run(version=True)
try:
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):
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 = CmdRunner(self.module, command=self.command, arg_formats=self.command_args_formats, force_lang=self.force_lang)
self.runner, self.ansible_version = self._get_ansible_galaxy_version()
if self.ansible_version < (2, 11) and not self.vars.ack_min_ansiblecore211:
self.module.deprecate(
"Support for Ansible 2.9 and ansible-base 2.10 is being deprecated. "
@@ -339,11 +355,12 @@ class AnsibleGalaxyInstall(ModuleHelper):
self._setup210plus()
with self.runner("type galaxy_cmd force no_deps dest requirements_file name", output_process=process) as ctx:
ctx.run(galaxy_cmd="install")
if self.verbosity > 2:
self.vars.set("run_info", ctx.run_info)
def main():
galaxy = AnsibleGalaxyInstall()
galaxy.run()
AnsibleGalaxyInstall.execute()
if __name__ == '__main__':

View File

@@ -108,17 +108,8 @@ EXAMPLES = '''
'''
RETURN = '''
create_release:
description:
- 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
tag:
description: Version of the created/latest release.
type: str
returned: success
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_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]
gitlab_keys = this_gitlab.list_all_group_variables()
existing_variables = [x.attributes for x in gitlab_keys]
# preprocessing:filter out and enrich before compare
for item in existing_variables:
item.pop('group_id')
existing_variables = filter_returned_variables(gitlab_keys)
for item in requested_variables:
item['key'] = item.pop('name')
@@ -331,9 +327,7 @@ def native_python_main(this_gitlab, purge, requested_variables, state, module):
if purge:
# refetch and filter
gitlab_keys = this_gitlab.list_all_group_variables()
existing_variables = [x.attributes for x in gitlab_keys]
for item in existing_variables:
item.pop('group_id')
existing_variables = filter_returned_variables(gitlab_keys)
remove = [x for x in existing_variables if x not in requested_variables]
for item in remove:

View File

@@ -189,7 +189,7 @@ except Exception:
HAS_GITLAB_PACKAGE = False
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
var = {
"key": var_obj.get('key'), "value": var_obj.get('value'),
"masked": var_obj.get('masked'), "protected": var_obj.get('protected'),
"variable_type": var_obj.get('variable_type')
"key": var_obj.get('key'),
"value": var_obj.get('value'),
"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:
@@ -319,12 +321,9 @@ def native_python_main(this_gitlab, purge, requested_variables, state, module):
before = [x.attributes for x in gitlab_keys]
gitlab_keys = this_gitlab.list_all_project_variables()
existing_variables = [x.attributes for x in gitlab_keys]
# preprocessing:filter out and enrich before compare
for item in existing_variables:
item.pop('project_id')
existing_variables = filter_returned_variables(gitlab_keys)
# filter out and enrich before compare
for item in requested_variables:
item['key'] = item.pop('name')
item['value'] = str(item.get('value'))
@@ -354,9 +353,7 @@ def native_python_main(this_gitlab, purge, requested_variables, state, module):
if purge:
# refetch and filter
gitlab_keys = this_gitlab.list_all_project_variables()
existing_variables = [x.attributes for x in gitlab_keys]
for item in existing_variables:
item.pop('project_id')
existing_variables = filter_returned_variables(gitlab_keys)
remove = [x for x in existing_variables if x not in requested_variables]
for item in remove:
@@ -409,7 +406,7 @@ def main():
masked=dict(type='bool', default=False),
protected=dict(type='bool', default=False),
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"]),
)

View File

@@ -41,9 +41,12 @@ options:
description:
- 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
md5_crypt and sha256_crypt, which are linux passwd hashes. If you
do so the password file will not be compatible with Apache or Nginx
- 'Some of the available choices might be: C(apr_md5_crypt), C(des_crypt), C(ldap_sha1), C(plaintext)'
C(portable_apache22) and C(host_apache24); or C(md5_crypt) and C(sha256_crypt),
which are Linux passwd hashes. Only some schemes in addition to
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:
type: str
required: false

View File

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

View File

@@ -27,7 +27,10 @@ options:
description:
- C(absent) - policy_profiles should not 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']
default: 'present'
policy_profiles:
@@ -163,6 +166,13 @@ def main():
resource_name = module.params['resource_name']
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
action = actions[state]
resource_type = manageiq_entities()[resource_type_key]

View File

@@ -22,6 +22,9 @@ options:
name:
description:
- 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]
required: true
type: list
@@ -64,6 +67,11 @@ EXAMPLES = '''
name: foo
state: present
- name: Install foo in version 1.2
community.general.opkg:
name: foo=1.2
state: present
- name: Update cache and install foo
community.general.opkg:
name: foo
@@ -96,22 +104,39 @@ from ansible.module_utils.six.moves import shlex_quote
def update_package_db(module, opkg_path):
""" 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:
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. """
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):
@@ -125,11 +150,16 @@ def remove_packages(module, opkg_path, packages):
remove_c = 0
# Using a for loop in case of error, we can report the package that failed
for package in packages:
package, version = split_name_and_version(module, package)
# Query the package first, to see if we even need to remove
if not query_package(module, opkg_path, package):
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):
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
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
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):
module.fail_json(msg="failed to install %s: %s" % (package, out))
if force:
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

View File

@@ -106,6 +106,14 @@ options:
description:
- sets DNS search domain for a container
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:
description:
- timeout for operations
@@ -391,6 +399,7 @@ EXAMPLES = r'''
state: absent
'''
import re
import time
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
@@ -415,11 +424,25 @@ class ProxmoxLxcAnsible(ProxmoxAnsible):
return config['template']
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)
# Remove all empty kwarg entries
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':
kwargs['cpulimit'] = cpus
kwargs['rootfs'] = disk
@@ -437,6 +460,14 @@ class ProxmoxLxcAnsible(ProxmoxAnsible):
kwargs['cpus'] = cpus
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 VZ_TYPE != 'lxc':
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']),
clone=dict(type='int'),
clone_type=dict(default='opportunistic', choices=['full', 'linked', 'opportunistic']),
tags=dict(type='list', elements='str')
)
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,
unprivileged=ansible_to_proxmox_bool(module.params['unprivileged']),
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']))
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))
if disk not in vm_config:
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))
except Exception as 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:
if disk not in vm_config:
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))
except Exception as 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 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 False

View File

@@ -152,15 +152,9 @@ import json
import os
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.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):
@@ -212,16 +206,6 @@ def main():
)
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 not os.path.exists(p['manifest']):
module.fail_json(
@@ -230,90 +214,24 @@ def main():
# Check if puppet is disabled here
if not p['manifest']:
rc, stdout, stderr = module.run_command(
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.")
puppet_utils.ensure_agent_enabled(module)
if module.params['facts'] and not module.check_mode:
_write_structured_data(
_get_facter_dir(),
puppet_utils.get_facter_dir(),
module.params['facter_basename'],
module.params['facts'])
if TIMEOUT_CMD:
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
runner = puppet_utils.puppet_runner(module)
if not p['manifest'] and not p['execute']:
cmd = ("%(base_cmd)s agent --onetime"
" --no-daemonize --no-usecacheonfailure --no-splay"
" --detailed-exitcodes --verbose --color 0") % dict(base_cmd=base_cmd)
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"
args_order = "_agent_fixed puppetmaster show_diff confdir environment tags certname noop use_srv_records"
with runner(args_order) as ctx:
rc, stdout, stderr = ctx.run()
else:
cmd = "%s apply --detailed-exitcodes " % base_cmd
if p['logdest'] == 'syslog':
cmd += "--logdest syslog "
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)
args_order = "_apply_fixed logdest modulepath environment certname tags noop _execute summarize debug verbose"
with runner(args_order) as ctx:
rc, stdout, stderr = ctx.run(_execute=[p['execute'], p['manifest']])
if rc == 0:
# success
@@ -335,11 +253,11 @@ def main():
elif rc == 124:
# timeout
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:
# failure
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)

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_cbs
short_description: Manipulate Rackspace Cloud Block Storage Volumes
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:
description:
type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_cbs_attachments
short_description: Manipulate Rackspace Cloud Block Storage Volume Attachments
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:
device:
type: str

View File

@@ -16,6 +16,8 @@ description:
- creates / deletes or resize a Rackspace Cloud Databases instance
and optionally waits for it to be 'running'. The name option needs to be
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:
name:
type: str

View File

@@ -13,6 +13,8 @@ module: rax_cdb_database
short_description: Create / delete a database in the Cloud Databases
description:
- 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:
cdb_id:
type: str

View File

@@ -14,6 +14,8 @@ module: rax_cdb_user
short_description: Create / delete a Rackspace Cloud Database
description:
- 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:
cdb_id:
type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_clb
short_description: Create / delete a load balancer in Rackspace Public Cloud
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:
algorithm:
type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_clb_nodes
short_description: Add, modify and remove nodes from a Rackspace Cloud Load Balancer
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:
address:
type: str

View File

@@ -12,7 +12,9 @@ DOCUMENTATION = '''
module: rax_clb_ssl
short_description: Manage SSL termination for a Rackspace Cloud Load Balancer
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:
loadbalancer:
type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_dns
short_description: Manage domains on Rackspace Cloud DNS
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:
comment:
type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_dns_record
short_description: Manage DNS records on Rackspace Cloud DNS
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:
comment:
type: str

View File

@@ -14,6 +14,8 @@ module: rax_facts
short_description: Gather facts for Rackspace Cloud Servers
description:
- 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:
address:
type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_files
short_description: Manipulate Rackspace Cloud Files Containers
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:
clear_meta:
description:

View File

@@ -14,6 +14,8 @@ module: rax_files_objects
short_description: Upload, download, and delete objects in Rackspace Cloud Files
description:
- 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:
clear_meta:
description:

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_identity
short_description: Load Rackspace Cloud Identity
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:
state:
type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_keypair
short_description: Create a keypair for use with Rackspace Cloud Servers
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:
name:
type: str

View File

@@ -13,7 +13,9 @@ DOCUMENTATION = '''
module: rax_meta
short_description: Manipulate metadata for Rackspace Cloud Servers
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:
address:
type: str

View File

@@ -13,12 +13,14 @@ DOCUMENTATION = '''
module: rax_mon_alarm
short_description: Create or delete a Rackspace Cloud Monitoring alarm
description:
- Create or delete a Rackspace Cloud Monitoring alarm that associates an
existing rax_mon_entity, rax_mon_check, and rax_mon_notification_plan with
criteria that specify what conditions will trigger which levels of
notifications. Rackspace monitoring module flow | rax_mon_entity ->
rax_mon_check -> rax_mon_notification -> rax_mon_notification_plan ->
*rax_mon_alarm*
- Create or delete a Rackspace Cloud Monitoring alarm that associates an
existing rax_mon_entity, rax_mon_check, and rax_mon_notification_plan with
criteria that specify what conditions will trigger which levels of
notifications. Rackspace monitoring module flow | rax_mon_entity ->
rax_mon_check -> 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:
state:
type: str

View File

@@ -14,12 +14,14 @@ module: rax_mon_check
short_description: Create or delete a Rackspace Cloud Monitoring check for an
existing entity.
description:
- 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
performed, possibly from different monitoring zones, on the systems you
monitor. Rackspace monitoring module flow | rax_mon_entity ->
*rax_mon_check* -> rax_mon_notification -> rax_mon_notification_plan ->
rax_mon_alarm
- 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
performed, possibly from different monitoring zones, on the systems you
monitor. Rackspace monitoring module flow | rax_mon_entity ->
*rax_mon_check* -> 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:
state:
type: str

View File

@@ -13,11 +13,13 @@ DOCUMENTATION = '''
module: rax_mon_entity
short_description: Create or delete a Rackspace Cloud Monitoring entity
description:
- Create or delete a Rackspace Cloud Monitoring entity, which represents a device
to monitor. Entities associate checks and alarms with a target system and
provide a convenient, centralized place to store IP addresses. Rackspace
monitoring module flow | *rax_mon_entity* -> rax_mon_check ->
rax_mon_notification -> rax_mon_notification_plan -> rax_mon_alarm
- Create or delete a Rackspace Cloud Monitoring entity, which represents a device
to monitor. Entities associate checks and alarms with a target system and
provide a convenient, centralized place to store IP addresses. Rackspace
monitoring module flow | *rax_mon_entity* -> rax_mon_check ->
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:
label:
type: str

View File

@@ -14,10 +14,12 @@ module: rax_mon_notification_plan
short_description: Create or delete a Rackspace Cloud Monitoring notification
plan.
description:
- Create or delete a Rackspace Cloud Monitoring notification plan by
associating existing rax_mon_notifications with severity levels. Rackspace
monitoring module flow | rax_mon_entity -> rax_mon_check ->
rax_mon_notification -> *rax_mon_notification_plan* -> rax_mon_alarm
- Create or delete a Rackspace Cloud Monitoring notification plan by
associating existing rax_mon_notifications with severity levels. Rackspace
monitoring module flow | rax_mon_entity -> rax_mon_check ->
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:
state:
type: str

View File

@@ -70,6 +70,11 @@ options:
description:
- Specify an HTTP proxy hostname.
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:
description:
- Specify an HTTP proxy port.
@@ -806,6 +811,7 @@ def main():
'consumer_id': {},
'force_register': {'default': False, 'type': 'bool'},
'server_proxy_hostname': {},
'server_proxy_scheme': {},
'server_proxy_port': {},
'server_proxy_user': {},
'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.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.ssh import determine_config_file
class SSHConfig():
@@ -188,10 +189,7 @@ class SSHConfig():
self.config.load()
def check_ssh_config_path(self):
if self.user:
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'
self.config_file = determine_config_file(self.user, self.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:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1
azp/posix/vm
destructive
skip/docker # kernel modules not loadable
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:
path: "{{ iptables_saved }}"
state: saved
table: "{{ item }}"
loop:
- security
- raw
- mangle
changed_when: false
@@ -198,8 +197,6 @@
- "'*nat' in iptables_state.saved"
- "'raw' in iptables_state.tables"
- "'*raw' in iptables_state.saved"
- "'security' in iptables_state.tables"
- "'*security' in iptables_state.saved"
quiet: yes
@@ -233,17 +230,14 @@
- "'*mangle' in iptables_state.initial_state"
- "'*nat' in iptables_state.initial_state"
- "'*raw' in iptables_state.initial_state"
- "'*security' in iptables_state.initial_state"
- "'filter' in iptables_state.tables"
- "'mangle' not in iptables_state.tables"
- "'nat' not in iptables_state.tables"
- "'raw' not in iptables_state.tables"
- "'security' not in iptables_state.tables"
- "'*filter' in iptables_state.restored"
- "'*mangle' not in iptables_state.restored"
- "'*nat' not in iptables_state.restored"
- "'*raw' not in iptables_state.restored"
- "'*security' not in iptables_state.restored"
- iptables_state is not changed
quiet: yes
@@ -264,17 +258,14 @@
- "'*mangle' in iptables_state.initial_state"
- "'*nat' in iptables_state.initial_state"
- "'*raw' in iptables_state.initial_state"
- "'*security' in iptables_state.initial_state"
- "'filter' in iptables_state.tables"
- "'mangle' in iptables_state.tables"
- "'nat' in iptables_state.tables"
- "'raw' in iptables_state.tables"
- "'security' in iptables_state.tables"
- "'*filter' in iptables_state.restored"
- "'*mangle' in iptables_state.restored"
- "'*nat' in iptables_state.restored"
- "'*raw' in iptables_state.restored"
- "'*security' in iptables_state.restored"
- iptables_state is not changed
quiet: yes

View File

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

View File

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

View File

@@ -8,15 +8,16 @@
vg: testvg
state: absent
- name: Detach loop device
command: "losetup -d {{ item.stdout }}"
loop: "{{ loop_devices.results|default([]) }}"
- name: Detach loop devices
command: "losetup -d {{ item }}"
loop:
- "{{ loop_device1 | default('') }}"
- "{{ loop_device2 | default('') }}"
when:
- item.stdout is defined
- item.stdout is match("/dev/.*")
- item != ''
- name: Remove device files
file:
path: "{{ remote_tmp_dir }}/img{{ item }}"
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"
lvg:
vg: testvg
pvs: "{{ loop_device1.stdout }}"
pvs: "{{ loop_device1 }}"
- name: "get lvm facts"
setup:
@@ -16,14 +16,14 @@
- name: "Assert the testvg span only on first disk"
assert:
that:
- ansible_lvm.pvs[loop_device1.stdout].vg == "testvg"
- 'loop_device2.stdout not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device2.stdout].vg == ""'
- ansible_lvm.pvs[loop_device1].vg == "testvg"
- 'loop_device2 not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device2].vg == ""'
- name: "Extend to second disk AND reduce from the first disk"
lvg:
vg: testvg
pvs: "{{ loop_device2.stdout }}"
pvs: "{{ loop_device2 }}"
- name: "get lvm facts"
setup:
@@ -33,6 +33,6 @@
- name: "Assert the testvg span only on first disk"
assert:
that:
- 'loop_device1.stdout not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device1.stdout].vg == ""'
- ansible_lvm.pvs[loop_device2.stdout].vg == "testvg"
- 'loop_device1 not in ansible_lvm.pvs or
ansible_lvm.pvs[loop_device1].vg == ""'
- ansible_lvm.pvs[loop_device2].vg == "testvg"

View File

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

View File

@@ -6,7 +6,7 @@
- name: "Create volume group on first disk"
lvg:
vg: testvg
pvs: "{{ loop_device1.stdout }}"
pvs: "{{ loop_device1 }}"
- name: Gets current vg size
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"
- 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"
lvg:
vg: testvg
pvs: "{{ loop_device1.stdout }}"
pvs: "{{ loop_device1 }}"
pvresize: no
register: cmd_result
@@ -46,7 +46,7 @@
- name: "Reruns lvg with pvresize:yes and check_mode:yes"
lvg:
vg: testvg
pvs: "{{ loop_device1.stdout }}"
pvs: "{{ loop_device1 }}"
pvresize: yes
check_mode: yes
register: cmd_result
@@ -68,7 +68,7 @@
- name: "Reruns lvg with pvresize:yes"
lvg:
vg: testvg
pvs: "{{ loop_device1.stdout }}"
pvs: "{{ loop_device1 }}"
pvresize: yes
- name: Gets current vg size

View File

@@ -56,7 +56,8 @@
- info_all_deps.application|length == 1
- info_all_deps.application[0].name == "tox"
- "'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]"
- info_tox.application == info_all_deps.application

View File

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

View File

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

View File

@@ -131,6 +131,19 @@
src: "{{ sudoers_path }}/my-sudo-rule-6"
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
community.general.sudoers:
@@ -229,6 +242,7 @@
- "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_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
ansible.builtin.assert:

View File

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

View File

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

View File

@@ -3,9 +3,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later
azp/posix/1
azp/posix/vm
needs/privileged
needs/root
skip/aix
skip/alpine # FIXME
skip/osx
skip/macos
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/iptables_state.py validate-modules:undocumented-parameter
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-missing-type # 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/osx_defaults.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.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed
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/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

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/iptables_state.py validate-modules:undocumented-parameter
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-missing-type # 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/osx_defaults.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.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed
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/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/iptables_state.py validate-modules:undocumented-parameter
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-missing-type # 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/osx_defaults.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.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed
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/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/iptables_state.py validate-modules:undocumented-parameter
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-missing-type # 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/osx_defaults.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.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed
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/xfconf.py validate-modules:return-syntax-error
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/iptables_state.py validate-modules:undocumented-parameter
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-missing-type # 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/osx_defaults.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.py validate-modules:parameter-state-invalid-choice
plugins/modules/rax.py use-argspec-type-path # fix needed
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/xfconf.py validate-modules:return-syntax-error
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',
'force_register': 'true',
'server_proxy_hostname': 'proxy.company.com',
'server_proxy_scheme': 'https',
'server_proxy_port': '12345',
'server_proxy_user': 'proxy_user',
'server_proxy_password': 'secret_proxy_password'
@@ -327,6 +328,7 @@ TEST_CASES = [
'--server.proxy_hostname=proxy.company.com',
'--server.proxy_password=secret_proxy_password',
'--server.proxy_port=12345',
'--server.proxy_scheme=https',
'--server.proxy_user=proxy_user'
],
{'check_rc': True},

View File

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

View File

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

View File

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