mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-30 10:26:52 +00:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec2efb26d0 | ||
|
|
150495a15f | ||
|
|
b2b3c056ca | ||
|
|
557594c392 | ||
|
|
b6a6edd403 | ||
|
|
e42770d4bf | ||
|
|
1b78f18bf4 | ||
|
|
ec11d13825 | ||
|
|
eb066335f8 | ||
|
|
cb26897b3e | ||
|
|
b7b5c1852e | ||
|
|
97dce1f621 | ||
|
|
0618af9b1e | ||
|
|
bd5f7197d6 | ||
|
|
8532e0e086 | ||
|
|
096f8bed3b | ||
|
|
725d16d835 | ||
|
|
5462773827 | ||
|
|
f798d914e1 | ||
|
|
c3d5a7b1b8 | ||
|
|
9bd160d989 | ||
|
|
1b800273ef | ||
|
|
61306b579e | ||
|
|
107a1729a4 | ||
|
|
895ae3b73e | ||
|
|
aa737429de | ||
|
|
28830d8ca5 | ||
|
|
3825264260 | ||
|
|
9e319610c3 | ||
|
|
92db683b08 | ||
|
|
81966e8900 | ||
|
|
465b0c72a6 | ||
|
|
37fc85b03a | ||
|
|
efcaf57da8 | ||
|
|
e4eead189b | ||
|
|
54bf6ef6de | ||
|
|
a63b8b14bc | ||
|
|
2e335f3876 | ||
|
|
9d770169cc | ||
|
|
d6c9c0c49a | ||
|
|
9f1e976b9f | ||
|
|
e309707e22 | ||
|
|
7503c69b53 | ||
|
|
34d7369293 | ||
|
|
91c37a79f4 | ||
|
|
24c706ca1b | ||
|
|
851dec44c5 | ||
|
|
22773418d2 | ||
|
|
8854f4d948 | ||
|
|
35092aa7f9 | ||
|
|
5bbcfa5644 | ||
|
|
8f6a4e0028 |
@@ -53,14 +53,14 @@ pool: Standard
|
||||
|
||||
stages:
|
||||
### Sanity
|
||||
- stage: Sanity_devel
|
||||
displayName: Sanity devel
|
||||
- stage: Sanity_2_14
|
||||
displayName: Sanity 2.14
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Test {0}
|
||||
testFormat: devel/sanity/{0}
|
||||
testFormat: 2.14/sanity/{0}
|
||||
targets:
|
||||
- test: 1
|
||||
- test: 2
|
||||
@@ -133,14 +133,14 @@ stages:
|
||||
- test: 3
|
||||
- test: 4
|
||||
### Units
|
||||
- stage: Units_devel
|
||||
displayName: Units devel
|
||||
- stage: Units_2_14
|
||||
displayName: Units 2.14
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Python {0}
|
||||
testFormat: devel/units/{0}/1
|
||||
testFormat: 2.14/units/{0}/1
|
||||
targets:
|
||||
- test: 2.7
|
||||
- test: 3.5
|
||||
@@ -211,13 +211,13 @@ stages:
|
||||
- test: 3.5
|
||||
|
||||
## Remote
|
||||
- stage: Remote_devel
|
||||
displayName: Remote devel
|
||||
- stage: Remote_2_14
|
||||
displayName: Remote 2.14
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: devel/{0}
|
||||
testFormat: 2.14/{0}
|
||||
targets:
|
||||
- name: macOS 12.0
|
||||
test: macos/12.0
|
||||
@@ -317,18 +317,16 @@ stages:
|
||||
- 2
|
||||
|
||||
### Docker
|
||||
- stage: Docker_devel
|
||||
displayName: Docker devel
|
||||
- stage: Docker_2_14
|
||||
displayName: Docker 2.14
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: devel/linux/{0}
|
||||
testFormat: 2.14/linux/{0}
|
||||
targets:
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 35
|
||||
test: fedora35
|
||||
- name: Fedora 36
|
||||
test: fedora36
|
||||
- name: openSUSE 15
|
||||
@@ -424,13 +422,13 @@ stages:
|
||||
- 3
|
||||
|
||||
### Community Docker
|
||||
- stage: Docker_community_devel
|
||||
displayName: Docker (community images) devel
|
||||
- stage: Docker_community_2_14
|
||||
displayName: Docker (community images) 2.14
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: devel/linux-community/{0}
|
||||
testFormat: 2.14/linux-community/{0}
|
||||
targets:
|
||||
- name: Debian Bullseye
|
||||
test: debian-bullseye/3.9
|
||||
@@ -444,14 +442,14 @@ stages:
|
||||
- 3
|
||||
|
||||
### Cloud
|
||||
- stage: Cloud_devel
|
||||
displayName: Cloud devel
|
||||
- stage: Cloud_2_14
|
||||
displayName: Cloud 2.14
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Python {0}
|
||||
testFormat: devel/cloud/{0}/1
|
||||
testFormat: 2.14/cloud/{0}/1
|
||||
targets:
|
||||
- test: 2.7
|
||||
- test: '3.10'
|
||||
@@ -508,32 +506,32 @@ stages:
|
||||
- stage: Summary
|
||||
condition: succeededOrFailed()
|
||||
dependsOn:
|
||||
- Sanity_devel
|
||||
- Sanity_2_14
|
||||
- Sanity_2_9
|
||||
- Sanity_2_10
|
||||
- Sanity_2_11
|
||||
- Sanity_2_12
|
||||
- Sanity_2_13
|
||||
- Units_devel
|
||||
- Units_2_14
|
||||
- Units_2_9
|
||||
- Units_2_10
|
||||
- Units_2_11
|
||||
- Units_2_12
|
||||
- Units_2_13
|
||||
- Remote_devel
|
||||
- Remote_2_14
|
||||
- Remote_2_9
|
||||
- Remote_2_10
|
||||
- Remote_2_11
|
||||
- Remote_2_12
|
||||
- Remote_2_13
|
||||
- Docker_devel
|
||||
- Docker_2_14
|
||||
- Docker_2_9
|
||||
- Docker_2_10
|
||||
- Docker_2_11
|
||||
- Docker_2_12
|
||||
- Docker_2_13
|
||||
- Docker_community_devel
|
||||
- Cloud_devel
|
||||
- Docker_community_2_14
|
||||
- Cloud_2_14
|
||||
- Cloud_2_9
|
||||
- Cloud_2_10
|
||||
- Cloud_2_11
|
||||
|
||||
8
.github/BOTMETA.yml
vendored
8
.github/BOTMETA.yml
vendored
@@ -220,7 +220,8 @@ files:
|
||||
$lookups/dnstxt.py:
|
||||
maintainers: jpmens
|
||||
$lookups/dsv.py:
|
||||
maintainers: amigus endlesstrax delineaKrehl tylerezimmerman
|
||||
maintainers: delineaKrehl tylerezimmerman
|
||||
ignore: amigus
|
||||
$lookups/etcd3.py:
|
||||
maintainers: eric-belhomme
|
||||
$lookups/etcd.py:
|
||||
@@ -257,7 +258,8 @@ files:
|
||||
maintainers: RevBits
|
||||
$lookups/shelvefile.py: {}
|
||||
$lookups/tss.py:
|
||||
maintainers: amigus endlesstrax delineaKrehl tylerezimmerman
|
||||
maintainers: delineaKrehl tylerezimmerman
|
||||
ignore: amigus
|
||||
$module_utils/:
|
||||
labels: module_utils
|
||||
$module_utils/gitlab.py:
|
||||
@@ -921,7 +923,7 @@ files:
|
||||
$modules/packaging/os/xbps.py:
|
||||
maintainers: dinoocch the-maldridge
|
||||
$modules/packaging/os/yum_versionlock.py:
|
||||
maintainers: florianpaulhoberg aminvakil
|
||||
maintainers: gyptazy aminvakil
|
||||
$modules/packaging/os/zypper.py:
|
||||
maintainers: $team_suse
|
||||
labels: zypper
|
||||
|
||||
@@ -6,6 +6,96 @@ Community General Release Notes
|
||||
|
||||
This changelog describes changes after version 3.0.0.
|
||||
|
||||
v4.8.8
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Regular bugfix release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- archive - avoid crash when ``lzma`` is not present and ``format`` is not ``xz`` (https://github.com/ansible-collections/community.general/pull/5393).
|
||||
- opentelemetry callback plugin - support opentelemetry-api 1.13.0 that removed support for ``_time_ns`` (https://github.com/ansible-collections/community.general/pull/5342).
|
||||
- pfexec become plugin - remove superflous quotes preventing exe wrap from working as expected (https://github.com/ansible-collections/community.general/issues/3671, https://github.com/ansible-collections/community.general/pull/3889).
|
||||
- pkgng - fix case when ``pkg`` fails when trying to upgrade all packages (https://github.com/ansible-collections/community.general/issues/5363).
|
||||
- redhat_subscription - make module idempotent when ``pool_ids`` are used (https://github.com/ansible-collections/community.general/issues/5313).
|
||||
- xenserver_facts - fix broken ``AnsibleModule`` call that prevented the module from working at all (https://github.com/ansible-collections/community.general/pull/5383).
|
||||
|
||||
v4.8.7
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Regular bugfix release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- gitlab module util - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_branch - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_deploy_key - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_group - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_group_members - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_group_variable - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_hook - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_project - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_project_members - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_project_variable - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_protected_branch - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_runner - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_user - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- locale_gen - fix support for Ubuntu (https://github.com/ansible-collections/community.general/issues/5281).
|
||||
- tss lookup plugin - adding support for updated Delinea library (https://github.com/DelineaXPM/python-tss-sdk/issues/9, https://github.com/ansible-collections/community.general/pull/5151).
|
||||
|
||||
v4.8.6
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix and maintenance release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- Added MIT license as ``MIT-license.txt`` for ``tests/unit/plugins/modules/packaging/language/test_gem.py`` (https://github.com/ansible-collections/community.general/pull/5065, https://github.com/ansible-collections/community.general/pull/5072).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- apache2_mod_proxy - avoid crash when reporting inability to parse balancer_member_page HTML caused by using an undefined variable in the error message (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- dnsimple_info - correctly report missing library as ``requests`` and not ``another_library`` (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- funcd connection plugin - fix signature of ``exec_command`` (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- manageiq_alert_profiles - avoid crash when reporting unknown profile caused by trying to return an undefined variable (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- nsupdate - compatibility with NS records (https://github.com/ansible-collections/community.general/pull/5112).
|
||||
- packet_ip_subnet - fix error reporting in case of invalid CIDR prefix lengths (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- pip_package_info - remove usage of global variable (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
|
||||
v4.8.5
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Regular bugfix release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- pacman - fixed name resolution of URL packages (https://github.com/ansible-collections/community.general/pull/4959).
|
||||
- proxmox - fix error handling when getting VM by name when ``state=absent`` (https://github.com/ansible-collections/community.general/pull/4945).
|
||||
- proxmox inventory plugin - fix crash when ``enabled=1`` is used in agent config string (https://github.com/ansible-collections/community.general/pull/4910).
|
||||
- proxmox_kvm - fix error handling when getting VM by name when ``state=absent`` (https://github.com/ansible-collections/community.general/pull/4945).
|
||||
- slack - fix incorrect channel prefix ``#`` caused by incomplete pattern detection by adding ``G0`` and ``GF`` as channel ID patterns (https://github.com/ansible-collections/community.general/pull/5019).
|
||||
|
||||
v4.8.4
|
||||
======
|
||||
|
||||
|
||||
9
MIT-license.txt
Normal file
9
MIT-license.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -17,7 +17,7 @@ If you encounter abusive behavior violating the [Ansible Code of Conduct](https:
|
||||
|
||||
## Tested with Ansible
|
||||
|
||||
Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12, ansible-core 2.13 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported.
|
||||
Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, and ansible-core 2.14 releases of ansible-core. Ansible versions before 2.9.10 are not supported.
|
||||
|
||||
## External requirements
|
||||
|
||||
|
||||
@@ -1877,3 +1877,105 @@ releases:
|
||||
- 4911-dsv-honor-tld-option.yml
|
||||
- 4933-fix-rax-clb-nodes.yaml
|
||||
release_date: '2022-07-12'
|
||||
4.8.5:
|
||||
changes:
|
||||
bugfixes:
|
||||
- pacman - fixed name resolution of URL packages (https://github.com/ansible-collections/community.general/pull/4959).
|
||||
- proxmox - fix error handling when getting VM by name when ``state=absent``
|
||||
(https://github.com/ansible-collections/community.general/pull/4945).
|
||||
- proxmox inventory plugin - fix crash when ``enabled=1`` is used in agent config
|
||||
string (https://github.com/ansible-collections/community.general/pull/4910).
|
||||
- proxmox_kvm - fix error handling when getting VM by name when ``state=absent``
|
||||
(https://github.com/ansible-collections/community.general/pull/4945).
|
||||
- slack - fix incorrect channel prefix ``#`` caused by incomplete pattern detection
|
||||
by adding ``G0`` and ``GF`` as channel ID patterns (https://github.com/ansible-collections/community.general/pull/5019).
|
||||
release_summary: Regular bugfix release.
|
||||
fragments:
|
||||
- 4.8.5.yml
|
||||
- 4910-fix-for-agent-enabled.yml
|
||||
- 4945-fix-get_vm-int-parse-handling.yaml
|
||||
- 4959-pacman-fix-url-packages-name.yaml
|
||||
- 5019-slack-support-more-groups.yml
|
||||
release_date: '2022-08-01'
|
||||
4.8.6:
|
||||
changes:
|
||||
bugfixes:
|
||||
- apache2_mod_proxy - avoid crash when reporting inability to parse balancer_member_page
|
||||
HTML caused by using an undefined variable in the error message (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- dnsimple_info - correctly report missing library as ``requests`` and not ``another_library``
|
||||
(https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- funcd connection plugin - fix signature of ``exec_command`` (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- manageiq_alert_profiles - avoid crash when reporting unknown profile caused
|
||||
by trying to return an undefined variable (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- nsupdate - compatibility with NS records (https://github.com/ansible-collections/community.general/pull/5112).
|
||||
- packet_ip_subnet - fix error reporting in case of invalid CIDR prefix lengths
|
||||
(https://github.com/ansible-collections/community.general/pull/5111).
|
||||
- pip_package_info - remove usage of global variable (https://github.com/ansible-collections/community.general/pull/5111).
|
||||
minor_changes:
|
||||
- Added MIT license as ``MIT-license.txt`` for ``tests/unit/plugins/modules/packaging/language/test_gem.py``
|
||||
(https://github.com/ansible-collections/community.general/pull/5065, https://github.com/ansible-collections/community.general/pull/5072).
|
||||
release_summary: Bugfix and maintenance release.
|
||||
fragments:
|
||||
- 4.8.6.yml
|
||||
- 5111-fixes.yml
|
||||
- 5112-fix-nsupdate-ns-entry.yaml
|
||||
- licenses.yml
|
||||
release_date: '2022-08-22'
|
||||
4.8.7:
|
||||
changes:
|
||||
bugfixes:
|
||||
- locale_gen - fix support for Ubuntu (https://github.com/ansible-collections/community.general/issues/5281).
|
||||
- tss lookup plugin - adding support for updated Delinea library (https://github.com/DelineaXPM/python-tss-sdk/issues/9,
|
||||
https://github.com/ansible-collections/community.general/pull/5151).
|
||||
minor_changes:
|
||||
- gitlab module util - minor refactor when checking for installed dependency
|
||||
(https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_branch - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_deploy_key - minor refactor when checking for installed dependency
|
||||
(https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_group - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_group_members - minor refactor when checking for installed dependency
|
||||
(https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_group_variable - minor refactor when checking for installed dependency
|
||||
(https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_hook - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_project - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_project_members - minor refactor when checking for installed dependency
|
||||
(https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_project_variable - minor refactor when checking for installed dependency
|
||||
(https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_protected_branch - minor refactor when checking for installed dependency
|
||||
(https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_runner - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
- gitlab_user - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
|
||||
release_summary: Regular bugfix release.
|
||||
fragments:
|
||||
- 4.8.7.yml
|
||||
- 5151-add-delinea-support-tss-lookup.yml
|
||||
- 5259-gitlab-imports.yaml
|
||||
- 5282-locale_gen.yaml
|
||||
release_date: '2022-10-03'
|
||||
4.8.8:
|
||||
changes:
|
||||
bugfixes:
|
||||
- archive - avoid crash when ``lzma`` is not present and ``format`` is not ``xz``
|
||||
(https://github.com/ansible-collections/community.general/pull/5393).
|
||||
- opentelemetry callback plugin - support opentelemetry-api 1.13.0 that removed
|
||||
support for ``_time_ns`` (https://github.com/ansible-collections/community.general/pull/5342).
|
||||
- pfexec become plugin - remove superflous quotes preventing exe wrap from working
|
||||
as expected (https://github.com/ansible-collections/community.general/issues/3671,
|
||||
https://github.com/ansible-collections/community.general/pull/3889).
|
||||
- pkgng - fix case when ``pkg`` fails when trying to upgrade all packages (https://github.com/ansible-collections/community.general/issues/5363).
|
||||
- redhat_subscription - make module idempotent when ``pool_ids`` are used (https://github.com/ansible-collections/community.general/issues/5313).
|
||||
- xenserver_facts - fix broken ``AnsibleModule`` call that prevented the module
|
||||
from working at all (https://github.com/ansible-collections/community.general/pull/5383).
|
||||
release_summary: Regular bugfix release.
|
||||
fragments:
|
||||
- 3671-illumos-pfexec.yml
|
||||
- 4.8.8.yml
|
||||
- 5313-fix-redhat_subscription-idempotency-pool_ids.yml
|
||||
- 5342-opentelemetry_bug_fix_opentelemetry-api-1.13.yml
|
||||
- 5369-pkgng-fix-update-all.yaml
|
||||
- 5383-xenserver_facts.yml
|
||||
- 5393-archive.yml
|
||||
release_date: '2022-10-24'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace: community
|
||||
name: general
|
||||
version: 4.8.4
|
||||
version: 4.8.8
|
||||
readme: README.md
|
||||
authors:
|
||||
- Ansible (https://github.com/ansible)
|
||||
|
||||
@@ -101,4 +101,4 @@ class BecomeModule(BecomeBase):
|
||||
|
||||
flags = self.get_option('become_flags')
|
||||
noexe = not self.get_option('wrap_exe')
|
||||
return '%s %s "%s"' % (exe, flags, self._build_success_command(cmd, shell, noexe=noexe))
|
||||
return '%s %s %s' % (exe, flags, self._build_success_command(cmd, shell, noexe=noexe))
|
||||
|
||||
@@ -8,9 +8,9 @@ DOCUMENTATION = """
|
||||
name: sudosu
|
||||
short_description: Run tasks using sudo su -
|
||||
description:
|
||||
- This become plugins allows your remote/login user to execute commands as another user via the C(sudo) and C(su) utilities combined.
|
||||
- This become plugin allows your remote/login user to execute commands as another user via the C(sudo) and C(su) utilities combined.
|
||||
author:
|
||||
- Dag Wieers (@dagwieers)
|
||||
- Dag Wieers (@dagwieers)
|
||||
version_added: 2.4.0
|
||||
options:
|
||||
become_user:
|
||||
|
||||
@@ -232,13 +232,13 @@ class CallbackModule(CallbackModule_default):
|
||||
# Remove non-essential attributes
|
||||
for attr in self.removed_attributes:
|
||||
if attr in result:
|
||||
del(result[attr])
|
||||
del result[attr]
|
||||
|
||||
# Remove empty attributes (list, dict, str)
|
||||
for attr in result.copy():
|
||||
if isinstance(result[attr], (MutableSequence, MutableMapping, binary_type, text_type)):
|
||||
if not result[attr]:
|
||||
del(result[attr])
|
||||
del result[attr]
|
||||
|
||||
def _handle_exceptions(self, result):
|
||||
if 'exception' in result:
|
||||
|
||||
@@ -94,13 +94,32 @@ try:
|
||||
from opentelemetry.sdk.trace.export import (
|
||||
BatchSpanProcessor
|
||||
)
|
||||
from opentelemetry.util._time import _time_ns
|
||||
|
||||
# Support for opentelemetry-api <= 1.12
|
||||
try:
|
||||
from opentelemetry.util._time import _time_ns
|
||||
except ImportError as imp_exc:
|
||||
OTEL_LIBRARY_TIME_NS_ERROR = imp_exc
|
||||
else:
|
||||
OTEL_LIBRARY_TIME_NS_ERROR = None
|
||||
|
||||
except ImportError as imp_exc:
|
||||
OTEL_LIBRARY_IMPORT_ERROR = imp_exc
|
||||
OTEL_LIBRARY_TIME_NS_ERROR = imp_exc
|
||||
else:
|
||||
OTEL_LIBRARY_IMPORT_ERROR = None
|
||||
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
time_ns = time.time_ns
|
||||
elif not OTEL_LIBRARY_TIME_NS_ERROR:
|
||||
time_ns = _time_ns
|
||||
else:
|
||||
def time_ns():
|
||||
# Support versions older than 3.7 with opentelemetry-api > 1.12
|
||||
return int(time.time() * 1e9)
|
||||
|
||||
|
||||
class TaskData:
|
||||
"""
|
||||
Data about an individual task.
|
||||
@@ -112,10 +131,7 @@ class TaskData:
|
||||
self.path = path
|
||||
self.play = play
|
||||
self.host_data = OrderedDict()
|
||||
if sys.version_info >= (3, 7):
|
||||
self.start = time.time_ns()
|
||||
else:
|
||||
self.start = _time_ns()
|
||||
self.start = time_ns()
|
||||
self.action = action
|
||||
self.args = args
|
||||
|
||||
@@ -140,10 +156,7 @@ class HostData:
|
||||
self.name = name
|
||||
self.status = status
|
||||
self.result = result
|
||||
if sys.version_info >= (3, 7):
|
||||
self.finish = time.time_ns()
|
||||
else:
|
||||
self.finish = _time_ns()
|
||||
self.finish = time_ns()
|
||||
|
||||
|
||||
class OpenTelemetrySource(object):
|
||||
|
||||
@@ -63,7 +63,7 @@ class Connection(ConnectionBase):
|
||||
self.client = fc.Client(self.host)
|
||||
return self
|
||||
|
||||
def exec_command(self, cmd, become_user=None, sudoable=False, executable='/bin/sh', in_data=None):
|
||||
def exec_command(self, cmd, in_data=None, sudoable=True):
|
||||
""" run a command on the remote minion """
|
||||
|
||||
if in_data:
|
||||
|
||||
@@ -51,10 +51,16 @@ DOCUMENTATION = '''
|
||||
type: boolean
|
||||
default: false
|
||||
requirements:
|
||||
- jc (https://github.com/kellyjonbrazil/jc)
|
||||
- jc installed as a Python library (U(https://pypi.org/project/jc/))
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Install the prereqs of the jc filter (jc Python package) on the Ansible controller
|
||||
delegate_to: localhost
|
||||
ansible.builtin.pip:
|
||||
name: jc
|
||||
state: present
|
||||
|
||||
- name: Run command
|
||||
ansible.builtin.command: uname -a
|
||||
register: result
|
||||
@@ -107,15 +113,19 @@ def jc(data, parser, quiet=True, raw=False):
|
||||
dictionary or list of dictionaries
|
||||
|
||||
Example:
|
||||
|
||||
- name: run date command
|
||||
hosts: ubuntu
|
||||
tasks:
|
||||
- shell: date
|
||||
- name: install the prereqs of the jc filter (jc Python package) on the Ansible controller
|
||||
delegate_to: localhost
|
||||
ansible.builtin.pip:
|
||||
name: jc
|
||||
state: present
|
||||
- ansible.builtin.shell: date
|
||||
register: result
|
||||
- set_fact:
|
||||
- ansible.builtin.set_fact:
|
||||
myvar: "{{ result.stdout | community.general.jc('date') }}"
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ myvar }}"
|
||||
|
||||
produces:
|
||||
@@ -137,7 +147,7 @@ def jc(data, parser, quiet=True, raw=False):
|
||||
"""
|
||||
|
||||
if not HAS_LIB:
|
||||
raise AnsibleError('You need to install "jc" prior to running jc filter')
|
||||
raise AnsibleError('You need to install "jc" as a Python library on the Ansible controller prior to running jc filter')
|
||||
|
||||
try:
|
||||
jc_parser = importlib.import_module('jc.parsers.' + parser)
|
||||
|
||||
@@ -400,12 +400,20 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
properties[parsed_key] = [tag.strip() for tag in stripped_value.split(",")]
|
||||
|
||||
# The first field in the agent string tells you whether the agent is enabled
|
||||
# the rest of the comma separated string is extra config for the agent
|
||||
if config == 'agent' and int(value.split(',')[0]):
|
||||
agent_iface_value = self._get_agent_network_interfaces(node, vmid, vmtype)
|
||||
if agent_iface_value:
|
||||
agent_iface_key = self.to_safe('%s%s' % (key, "_interfaces"))
|
||||
properties[agent_iface_key] = agent_iface_value
|
||||
# the rest of the comma separated string is extra config for the agent.
|
||||
# In some (newer versions of proxmox) instances it can be 'enabled=1'.
|
||||
if config == 'agent':
|
||||
agent_enabled = 0
|
||||
try:
|
||||
agent_enabled = int(value.split(',')[0])
|
||||
except ValueError:
|
||||
if value.split(',')[0] == "enabled=1":
|
||||
agent_enabled = 1
|
||||
if agent_enabled:
|
||||
agent_iface_value = self._get_agent_network_interfaces(node, vmid, vmtype)
|
||||
if agent_iface_value:
|
||||
agent_iface_key = self.to_safe('%s%s' % (key, "_interfaces"))
|
||||
properties[agent_iface_key] = agent_iface_value
|
||||
|
||||
if config == 'lxc':
|
||||
out_val = {}
|
||||
|
||||
@@ -170,19 +170,29 @@ try:
|
||||
|
||||
HAS_TSS_SDK = True
|
||||
except ImportError:
|
||||
SecretServer = None
|
||||
SecretServerError = None
|
||||
HAS_TSS_SDK = False
|
||||
try:
|
||||
from delinea.secrets.server import SecretServer, SecretServerError
|
||||
|
||||
HAS_TSS_SDK = True
|
||||
except ImportError:
|
||||
SecretServer = None
|
||||
SecretServerError = None
|
||||
HAS_TSS_SDK = False
|
||||
|
||||
try:
|
||||
from thycotic.secrets.server import PasswordGrantAuthorizer, DomainPasswordGrantAuthorizer, AccessTokenAuthorizer
|
||||
|
||||
HAS_TSS_AUTHORIZER = True
|
||||
except ImportError:
|
||||
PasswordGrantAuthorizer = None
|
||||
DomainPasswordGrantAuthorizer = None
|
||||
AccessTokenAuthorizer = None
|
||||
HAS_TSS_AUTHORIZER = False
|
||||
try:
|
||||
from delinea.secrets.server import PasswordGrantAuthorizer, DomainPasswordGrantAuthorizer, AccessTokenAuthorizer
|
||||
|
||||
HAS_TSS_AUTHORIZER = True
|
||||
except ImportError:
|
||||
PasswordGrantAuthorizer = None
|
||||
DomainPasswordGrantAuthorizer = None
|
||||
AccessTokenAuthorizer = None
|
||||
HAS_TSS_AUTHORIZER = False
|
||||
|
||||
|
||||
display = Display()
|
||||
|
||||
@@ -13,10 +13,9 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
try:
|
||||
from urllib import quote_plus # Python 2.X
|
||||
from urlparse import urljoin
|
||||
except ImportError:
|
||||
from urllib.parse import quote_plus, urljoin # Python 3+
|
||||
from urllib.parse import urljoin # Python 3+
|
||||
|
||||
import traceback
|
||||
|
||||
@@ -26,6 +25,7 @@ try:
|
||||
import requests
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
gitlab = None
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
@@ -63,6 +63,14 @@ def find_group(gitlab_instance, identifier):
|
||||
return project
|
||||
|
||||
|
||||
def ensure_gitlab_package(module):
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(
|
||||
msg=missing_required_lib("python-gitlab", url='https://python-gitlab.readthedocs.io/en/stable/'),
|
||||
exception=GITLAB_IMP_ERR
|
||||
)
|
||||
|
||||
|
||||
def gitlab_authentication(module):
|
||||
gitlab_url = module.params['api_url']
|
||||
validate_certs = module.params['validate_certs']
|
||||
@@ -72,8 +80,7 @@ def gitlab_authentication(module):
|
||||
gitlab_oauth_token = module.params['api_oauth_token']
|
||||
gitlab_job_token = module.params['api_job_token']
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
try:
|
||||
# python-gitlab library remove support for username/password authentication since 1.13.0
|
||||
|
||||
@@ -91,7 +91,7 @@ class iLORedfishUtils(RedfishUtils):
|
||||
data = response['data']
|
||||
|
||||
ntp_list = data[setkey]
|
||||
if(len(ntp_list) == 2):
|
||||
if len(ntp_list) == 2:
|
||||
ntp_list.pop(0)
|
||||
|
||||
ntp_list.append(mgr_attributes['mgr_attr_value'])
|
||||
|
||||
@@ -78,7 +78,7 @@ def memset_api_call(api_key, api_method, payload=None):
|
||||
if msg is None:
|
||||
msg = response.json()
|
||||
|
||||
return(has_failed, msg, response)
|
||||
return has_failed, msg, response
|
||||
|
||||
|
||||
def check_zone_domain(data, domain):
|
||||
@@ -92,7 +92,7 @@ def check_zone_domain(data, domain):
|
||||
if zone_domain['domain'] == domain:
|
||||
exists = True
|
||||
|
||||
return(exists)
|
||||
return exists
|
||||
|
||||
|
||||
def check_zone(data, name):
|
||||
@@ -109,7 +109,7 @@ def check_zone(data, name):
|
||||
if counter == 1:
|
||||
exists = True
|
||||
|
||||
return(exists, counter)
|
||||
return exists, counter
|
||||
|
||||
|
||||
def get_zone_id(zone_name, current_zones):
|
||||
@@ -135,4 +135,4 @@ def get_zone_id(zone_name, current_zones):
|
||||
zone_id = None
|
||||
msg = 'Zone ID could not be returned as duplicate zone names were detected'
|
||||
|
||||
return(zone_exists, msg, counter, zone_id)
|
||||
return zone_exists, msg, counter, zone_id
|
||||
|
||||
@@ -122,8 +122,7 @@ def rax_find_image(module, rax_module, image, exit=True):
|
||||
except ValueError:
|
||||
try:
|
||||
image = cs.images.find(human_id=image)
|
||||
except(cs.exceptions.NotFound,
|
||||
cs.exceptions.NoUniqueMatch):
|
||||
except (cs.exceptions.NotFound, cs.exceptions.NoUniqueMatch):
|
||||
try:
|
||||
image = cs.images.find(name=image)
|
||||
except (cs.exceptions.NotFound,
|
||||
|
||||
@@ -2055,7 +2055,7 @@ class RedfishUtils(object):
|
||||
if property in data:
|
||||
nic[property] = data[property]
|
||||
result['entries'] = nic
|
||||
return(result)
|
||||
return result
|
||||
|
||||
def get_nic_inventory(self, resource_uri):
|
||||
result = {}
|
||||
|
||||
@@ -15,6 +15,7 @@ try:
|
||||
from redis import Redis
|
||||
from redis import __version__ as redis_version
|
||||
HAS_REDIS_PACKAGE = True
|
||||
REDIS_IMP_ERR = None
|
||||
except ImportError:
|
||||
REDIS_IMP_ERR = traceback.format_exc()
|
||||
HAS_REDIS_PACKAGE = False
|
||||
@@ -22,6 +23,7 @@ except ImportError:
|
||||
try:
|
||||
import certifi
|
||||
HAS_CERTIFI_PACKAGE = True
|
||||
CERTIFI_IMPORT_ERROR = None
|
||||
except ImportError:
|
||||
CERTIFI_IMPORT_ERROR = traceback.format_exc()
|
||||
HAS_CERTIFI_PACKAGE = False
|
||||
|
||||
@@ -45,12 +45,12 @@ options:
|
||||
type: str
|
||||
image_id:
|
||||
description:
|
||||
- Image ID used to launch instances. Required when C(state=present) and creating new ECS instances.
|
||||
- Image ID used to launch instances. Required when I(state=present) and creating new ECS instances.
|
||||
aliases: ['image']
|
||||
type: str
|
||||
instance_type:
|
||||
description:
|
||||
- Instance type used to launch instances. Required when C(state=present) and creating new ECS instances.
|
||||
- Instance type used to launch instances. Required when I(state=present) and creating new ECS instances.
|
||||
aliases: ['type']
|
||||
type: str
|
||||
security_groups:
|
||||
@@ -89,7 +89,7 @@ options:
|
||||
max_bandwidth_out:
|
||||
description:
|
||||
- Maximum outgoing bandwidth to the public network, measured in Mbps (Megabits per second).
|
||||
Required when C(allocate_public_ip=True). Ignored when C(allocate_public_ip=False).
|
||||
Required when I(allocate_public_ip=true). Ignored when I(allocate_public_ip=false).
|
||||
default: 0
|
||||
type: int
|
||||
host_name:
|
||||
@@ -153,7 +153,7 @@ options:
|
||||
type: str
|
||||
period:
|
||||
description:
|
||||
- The charge duration of the instance, in month. Required when C(instance_charge_type=PrePaid).
|
||||
- The charge duration of the instance, in months. Required when I(instance_charge_type=PrePaid).
|
||||
- The valid value are [1-9, 12, 24, 36].
|
||||
default: 1
|
||||
type: int
|
||||
@@ -164,7 +164,7 @@ options:
|
||||
default: False
|
||||
auto_renew_period:
|
||||
description:
|
||||
- The duration of the automatic renew the charge of the instance. Required when C(auto_renew=True).
|
||||
- The duration of the automatic renew the charge of the instance. Required when I(auto_renew=true).
|
||||
choices: [1, 2, 3, 6, 12]
|
||||
type: int
|
||||
instance_ids:
|
||||
@@ -216,31 +216,31 @@ options:
|
||||
version_added: '0.2.0'
|
||||
spot_strategy:
|
||||
description:
|
||||
- The bidding mode of the pay-as-you-go instance. This parameter is valid when InstanceChargeType is set to PostPaid.
|
||||
- The bidding mode of the pay-as-you-go instance. This parameter is valid when InstanceChargeType is set to PostPaid.
|
||||
choices: ['NoSpot', 'SpotWithPriceLimit', 'SpotAsPriceGo']
|
||||
default: 'NoSpot'
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
period_unit:
|
||||
description:
|
||||
- The duration unit that you will buy the resource. It is valid when C(instance_charge_type=PrePaid)
|
||||
- The duration unit that you will buy the resource. It is valid when I(instance_charge_type=PrePaid).
|
||||
choices: ['Month', 'Week']
|
||||
default: 'Month'
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
dry_run:
|
||||
description:
|
||||
- Specifies whether to send a dry-run request.
|
||||
- If I(dry_run=True), Only a dry-run request is sent and no instance is created. The system checks whether the
|
||||
required parameters are set, and validates the request format, service permissions, and available ECS instances.
|
||||
If the validation fails, the corresponding error code is returned. If the validation succeeds, the DryRunOperation error code is returned.
|
||||
- If I(dry_run=False), A request is sent. If the validation succeeds, the instance is created.
|
||||
- Specifies whether to send a dry-run request.
|
||||
- If I(dry_run=true), Only a dry-run request is sent and no instance is created. The system checks whether the
|
||||
required parameters are set, and validates the request format, service permissions, and available ECS instances.
|
||||
If the validation fails, the corresponding error code is returned. If the validation succeeds, the DryRunOperation error code is returned.
|
||||
- If I(dry_run=false), A request is sent. If the validation succeeds, the instance is created.
|
||||
default: False
|
||||
type: bool
|
||||
version_added: '0.2.0'
|
||||
include_data_disks:
|
||||
description:
|
||||
- Whether to change instance disks charge type when changing instance charge type.
|
||||
- Whether to change instance disks charge type when changing instance charge type.
|
||||
default: True
|
||||
type: bool
|
||||
version_added: '0.2.0'
|
||||
|
||||
@@ -111,7 +111,7 @@ def poll_reload_status(api_key=None, job_id=None, payload=None):
|
||||
memset_api = response.json()
|
||||
msg = None
|
||||
|
||||
return(memset_api, msg, stderr)
|
||||
return memset_api, msg, stderr
|
||||
|
||||
|
||||
def reload_dns(args=None):
|
||||
@@ -133,7 +133,7 @@ def reload_dns(args=None):
|
||||
retvals['failed'] = has_failed
|
||||
retvals['memset_api'] = response.json()
|
||||
retvals['msg'] = msg
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
# set changed to true if the reload request was accepted.
|
||||
has_changed = True
|
||||
@@ -153,7 +153,7 @@ def reload_dns(args=None):
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -127,7 +127,7 @@ def get_facts(args=None):
|
||||
retvals['failed'] = has_failed
|
||||
retvals['msg'] = msg
|
||||
retvals['stderr'] = "API returned an error: {0}" . format(response.status_code)
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
# we don't want to return the same thing twice
|
||||
msg = None
|
||||
@@ -139,7 +139,7 @@ def get_facts(args=None):
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -252,7 +252,7 @@ def get_facts(args=None):
|
||||
retvals['failed'] = has_failed
|
||||
retvals['msg'] = msg
|
||||
retvals['stderr'] = "API returned an error: {0}" . format(response.status_code)
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
# we don't want to return the same thing twice
|
||||
msg = None
|
||||
@@ -264,7 +264,7 @@ def get_facts(args=None):
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -139,7 +139,7 @@ def check(args=None):
|
||||
retvals['changed'] = has_changed
|
||||
retvals['failed'] = has_failed
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
|
||||
def create_zone(args=None, zone_exists=None, payload=None):
|
||||
@@ -185,7 +185,7 @@ def create_zone(args=None, zone_exists=None, payload=None):
|
||||
_has_failed, _msg, response = memset_api_call(api_key=args['api_key'], api_method=api_method, payload=payload)
|
||||
memset_api = response.json()
|
||||
|
||||
return(has_failed, has_changed, memset_api, msg)
|
||||
return has_failed, has_changed, memset_api, msg
|
||||
|
||||
|
||||
def delete_zone(args=None, zone_exists=None, payload=None):
|
||||
@@ -233,7 +233,7 @@ def delete_zone(args=None, zone_exists=None, payload=None):
|
||||
else:
|
||||
has_failed, has_changed = False, False
|
||||
|
||||
return(has_failed, has_changed, memset_api, msg)
|
||||
return has_failed, has_changed, memset_api, msg
|
||||
|
||||
|
||||
def create_or_delete(args=None):
|
||||
@@ -255,7 +255,7 @@ def create_or_delete(args=None):
|
||||
retvals['failed'] = _has_failed
|
||||
retvals['msg'] = _msg
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
zone_exists, _msg, counter, _zone_id = get_zone_id(zone_name=args['name'], current_zones=response.json())
|
||||
|
||||
@@ -271,7 +271,7 @@ def create_or_delete(args=None):
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -110,7 +110,7 @@ def check(args=None):
|
||||
retvals['changed'] = has_changed
|
||||
retvals['failed'] = has_failed
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
|
||||
def create_zone_domain(args=None, zone_exists=None, zone_id=None, payload=None):
|
||||
@@ -138,7 +138,7 @@ def create_zone_domain(args=None, zone_exists=None, zone_id=None, payload=None):
|
||||
if not has_failed:
|
||||
has_changed = True
|
||||
|
||||
return(has_failed, has_changed, msg)
|
||||
return has_failed, has_changed, msg
|
||||
|
||||
|
||||
def delete_zone_domain(args=None, payload=None):
|
||||
@@ -165,7 +165,7 @@ def delete_zone_domain(args=None, payload=None):
|
||||
# unset msg as we don't want to return unnecessary info to the user.
|
||||
msg = None
|
||||
|
||||
return(has_failed, has_changed, memset_api, msg)
|
||||
return has_failed, has_changed, memset_api, msg
|
||||
|
||||
|
||||
def create_or_delete_domain(args=None):
|
||||
@@ -188,7 +188,7 @@ def create_or_delete_domain(args=None):
|
||||
retvals['failed'] = has_failed
|
||||
retvals['msg'] = msg
|
||||
retvals['stderr'] = "API returned an error: {0}" . format(response.status_code)
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
zone_exists, msg, counter, zone_id = get_zone_id(zone_name=args['zone'], current_zones=response.json())
|
||||
|
||||
@@ -203,7 +203,7 @@ def create_or_delete_domain(args=None):
|
||||
|
||||
retvals['failed'] = has_failed
|
||||
retvals['msg'] = stderr
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
if args['state'] == 'present':
|
||||
has_failed, has_changed, msg = create_zone_domain(args=args, zone_exists=zone_exists, zone_id=zone_id, payload=payload)
|
||||
@@ -217,7 +217,7 @@ def create_or_delete_domain(args=None):
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -221,7 +221,7 @@ def create_zone_record(args=None, zone_id=None, records=None, payload=None):
|
||||
# nothing to do; record is already correct so we populate
|
||||
# the return var with the existing record's details.
|
||||
memset_api = zone_record
|
||||
return(has_changed, has_failed, memset_api, msg)
|
||||
return has_changed, has_failed, memset_api, msg
|
||||
else:
|
||||
# merge dicts ensuring we change any updated values
|
||||
payload = zone_record.copy()
|
||||
@@ -231,7 +231,7 @@ def create_zone_record(args=None, zone_id=None, records=None, payload=None):
|
||||
has_changed = True
|
||||
# return the new record to the user in the returned var.
|
||||
memset_api = new_record
|
||||
return(has_changed, has_failed, memset_api, msg)
|
||||
return has_changed, has_failed, memset_api, msg
|
||||
has_failed, msg, response = memset_api_call(api_key=args['api_key'], api_method=api_method, payload=payload)
|
||||
if not has_failed:
|
||||
has_changed = True
|
||||
@@ -246,7 +246,7 @@ def create_zone_record(args=None, zone_id=None, records=None, payload=None):
|
||||
has_changed = True
|
||||
# populate the return var with the new record's details.
|
||||
memset_api = new_record
|
||||
return(has_changed, has_failed, memset_api, msg)
|
||||
return has_changed, has_failed, memset_api, msg
|
||||
has_failed, msg, response = memset_api_call(api_key=args['api_key'], api_method=api_method, payload=payload)
|
||||
if not has_failed:
|
||||
has_changed = True
|
||||
@@ -254,7 +254,7 @@ def create_zone_record(args=None, zone_id=None, records=None, payload=None):
|
||||
# empty msg as we don't want to return a boatload of json to the user.
|
||||
msg = None
|
||||
|
||||
return(has_changed, has_failed, memset_api, msg)
|
||||
return has_changed, has_failed, memset_api, msg
|
||||
|
||||
|
||||
def delete_zone_record(args=None, records=None, payload=None):
|
||||
@@ -270,7 +270,7 @@ def delete_zone_record(args=None, records=None, payload=None):
|
||||
for zone_record in records:
|
||||
if args['check_mode']:
|
||||
has_changed = True
|
||||
return(has_changed, has_failed, memset_api, msg)
|
||||
return has_changed, has_failed, memset_api, msg
|
||||
payload['id'] = zone_record['id']
|
||||
api_method = 'dns.zone_record_delete'
|
||||
has_failed, msg, response = memset_api_call(api_key=args['api_key'], api_method=api_method, payload=payload)
|
||||
@@ -280,7 +280,7 @@ def delete_zone_record(args=None, records=None, payload=None):
|
||||
# empty msg as we don't want to return a boatload of json to the user.
|
||||
msg = None
|
||||
|
||||
return(has_changed, has_failed, memset_api, msg)
|
||||
return has_changed, has_failed, memset_api, msg
|
||||
|
||||
|
||||
def create_or_delete(args=None):
|
||||
@@ -304,7 +304,7 @@ def create_or_delete(args=None):
|
||||
retvals['failed'] = _has_failed
|
||||
retvals['msg'] = msg
|
||||
retvals['stderr'] = "API returned an error: {0}" . format(response.status_code)
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
zone_exists, _msg, counter, zone_id = get_zone_id(zone_name=args['zone'], current_zones=response.json())
|
||||
|
||||
@@ -317,7 +317,7 @@ def create_or_delete(args=None):
|
||||
retvals['failed'] = has_failed
|
||||
retvals['msg'] = stderr
|
||||
retvals['stderr'] = stderr
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
# get a list of all records ( as we can't limit records by zone)
|
||||
api_method = 'dns.zone_record_list'
|
||||
@@ -339,7 +339,7 @@ def create_or_delete(args=None):
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
|
||||
return(retvals)
|
||||
return retvals
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -743,6 +743,8 @@ def main():
|
||||
module.fail_json(msg="restarting of VM %s failed with exception: %s" % (vmid, e))
|
||||
|
||||
elif state == 'absent':
|
||||
if not vmid:
|
||||
module.exit_json(changed=False, msg='VM with hostname = %s is already absent' % hostname)
|
||||
try:
|
||||
vm = proxmox.get_vm(vmid, ignore_missing=True)
|
||||
if not vm:
|
||||
|
||||
@@ -1370,6 +1370,8 @@ def main():
|
||||
|
||||
elif state == 'absent':
|
||||
status = {}
|
||||
if not vmid:
|
||||
module.exit_json(changed=False, msg='VM with name = %s is already absent' % name)
|
||||
try:
|
||||
vm = proxmox.get_vm(vmid, ignore_missing=True)
|
||||
if not vm:
|
||||
|
||||
@@ -1252,7 +1252,6 @@ def setChanged():
|
||||
|
||||
|
||||
def setMsg(message):
|
||||
global failed
|
||||
msg.append(message)
|
||||
|
||||
|
||||
|
||||
@@ -161,9 +161,7 @@ def get_srs(session):
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
supports_check_mode=True,
|
||||
)
|
||||
module = AnsibleModule({}, supports_check_mode=True)
|
||||
|
||||
if not HAVE_XENAPI:
|
||||
module.fail_json(changed=False, msg="python xen api required for this module")
|
||||
|
||||
@@ -346,7 +346,7 @@ def get_connection_info(module):
|
||||
if not password:
|
||||
password = os.environ.get('ONE_PASSWORD')
|
||||
|
||||
if not(url and username and password):
|
||||
if not (url and username and password):
|
||||
module.fail_json(msg="One or more connection parameters (api_url, api_username, api_password) were not specified")
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ def get_connection_info(module):
|
||||
if not password:
|
||||
password = os.environ.get('ONE_PASSWORD')
|
||||
|
||||
if not(url and username and password):
|
||||
if not (url and username and password):
|
||||
module.fail_json(msg="One or more connection parameters (api_url, api_username, api_password) were not specified")
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
@@ -660,7 +660,7 @@ def get_connection_info(module):
|
||||
if not password:
|
||||
password = os.environ.get('ONEFLOW_PASSWORD')
|
||||
|
||||
if not(url and username and password):
|
||||
if not (url and username and password):
|
||||
module.fail_json(msg="One or more connection parameters (api_url, api_username, api_password) were not specified")
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ def parse_subnet_cidr(cidr):
|
||||
try:
|
||||
prefixlen = int(prefixlen)
|
||||
except ValueError:
|
||||
raise("Wrong prefix length in CIDR expression {0}".format(cidr))
|
||||
raise Exception("Wrong prefix length in CIDR expression {0}".format(cidr))
|
||||
return addr, prefixlen
|
||||
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ def remove_datacenter(module, profitbricks):
|
||||
name = module.params.get('name')
|
||||
changed = False
|
||||
|
||||
if(uuid_match.match(name)):
|
||||
if uuid_match.match(name):
|
||||
_remove_datacenter(module, profitbricks, name)
|
||||
changed = True
|
||||
else:
|
||||
|
||||
@@ -324,7 +324,7 @@ def delete_volume(module, profitbricks):
|
||||
break
|
||||
|
||||
for n in instance_ids:
|
||||
if(uuid_match.match(n)):
|
||||
if uuid_match.match(n):
|
||||
_delete_volume(module, profitbricks, datacenter, n)
|
||||
changed = True
|
||||
else:
|
||||
|
||||
@@ -143,6 +143,7 @@ except ImportError:
|
||||
IPADDRESS_IMP_ERR = traceback.format_exc()
|
||||
HAS_IPADDRESS = False
|
||||
else:
|
||||
IPADDRESS_IMP_ERR = None
|
||||
HAS_IPADDRESS = True
|
||||
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
try:
|
||||
import etcd3
|
||||
HAS_ETCD = True
|
||||
ETCD_IMP_ERR = None
|
||||
except ImportError:
|
||||
ETCD_IMP_ERR = traceback.format_exc()
|
||||
HAS_ETCD = False
|
||||
|
||||
@@ -65,13 +65,15 @@ options:
|
||||
type: bool
|
||||
default: no
|
||||
notes:
|
||||
- Requires tarfile, zipfile, gzip and bzip2 packages on target host.
|
||||
- Requires lzma or backports.lzma if using xz format.
|
||||
- Can produce I(gzip), I(bzip2), I(lzma) and I(zip) compressed files or archives.
|
||||
- Can produce I(gzip), I(bzip2), I(lzma), and I(zip) compressed files or archives.
|
||||
- This module uses C(tarfile), C(zipfile), C(gzip), and C(bz2) packages on the target host to create archives.
|
||||
These are part of the Python standard library for Python 2 and 3.
|
||||
requirements:
|
||||
- Requires C(lzma) (standard library of Python 3) or L(backports.lzma, https://pypi.org/project/backports.lzma/) (Python 2) if using C(xz) format.
|
||||
seealso:
|
||||
- module: ansible.builtin.unarchive
|
||||
- module: ansible.builtin.unarchive
|
||||
author:
|
||||
- Ben Doherty (@bendoh)
|
||||
- Ben Doherty (@bendoh)
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
@@ -581,6 +583,11 @@ class TarArchive(Archive):
|
||||
self.file.add(path, archive_name, recursive=False, exclude=py26_filter)
|
||||
|
||||
def _get_checksums(self, path):
|
||||
if HAS_LZMA:
|
||||
LZMAError = lzma.LZMAError
|
||||
else:
|
||||
# Just picking another exception that's also listed below
|
||||
LZMAError = tarfile.ReadError
|
||||
try:
|
||||
if self.format == 'xz':
|
||||
with lzma.open(_to_native_ascii(path), 'r') as f:
|
||||
@@ -591,7 +598,7 @@ class TarArchive(Archive):
|
||||
archive = tarfile.open(_to_native_ascii(path), 'r|' + self.format)
|
||||
checksums = set((info.name, info.chksum) for info in archive.getmembers())
|
||||
archive.close()
|
||||
except (lzma.LZMAError, tarfile.ReadError, tarfile.CompressionError):
|
||||
except (LZMAError, tarfile.ReadError, tarfile.CompressionError):
|
||||
try:
|
||||
# The python implementations of gzip, bz2, and lzma do not support restoring compressed files
|
||||
# to their original names so only file checksum is returned
|
||||
|
||||
@@ -309,7 +309,7 @@ def do_ini(module, filename, section=None, option=None, values=None,
|
||||
# override option with no value to option with value if not allow_no_value
|
||||
if len(values) > 0:
|
||||
for index, line in enumerate(section_lines):
|
||||
if not changed_lines[index] and match_active_opt(option, section_lines[index]):
|
||||
if not changed_lines[index] and match_active_opt(option, section_lines[index]): # pylint: disable=unnecessary-list-index-lookup
|
||||
newline = assignment_format % (option, values.pop(0))
|
||||
(changed, msg) = update_section_line(changed, section_lines, index, changed_lines, newline, msg)
|
||||
if len(values) == 0:
|
||||
|
||||
@@ -445,8 +445,8 @@ def ensure(module, client):
|
||||
module_otptoken['all'] = True
|
||||
ipa_otptoken = client.otptoken_add(name=uniqueid, item=module_otptoken)
|
||||
else:
|
||||
if not(validate_modifications(ansible_to_ipa, module, ipa_otptoken,
|
||||
module_otptoken, unmodifiable_after_creation)):
|
||||
if not validate_modifications(ansible_to_ipa, module, ipa_otptoken,
|
||||
module_otptoken, unmodifiable_after_creation):
|
||||
module.fail_json(msg="Modifications requested in module are not valid")
|
||||
|
||||
# IPA will reject 'modifications' that do not actually modify anything
|
||||
|
||||
@@ -129,6 +129,7 @@ options:
|
||||
vendor:
|
||||
description:
|
||||
- LDAP vendor (provider).
|
||||
- Use short name. For instance, write C(rhds) for "Red Hat Directory Server".
|
||||
type: str
|
||||
|
||||
usernameLDAPAttribute:
|
||||
|
||||
@@ -86,6 +86,7 @@ from os import path
|
||||
try:
|
||||
from pdpyras import APISession
|
||||
HAS_PD_PY = True
|
||||
PD_IMPORT_ERR = None
|
||||
except ImportError:
|
||||
HAS_PD_PY = False
|
||||
PD_IMPORT_ERR = traceback.format_exc()
|
||||
@@ -93,6 +94,7 @@ except ImportError:
|
||||
try:
|
||||
from pdpyras import PDClientError
|
||||
HAS_PD_CLIENT_ERR = True
|
||||
PD_CLIENT_ERR_IMPORT_ERR = None
|
||||
except ImportError:
|
||||
HAS_PD_CLIENT_ERR = False
|
||||
PD_CLIENT_ERR_IMPORT_ERR = traceback.format_exc()
|
||||
|
||||
@@ -233,10 +233,11 @@ import json
|
||||
try:
|
||||
from requests import Request, Session
|
||||
except ImportError:
|
||||
HAS_ANOTHER_LIBRARY = False
|
||||
ANOTHER_LIBRARY_IMPORT_ERROR = traceback.format_exc()
|
||||
HAS_REQUESTS = False
|
||||
REQUESTS_IMPORT_ERROR = traceback.format_exc()
|
||||
else:
|
||||
HAS_ANOTHER_LIBRARY = True
|
||||
HAS_REQUESTS = True
|
||||
REQUESTS_IMPORT_ERROR = None
|
||||
|
||||
|
||||
def build_url(account, key, is_sandbox):
|
||||
@@ -261,7 +262,7 @@ def iterate_data(module, request_object):
|
||||
request_object.url = base_url + '&page=' + str(page)
|
||||
new_results = Session().send(request_object)
|
||||
data = data + new_results.json()["data"]
|
||||
return(data)
|
||||
return data
|
||||
else:
|
||||
module.fail_json('API Call failed, check ID, key and sandbox values')
|
||||
|
||||
@@ -305,11 +306,10 @@ def main():
|
||||
params['api_key'],
|
||||
params['sandbox'])
|
||||
|
||||
if not HAS_ANOTHER_LIBRARY:
|
||||
# Needs: from ansible.module_utils.basic import missing_required_lib
|
||||
if not HAS_REQUESTS:
|
||||
module.exit_json(
|
||||
msg=missing_required_lib('another_library'),
|
||||
exception=ANOTHER_LIBRARY_IMPORT_ERROR)
|
||||
msg=missing_required_lib('requests'),
|
||||
exception=REQUESTS_IMPORT_ERROR)
|
||||
|
||||
# At minimum we need account and key
|
||||
if params['account_id'] and params['api_key']:
|
||||
|
||||
@@ -44,7 +44,7 @@ options:
|
||||
address:
|
||||
description:
|
||||
- The IP address for the A or AAAA record.
|
||||
- Required for C(type=A) or C(type=AAAA)
|
||||
- Required for I(type=A) or I(type=AAAA).
|
||||
type: str
|
||||
ttl:
|
||||
description:
|
||||
@@ -70,38 +70,38 @@ options:
|
||||
port:
|
||||
description:
|
||||
- Sets the port of the SRV record.
|
||||
- Required for C(type=SRV)
|
||||
- Required for I(type=SRV).
|
||||
type: int
|
||||
target:
|
||||
description:
|
||||
- Sets the target of the SRV record.
|
||||
- Required for C(type=SRV)
|
||||
- Required for I(type=SRV).
|
||||
type: str
|
||||
order:
|
||||
description:
|
||||
- Sets the order of the NAPTR record.
|
||||
- Required for C(type=NAPTR)
|
||||
- Required for I(type=NAPTR).
|
||||
type: int
|
||||
preference:
|
||||
description:
|
||||
- Sets the preference of the NAPTR record.
|
||||
- Required for C(type=NAPTR)
|
||||
- Required for I(type=NAPTR).
|
||||
type: int
|
||||
flags:
|
||||
description:
|
||||
- Sets one of the possible flags of NAPTR record.
|
||||
- Required for C(type=NAPTR)
|
||||
- Required for I(type=NAPTR).
|
||||
type: str
|
||||
choices: ['S', 'A', 'U', 'P']
|
||||
service:
|
||||
description:
|
||||
- Sets the service of the NAPTR record.
|
||||
- Required for C(type=NAPTR)
|
||||
- Required for I(type=NAPTR).
|
||||
type: str
|
||||
replacement:
|
||||
description:
|
||||
- Sets the replacement of the NAPTR record.
|
||||
- Required for C(type=NAPTR)
|
||||
- Required for I(type=NAPTR).
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
|
||||
@@ -426,7 +426,10 @@ class RecordManager(object):
|
||||
if lookup.rcode() != dns.rcode.NOERROR:
|
||||
self.module.fail_json(msg='Failed to lookup TTL of existing matching record.')
|
||||
|
||||
current_ttl = lookup.answer[0].ttl
|
||||
if self.module.params['type'] == 'NS':
|
||||
current_ttl = lookup.answer[0].ttl if lookup.answer else lookup.authority[0].ttl
|
||||
else:
|
||||
current_ttl = lookup.answer[0].ttl
|
||||
return current_ttl != self.module.params['ttl']
|
||||
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ def build_payload_for_slack(text, channel, thread_id, username, icon_url, icon_e
|
||||
# With a custom color we have to set the message as attachment, and explicitly turn markdown parsing on for it.
|
||||
payload = dict(attachments=[dict(text=escape_quotes(text), color=color, mrkdwn_in=["text"])])
|
||||
if channel is not None:
|
||||
if channel.startswith(('#', '@', 'C0')):
|
||||
if channel.startswith(('#', '@', 'C0', 'GF', 'G0')):
|
||||
payload['channel'] = channel
|
||||
else:
|
||||
payload['channel'] = '#' + channel
|
||||
|
||||
@@ -97,13 +97,13 @@ from ansible.module_utils.facts.packages import CLIMgr
|
||||
|
||||
class PIP(CLIMgr):
|
||||
|
||||
def __init__(self, pip):
|
||||
def __init__(self, pip, module):
|
||||
|
||||
self.CLI = pip
|
||||
self.module = module
|
||||
|
||||
def list_installed(self):
|
||||
global module
|
||||
rc, out, err = module.run_command([self._cli, 'list', '-l', '--format=json'])
|
||||
rc, out, err = self.module.run_command([self._cli, 'list', '-l', '--format=json'])
|
||||
if rc != 0:
|
||||
raise Exception("Unable to list packages rc=%s : %s" % (rc, err))
|
||||
return json.loads(out)
|
||||
@@ -116,7 +116,6 @@ class PIP(CLIMgr):
|
||||
def main():
|
||||
|
||||
# start work
|
||||
global module
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
clients=dict(type='list', elements='path', default=['pip']),
|
||||
@@ -133,7 +132,7 @@ def main():
|
||||
module.warn('Skipping invalid pip client: %s' % (pip))
|
||||
continue
|
||||
try:
|
||||
pip_mgr = PIP(pip)
|
||||
pip_mgr = PIP(pip, module)
|
||||
if pip_mgr.is_available():
|
||||
found += 1
|
||||
packages[pip] = pip_mgr.get_packages()
|
||||
|
||||
@@ -224,7 +224,7 @@ class Yarn(object):
|
||||
rc, out, err = self.module.run_command(cmd, check_rc=check_rc, cwd=cwd)
|
||||
return out, err
|
||||
|
||||
return(None, None)
|
||||
return None, None
|
||||
|
||||
def list(self):
|
||||
cmd = ['list', '--depth=0', '--json']
|
||||
|
||||
@@ -84,6 +84,7 @@ try:
|
||||
import dnf.repodict
|
||||
from dnf.conf import Conf
|
||||
HAS_DNF_PACKAGES = True
|
||||
DNF_IMP_ERR = None
|
||||
except ImportError:
|
||||
DNF_IMP_ERR = traceback.format_exc()
|
||||
HAS_DNF_PACKAGES = False
|
||||
|
||||
@@ -162,7 +162,7 @@ OUTDATED_FLATPAK_VERSION_ERROR_MESSAGE = "Unknown option --columns=application"
|
||||
|
||||
def install_flat(module, binary, remote, names, method, no_dependencies):
|
||||
"""Add new flatpaks."""
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
uri_names = []
|
||||
id_names = []
|
||||
for name in names:
|
||||
@@ -189,7 +189,7 @@ def install_flat(module, binary, remote, names, method, no_dependencies):
|
||||
|
||||
def uninstall_flat(module, binary, names, method):
|
||||
"""Remove existing flatpaks."""
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
installed_flat_names = [
|
||||
_match_installed_flat_name(module, binary, name, method)
|
||||
for name in names
|
||||
@@ -224,7 +224,7 @@ def _match_installed_flat_name(module, binary, name, method):
|
||||
# This is a difficult function, since if the user supplies a flatpakref url,
|
||||
# we have to rely on a naming convention:
|
||||
# The flatpakref file name needs to match the flatpak name
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
parsed_name = _parse_flatpak_name(name)
|
||||
# Try running flatpak list with columns feature
|
||||
command = [binary, "list", "--{0}".format(method), "--app", "--columns=application"]
|
||||
@@ -248,7 +248,7 @@ def _match_installed_flat_name(module, binary, name, method):
|
||||
|
||||
|
||||
def _match_flat_using_outdated_flatpak_format(module, binary, parsed_name, method):
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
command = [binary, "list", "--{0}".format(method), "--app", "--columns=application"]
|
||||
output = _flatpak_command(module, False, command)
|
||||
for row in output.split('\n'):
|
||||
@@ -257,7 +257,7 @@ def _match_flat_using_outdated_flatpak_format(module, binary, parsed_name, metho
|
||||
|
||||
|
||||
def _match_flat_using_flatpak_column_feature(module, binary, parsed_name, method):
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
command = [binary, "list", "--{0}".format(method), "--app"]
|
||||
output = _flatpak_command(module, False, command)
|
||||
for row in output.split('\n'):
|
||||
@@ -276,7 +276,7 @@ def _parse_flatpak_name(name):
|
||||
|
||||
|
||||
def _flatpak_version(module, binary):
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
command = [binary, "--version"]
|
||||
output = _flatpak_command(module, False, command)
|
||||
version_number = output.split()[1]
|
||||
@@ -284,7 +284,7 @@ def _flatpak_version(module, binary):
|
||||
|
||||
|
||||
def _flatpak_command(module, noop, command, ignore_failure=False):
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
result['command'] = ' '.join(command)
|
||||
if noop:
|
||||
result['rc'] = 0
|
||||
|
||||
@@ -124,7 +124,7 @@ from ansible.module_utils.common.text.converters import to_bytes, to_native
|
||||
|
||||
def add_remote(module, binary, name, flatpakrepo_url, method):
|
||||
"""Add a new remote."""
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
command = [binary, "remote-add", "--{0}".format(method), name, flatpakrepo_url]
|
||||
_flatpak_command(module, module.check_mode, command)
|
||||
result['changed'] = True
|
||||
@@ -132,7 +132,7 @@ def add_remote(module, binary, name, flatpakrepo_url, method):
|
||||
|
||||
def remove_remote(module, binary, name, method):
|
||||
"""Remove an existing remote."""
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
command = [binary, "remote-delete", "--{0}".format(method), "--force", name]
|
||||
_flatpak_command(module, module.check_mode, command)
|
||||
result['changed'] = True
|
||||
@@ -153,7 +153,7 @@ def remote_exists(module, binary, name, method):
|
||||
|
||||
|
||||
def _flatpak_command(module, noop, command):
|
||||
global result
|
||||
global result # pylint: disable=global-variable-not-assigned
|
||||
result['command'] = ' '.join(command)
|
||||
if noop:
|
||||
result['rc'] = 0
|
||||
|
||||
@@ -636,8 +636,9 @@ class Pacman(object):
|
||||
stderr=stderr,
|
||||
rc=rc,
|
||||
)
|
||||
# With Pacman v6.0.1 - libalpm v13.0.1, --upgrade outputs "loading packages..." on stdout. strip that
|
||||
stdout = stdout.replace("loading packages...\n", "")
|
||||
# With Pacman v6.0.1 - libalpm v13.0.1, --upgrade outputs " filename_without_extension downloading..." if the URL is unseen.
|
||||
# In all cases, pacman outputs "loading packages..." on stdout. strip both
|
||||
stdout = stdout.splitlines()[-1]
|
||||
is_URL = True
|
||||
pkg_name = stdout.strip()
|
||||
pkg_list.append(Package(name=pkg_name, source=pkg, source_is_URL=is_URL))
|
||||
|
||||
@@ -37,7 +37,7 @@ options:
|
||||
state:
|
||||
description:
|
||||
- State of the package.
|
||||
- 'Note: "latest" added in 2.7'
|
||||
- 'Note: C(latest) added in 2.7.'
|
||||
choices: [ 'present', 'latest', 'absent' ]
|
||||
required: false
|
||||
default: present
|
||||
@@ -148,10 +148,7 @@ def query_package(module, run_pkgng, name):
|
||||
|
||||
rc, out, err = run_pkgng('info', '-g', '-e', name)
|
||||
|
||||
if rc == 0:
|
||||
return True
|
||||
|
||||
return False
|
||||
return rc == 0
|
||||
|
||||
|
||||
def query_update(module, run_pkgng, name):
|
||||
@@ -161,10 +158,7 @@ def query_update(module, run_pkgng, name):
|
||||
# rc = 1, updates available
|
||||
rc, out, err = run_pkgng('upgrade', '-g', '-n', name)
|
||||
|
||||
if rc == 1:
|
||||
return True
|
||||
|
||||
return False
|
||||
return rc == 1
|
||||
|
||||
|
||||
def pkgng_older_than(module, pkgng_path, compare_version):
|
||||
@@ -190,7 +184,7 @@ def upgrade_packages(module, run_pkgng):
|
||||
|
||||
pkgng_args = ['upgrade']
|
||||
pkgng_args.append('-n' if module.check_mode else '-y')
|
||||
rc, out, err = run_pkgng(*pkgng_args)
|
||||
rc, out, err = run_pkgng(*pkgng_args, check_rc=(not module.check_mode))
|
||||
|
||||
matches = re.findall('^Number of packages to be (?:upgraded|reinstalled): ([0-9]+)', out, re.MULTILINE)
|
||||
for match in matches:
|
||||
|
||||
@@ -592,15 +592,22 @@ class Rhsm(RegistrationBase):
|
||||
consumed_pools = RhsmPools(self.module, consumed=True)
|
||||
|
||||
existing_pools = {}
|
||||
serials_to_remove = []
|
||||
for p in consumed_pools:
|
||||
existing_pools[p.get_pool_id()] = p.QuantityUsed
|
||||
pool_id = p.get_pool_id()
|
||||
quantity_used = p.get_quantity_used()
|
||||
existing_pools[pool_id] = quantity_used
|
||||
|
||||
quantity = pool_ids.get(pool_id, 0)
|
||||
if quantity is not None and quantity != quantity_used:
|
||||
serials_to_remove.append(p.Serial)
|
||||
|
||||
serials_to_remove = [p.Serial for p in consumed_pools if pool_ids.get(p.get_pool_id(), 0) != p.QuantityUsed]
|
||||
serials = self.unsubscribe(serials=serials_to_remove)
|
||||
|
||||
missing_pools = {}
|
||||
for pool_id, quantity in sorted(pool_ids.items()):
|
||||
if existing_pools.get(pool_id, 0) != quantity:
|
||||
quantity_used = existing_pools.get(pool_id, 0)
|
||||
if quantity is None and quantity_used == 0 or quantity not in (None, 0, quantity_used):
|
||||
missing_pools[pool_id] = quantity
|
||||
|
||||
self.subscribe_by_pool_ids(missing_pools)
|
||||
@@ -634,6 +641,9 @@ class RhsmPool(object):
|
||||
def get_pool_id(self):
|
||||
return getattr(self, 'PoolId', getattr(self, 'PoolID'))
|
||||
|
||||
def get_quantity_used(self):
|
||||
return int(getattr(self, 'QuantityUsed'))
|
||||
|
||||
def subscribe(self):
|
||||
args = "subscription-manager attach --pool %s" % self.get_pool_id()
|
||||
rc, stdout, stderr = self.module.run_command(args, check_rc=True)
|
||||
|
||||
@@ -160,7 +160,7 @@ def upgrade(module, xbps_path):
|
||||
|
||||
rc, stdout, stderr = module.run_command(cmdneedupgrade, check_rc=False)
|
||||
if rc == 0:
|
||||
if(len(stdout.splitlines()) == 0):
|
||||
if len(stdout.splitlines()) == 0:
|
||||
module.exit_json(changed=False, msg='Nothing to upgrade')
|
||||
elif module.check_mode:
|
||||
module.exit_json(changed=True, msg='Would have performed upgrade')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright: (c) 2018, Florian Paul Hoberg <florian.hoberg@credativ.de>
|
||||
# Copyright: (c) 2018, Florian Paul Azim Hoberg <florian.hoberg@credativ.de>
|
||||
#
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
@@ -35,7 +35,7 @@ requirements:
|
||||
- yum
|
||||
- yum-versionlock
|
||||
author:
|
||||
- Florian Paul Hoberg (@florianpaulhoberg)
|
||||
- Florian Paul Azim Hoberg (@gyptazy)
|
||||
- Amin Vakil (@aminvakil)
|
||||
'''
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ class ManageIQAlertProfiles(object):
|
||||
except Exception as e:
|
||||
msg = "Updating profile '{name}' failed: {error}"
|
||||
msg = msg.format(name=old_profile['name'], error=e)
|
||||
self.module.fail_json(msg=msg, result=result)
|
||||
self.module.fail_json(msg=msg)
|
||||
|
||||
if changed:
|
||||
msg = "Profile {name} updated successfully".format(name=desired_profile['name'])
|
||||
|
||||
@@ -71,20 +71,13 @@ RETURN = '''
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitlabBranch(object):
|
||||
@@ -143,15 +136,13 @@ def main():
|
||||
],
|
||||
supports_check_mode=False
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
project = module.params['project']
|
||||
branch = module.params['branch']
|
||||
ref_branch = module.params['ref_branch']
|
||||
state = module.params['state']
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
gitlab_version = gitlab.__version__
|
||||
if LooseVersion(gitlab_version) < LooseVersion('2.3.0'):
|
||||
module.fail_json(msg="community.general.gitlab_proteched_branch requires python-gitlab Python module >= 2.3.0 (installed version: [%s])."
|
||||
|
||||
@@ -108,22 +108,13 @@ deploy_key:
|
||||
type: dict
|
||||
'''
|
||||
|
||||
import re
|
||||
import traceback
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, find_project, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, find_project, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitLabDeployKey(object):
|
||||
@@ -261,6 +252,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
state = module.params['state']
|
||||
project_identifier = module.params['project']
|
||||
@@ -268,9 +260,6 @@ def main():
|
||||
key_keyfile = module.params['key']
|
||||
key_can_push = module.params['can_push']
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
gitlab_instance = gitlab_authentication(module)
|
||||
|
||||
gitlab_deploy_key = GitLabDeployKey(module, gitlab_instance)
|
||||
|
||||
@@ -158,21 +158,13 @@ group:
|
||||
type: dict
|
||||
'''
|
||||
|
||||
import traceback
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, find_group, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, find_group, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitLabGroup(object):
|
||||
@@ -338,6 +330,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
group_name = module.params['name']
|
||||
group_path = module.params['path']
|
||||
@@ -351,9 +344,6 @@ def main():
|
||||
require_two_factor_authentication = module.params['require_two_factor_authentication']
|
||||
avatar_path = module.params['avatar_path']
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
gitlab_instance = gitlab_authentication(module)
|
||||
|
||||
# Define default group_path based on group_name
|
||||
|
||||
@@ -151,18 +151,11 @@ EXAMPLES = r'''
|
||||
RETURN = r''' # '''
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
|
||||
|
||||
import traceback
|
||||
|
||||
try:
|
||||
import gitlab
|
||||
HAS_PY_GITLAB = True
|
||||
except ImportError:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_PY_GITLAB = False
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitLabGroup(object):
|
||||
@@ -280,9 +273,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
if not HAS_PY_GITLAB:
|
||||
module.fail_json(msg=missing_required_lib('python-gitlab', url='https://python-gitlab.readthedocs.io/en/stable/'), exception=GITLAB_IMP_ERR)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
access_level_int = {
|
||||
'guest': gitlab.GUEST_ACCESS,
|
||||
|
||||
@@ -158,21 +158,14 @@ group_variable:
|
||||
sample: "['ACCESS_KEY_ID', 'SECRET_ACCESS_KEY']"
|
||||
'''
|
||||
|
||||
import traceback
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils.six import integer_types
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, gitlab_authentication, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
def vars_to_variables(vars, module):
|
||||
@@ -415,9 +408,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True
|
||||
)
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
purge = module.params['purge']
|
||||
var_list = module.params['vars']
|
||||
|
||||
@@ -158,22 +158,12 @@ hook:
|
||||
type: dict
|
||||
'''
|
||||
|
||||
import re
|
||||
import traceback
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, find_project, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, find_project, gitlab_authentication, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitLabHook(object):
|
||||
@@ -329,6 +319,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
state = module.params['state']
|
||||
project_identifier = module.params['project']
|
||||
@@ -345,9 +336,6 @@ def main():
|
||||
enable_ssl_verification = module.params['hook_validate_certs']
|
||||
hook_token = module.params['token']
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
gitlab_instance = gitlab_authentication(module)
|
||||
|
||||
gitlab_hook = GitLabHook(module, gitlab_instance)
|
||||
|
||||
@@ -245,21 +245,14 @@ project:
|
||||
type: dict
|
||||
'''
|
||||
|
||||
import traceback
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, find_group, find_project, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, find_group, find_project, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitLabProject(object):
|
||||
@@ -443,6 +436,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
group_identifier = module.params['group']
|
||||
project_name = module.params['name']
|
||||
@@ -473,9 +467,6 @@ def main():
|
||||
if default_branch and not initialize_with_readme:
|
||||
module.fail_json(msg="Param default_branch need param initialize_with_readme set to true")
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
gitlab_instance = gitlab_authentication(module)
|
||||
|
||||
# Set project_path to project_name if it is empty.
|
||||
|
||||
@@ -154,18 +154,11 @@ EXAMPLES = r'''
|
||||
RETURN = r''' # '''
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
|
||||
|
||||
import traceback
|
||||
|
||||
try:
|
||||
import gitlab
|
||||
HAS_PY_GITLAB = True
|
||||
except ImportError:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_PY_GITLAB = False
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitLabProjectMembers(object):
|
||||
@@ -280,9 +273,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
if not HAS_PY_GITLAB:
|
||||
module.fail_json(msg=missing_required_lib('python-gitlab', url='https://python-gitlab.readthedocs.io/en/stable/'), exception=GITLAB_IMP_ERR)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
access_level_int = {
|
||||
'guest': gitlab.GUEST_ACCESS,
|
||||
|
||||
@@ -175,7 +175,6 @@ project_variable:
|
||||
|
||||
import traceback
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils.six import integer_types
|
||||
@@ -188,7 +187,9 @@ except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, gitlab_authentication, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
def vars_to_variables(vars, module):
|
||||
@@ -430,6 +431,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
@@ -69,22 +69,14 @@ EXAMPLES = '''
|
||||
RETURN = '''
|
||||
'''
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitlabProtectedBranch(object):
|
||||
@@ -164,6 +156,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
project = module.params['project']
|
||||
name = module.params['name']
|
||||
@@ -171,9 +164,6 @@ def main():
|
||||
push_access_level = module.params['push_access_level']
|
||||
state = module.params['state']
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
gitlab_version = gitlab.__version__
|
||||
if LooseVersion(gitlab_version) < LooseVersion('2.3.0'):
|
||||
module.fail_json(msg="community.general.gitlab_proteched_branch requires python-gitlab Python module >= 2.3.0 (installed version: [%s])."
|
||||
|
||||
@@ -171,24 +171,17 @@ runner:
|
||||
type: dict
|
||||
'''
|
||||
|
||||
import traceback
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
cmp
|
||||
cmp # pylint: disable=used-before-assignment
|
||||
except NameError:
|
||||
def cmp(a, b):
|
||||
return (a > b) - (a < b)
|
||||
@@ -361,6 +354,7 @@ def main():
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
state = module.params['state']
|
||||
runner_description = module.params['description']
|
||||
@@ -373,9 +367,6 @@ def main():
|
||||
registration_token = module.params['registration_token']
|
||||
project = module.params['project']
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
gitlab_instance = gitlab_authentication(module)
|
||||
gitlab_project = None
|
||||
if project:
|
||||
|
||||
@@ -220,21 +220,14 @@ user:
|
||||
type: dict
|
||||
'''
|
||||
|
||||
import traceback
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
import gitlab
|
||||
HAS_GITLAB_PACKAGE = True
|
||||
except Exception:
|
||||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, find_group, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||
auth_argument_spec, find_group, gitlab_authentication, gitlab, ensure_gitlab_package
|
||||
)
|
||||
|
||||
|
||||
class GitLabUser(object):
|
||||
@@ -615,6 +608,7 @@ def main():
|
||||
('state', 'present', ['name', 'email']),
|
||||
)
|
||||
)
|
||||
ensure_gitlab_package(module)
|
||||
|
||||
user_name = module.params['name']
|
||||
state = module.params['state']
|
||||
@@ -633,9 +627,6 @@ def main():
|
||||
user_identities = module.params['identities']
|
||||
overwrite_identities = module.params['overwrite_identities']
|
||||
|
||||
if not HAS_GITLAB_PACKAGE:
|
||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
||||
|
||||
gitlab_instance = gitlab_authentication(module)
|
||||
|
||||
gitlab_user = GitLabUser(module, gitlab_instance)
|
||||
|
||||
@@ -211,6 +211,7 @@ except ImportError:
|
||||
XMLTODICT_LIBRARY_IMPORT_ERROR = traceback.format_exc()
|
||||
else:
|
||||
HAS_XMLTODICT_LIBRARY = True
|
||||
XMLTODICT_LIBRARY_IMPORT_ERROR = None
|
||||
|
||||
|
||||
class PersistentMemory(object):
|
||||
|
||||
@@ -105,55 +105,55 @@ EXAMPLES = r'''
|
||||
- name: Create filesystem in a previously defined logical volume.
|
||||
community.general.aix_filesystem:
|
||||
device: testlv
|
||||
community.general.filesystem: /testfs
|
||||
filesystem: /testfs
|
||||
state: present
|
||||
|
||||
- name: Creating NFS filesystem from nfshost.
|
||||
community.general.aix_filesystem:
|
||||
device: /home/ftp
|
||||
nfs_server: nfshost
|
||||
community.general.filesystem: /home/ftp
|
||||
filesystem: /home/ftp
|
||||
state: present
|
||||
|
||||
- name: Creating a new file system without a previously logical volume.
|
||||
community.general.aix_filesystem:
|
||||
community.general.filesystem: /newfs
|
||||
filesystem: /newfs
|
||||
size: 1G
|
||||
state: present
|
||||
vg: datavg
|
||||
|
||||
- name: Unmounting /testfs.
|
||||
community.general.aix_filesystem:
|
||||
community.general.filesystem: /testfs
|
||||
filesystem: /testfs
|
||||
state: unmounted
|
||||
|
||||
- name: Resizing /mksysb to +512M.
|
||||
community.general.aix_filesystem:
|
||||
community.general.filesystem: /mksysb
|
||||
filesystem: /mksysb
|
||||
size: +512M
|
||||
state: present
|
||||
|
||||
- name: Resizing /mksysb to 11G.
|
||||
community.general.aix_filesystem:
|
||||
community.general.filesystem: /mksysb
|
||||
filesystem: /mksysb
|
||||
size: 11G
|
||||
state: present
|
||||
|
||||
- name: Resizing /mksysb to -2G.
|
||||
community.general.aix_filesystem:
|
||||
community.general.filesystem: /mksysb
|
||||
filesystem: /mksysb
|
||||
size: -2G
|
||||
state: present
|
||||
|
||||
- name: Remove NFS filesystem /home/ftp.
|
||||
community.general.aix_filesystem:
|
||||
community.general.filesystem: /home/ftp
|
||||
filesystem: /home/ftp
|
||||
rm_mount_point: yes
|
||||
state: absent
|
||||
|
||||
- name: Remove /newfs.
|
||||
community.general.aix_filesystem:
|
||||
community.general.filesystem: /newfs
|
||||
filesystem: /newfs
|
||||
rm_mount_point: yes
|
||||
state: absent
|
||||
'''
|
||||
|
||||
@@ -164,10 +164,10 @@ class BE(object):
|
||||
for line in out.splitlines():
|
||||
if self.is_freebsd:
|
||||
check = line.split()
|
||||
if(check == []):
|
||||
if check == []:
|
||||
continue
|
||||
full_name = check[0].split('/')
|
||||
if(full_name == []):
|
||||
if full_name == []:
|
||||
continue
|
||||
check[0] = full_name[len(full_name) - 1]
|
||||
if check[0] == self.name:
|
||||
|
||||
@@ -328,7 +328,7 @@ class Homectl(object):
|
||||
cmd = [self.module.get_bin_path('homectl', True)]
|
||||
cmd.append('create')
|
||||
cmd.append('--identity=-') # Read the user record from standard input.
|
||||
return(self.module.run_command(cmd, data=record))
|
||||
return self.module.run_command(cmd, data=record)
|
||||
|
||||
def _hash_password(self, password):
|
||||
method = crypt.METHOD_SHA512
|
||||
|
||||
@@ -195,15 +195,15 @@ def main():
|
||||
name = module.params['name']
|
||||
state = module.params['state']
|
||||
|
||||
if not os.path.exists("/etc/locale.gen"):
|
||||
if os.path.exists("/var/lib/locales/supported.d/"):
|
||||
# Ubuntu created its own system to manage locales.
|
||||
ubuntuMode = True
|
||||
if not os.path.exists("/var/lib/locales/supported.d/"):
|
||||
if os.path.exists("/etc/locale.gen"):
|
||||
# We found the common way to manage locales.
|
||||
ubuntuMode = False
|
||||
else:
|
||||
module.fail_json(msg="/etc/locale.gen and /var/lib/locales/supported.d/local are missing. Is the package \"locales\" installed?")
|
||||
else:
|
||||
# We found the common way to manage locales.
|
||||
ubuntuMode = False
|
||||
# Ubuntu created its own system to manage locales.
|
||||
ubuntuMode = True
|
||||
|
||||
if not is_available(name, ubuntuMode):
|
||||
module.fail_json(msg="The locale you've entered is not available "
|
||||
|
||||
@@ -362,7 +362,7 @@ def format_disk_size(size_bytes, unit):
|
||||
This function has been adapted from https://github.com/Distrotech/parted/blo
|
||||
b/279d9d869ff472c52b9ec2e180d568f0c99e30b0/libparted/unit.c
|
||||
"""
|
||||
global units_si, units_iec
|
||||
global units_si, units_iec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
unit = unit.lower()
|
||||
|
||||
@@ -458,7 +458,7 @@ def get_device_info(device, unit):
|
||||
Fetches information about a disk and its partitions and it returns a
|
||||
dictionary.
|
||||
"""
|
||||
global module, parted_exec
|
||||
global module, parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
# If parted complains about missing labels, it means there are no partitions.
|
||||
# In this case only, use a custom function to fetch information and emulate
|
||||
@@ -485,7 +485,7 @@ def check_parted_label(device):
|
||||
to 3.1 don't return data when there is no label. For more information see:
|
||||
http://upstream.rosalinux.ru/changelogs/libparted/3.1/changelog.html
|
||||
"""
|
||||
global parted_exec
|
||||
global parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
# Check the version
|
||||
parted_major, parted_minor, dummy = parted_version()
|
||||
@@ -531,7 +531,7 @@ def parted_version():
|
||||
"""
|
||||
Returns the major and minor version of parted installed on the system.
|
||||
"""
|
||||
global module, parted_exec
|
||||
global module, parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
rc, out, err = module.run_command("%s --version" % parted_exec)
|
||||
if rc != 0:
|
||||
@@ -550,7 +550,7 @@ def parted(script, device, align):
|
||||
"""
|
||||
Runs a parted script.
|
||||
"""
|
||||
global module, parted_exec
|
||||
global module, parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
align_option = '-a %s' % align
|
||||
if align == 'undefined':
|
||||
@@ -601,7 +601,7 @@ def check_size_format(size_str):
|
||||
|
||||
|
||||
def main():
|
||||
global module, units_si, units_iec, parted_exec
|
||||
global module, units_si, units_iec, parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
changed = False
|
||||
output_script = ""
|
||||
|
||||
@@ -187,6 +187,7 @@ except ImportError:
|
||||
PYRFC_LIBRARY_IMPORT_ERROR = traceback.format_exc()
|
||||
else:
|
||||
HAS_PYRFC_LIBRARY = True
|
||||
PYRFC_LIBRARY_IMPORT_ERROR = None
|
||||
try:
|
||||
import xmltodict
|
||||
except ImportError:
|
||||
@@ -194,6 +195,7 @@ except ImportError:
|
||||
XMLTODICT_LIBRARY_IMPORT_ERROR = traceback.format_exc()
|
||||
else:
|
||||
HAS_XMLTODICT_LIBRARY = True
|
||||
XMLTODICT_LIBRARY_IMPORT_ERROR = None
|
||||
|
||||
|
||||
def call_rfc_method(connection, method_name, kwargs):
|
||||
|
||||
@@ -261,8 +261,8 @@ class BalancerMember(object):
|
||||
else:
|
||||
try:
|
||||
soup = BeautifulSoup(balancer_member_page[0])
|
||||
except TypeError:
|
||||
self.module.fail_json(msg="Cannot parse balancer_member_page HTML! " + str(soup))
|
||||
except TypeError as exc:
|
||||
self.module.fail_json(msg="Cannot parse balancer_member_page HTML! " + str(exc))
|
||||
else:
|
||||
subsoup = soup.findAll('table')[1].findAll('tr')
|
||||
keys = subsoup[0].findAll('th')
|
||||
|
||||
@@ -23,6 +23,37 @@
|
||||
# Make sure we start fresh
|
||||
|
||||
# Test setup
|
||||
- name: prep our files
|
||||
copy: src={{ item }} dest={{remote_tmp_dir}}/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
- empty.txt
|
||||
- sub
|
||||
- sub/subfile.txt
|
||||
|
||||
# Run twice without lzma backport installed, to make sure it does not crash
|
||||
- name: Archive - pre-test - first run
|
||||
archive:
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_pretest_1.tar"
|
||||
format: "tar"
|
||||
register: pretest_1
|
||||
|
||||
- name: Archive - pre-test - second run
|
||||
archive:
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_pretest_1.tar"
|
||||
format: "tar"
|
||||
register: pretest_2
|
||||
|
||||
- name: Archive - validate pre-test
|
||||
assert:
|
||||
that:
|
||||
- pretest_1 is changed
|
||||
- pretest_2 is not changed
|
||||
|
||||
# Install dependencies
|
||||
- name: Ensure zip is present to create test archive (yum)
|
||||
yum: name=zip state=latest
|
||||
when: ansible_facts.pkg_mgr == 'yum'
|
||||
@@ -74,15 +105,6 @@
|
||||
when: ansible_python_version.split('.')[0] == '2'
|
||||
register: backports_lzma_pip
|
||||
|
||||
- name: prep our files
|
||||
copy: src={{ item }} dest={{remote_tmp_dir}}/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
- empty.txt
|
||||
- sub
|
||||
- sub/subfile.txt
|
||||
|
||||
- name: Define formats to test
|
||||
set_fact:
|
||||
formats:
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
- import_tasks: setup.yml
|
||||
- name: Set default environment
|
||||
set_fact:
|
||||
cargo_environment: {}
|
||||
- name: Set special environment to work around cargo bugs
|
||||
set_fact:
|
||||
cargo_environment:
|
||||
# See https://github.com/rust-lang/cargo/issues/10230#issuecomment-1201662729:
|
||||
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
|
||||
when: has_cargo | default(false) and ansible_distribution == 'Alpine'
|
||||
- block:
|
||||
- import_tasks: test_general.yml
|
||||
- import_tasks: test_version.yml
|
||||
environment: "{{ cargo_environment }}"
|
||||
when: has_cargo | default(false)
|
||||
|
||||
@@ -6,5 +6,8 @@ set -eux
|
||||
|
||||
# Run connection tests with both the default and C locale.
|
||||
|
||||
ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
|
||||
LC_ALL=C LANG=C ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
|
||||
ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
|
||||
|
||||
if ansible --version | grep ansible | grep -E ' 2\.(9|10|11|12|13)\.'; then
|
||||
LC_ALL=C LANG=C ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
|
||||
fi
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
suffix: .django_manage
|
||||
register: tmp_django_root
|
||||
|
||||
- name: Install virtualenv
|
||||
- name: Install virtualenv on CentOS 8
|
||||
package:
|
||||
name: virtualenv
|
||||
state: present
|
||||
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8'
|
||||
|
||||
- name: Install virtualenv
|
||||
package:
|
||||
name: python-virtualenv
|
||||
- name: Install virtualenv on Arch Linux
|
||||
pip:
|
||||
name: virtualenv
|
||||
state: present
|
||||
when: ansible_os_family == 'Archlinux'
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ tested_filesystems:
|
||||
ext4dev: {fssize: 10, grow: True}
|
||||
ext3: {fssize: 10, grow: True}
|
||||
ext2: {fssize: 10, grow: True}
|
||||
xfs: {fssize: 20, grow: False} # grow requires a mounted filesystem
|
||||
xfs: {fssize: 300, grow: False} # grow requires a mounted filesystem
|
||||
btrfs: {fssize: 150, grow: False} # grow requires a mounted filesystem
|
||||
reiserfs: {fssize: 33, grow: False} # grow not implemented
|
||||
vfat: {fssize: 20, grow: True}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
dependencies:
|
||||
- setup_pkg_mgr
|
||||
- setup_remote_tmp_dir
|
||||
- setup_remote_tmp_dir_outside_tmp
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
assert:
|
||||
that:
|
||||
- eval_error is failed
|
||||
- eval_error.msg.startswith("Caught \"'foo' is undefined\" while evaluating ")
|
||||
- eval_error.msg.startswith("Caught \"'foo' is undefined")
|
||||
|
||||
- name: "Test 5: same variable name reused"
|
||||
debug:
|
||||
@@ -147,7 +147,7 @@
|
||||
assert:
|
||||
that:
|
||||
- eval_error is failed
|
||||
- eval_error.msg.startswith("Caught \"'x' is undefined\" while evaluating ")
|
||||
- eval_error.msg.startswith("Caught \"'x' is undefined")
|
||||
|
||||
- name: "Test 6: multi-value dict"
|
||||
debug:
|
||||
|
||||
@@ -61,7 +61,7 @@ if HAS_TLS and ssl_ctx is not None:
|
||||
smtp_server2 = smtpd_tls.DebuggingServer(('127.0.0.1', port2), None, ssl_ctx=ssl_ctx, starttls=False)
|
||||
else:
|
||||
print('Start SMTP server on port', port1)
|
||||
smtp_server1 = smtpd.DebuggingServer(('127.0.0.1', port1), None)
|
||||
smtp_server1 = smtpd.DebuggingServer(('127.0.0.1', port1), None) # pylint: disable=used-before-assignment
|
||||
if port2:
|
||||
print('WARNING: TLS is NOT supported on this system, not listening on port %s.' % port2)
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
dependencies:
|
||||
- setup_pkg_mgr
|
||||
- setup_remote_constraints
|
||||
|
||||
@@ -46,15 +46,15 @@
|
||||
src: httpd_echo.py
|
||||
dest: "{{ process_file }}"
|
||||
|
||||
- name: Install virtualenv
|
||||
- name: Install virtualenv on CentOS 8
|
||||
package:
|
||||
name: virtualenv
|
||||
state: present
|
||||
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8'
|
||||
|
||||
- name: Install virtualenv
|
||||
package:
|
||||
name: python-virtualenv
|
||||
- name: Install virtualenv on Arch Linux
|
||||
pip:
|
||||
name: virtualenv
|
||||
state: present
|
||||
when: ansible_os_family == 'Archlinux'
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
virtualenv: "{{ process_venv }}"
|
||||
extra_args: "-c {{ remote_constraints }}"
|
||||
loop:
|
||||
- setuptools==44
|
||||
- python-daemon
|
||||
|
||||
@@ -3,3 +3,4 @@ dependencies:
|
||||
- setup_pkg_mgr
|
||||
- setup_openssl
|
||||
- setup_remote_tmp_dir
|
||||
- setup_remote_constraints
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
- name: Install requests<2.20 (CentOS/RHEL 6)
|
||||
pip:
|
||||
name: requests<2.20
|
||||
extra_args: "-c {{ remote_constraints }}"
|
||||
register: result
|
||||
until: result is success
|
||||
when: ansible_distribution_file_variety|default() == 'RedHat' and ansible_distribution_major_version is version('6', '<=')
|
||||
@@ -22,12 +23,14 @@
|
||||
- name: Install python-nomad
|
||||
pip:
|
||||
name: python-nomad
|
||||
extra_args: "-c {{ remote_constraints }}"
|
||||
register: result
|
||||
until: result is success
|
||||
|
||||
- name: Install jmespath
|
||||
pip:
|
||||
name: jmespath
|
||||
extra_args: "-c {{ remote_constraints }}"
|
||||
register: result
|
||||
until: result is success
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
---
|
||||
- vars:
|
||||
http_port: 27617
|
||||
reg_pkg: ed
|
||||
url_pkg: lemon
|
||||
url_pkg_filename: url.pkg.zst
|
||||
url_pkg_path: '/tmp/'
|
||||
url_pkg_url: 'http://localhost:{{http_port}}/{{url_pkg_filename}}'
|
||||
file_pkg: hdparm
|
||||
file_pkg_path: /tmp/pkg.zst
|
||||
file_pkg_path: /tmp/file.pkg.zst
|
||||
extra_pkg: core/sdparm
|
||||
extra_pkg_outfmt: sdparm
|
||||
block:
|
||||
@@ -15,11 +19,33 @@
|
||||
- '{{file_pkg}}'
|
||||
- '{{extra_pkg}}'
|
||||
state: absent
|
||||
- name: Make sure that url package is not cached
|
||||
file:
|
||||
path: '/var/cache/pacman/pkg/{{url_pkg_filename}}'
|
||||
state: absent
|
||||
|
||||
- name: Get URL for {{url_pkg}}
|
||||
command:
|
||||
cmd: pacman --sync --print-format "%l" {{url_pkg}}
|
||||
register: url_pkg_url
|
||||
register: url_pkg_stdout
|
||||
- name: Download {{url_pkg}} pkg
|
||||
get_url:
|
||||
url: '{{url_pkg_stdout.stdout}}'
|
||||
dest: '{{url_pkg_path}}/{{url_pkg_filename}}'
|
||||
- name: Download {{url_pkg}} pkg sig
|
||||
get_url:
|
||||
url: '{{url_pkg_stdout.stdout}}.sig'
|
||||
dest: '{{url_pkg_path}}/{{url_pkg_filename}}.sig'
|
||||
- name: Host {{url_pkg}}
|
||||
shell:
|
||||
cmd: 'python -m http.server --directory {{url_pkg_path}} {{http_port}} >/dev/null 2>&1'
|
||||
async: 90
|
||||
poll: 0
|
||||
- name: Wait for http.server to come up online
|
||||
wait_for:
|
||||
host: 'localhost'
|
||||
port: '{{http_port}}'
|
||||
state: started
|
||||
|
||||
- name: Get URL for {{file_pkg}}
|
||||
command:
|
||||
@@ -34,26 +60,50 @@
|
||||
pacman:
|
||||
name:
|
||||
- '{{reg_pkg}}'
|
||||
- '{{url_pkg_url.stdout}}'
|
||||
- '{{url_pkg_url}}'
|
||||
- '{{file_pkg_path}}'
|
||||
check_mode: True
|
||||
register: install_1
|
||||
|
||||
- name: Install packages from url (check mode, cached)
|
||||
pacman:
|
||||
name:
|
||||
- '{{url_pkg_url}}'
|
||||
check_mode: True
|
||||
register: install_1c
|
||||
- name: Delete cached {{url_pkg}}
|
||||
file:
|
||||
path: '/var/cache/pacman/pkg/{{url_pkg_filename}}'
|
||||
state: absent
|
||||
|
||||
- name: Install packages from mixed sources
|
||||
pacman:
|
||||
name:
|
||||
- '{{reg_pkg}}'
|
||||
- '{{url_pkg_url.stdout}}'
|
||||
- '{{url_pkg_url}}'
|
||||
- '{{file_pkg_path}}'
|
||||
register: install_2
|
||||
- name: Delete cached {{url_pkg}}
|
||||
file:
|
||||
path: '/var/cache/pacman/pkg/{{url_pkg_filename}}'
|
||||
state: absent
|
||||
|
||||
- name: Install packages from mixed sources - (idempotency)
|
||||
pacman:
|
||||
name:
|
||||
- '{{reg_pkg}}'
|
||||
- '{{url_pkg_url.stdout}}'
|
||||
- '{{url_pkg_url}}'
|
||||
- '{{file_pkg_path}}'
|
||||
register: install_3
|
||||
- name: Install packages from url - (idempotency, cached)
|
||||
pacman:
|
||||
name:
|
||||
- '{{url_pkg_url}}'
|
||||
register: install_3c
|
||||
- name: Delete cached {{url_pkg}}
|
||||
file:
|
||||
path: '/var/cache/pacman/pkg/{{url_pkg_filename}}'
|
||||
state: absent
|
||||
|
||||
- name: Install packages with their regular names (idempotency)
|
||||
pacman:
|
||||
@@ -62,54 +112,89 @@
|
||||
- '{{url_pkg}}'
|
||||
- '{{file_pkg}}'
|
||||
register: install_4
|
||||
- name: Delete cached {{url_pkg}}
|
||||
file:
|
||||
path: '/var/cache/pacman/pkg/{{url_pkg_filename}}'
|
||||
state: absent
|
||||
|
||||
- name: Install new package with already installed packages from mixed sources
|
||||
pacman:
|
||||
name:
|
||||
- '{{reg_pkg}}'
|
||||
- '{{url_pkg_url.stdout}}'
|
||||
- '{{url_pkg_url}}'
|
||||
- '{{file_pkg_path}}'
|
||||
- '{{extra_pkg}}'
|
||||
register: install_5
|
||||
- name: Delete cached {{url_pkg}}
|
||||
file:
|
||||
path: '/var/cache/pacman/pkg/{{url_pkg_filename}}'
|
||||
state: absent
|
||||
|
||||
- name: Uninstall packages - mixed sources (check mode)
|
||||
pacman:
|
||||
state: absent
|
||||
name:
|
||||
- '{{reg_pkg}}'
|
||||
- '{{url_pkg_url.stdout}}'
|
||||
- '{{url_pkg_url}}'
|
||||
- '{{file_pkg_path}}'
|
||||
check_mode: True
|
||||
register: uninstall_1
|
||||
- name: Uninstall packages - url (check mode, cached)
|
||||
pacman:
|
||||
state: absent
|
||||
name:
|
||||
- '{{url_pkg_url}}'
|
||||
check_mode: True
|
||||
register: uninstall_1c
|
||||
- name: Delete cached {{url_pkg}}
|
||||
file:
|
||||
path: '/var/cache/pacman/pkg/{{url_pkg_filename}}'
|
||||
state: absent
|
||||
|
||||
- name: Uninstall packages - mixed sources
|
||||
pacman:
|
||||
state: absent
|
||||
name:
|
||||
- '{{reg_pkg}}'
|
||||
- '{{url_pkg_url.stdout}}'
|
||||
- '{{url_pkg_url}}'
|
||||
- '{{file_pkg_path}}'
|
||||
register: uninstall_2
|
||||
- name: Delete cached {{url_pkg}}
|
||||
file:
|
||||
path: '/var/cache/pacman/pkg/{{url_pkg_filename}}'
|
||||
state: absent
|
||||
|
||||
- name: Uninstall packages - mixed sources (idempotency)
|
||||
pacman:
|
||||
state: absent
|
||||
name:
|
||||
- '{{reg_pkg}}'
|
||||
- '{{url_pkg_url.stdout}}'
|
||||
- '{{url_pkg_url}}'
|
||||
- '{{file_pkg_path}}'
|
||||
register: uninstall_3
|
||||
|
||||
- name: Uninstall package - url (idempotency, cached)
|
||||
pacman:
|
||||
state: absent
|
||||
name:
|
||||
- '{{url_pkg_url}}'
|
||||
register: uninstall_3c
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- install_1 is changed
|
||||
- install_1.msg == 'Would have installed 3 packages'
|
||||
- install_1.packages|sort() == [reg_pkg, url_pkg, file_pkg]|sort()
|
||||
- install_1c is changed
|
||||
- install_1c.msg == 'Would have installed 1 packages'
|
||||
- install_1c.packages|sort() == [url_pkg]
|
||||
- install_2 is changed
|
||||
- install_2.msg == 'Installed 3 package(s)'
|
||||
- install_1.packages|sort() == [reg_pkg, url_pkg, file_pkg]|sort()
|
||||
- install_2.packages|sort() == [reg_pkg, url_pkg, file_pkg]|sort()
|
||||
- install_3 is not changed
|
||||
- install_3.msg == 'package(s) already installed'
|
||||
- install_3c is not changed
|
||||
- install_3c.msg == 'package(s) already installed'
|
||||
- install_4 is not changed
|
||||
- install_4.msg == 'package(s) already installed'
|
||||
- install_5 is changed
|
||||
@@ -118,8 +203,13 @@
|
||||
- uninstall_1 is changed
|
||||
- uninstall_1.msg == 'Would have removed 3 packages'
|
||||
- uninstall_1.packages | length() == 3 # pkgs have versions here
|
||||
- uninstall_1c is changed
|
||||
- uninstall_1c.msg == 'Would have removed 1 packages'
|
||||
- uninstall_1c.packages | length() == 1 # pkgs have versions here
|
||||
- uninstall_2 is changed
|
||||
- uninstall_2.msg == 'Removed 3 package(s)'
|
||||
- uninstall_2.packages | length() == 3
|
||||
- uninstall_3 is not changed
|
||||
- uninstall_3.msg == 'package(s) already absent'
|
||||
- uninstall_3c is not changed
|
||||
- uninstall_3c.msg == 'package(s) already absent'
|
||||
|
||||
@@ -136,6 +136,42 @@
|
||||
- pkgng_example4.changed
|
||||
- not pkgng_example4_idempotent.changed
|
||||
|
||||
##
|
||||
## pkgng - example - state=latest for out-of-date package without privileges
|
||||
##
|
||||
- name: Install intentionally out-of-date package and try to upgrade it with unprivileged user
|
||||
block:
|
||||
- ansible.builtin.user:
|
||||
name: powerless
|
||||
shell: /bin/bash
|
||||
|
||||
- name: Create out-of-date test package
|
||||
import_tasks: create-outofdate-pkg.yml
|
||||
|
||||
- name: Install out-of-date test package
|
||||
command: 'pkg add {{ pkgng_test_outofdate_pkg_path }}'
|
||||
register: pkgng_example4_nopower_prepare
|
||||
|
||||
- name: Check for any available package upgrades with unprivileged user
|
||||
become: true
|
||||
become_user: powerless
|
||||
pkgng:
|
||||
name: '*'
|
||||
state: latest
|
||||
register: pkgng_example4_nopower_wildcard
|
||||
ignore_errors: true
|
||||
|
||||
- name: Remove test out-of-date package
|
||||
pkgng:
|
||||
name: '{{ pkgng_test_pkg_name }}'
|
||||
state: absent
|
||||
|
||||
- name: Ensure pkgng upgrades package correctly
|
||||
assert:
|
||||
that:
|
||||
- not pkgng_example4_nopower_prepare.failed
|
||||
- pkgng_example4_nopower_wildcard.failed
|
||||
|
||||
##
|
||||
## pkgng - example - Install multiple packages in one command
|
||||
##
|
||||
@@ -461,10 +497,15 @@
|
||||
# NOTE: FreeBSD 12.0 test runner receives a "connection reset by peer" after ~20% downloaded so we are
|
||||
# only running this on 12.1 or higher
|
||||
#
|
||||
# NOTE: FreeBSD 13.0 fails to update the package catalogue for unknown reasons (someone with FreeBSD
|
||||
# knowledge has to take a look)
|
||||
#
|
||||
# NOTE: FreeBSD 13.1 fails to update the package catalogue for unknown reasons (someone with FreeBSD
|
||||
# knowledge has to take a look)
|
||||
#
|
||||
when: ansible_distribution_version is version('12.01', '>=') and ansible_distribution_version is version('13.1', '<')
|
||||
when: >-
|
||||
(ansible_distribution_version is version('12.01', '>=') and ansible_distribution_version is version('13.0', '<'))
|
||||
or ansible_distribution_version is version('13.2', '>=')
|
||||
block:
|
||||
- name: Setup testjail
|
||||
include: setup-testjail.yml
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
- name: delete temporary directory
|
||||
include_tasks: default-cleanup.yml
|
||||
|
||||
- name: delete temporary directory (windows)
|
||||
include_tasks: windows-cleanup.yml
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
- name: delete temporary directory
|
||||
file:
|
||||
path: "{{ remote_tmp_dir }}"
|
||||
state: absent
|
||||
no_log: yes
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
- name: create ~/tmp
|
||||
file:
|
||||
path: '~/tmp'
|
||||
state: directory
|
||||
|
||||
- name: create temporary directory
|
||||
tempfile:
|
||||
state: directory
|
||||
suffix: .test
|
||||
path: ~/tmp
|
||||
register: remote_tmp_dir
|
||||
notify:
|
||||
- delete temporary directory
|
||||
|
||||
- name: record temporary directory
|
||||
set_fact:
|
||||
remote_tmp_dir: "{{ remote_tmp_dir.path }}"
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
- name: make sure we have the ansible_os_family and ansible_distribution_version facts
|
||||
setup:
|
||||
gather_subset: distribution
|
||||
when: ansible_facts == {}
|
||||
|
||||
- include_tasks: "{{ lookup('first_found', files)}}"
|
||||
vars:
|
||||
files:
|
||||
- "{{ ansible_os_family | lower }}.yml"
|
||||
- "default.yml"
|
||||
@@ -4,3 +4,4 @@ skip/freebsd
|
||||
skip/osx
|
||||
skip/macos
|
||||
skip/rhel8.4 # TODO make sure that tests work on 8.4 as well!
|
||||
disabled # TODO
|
||||
|
||||
@@ -24,6 +24,7 @@ plugins/modules/cloud/univention/udm_user.py validate-modules:parameter-list-no-
|
||||
plugins/modules/clustering/consul/consul.py validate-modules:doc-missing-type
|
||||
plugins/modules/clustering/consul/consul.py validate-modules:undocumented-parameter
|
||||
plugins/modules/clustering/consul/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/files/ini_file.py pylint:bad-option-value
|
||||
plugins/modules/packaging/language/composer.py validate-modules:parameter-invalid # invalid alias - removed in 5.0.0
|
||||
plugins/modules/packaging/language/yarn.py use-argspec-type-path
|
||||
plugins/modules/packaging/os/apt_rpm.py validate-modules:parameter-invalid # invalid alias - removed in 5.0.0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user