mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-28 09:26:44 +00:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44d2d62d38 | ||
|
|
82b2d294b7 | ||
|
|
812fbef786 | ||
|
|
9d795c334b | ||
|
|
512d412eb4 | ||
|
|
8f0ee6966f | ||
|
|
3af9e39043 | ||
|
|
7b78512c59 | ||
|
|
9f0913bf73 | ||
|
|
aea851018b | ||
|
|
69c79f618e | ||
|
|
6a51ba5169 | ||
|
|
52e8e7e928 | ||
|
|
d71b90be07 | ||
|
|
1293b0ac91 | ||
|
|
d4330a3e54 | ||
|
|
7c3bf118ca | ||
|
|
742b438b32 | ||
|
|
c59ebc82cd | ||
|
|
36a4fbfe60 | ||
|
|
ad3e7bc21d | ||
|
|
66a7fdfeba | ||
|
|
77e25a7503 | ||
|
|
05ac79cee6 | ||
|
|
22b4fc8d8b | ||
|
|
6252f3bded | ||
|
|
15c4e08295 | ||
|
|
a77bb090b3 | ||
|
|
99958cea49 | ||
|
|
b2802dc8eb | ||
|
|
8617568146 | ||
|
|
7569d6315c | ||
|
|
ab5143b15d | ||
|
|
a71ff614f0 | ||
|
|
bfd3e15074 | ||
|
|
90b815de50 | ||
|
|
056e16baa5 | ||
|
|
890cf636a0 | ||
|
|
8c2b2aeb83 | ||
|
|
3c597d8b04 |
@@ -177,12 +177,12 @@ stages:
|
||||
test: macos/12.0
|
||||
- name: RHEL 7.9
|
||||
test: rhel/7.9
|
||||
- name: RHEL 8.5
|
||||
test: rhel/8.5
|
||||
- name: RHEL 9.0
|
||||
test: rhel/9.0
|
||||
- name: FreeBSD 12.3
|
||||
test: freebsd/12.3
|
||||
- name: FreeBSD 13.0
|
||||
test: freebsd/13.0
|
||||
- name: FreeBSD 13.1
|
||||
test: freebsd/13.1
|
||||
groups:
|
||||
- 1
|
||||
- 2
|
||||
@@ -251,16 +251,16 @@ stages:
|
||||
targets:
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 34
|
||||
test: fedora34
|
||||
- name: Fedora 35
|
||||
test: fedora35
|
||||
- name: Fedora 36
|
||||
test: fedora36
|
||||
- name: openSUSE 15
|
||||
test: opensuse15
|
||||
- name: Ubuntu 18.04
|
||||
test: ubuntu1804
|
||||
- name: Ubuntu 20.04
|
||||
test: ubuntu2004
|
||||
- name: Ubuntu 22.04
|
||||
test: ubuntu2204
|
||||
- name: Alpine 3
|
||||
test: alpine3
|
||||
groups:
|
||||
@@ -297,8 +297,8 @@ stages:
|
||||
test: centos6
|
||||
- name: Fedora 34
|
||||
test: fedora34
|
||||
- name: Ubuntu 20.04
|
||||
test: ubuntu2004
|
||||
- name: Ubuntu 18.04
|
||||
test: ubuntu1804
|
||||
groups:
|
||||
- 1
|
||||
- 2
|
||||
|
||||
15
.github/BOTMETA.yml
vendored
15
.github/BOTMETA.yml
vendored
@@ -254,6 +254,9 @@ files:
|
||||
maintainers: amigus endlesstrax
|
||||
$module_utils/:
|
||||
labels: module_utils
|
||||
$module_utils/gconftool2.py:
|
||||
maintainers: russoz
|
||||
labels: gconftool2
|
||||
$module_utils/gitlab.py:
|
||||
notify: jlozadad
|
||||
maintainers: $team_gitlab
|
||||
@@ -304,6 +307,9 @@ files:
|
||||
$module_utils/xenserver.py:
|
||||
maintainers: bvitnik
|
||||
labels: xenserver
|
||||
$module_utils/xfconf.py:
|
||||
maintainers: russoz
|
||||
labels: xfconf
|
||||
$modules/cloud/alicloud/:
|
||||
maintainers: xiaozhu36
|
||||
$modules/cloud/atomic/atomic_container.py:
|
||||
@@ -615,7 +621,7 @@ files:
|
||||
$modules/monitoring/nagios.py:
|
||||
maintainers: tbielawa tgoetheyn
|
||||
$modules/monitoring/newrelic_deployment.py:
|
||||
maintainers: mcodd
|
||||
ignore: mcodd
|
||||
$modules/monitoring/pagerduty.py:
|
||||
maintainers: suprememoocow thaumos
|
||||
labels: pagerduty
|
||||
@@ -707,7 +713,7 @@ files:
|
||||
$modules/notification/discord.py:
|
||||
maintainers: cwollinger
|
||||
$modules/notification/flowdock.py:
|
||||
maintainers: mcodd
|
||||
ignore: mcodd
|
||||
$modules/notification/grove.py:
|
||||
maintainers: zimbatm
|
||||
$modules/notification/hipchat.py:
|
||||
@@ -1024,7 +1030,7 @@ files:
|
||||
$modules/system/alternatives.py:
|
||||
maintainers: mulby
|
||||
labels: alternatives
|
||||
ignore: DavidWittman
|
||||
ignore: DavidWittman jiuka
|
||||
$modules/system/aix_lvol.py:
|
||||
maintainers: adejoux
|
||||
$modules/system/awall.py:
|
||||
@@ -1052,6 +1058,9 @@ files:
|
||||
$modules/system/gconftool2.py:
|
||||
maintainers: Akasurde kevensen
|
||||
labels: gconftool2
|
||||
$modules/system/gconftool2_info.py:
|
||||
maintainers: russoz
|
||||
labels: gconftool2
|
||||
$modules/system/homectl.py:
|
||||
maintainers: jameslivulpi
|
||||
$modules/system/interfaces_file.py:
|
||||
|
||||
106
CHANGELOG.rst
106
CHANGELOG.rst
@@ -6,13 +6,90 @@ Community General Release Notes
|
||||
|
||||
This changelog describes changes after version 4.0.0.
|
||||
|
||||
v5.0.0-a1
|
||||
=========
|
||||
v5.1.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Alpha release for community.general 5.0.0.
|
||||
Regular bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- ModuleHelper module utils - improved ``ModuleHelperException``, using ``to_native()`` for the exception message (https://github.com/ansible-collections/community.general/pull/4755).
|
||||
- alternatives - add ``state=absent`` to be able to remove an alternative (https://github.com/ansible-collections/community.general/pull/4654).
|
||||
- alternatives - add ``subcommands`` parameter (https://github.com/ansible-collections/community.general/pull/4654).
|
||||
- ansible_galaxy_install - minor refactoring using latest ``ModuleHelper`` updates (https://github.com/ansible-collections/community.general/pull/4752).
|
||||
- cmd_runner module util - added parameters ``check_mode_skip`` and ``check_mode_return`` to ``CmdRunner.context()``, so that the command is not executed when ``check_mode=True`` (https://github.com/ansible-collections/community.general/pull/4736).
|
||||
- nmcli - adds ``vpn`` type and parameter for supporting VPN with service type L2TP and PPTP (https://github.com/ansible-collections/community.general/pull/4746).
|
||||
- proxmox inventory plugin - added new flag ``qemu_extended_statuses`` and new groups ``<group_prefix>prelaunch``, ``<group_prefix>paused``. They will be populated only when ``want_facts=true``, ``qemu_extended_statuses=true`` and only for ``QEMU`` machines (https://github.com/ansible-collections/community.general/pull/4723).
|
||||
- puppet - adds ``confdir`` parameter to configure a custom confir location (https://github.com/ansible-collections/community.general/pull/4740).
|
||||
- xfconf - changed implementation to use ``cmd_runner`` (https://github.com/ansible-collections/community.general/pull/4776).
|
||||
- xfconf module utils - created new module util ``xfconf`` providing a ``cmd_runner`` specific for ``xfconf`` modules (https://github.com/ansible-collections/community.general/pull/4776).
|
||||
- xfconf_info - changed implementation to use ``cmd_runner`` (https://github.com/ansible-collections/community.general/pull/4776).
|
||||
|
||||
Deprecated Features
|
||||
-------------------
|
||||
|
||||
- cmd_runner module utils - deprecated ``fmt`` in favour of ``cmd_runner_fmt`` as the parameter format object (https://github.com/ansible-collections/community.general/pull/4777).
|
||||
|
||||
New Modules
|
||||
-----------
|
||||
|
||||
System
|
||||
~~~~~~
|
||||
|
||||
- gconftool2_info - Retrieve GConf configurations
|
||||
|
||||
v5.0.2
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Maintenance and bugfix release for Ansible 6.0.0.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Include ``simplified_bsd.txt`` license file for various module utils, the ``lxca_common`` docs fragment, and the ``utm_utils`` unit tests.
|
||||
|
||||
v5.0.1
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Regular bugfix release for inclusion in Ansible 6.0.0.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- cpanm - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
- mksysb - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
- pipx - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
- snap - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
- xfconf - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- consul - fixed bug introduced in PR 4590 (https://github.com/ansible-collections/community.general/issues/4680).
|
||||
- filesystem - handle ``fatresize --info`` output lines without ``:`` (https://github.com/ansible-collections/community.general/pull/4700).
|
||||
- filesystem - improve error messages when output cannot be parsed by including newlines in escaped form (https://github.com/ansible-collections/community.general/pull/4700).
|
||||
- keycloak_realm - fix default groups and roles (https://github.com/ansible-collections/community.general/issues/4241).
|
||||
- redis* modules - fix call to ``module.fail_json`` when failing because of missing Python libraries (https://github.com/ansible-collections/community.general/pull/4733).
|
||||
- xcc_redfish_command - for compatibility due to Redfish spec changes the virtualMedia resource location changed from Manager to System (https://github.com/ansible-collections/community.general/pull/4682).
|
||||
- zfs - fix wrong quoting of properties (https://github.com/ansible-collections/community.general/issues/4707, https://github.com/ansible-collections/community.general/pull/4726).
|
||||
|
||||
v5.0.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This is release 5.0.0 of ``community.general``, released on 2022-05-17.
|
||||
|
||||
Major Changes
|
||||
-------------
|
||||
@@ -23,6 +100,8 @@ Minor Changes
|
||||
-------------
|
||||
|
||||
- Avoid internal ansible-core module_utils in favor of equivalent public API available since at least Ansible 2.9. This fixes some instances added since the last time this was fixed (https://github.com/ansible-collections/community.general/pull/4232).
|
||||
- ModuleHelper module utils - ``ModuleHelperBase` now delegates the attributes ``check_mode``, ``get_bin_path``, ``warn``, and ``deprecate`` to the underlying ``AnsibleModule`` instance (https://github.com/ansible-collections/community.general/pull/4600).
|
||||
- ModuleHelper module utils - ``ModuleHelperBase`` now has a convenience method ``do_raise`` (https://github.com/ansible-collections/community.general/pull/4660).
|
||||
- Remove vendored copy of ``distutils.version`` in favor of vendored copy included with ansible-core 2.12+. For ansible-core 2.11, uses ``distutils.version`` for Python < 3.12. There is no support for ansible-core 2.11 with Python 3.12+ (https://github.com/ansible-collections/community.general/pull/3988).
|
||||
- aix_filesystem - calling ``run_command`` with arguments as ``list`` instead of ``str`` (https://github.com/ansible-collections/community.general/pull/3833).
|
||||
- aix_lvg - calling ``run_command`` with arguments as ``list`` instead of ``str`` (https://github.com/ansible-collections/community.general/pull/3834).
|
||||
@@ -48,6 +127,7 @@ Minor Changes
|
||||
- icinga2 inventory plugin - implemented constructed interface (https://github.com/ansible-collections/community.general/pull/4088).
|
||||
- icinga2 inventory plugin - inventory object names are changable using ``inventory_attr`` in your config file to the host object name, address, or display_name fields (https://github.com/ansible-collections/community.general/issues/3875, https://github.com/ansible-collections/community.general/pull/3906).
|
||||
- ip_netns - calling ``run_command`` with arguments as ``list`` instead of ``str`` (https://github.com/ansible-collections/community.general/pull/3822).
|
||||
- ipa_dnsrecord - add new argument ``record_values``, mutually exclusive to ``record_value``, which supports multiple values for one record (https://github.com/ansible-collections/community.general/pull/4578).
|
||||
- ipa_dnszone - ``dynamicupdate`` is now a boolean parameter, instead of a string parameter accepting ``"true"`` and ``"false"``. Also the module is now idempotent with respect to ``dynamicupdate`` (https://github.com/ansible-collections/community.general/pull/3374).
|
||||
- ipa_dnszone - add DNS zone synchronization support (https://github.com/ansible-collections/community.general/pull/3374).
|
||||
- ipa_service - add ``skip_host_check`` parameter. (https://github.com/ansible-collections/community.general/pull/4417).
|
||||
@@ -106,6 +186,7 @@ Minor Changes
|
||||
- pacman - the module has been rewritten and is now much faster when using ``state=latest``. Operations are now done all packages at once instead of package per package and the configured output format of ``pacman`` no longer affect the module's operation. (https://github.com/ansible-collections/community.general/pull/3907, https://github.com/ansible-collections/community.general/issues/3783, https://github.com/ansible-collections/community.general/issues/4079)
|
||||
- passwordstore lookup plugin - add configurable ``lock`` and ``locktimeout`` options to avoid race conditions in itself and in the ``pass`` utility it calls. By default, the plugin now locks on write operations (https://github.com/ansible-collections/community.general/pull/4194).
|
||||
- pipx - added options ``editable`` and ``pip_args`` (https://github.com/ansible-collections/community.general/issues/4300).
|
||||
- pritunl_user - add ``mac_addresses`` parameter (https://github.com/ansible-collections/community.general/pull/4535).
|
||||
- profitbricks - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567).
|
||||
- proxmox - add ``clone`` parameter (https://github.com/ansible-collections/community.general/pull/3930).
|
||||
- proxmox - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567).
|
||||
@@ -121,6 +202,8 @@ Minor Changes
|
||||
- proxmox_snap - fixed timeout value to correctly reflect time in seconds. The timeout was off by one second (https://github.com/ansible-collections/community.general/pull/4377).
|
||||
- puppet - remove deprecation for ``show_diff`` parameter. Its alias ``show-diff`` is still deprecated and will be removed in community.general 7.0.0 (https://github.com/ansible-collections/community.general/pull/3980).
|
||||
- python_requirements_info - returns python version broken down into its components, and some minor refactoring (https://github.com/ansible-collections/community.general/pull/3797).
|
||||
- rax_files_objects - minor refactoring improving code quality (https://github.com/ansible-collections/community.general/pull/4649).
|
||||
- redfish_* modules - the contents of ``@Message.ExtendedInfo`` will be returned as a string in the event that ``@Message.ExtendedInfo.Messages`` does not exist. This is likely more useful than the standard HTTP error (https://github.com/ansible-collections/community.general/pull/4596).
|
||||
- redfish_command - add ``GetHostInterfaces`` command to enable reporting Redfish Host Interface information (https://github.com/ansible-collections/community.general/issues/3693).
|
||||
- redfish_command - add ``IndicatorLedOn``, ``IndicatorLedOff``, and ``IndicatorLedBlink`` commands to the Systems category for controling system LEDs (https://github.com/ansible-collections/community.general/issues/4084).
|
||||
- redfish_command - add ``SetHostInterface`` command to enable configuring the Redfish Host Interface (https://github.com/ansible-collections/community.general/issues/3632).
|
||||
@@ -135,14 +218,18 @@ Minor Changes
|
||||
- svc - calling ``run_command`` with arguments as ``list`` instead of ``str`` (https://github.com/ansible-collections/community.general/pull/3829).
|
||||
- syslog_json - add option to skip logging of ``gather_facts`` playbook tasks; use v2 callback API (https://github.com/ansible-collections/community.general/pull/4223).
|
||||
- terraform - adds ``terraform_upgrade`` parameter which allows ``terraform init`` to satisfy new provider constraints in an existing Terraform project (https://github.com/ansible-collections/community.general/issues/4333).
|
||||
- to_time_unit filter plugins - the time filters has been extended to also allow ``0`` as input (https://github.com/ansible-collections/community.general/pull/4612).
|
||||
- udm_group - minor refactoring (https://github.com/ansible-collections/community.general/pull/4556).
|
||||
- udm_share - minor refactoring (https://github.com/ansible-collections/community.general/pull/4556).
|
||||
- vmadm - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567).
|
||||
- vmadm - minor refactoring and improvement on the module (https://github.com/ansible-collections/community.general/pull/4581).
|
||||
- vmadm - minor refactoring and improvement on the module (https://github.com/ansible-collections/community.general/pull/4648).
|
||||
- webfaction_app - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567).
|
||||
- webfaction_db - minor refactoring (https://github.com/ansible-collections/community.general/pull/4567).
|
||||
- xattr - calling ``run_command`` with arguments as ``list`` instead of ``str`` (https://github.com/ansible-collections/community.general/pull/3806).
|
||||
- xfconf - added missing value types ``char``, ``uchar``, ``int64`` and ``uint64`` (https://github.com/ansible-collections/community.general/pull/4534).
|
||||
- xfconf - minor refactor on the base class for the module (https://github.com/ansible-collections/community.general/pull/3919).
|
||||
- zfs - minor refactoring in the code (https://github.com/ansible-collections/community.general/pull/4650).
|
||||
- zypper - add support for ``--clean-deps`` option to remove packages that depend on a package being removed (https://github.com/ansible-collections/community.general/pull/4195).
|
||||
|
||||
Breaking Changes / Porting Guide
|
||||
@@ -154,15 +241,19 @@ Breaking Changes / Porting Guide
|
||||
- archive - remove Ansible 2.9 compatibility code (https://github.com/ansible-collections/community.general/pull/4548).
|
||||
- git_config - remove Ansible 2.9 and early ansible-base 2.10 compatibility code (https://github.com/ansible-collections/community.general/pull/4548).
|
||||
- java_keystore - remove Ansible 2.9 compatibility code (https://github.com/ansible-collections/community.general/pull/4548).
|
||||
- lists_mergeby and groupby_as_dict filter plugins - adjust filter plugin filename. This change is not visible to end-users, it only affects possible other collections importing Python paths (https://github.com/ansible-collections/community.general/pull/4625).
|
||||
- lists_mergeby filter plugin - remove Ansible 2.9 compatibility code (https://github.com/ansible-collections/community.general/pull/4548).
|
||||
- maven_artifact - remove Ansible 2.9 compatibility code (https://github.com/ansible-collections/community.general/pull/4548).
|
||||
- memcached cache plugin - remove Ansible 2.9 compatibility code (https://github.com/ansible-collections/community.general/pull/4548).
|
||||
- path_join filter plugin shim - remove Ansible 2.9 compatibility code (https://github.com/ansible-collections/community.general/pull/4548).
|
||||
- redis cache plugin - remove Ansible 2.9 compatibility code (https://github.com/ansible-collections/community.general/pull/4548).
|
||||
- yarn - remove unsupported and unnecessary ``--no-emoji`` flag (https://github.com/ansible-collections/community.general/pull/4662).
|
||||
|
||||
Deprecated Features
|
||||
-------------------
|
||||
|
||||
- ansible_galaxy_install - deprecated support for ``ansible`` 2.9 and ``ansible-base`` 2.10 (https://github.com/ansible-collections/community.general/pull/4601).
|
||||
- dig lookup plugin - the ``DLV`` record type has been decommissioned in 2017 and support for it will be removed from community.general 6.0.0 (https://github.com/ansible-collections/community.general/pull/4618).
|
||||
- gem - the default of the ``norc`` option has been deprecated and will change to ``true`` in community.general 6.0.0. Explicitly specify a value to avoid a deprecation warning (https://github.com/ansible-collections/community.general/pull/4517).
|
||||
- mail callback plugin - not specifying ``sender`` is deprecated and will be disallowed in community.general 6.0.0 (https://github.com/ansible-collections/community.general/pull/4140).
|
||||
- module_helper module utils - deprecated the attribute ``ModuleHelper.VarDict`` (https://github.com/ansible-collections/community.general/pull/3801).
|
||||
@@ -200,11 +291,13 @@ Bugfixes
|
||||
- alternatives - fix output parsing for alternatives groups (https://github.com/ansible-collections/community.general/pull/3976).
|
||||
- cargo - fix detection of outdated packages when ``state=latest`` (https://github.com/ansible-collections/community.general/pull/4052).
|
||||
- cargo - fix incorrectly reported changed status for packages with a name containing a hyphen (https://github.com/ansible-collections/community.general/issues/4044, https://github.com/ansible-collections/community.general/pull/4052).
|
||||
- consul - fixed bug where class ``ConsulService`` was overwriting the field ``checks``, preventing the addition of checks to a service (https://github.com/ansible-collections/community.general/pull/4590).
|
||||
- counter_enabled callback plugin - fix output to correctly display host and task counters in serial mode (https://github.com/ansible-collections/community.general/pull/3709).
|
||||
- dconf - skip processes that disappeared while we inspected them (https://github.com/ansible-collections/community.general/issues/4151).
|
||||
- dnsmadeeasy - fix failure on deleting DNS entries when API response does not contain monitor value (https://github.com/ansible-collections/community.general/issues/3620).
|
||||
- dsv lookup plugin - raise an Ansible error if the wrong ``python-dsv-sdk`` version is installed (https://github.com/ansible-collections/community.general/pull/4422).
|
||||
- filesize - add support for busybox dd implementation, that is used by default on Alpine linux (https://github.com/ansible-collections/community.general/pull/4288, https://github.com/ansible-collections/community.general/issues/4259).
|
||||
- gconftool2 - properly escape values when passing them to ``gconftool-2`` (https://github.com/ansible-collections/community.general/pull/4647).
|
||||
- git_branch - remove deprecated and unnecessary branch ``unprotect`` method (https://github.com/ansible-collections/community.general/pull/4496).
|
||||
- github_repo - ``private`` and ``description`` attributes should not be set to default values when the repo already exists (https://github.com/ansible-collections/community.general/pull/2386).
|
||||
- gitlab_group - improve searching for projects inside group on deletion (https://github.com/ansible-collections/community.general/pull/4491).
|
||||
@@ -212,6 +305,7 @@ Bugfixes
|
||||
- gitlab_group_variable - add missing documentation about GitLab versions that support ``environment_scope`` and ``variable_type`` (https://github.com/ansible-collections/community.general/pull/4038).
|
||||
- gitlab_group_variable - allow to set same variable name under different environment scopes. Due this change, the return value ``group_variable`` differs from previous version in check mode. It was counting ``updated`` values, because it was accidentally overwriting environment scopes (https://github.com/ansible-collections/community.general/pull/4038).
|
||||
- gitlab_group_variable - fix idempotent change behaviour for float and integer variables (https://github.com/ansible-collections/community.general/pull/4038).
|
||||
- gitlab_hook - avoid errors during idempotency check when an attribute does not exist (https://github.com/ansible-collections/community.general/pull/4668).
|
||||
- gitlab_hook - handle more than 20 hooks when finding a hook (https://github.com/ansible-collections/community.general/pull/4491).
|
||||
- gitlab_project - handle more than 20 namespaces when finding a namespace (https://github.com/ansible-collections/community.general/pull/4491).
|
||||
- gitlab_project_members - handle more than 20 projects and users when finding a project resp. user (https://github.com/ansible-collections/community.general/pull/4491).
|
||||
@@ -248,8 +342,11 @@ Bugfixes
|
||||
- nmcli - fixed falsely reported changed status when ``mtu`` is omitted with ``dummy`` connections (https://github.com/ansible-collections/community.general/issues/3612, https://github.com/ansible-collections/community.general/pull/3625).
|
||||
- nmcli - pass ``flags``, ``ingress``, ``egress`` params to ``nmcli`` (https://github.com/ansible-collections/community.general/issues/1086).
|
||||
- nrdp callback plugin - fix error ``string arguments without an encoding`` (https://github.com/ansible-collections/community.general/issues/3903).
|
||||
- onepassword - search all valid configuration locations and use the first found (https://github.com/ansible-collections/community.general/pull/4640).
|
||||
- opennebula inventory plugin - complete the implementation of ``constructable`` for opennebula inventory plugin. Now ``keyed_groups``, ``compose``, ``groups`` actually work (https://github.com/ansible-collections/community.general/issues/4497).
|
||||
- opentelemetry - fix generating a trace with a task containing ``no_log: true`` (https://github.com/ansible-collections/community.general/pull/4043).
|
||||
- opentelemetry callback plugin - fix task message attribute that is reported failed regardless of the task result (https://github.com/ansible-collections/community.general/pull/4624).
|
||||
- opentelemetry callback plugin - fix warning for the include_tasks (https://github.com/ansible-collections/community.general/pull/4623).
|
||||
- opentelemetry_plugin - honour ``ignore_errors`` when a task has failed instead of reporting an error (https://github.com/ansible-collections/community.general/pull/3837).
|
||||
- pacman - Use ``--groups`` instead of ``--group`` (https://github.com/ansible-collections/community.general/pull/4312).
|
||||
- pacman - fix URL based package installation (https://github.com/ansible-collections/community.general/pull/4286, https://github.com/ansible-collections/community.general/issues/4285).
|
||||
@@ -272,10 +369,12 @@ Bugfixes
|
||||
- proxmox_kvm - fix error when checking whether Proxmox VM exists (https://github.com/ansible-collections/community.general/pull/4287).
|
||||
- python_requirements_info - fails if version operator used without version (https://github.com/ansible-collections/community.general/pull/3785).
|
||||
- python_requirements_info - store ``mismatched`` return values per package as documented in the module (https://github.com/ansible-collections/community.general/pull/4078).
|
||||
- redfish_command - the iLO4 Redfish implementation only supports the ``image_url`` parameter in the underlying API calls to ``VirtualMediaInsert`` and ``VirtualMediaEject``. Any values set (or the defaults) for ``write_protected`` or ``inserted`` will be ignored (https://github.com/ansible-collections/community.general/pull/4596).
|
||||
- say callback plugin - replace deprecated ``distutils.spawn.find_executable`` with Ansible's ``get_bin_path`` to find the ``say`` resp. ``espeak`` executables (https://github.com/ansible-collections/community.general/pull/3934).
|
||||
- scaleway_user_data - fix double-quote added where no double-quote is needed to user data in scaleway's server (``Content-type`` -> ``Content-Type``) (https://github.com/ansible-collections/community.general/pull/3940).
|
||||
- slack - add ``charset`` to HTTP headers to avoid Slack API warning (https://github.com/ansible-collections/community.general/issues/3932).
|
||||
- terraform - fix command options being ignored during planned/plan in function ``build_plan`` such as ``lock`` or ``lock_timeout`` (https://github.com/ansible-collections/community.general/issues/3707, https://github.com/ansible-collections/community.general/pull/3726).
|
||||
- terraform - fix list initialization to support both Python 2 and Python 3 (https://github.com/ansible-collections/community.general/issues/4531).
|
||||
- vdo - fix options error (https://github.com/ansible-collections/community.general/pull/4163).
|
||||
- xattr - fix exception caused by ``_run_xattr()`` raising a ``ValueError`` due to a mishandling of base64-encoded value (https://github.com/ansible-collections/community.general/issues/3673).
|
||||
- xbps - fix error message that is reported when installing packages fails (https://github.com/ansible-collections/community.general/pull/4438).
|
||||
@@ -284,6 +383,7 @@ Bugfixes
|
||||
- yarn - fix missing ``~`` expansion in yarn global install folder which resulted in incorrect task status (https://github.com/ansible-collections/community.general/issues/4045, https://github.com/ansible-collections/community.general/pull/4048).
|
||||
- yum_versionlock - fix matching of existing entries with names passed to the module. Match yum and dnf lock format (https://github.com/ansible-collections/community.general/pull/4183).
|
||||
- zone connection plugin - replace deprecated ``distutils.spawn.find_executable`` with Ansible's ``get_bin_path`` to find the executable (https://github.com/ansible-collections/community.general/pull/3934).
|
||||
- zypper - fix undefined variable when running in check mode (https://github.com/ansible-collections/community.general/pull/4667).
|
||||
- zypper - fixed bug that caused zypper to always report [ok] and do nothing on ``state=present`` when all packages in ``name`` had a version specification (https://github.com/ansible-collections/community.general/issues/4371, https://github.com/ansible-collections/community.general/pull/4421).
|
||||
|
||||
Known Issues
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Community General Collection
|
||||
|
||||
[](https://dev.azure.com/ansible/community.general/_build?definitionId=31)
|
||||
[](https://dev.azure.com/ansible/community.general/_build?definitionId=31)
|
||||
[](https://codecov.io/gh/ansible-collections/community.general)
|
||||
|
||||
This repository contains the `community.general` Ansible Collection. The collection is a part of the Ansible package and includes many modules and plugins supported by Ansible community which are not part of more specialized community collections.
|
||||
@@ -110,7 +110,7 @@ See the [Releasing guidelines](https://github.com/ansible/community-docs/blob/ma
|
||||
|
||||
## Release notes
|
||||
|
||||
See the [changelog](https://github.com/ansible-collections/community.general/blob/main/CHANGELOG.rst).
|
||||
See the [changelog](https://github.com/ansible-collections/community.general/blob/stable-5/CHANGELOG.rst).
|
||||
|
||||
## Roadmap
|
||||
|
||||
|
||||
@@ -1,5 +1,80 @@
|
||||
ancestor: 4.0.0
|
||||
releases:
|
||||
5.0.0:
|
||||
changes:
|
||||
breaking_changes:
|
||||
- lists_mergeby and groupby_as_dict filter plugins - adjust filter plugin filename.
|
||||
This change is not visible to end-users, it only affects possible other collections
|
||||
importing Python paths (https://github.com/ansible-collections/community.general/pull/4625).
|
||||
- yarn - remove unsupported and unnecessary ``--no-emoji`` flag (https://github.com/ansible-collections/community.general/pull/4662).
|
||||
bugfixes:
|
||||
- consul - fixed bug where class ``ConsulService`` was overwriting the field
|
||||
``checks``, preventing the addition of checks to a service (https://github.com/ansible-collections/community.general/pull/4590).
|
||||
- gconftool2 - properly escape values when passing them to ``gconftool-2`` (https://github.com/ansible-collections/community.general/pull/4647).
|
||||
- gitlab_hook - avoid errors during idempotency check when an attribute does
|
||||
not exist (https://github.com/ansible-collections/community.general/pull/4668).
|
||||
- onepassword - search all valid configuration locations and use the first found
|
||||
(https://github.com/ansible-collections/community.general/pull/4640).
|
||||
- opentelemetry callback plugin - fix task message attribute that is reported
|
||||
failed regardless of the task result (https://github.com/ansible-collections/community.general/pull/4624).
|
||||
- opentelemetry callback plugin - fix warning for the include_tasks (https://github.com/ansible-collections/community.general/pull/4623).
|
||||
- redfish_command - the iLO4 Redfish implementation only supports the ``image_url``
|
||||
parameter in the underlying API calls to ``VirtualMediaInsert`` and ``VirtualMediaEject``.
|
||||
Any values set (or the defaults) for ``write_protected`` or ``inserted`` will
|
||||
be ignored (https://github.com/ansible-collections/community.general/pull/4596).
|
||||
- terraform - fix list initialization to support both Python 2 and Python 3
|
||||
(https://github.com/ansible-collections/community.general/issues/4531).
|
||||
- zypper - fix undefined variable when running in check mode (https://github.com/ansible-collections/community.general/pull/4667).
|
||||
deprecated_features:
|
||||
- ansible_galaxy_install - deprecated support for ``ansible`` 2.9 and ``ansible-base``
|
||||
2.10 (https://github.com/ansible-collections/community.general/pull/4601).
|
||||
- dig lookup plugin - the ``DLV`` record type has been decommissioned in 2017
|
||||
and support for it will be removed from community.general 6.0.0 (https://github.com/ansible-collections/community.general/pull/4618).
|
||||
minor_changes:
|
||||
- ModuleHelper module utils - ``ModuleHelperBase` now delegates the attributes
|
||||
``check_mode``, ``get_bin_path``, ``warn``, and ``deprecate`` to the underlying
|
||||
``AnsibleModule`` instance (https://github.com/ansible-collections/community.general/pull/4600).
|
||||
- ModuleHelper module utils - ``ModuleHelperBase`` now has a convenience method
|
||||
``do_raise`` (https://github.com/ansible-collections/community.general/pull/4660).
|
||||
- ipa_dnsrecord - add new argument ``record_values``, mutually exclusive to
|
||||
``record_value``, which supports multiple values for one record (https://github.com/ansible-collections/community.general/pull/4578).
|
||||
- pritunl_user - add ``mac_addresses`` parameter (https://github.com/ansible-collections/community.general/pull/4535).
|
||||
- rax_files_objects - minor refactoring improving code quality (https://github.com/ansible-collections/community.general/pull/4649).
|
||||
- redfish_* modules - the contents of ``@Message.ExtendedInfo`` will be returned
|
||||
as a string in the event that ``@Message.ExtendedInfo.Messages`` does not
|
||||
exist. This is likely more useful than the standard HTTP error (https://github.com/ansible-collections/community.general/pull/4596).
|
||||
- to_time_unit filter plugins - the time filters has been extended to also allow
|
||||
``0`` as input (https://github.com/ansible-collections/community.general/pull/4612).
|
||||
- vmadm - minor refactoring and improvement on the module (https://github.com/ansible-collections/community.general/pull/4581).
|
||||
- vmadm - minor refactoring and improvement on the module (https://github.com/ansible-collections/community.general/pull/4648).
|
||||
- zfs - minor refactoring in the code (https://github.com/ansible-collections/community.general/pull/4650).
|
||||
release_summary: This is release 5.0.0 of ``community.general``, released on
|
||||
2022-05-17.
|
||||
fragments:
|
||||
- 4065-onepassword-config.yml
|
||||
- 4535-pritunl-add-mac_addresses-parameter.yml
|
||||
- 4578-ipa_dnsrecord-add_multiple_record_support.yml
|
||||
- 4581-vmadm-improvements.yaml
|
||||
- 4590-consul-fix-service-checks.yaml
|
||||
- 4595-fix-VirtualMediaInsert-iLO4.yml
|
||||
- 4600-mh-delegate.yaml
|
||||
- 4601-ansible-galaxy-install-deprecate-ansible29-and-210.yaml
|
||||
- 4612-time_filter_zero.yml
|
||||
- 4618-dig-dlv.yml
|
||||
- 4621-terraform-py2-compat.yml
|
||||
- 4623-opentelemetry_bug_fix_include_tasks.yml
|
||||
- 4624-opentelemetry_bug_fix_hardcoded_value.yml
|
||||
- 4625-fix-filter-filenames.yml
|
||||
- 4647-gconftool2-command-arg.yaml
|
||||
- 4648-vmadm-improvements-2.yaml
|
||||
- 4649-rax-files-objects-improvements.yaml
|
||||
- 4650-zfs-improvements.yaml
|
||||
- 4651-zypper-checkmode-fix.yaml
|
||||
- 4660-mh-added-do-raise.yaml
|
||||
- 4662-yarn-emoji.yml
|
||||
- 4668-gitlab_hook-use-None-for-non-existent-attr.yml
|
||||
- 5.0.0.yml
|
||||
release_date: '2022-05-17'
|
||||
5.0.0-a1:
|
||||
changes:
|
||||
breaking_changes:
|
||||
@@ -680,3 +755,93 @@ releases:
|
||||
name: counter
|
||||
namespace: null
|
||||
release_date: '2022-04-29'
|
||||
5.0.1:
|
||||
changes:
|
||||
bugfixes:
|
||||
- consul - fixed bug introduced in PR 4590 (https://github.com/ansible-collections/community.general/issues/4680).
|
||||
- filesystem - handle ``fatresize --info`` output lines without ``:`` (https://github.com/ansible-collections/community.general/pull/4700).
|
||||
- filesystem - improve error messages when output cannot be parsed by including
|
||||
newlines in escaped form (https://github.com/ansible-collections/community.general/pull/4700).
|
||||
- keycloak_realm - fix default groups and roles (https://github.com/ansible-collections/community.general/issues/4241).
|
||||
- redis* modules - fix call to ``module.fail_json`` when failing because of
|
||||
missing Python libraries (https://github.com/ansible-collections/community.general/pull/4733).
|
||||
- xcc_redfish_command - for compatibility due to Redfish spec changes the virtualMedia
|
||||
resource location changed from Manager to System (https://github.com/ansible-collections/community.general/pull/4682).
|
||||
- zfs - fix wrong quoting of properties (https://github.com/ansible-collections/community.general/issues/4707,
|
||||
https://github.com/ansible-collections/community.general/pull/4726).
|
||||
minor_changes:
|
||||
- cpanm - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
|
||||
modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
- mksysb - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
|
||||
modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
- pipx - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
|
||||
modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
- snap - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
|
||||
modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
- xfconf - using ``do_raise()`` to raise exceptions in ``ModuleHelper`` derived
|
||||
modules (https://github.com/ansible-collections/community.general/pull/4674).
|
||||
release_summary: Regular bugfix release for inclusion in Ansible 6.0.0.
|
||||
fragments:
|
||||
- 4674-use-mh-raise.yaml
|
||||
- 4682-compatibility-virtualmedia-resource-location.yaml
|
||||
- 4700-code-changes.yml
|
||||
- 4712-consul-bugfix.yaml
|
||||
- 4719-fix-keycloak-realm.yaml
|
||||
- 4726-zfs.yml
|
||||
- 4733-redis-fail.yml
|
||||
- 5.0.1.yml
|
||||
release_date: '2022-05-30'
|
||||
5.0.2:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Include ``simplified_bsd.txt`` license file for various module utils, the
|
||||
``lxca_common`` docs fragment, and the ``utm_utils`` unit tests.
|
||||
release_summary: Maintenance and bugfix release for Ansible 6.0.0.
|
||||
fragments:
|
||||
- 5.0.2.yml
|
||||
- simplified-bsd-license.yml
|
||||
release_date: '2022-06-06'
|
||||
5.1.0:
|
||||
changes:
|
||||
deprecated_features:
|
||||
- cmd_runner module utils - deprecated ``fmt`` in favour of ``cmd_runner_fmt``
|
||||
as the parameter format object (https://github.com/ansible-collections/community.general/pull/4777).
|
||||
minor_changes:
|
||||
- ModuleHelper module utils - improved ``ModuleHelperException``, using ``to_native()``
|
||||
for the exception message (https://github.com/ansible-collections/community.general/pull/4755).
|
||||
- alternatives - add ``state=absent`` to be able to remove an alternative (https://github.com/ansible-collections/community.general/pull/4654).
|
||||
- alternatives - add ``subcommands`` parameter (https://github.com/ansible-collections/community.general/pull/4654).
|
||||
- ansible_galaxy_install - minor refactoring using latest ``ModuleHelper`` updates
|
||||
(https://github.com/ansible-collections/community.general/pull/4752).
|
||||
- cmd_runner module util - added parameters ``check_mode_skip`` and ``check_mode_return``
|
||||
to ``CmdRunner.context()``, so that the command is not executed when ``check_mode=True``
|
||||
(https://github.com/ansible-collections/community.general/pull/4736).
|
||||
- nmcli - adds ``vpn`` type and parameter for supporting VPN with service type
|
||||
L2TP and PPTP (https://github.com/ansible-collections/community.general/pull/4746).
|
||||
- proxmox inventory plugin - added new flag ``qemu_extended_statuses`` and new
|
||||
groups ``<group_prefix>prelaunch``, ``<group_prefix>paused``. They will be
|
||||
populated only when ``want_facts=true``, ``qemu_extended_statuses=true`` and
|
||||
only for ``QEMU`` machines (https://github.com/ansible-collections/community.general/pull/4723).
|
||||
- puppet - adds ``confdir`` parameter to configure a custom confir location
|
||||
(https://github.com/ansible-collections/community.general/pull/4740).
|
||||
- xfconf - changed implementation to use ``cmd_runner`` (https://github.com/ansible-collections/community.general/pull/4776).
|
||||
- xfconf module utils - created new module util ``xfconf`` providing a ``cmd_runner``
|
||||
specific for ``xfconf`` modules (https://github.com/ansible-collections/community.general/pull/4776).
|
||||
- xfconf_info - changed implementation to use ``cmd_runner`` (https://github.com/ansible-collections/community.general/pull/4776).
|
||||
release_summary: Regular bugfix and feature release.
|
||||
fragments:
|
||||
- 4654-alternatives-add-subcommands.yml
|
||||
- 4724-proxmox-qemu-extend.yaml
|
||||
- 4736-cmd-runner-skip-if-check.yml
|
||||
- 4740-puppet-feature.yaml
|
||||
- 4746-add-vpn-support-nmcli.yaml
|
||||
- 4752-ansible-galaxy-install-mh-updates.yml
|
||||
- 4755-mhexception-improvement.yml
|
||||
- 4776-xfconf-cmd-runner.yaml
|
||||
- 4777-cmd-runner-deprecate-fmt.yaml
|
||||
- 5.1.0.yml
|
||||
modules:
|
||||
- description: Retrieve GConf configurations
|
||||
name: gconftool2_info
|
||||
namespace: system
|
||||
release_date: '2022-06-07'
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- onepassword - search all valid configuration locations and use the first found (https://github.com/ansible-collections/community.general/pull/4640).
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
minor_changes:
|
||||
- pritunl_user - add ``mac_addresses`` parameter (https://github.com/ansible-collections/community.general/pull/4535).
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
minor_changes:
|
||||
- ipa_dnsrecord - add new argument ``record_values``, mutually exclusive to ``record_value``, which supports multiple values for one record (https://github.com/ansible-collections/community.general/pull/4578).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- vmadm - minor refactoring and improvement on the module (https://github.com/ansible-collections/community.general/pull/4581).
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- consul - fixed bug where class ``ConsulService`` was overwriting the field ``checks``, preventing the addition of checks to a service (https://github.com/ansible-collections/community.general/pull/4590).
|
||||
@@ -1,10 +0,0 @@
|
||||
bugfixes:
|
||||
- redfish_command - the iLO4 Redfish implementation only supports the ``image_url`` parameter in
|
||||
the underlying API calls to ``VirtualMediaInsert`` and ``VirtualMediaEject``. Any values set
|
||||
(or the defaults) for ``write_protected`` or ``inserted`` will be ignored
|
||||
(https://github.com/ansible-collections/community.general/pull/4596).
|
||||
minor_changes:
|
||||
- redfish_* modules - the contents of ``@Message.ExtendedInfo`` will be returned as a string in the event
|
||||
that ``@Message.ExtendedInfo.Messages`` does not exist. This is likely more useful than the
|
||||
standard HTTP error
|
||||
(https://github.com/ansible-collections/community.general/pull/4596).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- ModuleHelper module utils - ``ModuleHelperBase` now delegates the attributes ``check_mode``, ``get_bin_path``, ``warn``, and ``deprecate`` to the underlying ``AnsibleModule`` instance (https://github.com/ansible-collections/community.general/pull/4600).
|
||||
@@ -1,2 +0,0 @@
|
||||
deprecated_features:
|
||||
- ansible_galaxy_install - deprecated support for ``ansible`` 2.9 and ``ansible-base`` 2.10 (https://github.com/ansible-collections/community.general/pull/4601).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- to_time_unit filter plugins - the time filters has been extended to also allow ``0`` as input (https://github.com/ansible-collections/community.general/pull/4612).
|
||||
@@ -1,2 +0,0 @@
|
||||
deprecated_features:
|
||||
- "dig lookup plugin - the ``DLV`` record type has been decommissioned in 2017 and support for it will be removed from community.general 6.0.0 (https://github.com/ansible-collections/community.general/pull/4618)."
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- terraform - fix list initialization to support both Python 2 and Python 3 (https://github.com/ansible-collections/community.general/issues/4531).
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- opentelemetry callback plugin - fix warning for the include_tasks (https://github.com/ansible-collections/community.general/pull/4623).
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- opentelemetry callback plugin - fix task message attribute that is reported failed regardless of the task result (https://github.com/ansible-collections/community.general/pull/4624).
|
||||
@@ -1,2 +0,0 @@
|
||||
breaking_changes:
|
||||
- "lists_mergeby and groupby_as_dict filter plugins - adjust filter plugin filename. This change is not visible to end-users, it only affects possible other collections importing Python paths (https://github.com/ansible-collections/community.general/pull/4625)."
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- gconftool2 - properly escape values when passing them to ``gconftool-2`` (https://github.com/ansible-collections/community.general/pull/4647).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- vmadm - minor refactoring and improvement on the module (https://github.com/ansible-collections/community.general/pull/4648).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- rax_files_objects - minor refactoring improving code quality (https://github.com/ansible-collections/community.general/pull/4649).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- zfs - minor refactoring in the code (https://github.com/ansible-collections/community.general/pull/4650).
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- zypper - fix undefined variable when running in check mode (https://github.com/ansible-collections/community.general/pull/4667).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- ModuleHelper module utils - ``ModuleHelperBase`` now has a convenience method ``do_raise`` (https://github.com/ansible-collections/community.general/pull/4660).
|
||||
@@ -1,2 +0,0 @@
|
||||
breaking_changes:
|
||||
- yarn - remove unsupported and unnecessary ``--no-emoji`` flag (https://github.com/ansible-collections/community.general/pull/4662).
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- gitlab_hook - avoid errors during idempotency check when an attribute does not exist (https://github.com/ansible-collections/community.general/pull/4668).
|
||||
@@ -1 +0,0 @@
|
||||
release_summary: This is release 5.0.0 of ``community.general``, released on 2022-05-17.
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace: community
|
||||
name: general
|
||||
version: 5.0.0
|
||||
version: 5.1.0
|
||||
readme: README.md
|
||||
authors:
|
||||
- Ansible (https://github.com/ansible)
|
||||
|
||||
@@ -292,6 +292,8 @@ plugin_routing:
|
||||
redirect: community.google.gce_tag
|
||||
gconftool2:
|
||||
redirect: community.general.system.gconftool2
|
||||
gconftool2_info:
|
||||
redirect: community.general.system.gconftool2_info
|
||||
gcp_backend_service:
|
||||
tombstone:
|
||||
removal_version: 2.0.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2017 Lenovo, Inc.
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -92,9 +92,21 @@ DOCUMENTATION = '''
|
||||
default: proxmox_
|
||||
type: str
|
||||
want_facts:
|
||||
description: Gather LXC/QEMU configuration facts.
|
||||
description:
|
||||
- Gather LXC/QEMU configuration facts.
|
||||
- When I(want_facts) is set to C(true) more details about QEMU VM status are possible, besides the running and stopped states.
|
||||
Currently if the VM is running and it is suspended, the status will be running and the machine will be in C(running) group,
|
||||
but its actual state will be paused. See I(qemu_extended_statuses) for how to retrieve the real status.
|
||||
default: no
|
||||
type: bool
|
||||
qemu_extended_statuses:
|
||||
description:
|
||||
- Requires I(want_facts) to be set to C(true) to function. This will allow you to differentiate betweend C(paused) and C(prelaunch)
|
||||
statuses of the QEMU VMs.
|
||||
- This introduces multiple groups [prefixed with I(group_prefix)] C(prelaunch) and C(paused).
|
||||
default: no
|
||||
type: bool
|
||||
version_added: 5.1.0
|
||||
want_proxmox_nodes_ansible_host:
|
||||
version_added: 3.0.0
|
||||
description:
|
||||
@@ -431,6 +443,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
def _get_vm_status(self, properties, node, vmid, vmtype, name):
|
||||
ret = self._get_json("%s/api2/json/nodes/%s/%s/%s/status/current" % (self.proxmox_url, node, vmtype, vmid))
|
||||
properties[self._fact('status')] = ret['status']
|
||||
properties[self._fact('qmpstatus')] = ret['qmpstatus']
|
||||
|
||||
def _get_vm_snapshots(self, properties, node, vmid, vmtype, name):
|
||||
ret = self._get_json("%s/api2/json/nodes/%s/%s/%s/snapshot" % (self.proxmox_url, node, vmtype, vmid))
|
||||
@@ -489,7 +502,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
name, vmid = item['name'], item['vmid']
|
||||
|
||||
# get status, config and snapshots if want_facts == True
|
||||
if self.get_option('want_facts'):
|
||||
want_facts = self.get_option('want_facts')
|
||||
if want_facts:
|
||||
self._get_vm_status(properties, node, vmid, ittype, name)
|
||||
self._get_vm_config(properties, node, vmid, ittype, name)
|
||||
self._get_vm_snapshots(properties, node, vmid, ittype, name)
|
||||
@@ -503,10 +517,13 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
node_type_group = self._group('%s_%s' % (node, ittype))
|
||||
self.inventory.add_child(self._group('all_' + ittype), name)
|
||||
self.inventory.add_child(node_type_group, name)
|
||||
if item['status'] == 'stopped':
|
||||
self.inventory.add_child(self._group('all_stopped'), name)
|
||||
elif item['status'] == 'running':
|
||||
self.inventory.add_child(self._group('all_running'), name)
|
||||
|
||||
item_status = item['status']
|
||||
if item_status == 'running':
|
||||
if want_facts and ittype == 'qemu' and self.get_option('qemu_extended_statuses'):
|
||||
# get more details about the status of the qemu VM
|
||||
item_status = properties.get(self._fact('qmpstatus'), item_status)
|
||||
self.inventory.add_child(self._group('all_%s' % (item_status, )), name)
|
||||
|
||||
return name
|
||||
|
||||
@@ -528,10 +545,14 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
def _populate(self):
|
||||
|
||||
# create common groups
|
||||
self.inventory.add_group(self._group('all_lxc'))
|
||||
self.inventory.add_group(self._group('all_qemu'))
|
||||
self.inventory.add_group(self._group('all_running'))
|
||||
self.inventory.add_group(self._group('all_stopped'))
|
||||
default_groups = ['lxc', 'qemu', 'running', 'stopped']
|
||||
|
||||
if self.get_option('qemu_extended_statuses'):
|
||||
default_groups.extend(['prelaunch', 'paused'])
|
||||
|
||||
for group in default_groups:
|
||||
self.inventory.add_group(self._group('all_%s' % (group)))
|
||||
|
||||
nodes_group = self._group('nodes')
|
||||
self.inventory.add_group(nodes_group)
|
||||
|
||||
@@ -621,6 +642,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
if proxmox_password is None and (proxmox_token_id is None or proxmox_token_secret is None):
|
||||
raise AnsibleError('You must specify either a password or both token_id and token_secret.')
|
||||
|
||||
if self.get_option('qemu_extended_statuses') and not self.get_option('want_facts'):
|
||||
raise AnsibleError('You must set want_facts to True if you want to use qemu_extended_statuses.')
|
||||
|
||||
self.cache_key = self.get_cache_key(path)
|
||||
self.use_cache = cache and self.get_option('cache')
|
||||
self.host_filters = self.get_option('filters')
|
||||
|
||||
@@ -18,7 +18,7 @@ DOCUMENTATION = '''
|
||||
'''
|
||||
|
||||
EXAMPLES = """
|
||||
- name : output secrets to screen (BAD IDEA)
|
||||
- name: output secrets to screen (BAD IDEA)
|
||||
ansible.builtin.debug:
|
||||
msg: "Password: {{item}}"
|
||||
with_community.general.keyring:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (c) 2017-present Alibaba Group Holding Limited. He Guimin <heguimin36@163.com>
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -197,7 +197,7 @@ class CmdRunner(object):
|
||||
if mod_param_name not in self.arg_formats:
|
||||
self.arg_formats[mod_param_name] = _Format.as_default_type(spec['type'], mod_param_name)
|
||||
|
||||
def context(self, args_order=None, output_process=None, ignore_value_none=True, **kwargs):
|
||||
def context(self, args_order=None, output_process=None, ignore_value_none=True, check_mode_skip=False, check_mode_return=None, **kwargs):
|
||||
if output_process is None:
|
||||
output_process = _process_as_is
|
||||
if args_order is None:
|
||||
@@ -209,18 +209,22 @@ class CmdRunner(object):
|
||||
return _CmdRunnerContext(runner=self,
|
||||
args_order=args_order,
|
||||
output_process=output_process,
|
||||
ignore_value_none=ignore_value_none, **kwargs)
|
||||
ignore_value_none=ignore_value_none,
|
||||
check_mode_skip=check_mode_skip,
|
||||
check_mode_return=check_mode_return, **kwargs)
|
||||
|
||||
def has_arg_format(self, arg):
|
||||
return arg in self.arg_formats
|
||||
|
||||
|
||||
class _CmdRunnerContext(object):
|
||||
def __init__(self, runner, args_order, output_process, ignore_value_none, **kwargs):
|
||||
def __init__(self, runner, args_order, output_process, ignore_value_none, check_mode_skip, check_mode_return, **kwargs):
|
||||
self.runner = runner
|
||||
self.args_order = tuple(args_order)
|
||||
self.output_process = output_process
|
||||
self.ignore_value_none = ignore_value_none
|
||||
self.check_mode_skip = check_mode_skip
|
||||
self.check_mode_return = check_mode_return
|
||||
self.run_command_args = dict(kwargs)
|
||||
|
||||
self.environ_update = runner.environ_update
|
||||
@@ -260,6 +264,8 @@ class _CmdRunnerContext(object):
|
||||
except Exception as e:
|
||||
raise FormatError(arg_name, value, runner.arg_formats[arg_name], e)
|
||||
|
||||
if self.check_mode_skip and module.check_mode:
|
||||
return self.check_mode_return
|
||||
results = module.run_command(self.cmd, **self.run_command_args)
|
||||
self.results_rc, self.results_out, self.results_err = results
|
||||
self.results_processed = self.output_process(*results)
|
||||
@@ -288,4 +294,12 @@ class _CmdRunnerContext(object):
|
||||
return False
|
||||
|
||||
|
||||
fmt = _Format()
|
||||
cmd_runner_fmt = _Format()
|
||||
|
||||
#
|
||||
# The fmt form is deprecated and will be removed in community.general 7.0.0
|
||||
# Please use:
|
||||
# cmd_runner_fmt
|
||||
# Or, to retain the same effect, use:
|
||||
# from ansible_collections.community.general.plugins.module_utils.cmd_runner import cmd_runner_fmt as fmt
|
||||
fmt = cmd_runner_fmt
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright: (c) 2019 Gregory Thiemonge <gregory.thiemonge@gmail.com>
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
26
plugins/module_utils/gconftool2.py
Normal file
26
plugins/module_utils/gconftool2.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2022, Alexei Znamensky <russoz@gmail.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt as fmt
|
||||
|
||||
|
||||
def gconftool2_runner(module, **kwargs):
|
||||
return CmdRunner(
|
||||
module,
|
||||
command='gconftool-2',
|
||||
arg_formats=dict(
|
||||
key=fmt.as_list(),
|
||||
value_type=fmt.as_opt_val("--type"),
|
||||
value=fmt.as_list(),
|
||||
direct=fmt.as_bool("--direct"),
|
||||
config_source=fmt.as_opt_val("--config-source"),
|
||||
get=fmt.as_bool("--get"),
|
||||
set_arg=fmt.as_bool("--set"),
|
||||
unset=fmt.as_bool("--unset"),
|
||||
),
|
||||
**kwargs
|
||||
)
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright: (c) 2018, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c), Google Inc, 2017
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or
|
||||
# Simplified BSD License (see simplified_bsd.txt or
|
||||
# https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) 2018 IBM CORPORATION
|
||||
# Author(s): Tzur Eliyahu <tzure@il.ibm.com>
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: (c) 2017, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (c) 2016 Thomas Krahn (@Nosmoht)
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (c), Luke Murphy @decentral1se
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# still belong to the author of the module, and may assign their own license
|
||||
# to the complete work.
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# still belong to the author of the module, and may assign their own license
|
||||
# to the complete work.
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (c) 2018, Simon Weald <ansible@simonweald.com>
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
|
||||
class ModuleHelperException(Exception):
|
||||
@staticmethod
|
||||
def _get_remove(key, kwargs):
|
||||
if key in kwargs:
|
||||
result = kwargs[key]
|
||||
del kwargs[key]
|
||||
return result
|
||||
return None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.msg = self._get_remove('msg', kwargs) or "Module failed with exception: {0}".format(self)
|
||||
self.update_output = self._get_remove('update_output', kwargs) or {}
|
||||
def __init__(self, msg, update_output=None, *args, **kwargs):
|
||||
self.msg = to_native(msg or "Module failed with exception: {0}".format(self))
|
||||
if update_output is None:
|
||||
update_output = {}
|
||||
self.update_output = update_output
|
||||
super(ModuleHelperException, self).__init__(*args)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
||||
# Copyright: (c) 2020, Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# still belong to the author of the module, and may assign their own license
|
||||
# to the complete work.
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (2016-2017) Hewlett Packard Enterprise Development LP
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright 2018 www.privaz.io Valletech AB
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# to the complete work.
|
||||
#
|
||||
# Copyright (c), Simon Dodsley <simon@purestorage.com>,2017
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright (c), James Laska
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -37,7 +37,7 @@ def fail_imports(module, needs_certifi=True):
|
||||
errors.append(missing_required_lib('certifi'))
|
||||
traceback.append(CERTIFI_IMPORT_ERROR)
|
||||
if errors:
|
||||
module.fail_json(errors=errors, traceback='\n'.join(traceback))
|
||||
module.fail_json(msg='\n'.join(errors), traceback='\n'.join(traceback))
|
||||
|
||||
|
||||
def redis_auth_argument_spec(tls_default=True):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# own license to the complete work.
|
||||
#
|
||||
# Copyright (C) 2017 Lenovo, Inc.
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
#
|
||||
# Contains LXCA common class
|
||||
# Lenovo xClarity Administrator (LXCA)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# Copyright: (c) 2020, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru>
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2018 Luca 'remix_tj' Lorenzetto
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright: (c) 2018, Hewlett Packard Enterprise Development LP
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# Copyright (c) 2016, Adfinis SyGroup AG
|
||||
# Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch>
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Copyright: (c) 2018, Johannes Brunswicker <johannes.brunswicker@gmail.com>
|
||||
#
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright: (c) 2019, Sandeep Kasargod <sandeep@vexata.com>
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
37
plugins/module_utils/xfconf.py
Normal file
37
plugins/module_utils/xfconf.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2022, Alexei Znamensky <russoz@gmail.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt as fmt
|
||||
|
||||
|
||||
@fmt.unpack_args
|
||||
def _values_fmt(values, value_types):
|
||||
result = []
|
||||
for value, value_type in zip(values, value_types):
|
||||
if value_type == 'bool':
|
||||
value = boolean(value)
|
||||
result.extend(['--type', '{0}'.format(value_type), '--set', '{0}'.format(value)])
|
||||
return result
|
||||
|
||||
|
||||
def xfconf_runner(module, **kwargs):
|
||||
runner = CmdRunner(
|
||||
module,
|
||||
command='xfconf-query',
|
||||
arg_formats=dict(
|
||||
channel=fmt.as_opt_val("--channel"),
|
||||
property=fmt.as_opt_val("--property"),
|
||||
force_array=fmt.as_bool("--force-array"),
|
||||
reset=fmt.as_bool("--reset"),
|
||||
create=fmt.as_bool("--create"),
|
||||
list_arg=fmt.as_bool("--list"),
|
||||
values_and_types=fmt.as_func(_values_fmt),
|
||||
),
|
||||
**kwargs
|
||||
)
|
||||
return runner
|
||||
@@ -333,7 +333,7 @@ def add_service(module, service):
|
||||
service_id=result.id,
|
||||
service_name=result.name,
|
||||
service_port=result.port,
|
||||
checks=[check.to_dict() for check in service.checks],
|
||||
checks=[check.to_dict() for check in service.checks()],
|
||||
tags=result.tags)
|
||||
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ options:
|
||||
aliases:
|
||||
- defaultGroups
|
||||
type: list
|
||||
elements: dict
|
||||
elements: str
|
||||
default_locale:
|
||||
description:
|
||||
- The realm default locale.
|
||||
@@ -183,7 +183,7 @@ options:
|
||||
aliases:
|
||||
- defaultRoles
|
||||
type: list
|
||||
elements: dict
|
||||
elements: str
|
||||
default_signature_algorithm:
|
||||
description:
|
||||
- The realm default signature algorithm.
|
||||
@@ -622,10 +622,10 @@ def main():
|
||||
client_authentication_flow=dict(type='str', aliases=['clientAuthenticationFlow']),
|
||||
client_scope_mappings=dict(type='dict', aliases=['clientScopeMappings']),
|
||||
default_default_client_scopes=dict(type='list', elements='str', aliases=['defaultDefaultClientScopes']),
|
||||
default_groups=dict(type='list', elements='dict', aliases=['defaultGroups']),
|
||||
default_groups=dict(type='list', elements='str', aliases=['defaultGroups']),
|
||||
default_locale=dict(type='str', aliases=['defaultLocale']),
|
||||
default_optional_client_scopes=dict(type='list', elements='str', aliases=['defaultOptionalClientScopes']),
|
||||
default_roles=dict(type='list', elements='dict', aliases=['defaultRoles']),
|
||||
default_roles=dict(type='list', elements='str', aliases=['defaultRoles']),
|
||||
default_signature_algorithm=dict(type='str', aliases=['defaultSignatureAlgorithm']),
|
||||
direct_grant_flow=dict(type='str', aliases=['directGrantFlow']),
|
||||
display_name=dict(type='str', aliases=['displayName']),
|
||||
|
||||
@@ -45,8 +45,8 @@ options:
|
||||
- The interface to bind the connection to.
|
||||
- The connection will only be applicable to this interface name.
|
||||
- A special value of C('*') can be used for interface-independent connections.
|
||||
- The ifname argument is mandatory for all connection types except bond, team, bridge and vlan.
|
||||
- This parameter defaults to C(conn_name) when left unset.
|
||||
- The ifname argument is mandatory for all connection types except bond, team, bridge, vlan and vpn.
|
||||
- This parameter defaults to C(conn_name) when left unset for all connection types except vpn that removes it.
|
||||
type: str
|
||||
type:
|
||||
description:
|
||||
@@ -55,10 +55,11 @@ options:
|
||||
- Type C(generic) is added in Ansible 2.5.
|
||||
- Type C(infiniband) is added in community.general 2.0.0.
|
||||
- Type C(gsm) is added in community.general 3.7.0.
|
||||
- Type C(wireguard) is added in community.general 4.3.0
|
||||
- Type C(wireguard) is added in community.general 4.3.0.
|
||||
- Type C(vpn) is added in community.general 5.1.0.
|
||||
type: str
|
||||
choices: [ bond, bond-slave, bridge, bridge-slave, dummy, ethernet, generic, gre, infiniband, ipip, sit, team, team-slave, vlan, vxlan, wifi, gsm,
|
||||
wireguard ]
|
||||
wireguard, vpn ]
|
||||
mode:
|
||||
description:
|
||||
- This is the type of device or network connection that you wish to create for a bond or bridge.
|
||||
@@ -157,8 +158,8 @@ options:
|
||||
version_added: 2.0.0
|
||||
dns4:
|
||||
description:
|
||||
- A list of up to 3 dns servers.
|
||||
- IPv4 format e.g. to add two IPv4 DNS server addresses, use C(192.0.2.53 198.51.100.53).
|
||||
- A list of up to 3 DNS servers.
|
||||
- The entries must be IPv4 addresses, for example C(192.0.2.53).
|
||||
elements: str
|
||||
type: list
|
||||
dns4_search:
|
||||
@@ -255,8 +256,8 @@ options:
|
||||
version_added: 4.4.0
|
||||
dns6:
|
||||
description:
|
||||
- A list of up to 3 dns servers.
|
||||
- IPv6 format e.g. to add two IPv6 DNS server addresses, use C(2001:4860:4860::8888 2001:4860:4860::8844).
|
||||
- A list of up to 3 DNS servers.
|
||||
- The entries must be IPv6 addresses, for example C(2001:4860:4860::8888).
|
||||
elements: str
|
||||
type: list
|
||||
dns6_search:
|
||||
@@ -905,6 +906,58 @@ options:
|
||||
description: C(NMSettingSecretFlags) indicating how to handle the I(wireguard.private-key) property.
|
||||
type: int
|
||||
choices: [ 0, 1, 2 ]
|
||||
vpn:
|
||||
description:
|
||||
- Configuration of a VPN connection (PPTP and L2TP).
|
||||
- In order to use L2TP you need to be sure that C(network-manager-l2tp) - and C(network-manager-l2tp-gnome)
|
||||
if host has UI - are installed on the host.
|
||||
type: dict
|
||||
version_added: 5.1.0
|
||||
suboptions:
|
||||
permissions:
|
||||
description: User that will have permission to use the connection.
|
||||
type: str
|
||||
required: true
|
||||
service-type:
|
||||
description: This defines the service type of connection.
|
||||
type: str
|
||||
required: true
|
||||
choices: [ pptp, l2tp ]
|
||||
gateway:
|
||||
description: The gateway to connection. It can be an IP address (for example C(192.0.2.1))
|
||||
or a FQDN address (for example C(vpn.example.com)).
|
||||
type: str
|
||||
required: true
|
||||
password-flags:
|
||||
description:
|
||||
- NMSettingSecretFlags indicating how to handle the I(password) property.
|
||||
- 'Following choices are allowed:
|
||||
C(0) B(NONE): The system is responsible for providing and storing this secret (default);
|
||||
C(1) B(AGENT_OWNED): A user secret agent is responsible for providing and storing this secret; when it is required agents will be
|
||||
asked to retrieve it;
|
||||
C(2) B(NOT_SAVED): This secret should not be saved, but should be requested from the user each time it is needed;
|
||||
C(4) B(NOT_REQUIRED): In situations where it cannot be automatically determined that the secret is required
|
||||
(some VPNs and PPP providers do not require all secrets) this flag indicates that the specific secret is not required.'
|
||||
type: int
|
||||
choices: [ 0, 1, 2 , 4 ]
|
||||
default: 0
|
||||
user:
|
||||
description: Username provided by VPN administrator.
|
||||
type: str
|
||||
required: true
|
||||
ipsec-enabled:
|
||||
description:
|
||||
- Enable or disable IPSec tunnel to L2TP host.
|
||||
- This option is need when C(service-type) is C(l2tp).
|
||||
type: bool
|
||||
choices: [ yes, no ]
|
||||
ipsec-psk:
|
||||
description:
|
||||
- The pre-shared key in base64 encoding.
|
||||
- >
|
||||
You can encode using this Ansible jinja2 expression: C("0s{{ '[YOUR PRE-SHARED KEY]' | ansible.builtin.b64encode }}").
|
||||
- This is only used when I(ipsec-enabled=true).
|
||||
type: str
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
@@ -1288,6 +1341,23 @@ EXAMPLES = r'''
|
||||
autoconnect: true
|
||||
state: present
|
||||
|
||||
- name: >-
|
||||
Create a VPN L2TP connection for ansible_user to connect on vpn.example.com
|
||||
authenticating with user 'brittany' and pre-shared key as 'Brittany123'
|
||||
community.general.nmcli:
|
||||
type: vpn
|
||||
conn_name: my-vpn-connection
|
||||
vpn:
|
||||
permissions: "{{ ansible_user }}"
|
||||
service-type: l2tp
|
||||
gateway: vpn.example.com
|
||||
password-flags: 2
|
||||
user: brittany
|
||||
ipsec-enabled: true
|
||||
ipsec-psk: "0s{{ 'Brittany123' | ansible.builtin.b64encode }}"
|
||||
autoconnect: false
|
||||
state: present
|
||||
|
||||
'''
|
||||
|
||||
RETURN = r"""#
|
||||
@@ -1404,6 +1474,7 @@ class Nmcli(object):
|
||||
self.wifi_sec = module.params['wifi_sec']
|
||||
self.gsm = module.params['gsm']
|
||||
self.wireguard = module.params['wireguard']
|
||||
self.vpn = module.params['vpn']
|
||||
|
||||
if self.method4:
|
||||
self.ipv4_method = self.method4
|
||||
@@ -1592,6 +1663,29 @@ class Nmcli(object):
|
||||
options.update({
|
||||
'wireguard.%s' % name: value,
|
||||
})
|
||||
elif self.type == 'vpn':
|
||||
if self.vpn:
|
||||
vpn_data_values = ''
|
||||
for name, value in self.vpn.items():
|
||||
if name == 'service-type':
|
||||
options.update({
|
||||
'vpn-type': value,
|
||||
})
|
||||
elif name == 'permissions':
|
||||
options.update({
|
||||
'connection.permissions': value,
|
||||
})
|
||||
else:
|
||||
if vpn_data_values != '':
|
||||
vpn_data_values += ', '
|
||||
|
||||
if isinstance(value, bool):
|
||||
value = self.bool_to_string(value)
|
||||
|
||||
vpn_data_values += '%s=%s' % (name, value)
|
||||
options.update({
|
||||
'vpn.data': vpn_data_values,
|
||||
})
|
||||
# Convert settings values based on the situation.
|
||||
for setting, value in options.items():
|
||||
setting_type = self.settings_type(setting)
|
||||
@@ -1832,6 +1926,10 @@ class Nmcli(object):
|
||||
'connection.interface-name': ifname,
|
||||
}
|
||||
|
||||
# VPN doesn't need an interface but if sended it must be a valid interface.
|
||||
if self.type == 'vpn' and self.ifname is None:
|
||||
del options['connection.interface-name']
|
||||
|
||||
options.update(self.connection_options())
|
||||
|
||||
# Constructing the command.
|
||||
@@ -1997,6 +2095,9 @@ class Nmcli(object):
|
||||
current_value = current_value.strip('"')
|
||||
if key == self.mtu_setting and self.mtu is None:
|
||||
self.mtu = 0
|
||||
if key == 'vpn.data':
|
||||
current_value = list(map(str.strip, current_value.split(',')))
|
||||
value = list(map(str.strip, value.split(',')))
|
||||
else:
|
||||
# parameter does not exist
|
||||
current_value = None
|
||||
@@ -2025,6 +2126,10 @@ class Nmcli(object):
|
||||
'connection.interface-name': self.ifname,
|
||||
}
|
||||
|
||||
# VPN doesn't need an interface but if sended it must be a valid interface.
|
||||
if self.type == 'vpn' and self.ifname is None:
|
||||
del options['connection.interface-name']
|
||||
|
||||
if not self.type:
|
||||
current_con_type = self.show_connection().get('connection.type')
|
||||
if current_con_type:
|
||||
@@ -2064,6 +2169,7 @@ def main():
|
||||
'wifi',
|
||||
'gsm',
|
||||
'wireguard',
|
||||
'vpn',
|
||||
]),
|
||||
ip4=dict(type='list', elements='str'),
|
||||
gw4=dict(type='str'),
|
||||
@@ -2163,6 +2269,7 @@ def main():
|
||||
wifi_sec=dict(type='dict', no_log=True),
|
||||
gsm=dict(type='dict'),
|
||||
wireguard=dict(type='dict'),
|
||||
vpn=dict(type='dict'),
|
||||
),
|
||||
mutually_exclusive=[['never_default4', 'gw4'],
|
||||
['routes4_extended', 'routes4'],
|
||||
|
||||
@@ -226,7 +226,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
|
||||
check_rc = True
|
||||
|
||||
def _get_ansible_galaxy_version(self):
|
||||
ansible_galaxy = self.module.get_bin_path("ansible-galaxy", required=True)
|
||||
ansible_galaxy = self.get_bin_path("ansible-galaxy", required=True)
|
||||
dummy, out, dummy = self.module.run_command([ansible_galaxy, "--version"], check_rc=True)
|
||||
line = out.splitlines()[0]
|
||||
match = self._RE_GALAXY_VERSION.match(line)
|
||||
@@ -302,9 +302,9 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
|
||||
self.vars.set("new_roles", {})
|
||||
self.vars.set("ansible29_change", False, change=True, output=False)
|
||||
if not (self.vars.ack_ansible29 or self.vars.ack_min_ansiblecore211):
|
||||
self.module.warn("Ansible 2.9 or older: unable to retrieve lists of roles and collections already installed")
|
||||
self.warn("Ansible 2.9 or older: unable to retrieve lists of roles and collections already installed")
|
||||
if self.vars.requirements_file is not None and self.vars.type == 'both':
|
||||
self.module.warn("Ansible 2.9 or older: will install only roles from requirement files")
|
||||
self.warn("Ansible 2.9 or older: will install only roles from requirement files")
|
||||
|
||||
def _setup210plus(self):
|
||||
self.vars.set("new_collections", {}, change=True)
|
||||
|
||||
@@ -134,7 +134,7 @@ EXAMPLES = '''
|
||||
import os
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
||||
ModuleHelper, CmdMixin, ArgFormat, ModuleHelperException
|
||||
ModuleHelper, CmdMixin, ArgFormat
|
||||
)
|
||||
|
||||
|
||||
@@ -171,10 +171,10 @@ class CPANMinus(CmdMixin, ModuleHelper):
|
||||
v = self.vars
|
||||
if v.mode == "compatibility":
|
||||
if v.name_check:
|
||||
raise ModuleHelperException("Parameter name_check can only be used with mode=new")
|
||||
self.do_raise("Parameter name_check can only be used with mode=new")
|
||||
else:
|
||||
if v.name and v.from_path:
|
||||
raise ModuleHelperException("Parameters 'name' and 'from_path' are mutually exclusive when 'mode=new'")
|
||||
self.do_raise("Parameters 'name' and 'from_path' are mutually exclusive when 'mode=new'")
|
||||
|
||||
self.command = self.module.get_bin_path(v.executable if v.executable else self.command)
|
||||
self.vars.set("binary", self.command)
|
||||
@@ -190,17 +190,16 @@ class CPANMinus(CmdMixin, ModuleHelper):
|
||||
|
||||
return rc == 0
|
||||
|
||||
@staticmethod
|
||||
def sanitize_pkg_spec_version(pkg_spec, version):
|
||||
def sanitize_pkg_spec_version(self, pkg_spec, version):
|
||||
if version is None:
|
||||
return pkg_spec
|
||||
if pkg_spec.endswith('.tar.gz'):
|
||||
raise ModuleHelperException(msg="parameter 'version' must not be used when installing from a file")
|
||||
self.do_raise(msg="parameter 'version' must not be used when installing from a file")
|
||||
if os.path.isdir(pkg_spec):
|
||||
raise ModuleHelperException(msg="parameter 'version' must not be used when installing from a directory")
|
||||
self.do_raise(msg="parameter 'version' must not be used when installing from a directory")
|
||||
if pkg_spec.endswith('.git'):
|
||||
if version.startswith('~'):
|
||||
raise ModuleHelperException(msg="operator '~' not allowed in version parameter when installing from git repository")
|
||||
self.do_raise(msg="operator '~' not allowed in version parameter when installing from git repository")
|
||||
version = version if version.startswith('@') else '@' + version
|
||||
elif version[0] not in ('@', '~'):
|
||||
version = '~' + version
|
||||
@@ -228,7 +227,7 @@ class CPANMinus(CmdMixin, ModuleHelper):
|
||||
|
||||
def process_command_output(self, rc, out, err):
|
||||
if self.vars.mode == "compatibility" and rc != 0:
|
||||
raise ModuleHelperException(msg=err, cmd=self.vars.cmd_args)
|
||||
self.do_raise(msg=err, cmd=self.vars.cmd_args)
|
||||
return 'is up to date' not in err and 'is up to date' not in out
|
||||
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ EXAMPLES = '''
|
||||
import json
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
||||
CmdStateModuleHelper, ArgFormat, ModuleHelperException
|
||||
CmdStateModuleHelper, ArgFormat
|
||||
)
|
||||
from ansible.module_utils.facts.compat import ansible_facts
|
||||
|
||||
@@ -153,9 +153,8 @@ class PipX(CmdStateModuleHelper):
|
||||
module = dict(
|
||||
argument_spec=dict(
|
||||
state=dict(type='str', default='install',
|
||||
choices=[
|
||||
'present', 'absent', 'install', 'uninstall', 'uninstall_all',
|
||||
'inject', 'upgrade', 'upgrade_all', 'reinstall', 'reinstall_all']),
|
||||
choices=['present', 'absent', 'install', 'uninstall', 'uninstall_all',
|
||||
'inject', 'upgrade', 'upgrade_all', 'reinstall', 'reinstall_all']),
|
||||
name=dict(type='str'),
|
||||
source=dict(type='str'),
|
||||
install_deps=dict(type='bool', default=False),
|
||||
@@ -247,8 +246,7 @@ class PipX(CmdStateModuleHelper):
|
||||
|
||||
def state_upgrade(self):
|
||||
if not self.vars.application:
|
||||
raise ModuleHelperException(
|
||||
"Trying to upgrade a non-existent application: {0}".format(self.vars.name))
|
||||
self.do_raise("Trying to upgrade a non-existent application: {0}".format(self.vars.name))
|
||||
if self.vars.force:
|
||||
self.changed = True
|
||||
if not self.module.check_mode:
|
||||
@@ -262,16 +260,14 @@ class PipX(CmdStateModuleHelper):
|
||||
|
||||
def state_reinstall(self):
|
||||
if not self.vars.application:
|
||||
raise ModuleHelperException(
|
||||
"Trying to reinstall a non-existent application: {0}".format(self.vars.name))
|
||||
self.do_raise("Trying to reinstall a non-existent application: {0}".format(self.vars.name))
|
||||
self.changed = True
|
||||
if not self.module.check_mode:
|
||||
self.run_command(params=['state', 'name', 'python'])
|
||||
|
||||
def state_inject(self):
|
||||
if not self.vars.application:
|
||||
raise ModuleHelperException(
|
||||
"Trying to inject packages into a non-existent application: {0}".format(self.vars.name))
|
||||
self.do_raise("Trying to inject packages into a non-existent application: {0}".format(self.vars.name))
|
||||
if self.vars.force:
|
||||
self.changed = True
|
||||
if not self.module.check_mode:
|
||||
|
||||
@@ -147,7 +147,7 @@ import numbers
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
||||
CmdStateModuleHelper, ArgFormat, ModuleHelperException
|
||||
CmdStateModuleHelper, ArgFormat
|
||||
)
|
||||
|
||||
|
||||
@@ -218,8 +218,8 @@ class Snap(CmdStateModuleHelper):
|
||||
option_map = {}
|
||||
|
||||
if not isinstance(json_subtree, dict):
|
||||
raise ModuleHelperException("Non-dict non-leaf element encountered while parsing option map. "
|
||||
"The output format of 'snap set' may have changed. Aborting!")
|
||||
self.do_raise("Non-dict non-leaf element encountered while parsing option map. "
|
||||
"The output format of 'snap set' may have changed. Aborting!")
|
||||
|
||||
for key, value in json_subtree.items():
|
||||
full_key = key if prefix is None else prefix + "." + key
|
||||
@@ -252,7 +252,7 @@ class Snap(CmdStateModuleHelper):
|
||||
option_map = self.convert_json_to_map(out)
|
||||
|
||||
except Exception as e:
|
||||
raise ModuleHelperException(
|
||||
self.do_raise(
|
||||
msg="Parsing option map returned by 'snap get {0}' triggers exception '{1}', output:\n'{2}'".format(snap_name, str(e), out))
|
||||
|
||||
return option_map
|
||||
@@ -267,7 +267,7 @@ class Snap(CmdStateModuleHelper):
|
||||
result = out.splitlines()[1]
|
||||
match = self.__disable_re.match(result)
|
||||
if not match:
|
||||
raise ModuleHelperException(msg="Unable to parse 'snap list {0}' output:\n{1}".format(snap_name, out))
|
||||
self.do_raise(msg="Unable to parse 'snap list {0}' output:\n{1}".format(snap_name, out))
|
||||
notes = match.group('notes')
|
||||
return "disabled" not in notes.split(',')
|
||||
|
||||
@@ -300,7 +300,7 @@ class Snap(CmdStateModuleHelper):
|
||||
else:
|
||||
msg = "Ooops! Snap installation failed while executing '{cmd}', please examine logs and " \
|
||||
"error output for more details.".format(cmd=self.vars.cmd)
|
||||
raise ModuleHelperException(msg=msg)
|
||||
self.do_raise(msg=msg)
|
||||
|
||||
def state_present(self):
|
||||
|
||||
@@ -330,14 +330,14 @@ class Snap(CmdStateModuleHelper):
|
||||
|
||||
if not match:
|
||||
msg = "Cannot parse set option '{option_string}'".format(option_string=option_string)
|
||||
raise ModuleHelperException(msg)
|
||||
self.do_raise(msg)
|
||||
|
||||
snap_prefix = match.group("snap_prefix")
|
||||
selected_snap_name = snap_prefix[:-1] if snap_prefix else None
|
||||
|
||||
if selected_snap_name is not None and selected_snap_name not in self.vars.name:
|
||||
msg = "Snap option '{option_string}' refers to snap which is not in the list of snap names".format(option_string=option_string)
|
||||
raise ModuleHelperException(msg)
|
||||
self.do_raise(msg)
|
||||
|
||||
if selected_snap_name is None or (snap_name is not None and snap_name == selected_snap_name):
|
||||
key = match.group("key")
|
||||
@@ -360,11 +360,11 @@ class Snap(CmdStateModuleHelper):
|
||||
if rc != 0:
|
||||
if 'has no "configure" hook' in err:
|
||||
msg = "Snap '{snap}' does not have any configurable options".format(snap=snap_name)
|
||||
raise ModuleHelperException(msg)
|
||||
self.do_raise(msg)
|
||||
|
||||
msg = "Cannot set options '{options}' for snap '{snap}': error={error}".format(
|
||||
options=" ".join(options_changed), snap=snap_name, error=err)
|
||||
raise ModuleHelperException(msg)
|
||||
self.do_raise(msg)
|
||||
|
||||
if overall_options_changed:
|
||||
self.vars.options_changed = overall_options_changed
|
||||
@@ -385,7 +385,7 @@ class Snap(CmdStateModuleHelper):
|
||||
return
|
||||
msg = "Ooops! Snap operation failed while executing '{cmd}', please examine logs and " \
|
||||
"error output for more details.".format(cmd=self.vars.cmd)
|
||||
raise ModuleHelperException(msg=msg)
|
||||
self.do_raise(msg=msg)
|
||||
|
||||
def state_absent(self):
|
||||
self._generic_state_action(self.is_snap_installed, "snaps_removed", ['classic', 'channel', 'state'])
|
||||
|
||||
@@ -305,6 +305,8 @@ class XCCRedfishUtils(RedfishUtils):
|
||||
continue
|
||||
if 'RDOC' in uri:
|
||||
continue
|
||||
if 'Remote' in uri:
|
||||
continue
|
||||
# if ejected, 'Inserted' should be False and 'ImageName' cleared
|
||||
if (not data.get('Inserted', False) and
|
||||
not data.get('ImageName')):
|
||||
@@ -312,13 +314,19 @@ class XCCRedfishUtils(RedfishUtils):
|
||||
return None, None
|
||||
|
||||
def virtual_media_eject_one(self, image_url):
|
||||
# locate and read the VirtualMedia resources
|
||||
response = self.get_request(self.root_uri + self.manager_uri)
|
||||
# read the VirtualMedia resources from systems
|
||||
response = self.get_request(self.root_uri + self.systems_uri)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
data = response['data']
|
||||
if 'VirtualMedia' not in data:
|
||||
return {'ret': False, 'msg': "VirtualMedia resource not found"}
|
||||
# read the VirtualMedia resources from manager
|
||||
response = self.get_request(self.root_uri + self.manager_uri)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
data = response['data']
|
||||
if 'VirtualMedia' not in data:
|
||||
return {'ret': False, 'msg': "VirtualMedia resource not found"}
|
||||
virt_media_uri = data["VirtualMedia"]["@odata.id"]
|
||||
response = self.get_request(self.root_uri + virt_media_uri)
|
||||
if response['ret'] is False:
|
||||
@@ -379,13 +387,20 @@ class XCCRedfishUtils(RedfishUtils):
|
||||
return self.virtual_media_eject_one(image_url)
|
||||
|
||||
# eject all inserted media when no image_url specified
|
||||
# read all the VirtualMedia resources
|
||||
response = self.get_request(self.root_uri + self.manager_uri)
|
||||
# read the VirtualMedia resources from systems
|
||||
response = self.get_request(self.root_uri + self.systems_uri)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
data = response['data']
|
||||
if 'VirtualMedia' not in data:
|
||||
return {'ret': False, 'msg': "VirtualMedia resource not found"}
|
||||
# read the VirtualMedia resources from manager
|
||||
response = self.get_request(self.root_uri + self.manager_uri)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
data = response['data']
|
||||
if 'VirtualMedia' not in data:
|
||||
return {'ret': False, 'msg': "VirtualMedia resource not found"}
|
||||
# read all the VirtualMedia resources
|
||||
virt_media_uri = data["VirtualMedia"]["@odata.id"]
|
||||
response = self.get_request(self.root_uri + virt_media_uri)
|
||||
if response['ret'] is False:
|
||||
@@ -413,6 +428,95 @@ class XCCRedfishUtils(RedfishUtils):
|
||||
return {'ret': True, 'changed': True,
|
||||
'msg': "VirtualMedia %s ejected" % str(ejected_media_list)}
|
||||
|
||||
def virtual_media_insert(self, options):
|
||||
param_map = {
|
||||
'Inserted': 'inserted',
|
||||
'WriteProtected': 'write_protected',
|
||||
'UserName': 'username',
|
||||
'Password': 'password',
|
||||
'TransferProtocolType': 'transfer_protocol_type',
|
||||
'TransferMethod': 'transfer_method'
|
||||
}
|
||||
image_url = options.get('image_url')
|
||||
if not image_url:
|
||||
return {'ret': False,
|
||||
'msg': "image_url option required for VirtualMediaInsert"}
|
||||
media_types = options.get('media_types')
|
||||
|
||||
# read the VirtualMedia resources from systems
|
||||
response = self.get_request(self.root_uri + self.systems_uri)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
data = response['data']
|
||||
if 'VirtualMedia' not in data:
|
||||
# read the VirtualMedia resources from manager
|
||||
response = self.get_request(self.root_uri + self.manager_uri)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
data = response['data']
|
||||
if 'VirtualMedia' not in data:
|
||||
return {'ret': False, 'msg': "VirtualMedia resource not found"}
|
||||
virt_media_uri = data["VirtualMedia"]["@odata.id"]
|
||||
response = self.get_request(self.root_uri + virt_media_uri)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
data = response['data']
|
||||
virt_media_list = []
|
||||
for member in data[u'Members']:
|
||||
virt_media_list.append(member[u'@odata.id'])
|
||||
resources, headers = self._read_virt_media_resources(virt_media_list)
|
||||
|
||||
# see if image already inserted; if so, nothing to do
|
||||
if self._virt_media_image_inserted(resources, image_url):
|
||||
return {'ret': True, 'changed': False,
|
||||
'msg': "VirtualMedia '%s' already inserted" % image_url}
|
||||
|
||||
# find an empty slot to insert the media
|
||||
# try first with strict media_type matching
|
||||
uri, data = self._find_empty_virt_media_slot(
|
||||
resources, media_types, media_match_strict=True)
|
||||
if not uri:
|
||||
# if not found, try without strict media_type matching
|
||||
uri, data = self._find_empty_virt_media_slot(
|
||||
resources, media_types, media_match_strict=False)
|
||||
if not uri:
|
||||
return {'ret': False,
|
||||
'msg': "Unable to find an available VirtualMedia resource "
|
||||
"%s" % ('supporting ' + str(media_types)
|
||||
if media_types else '')}
|
||||
|
||||
# confirm InsertMedia action found
|
||||
if ('Actions' not in data or
|
||||
'#VirtualMedia.InsertMedia' not in data['Actions']):
|
||||
# try to insert via PATCH if no InsertMedia action found
|
||||
h = headers[uri]
|
||||
if 'allow' in h:
|
||||
methods = [m.strip() for m in h.get('allow').split(',')]
|
||||
if 'PATCH' not in methods:
|
||||
# if Allow header present and PATCH missing, return error
|
||||
return {'ret': False,
|
||||
'msg': "%s action not found and PATCH not allowed"
|
||||
% '#VirtualMedia.InsertMedia'}
|
||||
return self.virtual_media_insert_via_patch(options, param_map,
|
||||
uri, data)
|
||||
|
||||
# get the action property
|
||||
action = data['Actions']['#VirtualMedia.InsertMedia']
|
||||
if 'target' not in action:
|
||||
return {'ret': False,
|
||||
'msg': "target URI missing from Action "
|
||||
"#VirtualMedia.InsertMedia"}
|
||||
action_uri = action['target']
|
||||
# get ActionInfo or AllowableValues
|
||||
ai = self._get_all_action_info_values(action)
|
||||
# construct payload
|
||||
payload = self._insert_virt_media_payload(options, param_map, data, ai)
|
||||
# POST to action
|
||||
response = self.post_request(self.root_uri + action_uri, payload)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
return {'ret': True, 'changed': True, 'msg': "VirtualMedia inserted"}
|
||||
|
||||
def raw_get_resource(self, resource_uri):
|
||||
if resource_uri is None:
|
||||
return {'ret': False, 'msg': "resource_uri is missing"}
|
||||
@@ -640,7 +744,11 @@ def main():
|
||||
|
||||
# Organize by Categories / Commands
|
||||
if category == "Manager":
|
||||
# execute only if we find a Manager service resource
|
||||
# For virtual media resource locates on Systems service
|
||||
result = rf_utils._find_systems_resource()
|
||||
if result['ret'] is False:
|
||||
module.fail_json(msg=to_native(result['msg']))
|
||||
# For virtual media resource locates on Managers service
|
||||
result = rf_utils._find_managers_resource()
|
||||
if result['ret'] is False:
|
||||
module.fail_json(msg=to_native(result['msg']))
|
||||
|
||||
@@ -14,46 +14,46 @@ short_description: Manages Out-Of-Band controllers using iDRAC OEM Redfish APIs
|
||||
description:
|
||||
- Builds Redfish URIs locally and sends them to remote OOB controllers to
|
||||
perform an action.
|
||||
- For use with Dell iDRAC operations that require Redfish OEM extensions
|
||||
- For use with Dell iDRAC operations that require Redfish OEM extensions.
|
||||
options:
|
||||
category:
|
||||
required: true
|
||||
description:
|
||||
- Category to execute on OOB controller
|
||||
- Category to execute on iDRAC.
|
||||
type: str
|
||||
command:
|
||||
required: true
|
||||
description:
|
||||
- List of commands to execute on OOB controller
|
||||
- List of commands to execute on iDRAC.
|
||||
type: list
|
||||
elements: str
|
||||
baseuri:
|
||||
required: true
|
||||
description:
|
||||
- Base URI of OOB controller
|
||||
- Base URI of iDRAC.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- User for authentication with OOB controller
|
||||
- Username for authenticating to iDRAC.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for authentication with OOB controller
|
||||
- Password for authenticating to iDRAC.
|
||||
type: str
|
||||
auth_token:
|
||||
description:
|
||||
- Security token for authentication with OOB controller
|
||||
- Security token for authenticating to iDRAC.
|
||||
type: str
|
||||
version_added: 2.3.0
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to OOB controller
|
||||
- Timeout in seconds for HTTP requests to iDRAC.
|
||||
default: 10
|
||||
type: int
|
||||
resource_id:
|
||||
required: false
|
||||
description:
|
||||
- The ID of the System, Manager or Chassis to modify
|
||||
- ID of the System, Manager or Chassis to modify.
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
|
||||
|
||||
@@ -20,50 +20,50 @@ options:
|
||||
required: true
|
||||
type: str
|
||||
description:
|
||||
- Category to execute on iDRAC
|
||||
- Category to execute on iDRAC.
|
||||
command:
|
||||
required: true
|
||||
description:
|
||||
- List of commands to execute on iDRAC
|
||||
- List of commands to execute on iDRAC.
|
||||
- I(SetManagerAttributes), I(SetLifecycleControllerAttributes) and
|
||||
I(SetSystemAttributes) are mutually exclusive commands when C(category)
|
||||
is I(Manager)
|
||||
is I(Manager).
|
||||
type: list
|
||||
elements: str
|
||||
baseuri:
|
||||
required: true
|
||||
description:
|
||||
- Base URI of iDRAC
|
||||
- Base URI of iDRAC.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- User for authentication with iDRAC
|
||||
- Username for authenticating to iDRAC.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for authentication with iDRAC
|
||||
- Password for authenticating to iDRAC.
|
||||
type: str
|
||||
auth_token:
|
||||
description:
|
||||
- Security token for authentication with OOB controller
|
||||
- Security token for authenticating to iDRAC.
|
||||
type: str
|
||||
version_added: 2.3.0
|
||||
manager_attributes:
|
||||
required: false
|
||||
description:
|
||||
- dictionary of iDRAC attribute name and value pairs to update
|
||||
- Dictionary of iDRAC attribute name and value pairs to update.
|
||||
default: {}
|
||||
type: 'dict'
|
||||
version_added: '0.2.0'
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to iDRAC controller
|
||||
- Timeout in seconds for HTTP requests to iDRAC.
|
||||
default: 10
|
||||
type: int
|
||||
resource_id:
|
||||
required: false
|
||||
description:
|
||||
- The ID of the System, Manager or Chassis to modify
|
||||
- ID of the System, Manager or Chassis to modify.
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
|
||||
|
||||
@@ -14,44 +14,44 @@ short_description: Gather PowerEdge server information through iDRAC using Redfi
|
||||
description:
|
||||
- Builds Redfish URIs locally and sends them to remote iDRAC controllers to
|
||||
get information back.
|
||||
- For use with Dell EMC iDRAC operations that require Redfish OEM extensions
|
||||
- For use with Dell EMC iDRAC operations that require Redfish OEM extensions.
|
||||
- This module was called C(idrac_redfish_facts) before Ansible 2.9, returning C(ansible_facts).
|
||||
Note that the M(community.general.idrac_redfish_info) module no longer returns C(ansible_facts)!
|
||||
options:
|
||||
category:
|
||||
required: true
|
||||
description:
|
||||
- Category to execute on iDRAC controller
|
||||
- Category to execute on iDRAC.
|
||||
type: str
|
||||
command:
|
||||
required: true
|
||||
description:
|
||||
- List of commands to execute on iDRAC controller
|
||||
- List of commands to execute on iDRAC.
|
||||
- C(GetManagerAttributes) returns the list of dicts containing iDRAC,
|
||||
LifecycleController and System attributes
|
||||
LifecycleController and System attributes.
|
||||
type: list
|
||||
elements: str
|
||||
baseuri:
|
||||
required: true
|
||||
description:
|
||||
- Base URI of iDRAC controller
|
||||
- Base URI of iDRAC.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- User for authentication with iDRAC controller
|
||||
- Username for authenticating to iDRAC.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for authentication with iDRAC controller
|
||||
- Password for authenticating to iDRAC.
|
||||
type: str
|
||||
auth_token:
|
||||
description:
|
||||
- Security token for authentication with OOB controller
|
||||
- Security token for authenticating to iDRAC.
|
||||
type: str
|
||||
version_added: 2.3.0
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to OOB controller
|
||||
- Timeout in seconds for HTTP requests to iDRAC.
|
||||
default: 10
|
||||
type: int
|
||||
|
||||
|
||||
@@ -34,19 +34,19 @@ options:
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- User for authentication with iLO.
|
||||
- Username for authenticating to iLO.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for authentication with iLO.
|
||||
- Password for authenticating to iLO.
|
||||
type: str
|
||||
auth_token:
|
||||
description:
|
||||
- Security token for authentication with OOB controller.
|
||||
- Security token for authenticating to iLO.
|
||||
type: str
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to iLO controller.
|
||||
- Timeout in seconds for HTTP requests to iLO.
|
||||
default: 10
|
||||
type: int
|
||||
attribute_name:
|
||||
@@ -82,6 +82,17 @@ EXAMPLES = '''
|
||||
password: Testpass123
|
||||
attribute_name: TimeZone
|
||||
attribute_value: Chennai
|
||||
|
||||
- name: Set NTP Servers
|
||||
community.general.ilo_redfish_config:
|
||||
category: Manager
|
||||
command: SetNTPServers
|
||||
baseuri: 15.X.X.X
|
||||
username: Admin
|
||||
password: Testpass123
|
||||
attribute_name: StaticNTPServers
|
||||
attribute_value: X.X.X.X
|
||||
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
||||
@@ -34,19 +34,19 @@ options:
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- User for authentication with iLO.
|
||||
- Username for authenticating to iLO.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for authentication with iLO.
|
||||
- Password for authenticating to iLO.
|
||||
type: str
|
||||
auth_token:
|
||||
description:
|
||||
- Security token for authentication with iLO.
|
||||
- Security token for authenticating to iLO.
|
||||
type: str
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to iLO.
|
||||
- Timeout in seconds for HTTP requests to iLO.
|
||||
default: 10
|
||||
type: int
|
||||
author:
|
||||
|
||||
@@ -21,35 +21,35 @@ options:
|
||||
category:
|
||||
required: true
|
||||
description:
|
||||
- Category to execute on OOB controller
|
||||
- Category to execute on OOB controller.
|
||||
type: str
|
||||
command:
|
||||
required: true
|
||||
description:
|
||||
- List of commands to execute on OOB controller
|
||||
- List of commands to execute on OOB controller.
|
||||
type: list
|
||||
elements: str
|
||||
baseuri:
|
||||
required: true
|
||||
description:
|
||||
- Base URI of OOB controller
|
||||
- Base URI of OOB controller.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- Username for authentication with OOB controller
|
||||
- Username for authenticating to OOB controller.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for authentication with OOB controller
|
||||
- Password for authenticating to OOB controller.
|
||||
type: str
|
||||
auth_token:
|
||||
description:
|
||||
- Security token for authentication with OOB controller
|
||||
- Security token for authenticating to OOB controller.
|
||||
type: str
|
||||
version_added: 2.3.0
|
||||
session_uri:
|
||||
description:
|
||||
- URI of the session resource
|
||||
- URI of the session resource.
|
||||
type: str
|
||||
version_added: 2.3.0
|
||||
id:
|
||||
@@ -63,28 +63,28 @@ options:
|
||||
required: false
|
||||
aliases: [ account_username ]
|
||||
description:
|
||||
- Username of account to add/delete/modify
|
||||
- Username of account to add/delete/modify.
|
||||
type: str
|
||||
new_password:
|
||||
required: false
|
||||
aliases: [ account_password ]
|
||||
description:
|
||||
- New password of account to add/modify
|
||||
- New password of account to add/modify.
|
||||
type: str
|
||||
roleid:
|
||||
required: false
|
||||
aliases: [ account_roleid ]
|
||||
description:
|
||||
- Role of account to add/modify
|
||||
- Role of account to add/modify.
|
||||
type: str
|
||||
bootdevice:
|
||||
required: false
|
||||
description:
|
||||
- bootdevice when setting boot configuration
|
||||
- Boot device when setting boot configuration.
|
||||
type: str
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to OOB controller
|
||||
- Timeout in seconds for HTTP requests to OOB controller.
|
||||
default: 10
|
||||
type: int
|
||||
boot_override_mode:
|
||||
@@ -96,117 +96,117 @@ options:
|
||||
uefi_target:
|
||||
required: false
|
||||
description:
|
||||
- UEFI target when bootdevice is "UefiTarget"
|
||||
- UEFI boot target when bootdevice is "UefiTarget".
|
||||
type: str
|
||||
boot_next:
|
||||
required: false
|
||||
description:
|
||||
- BootNext target when bootdevice is "UefiBootNext"
|
||||
- BootNext target when bootdevice is "UefiBootNext".
|
||||
type: str
|
||||
update_username:
|
||||
required: false
|
||||
aliases: [ account_updatename ]
|
||||
description:
|
||||
- new update user name for account_username
|
||||
- New user name for updating account_username.
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
account_properties:
|
||||
required: false
|
||||
description:
|
||||
- properties of account service to update
|
||||
- Properties of account service to update.
|
||||
type: dict
|
||||
version_added: '0.2.0'
|
||||
resource_id:
|
||||
required: false
|
||||
description:
|
||||
- The ID of the System, Manager or Chassis to modify
|
||||
- ID of the System, Manager or Chassis to modify.
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
update_image_uri:
|
||||
required: false
|
||||
description:
|
||||
- The URI of the image for the update
|
||||
- URI of the image for the update.
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
update_protocol:
|
||||
required: false
|
||||
description:
|
||||
- The protocol for the update
|
||||
- Protocol for the update.
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
update_targets:
|
||||
required: false
|
||||
description:
|
||||
- The list of target resource URIs to apply the update to
|
||||
- List of target resource URIs to apply the update to.
|
||||
type: list
|
||||
elements: str
|
||||
version_added: '0.2.0'
|
||||
update_creds:
|
||||
required: false
|
||||
description:
|
||||
- The credentials for retrieving the update image
|
||||
- Credentials for retrieving the update image.
|
||||
type: dict
|
||||
version_added: '0.2.0'
|
||||
suboptions:
|
||||
username:
|
||||
required: false
|
||||
description:
|
||||
- The username for retrieving the update image
|
||||
- Username for retrieving the update image.
|
||||
type: str
|
||||
password:
|
||||
required: false
|
||||
description:
|
||||
- The password for retrieving the update image
|
||||
- Password for retrieving the update image.
|
||||
type: str
|
||||
virtual_media:
|
||||
required: false
|
||||
description:
|
||||
- The options for VirtualMedia commands
|
||||
- Options for VirtualMedia commands.
|
||||
type: dict
|
||||
version_added: '0.2.0'
|
||||
suboptions:
|
||||
media_types:
|
||||
required: false
|
||||
description:
|
||||
- The list of media types appropriate for the image
|
||||
- List of media types appropriate for the image.
|
||||
type: list
|
||||
elements: str
|
||||
image_url:
|
||||
required: false
|
||||
description:
|
||||
- The URL od the image the insert or eject
|
||||
- URL of the image to insert or eject.
|
||||
type: str
|
||||
inserted:
|
||||
required: false
|
||||
description:
|
||||
- Indicates if the image is treated as inserted on command completion
|
||||
- Indicates that the image is treated as inserted on command completion.
|
||||
type: bool
|
||||
default: True
|
||||
write_protected:
|
||||
required: false
|
||||
description:
|
||||
- Indicates if the media is treated as write-protected
|
||||
- Indicates that the media is treated as write-protected.
|
||||
type: bool
|
||||
default: True
|
||||
username:
|
||||
required: false
|
||||
description:
|
||||
- The username for accessing the image URL
|
||||
- Username for accessing the image URL.
|
||||
type: str
|
||||
password:
|
||||
required: false
|
||||
description:
|
||||
- The password for accessing the image URL
|
||||
- Password for accessing the image URL.
|
||||
type: str
|
||||
transfer_protocol_type:
|
||||
required: false
|
||||
description:
|
||||
- The network protocol to use with the image
|
||||
- Network protocol to use with the image.
|
||||
type: str
|
||||
transfer_method:
|
||||
required: false
|
||||
description:
|
||||
- The transfer method to use with the image
|
||||
- Transfer method to use with the image.
|
||||
type: str
|
||||
strip_etag_quotes:
|
||||
description:
|
||||
|
||||
@@ -20,48 +20,48 @@ options:
|
||||
category:
|
||||
required: true
|
||||
description:
|
||||
- Category to execute on OOB controller
|
||||
- Category to execute on OOB controller.
|
||||
type: str
|
||||
command:
|
||||
required: true
|
||||
description:
|
||||
- List of commands to execute on OOB controller
|
||||
- List of commands to execute on OOB controller.
|
||||
type: list
|
||||
elements: str
|
||||
baseuri:
|
||||
required: true
|
||||
description:
|
||||
- Base URI of OOB controller
|
||||
- Base URI of OOB controller.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- User for authentication with OOB controller
|
||||
- Username for authenticating to OOB controller.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for authentication with OOB controller
|
||||
- Password for authenticating to OOB controller.
|
||||
type: str
|
||||
auth_token:
|
||||
description:
|
||||
- Security token for authentication with OOB controller
|
||||
- Security token for authenticating to OOB controller.
|
||||
type: str
|
||||
version_added: 2.3.0
|
||||
bios_attributes:
|
||||
required: false
|
||||
description:
|
||||
- dictionary of BIOS attributes to update
|
||||
- Dictionary of BIOS attributes to update.
|
||||
default: {}
|
||||
type: dict
|
||||
version_added: '0.2.0'
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to OOB controller
|
||||
- Timeout in seconds for HTTP requests to OOB controller.
|
||||
default: 10
|
||||
type: int
|
||||
boot_order:
|
||||
required: false
|
||||
description:
|
||||
- list of BootOptionReference strings specifying the BootOrder
|
||||
- List of BootOptionReference strings specifying the BootOrder.
|
||||
default: []
|
||||
type: list
|
||||
elements: str
|
||||
@@ -69,26 +69,26 @@ options:
|
||||
network_protocols:
|
||||
required: false
|
||||
description:
|
||||
- setting dict of manager services to update
|
||||
- Setting dict of manager services to update.
|
||||
type: dict
|
||||
version_added: '0.2.0'
|
||||
resource_id:
|
||||
required: false
|
||||
description:
|
||||
- The ID of the System, Manager or Chassis to modify
|
||||
- ID of the System, Manager or Chassis to modify.
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
nic_addr:
|
||||
required: false
|
||||
description:
|
||||
- EthernetInterface Address string on OOB controller
|
||||
- EthernetInterface Address string on OOB controller.
|
||||
default: 'null'
|
||||
type: str
|
||||
version_added: '0.2.0'
|
||||
nic_config:
|
||||
required: false
|
||||
description:
|
||||
- setting dict of EthernetInterface on OOB controller
|
||||
- Setting dict of EthernetInterface on OOB controller.
|
||||
type: dict
|
||||
version_added: '0.2.0'
|
||||
strip_etag_quotes:
|
||||
|
||||
@@ -21,37 +21,37 @@ options:
|
||||
category:
|
||||
required: false
|
||||
description:
|
||||
- List of categories to execute on OOB controller
|
||||
- List of categories to execute on OOB controller.
|
||||
default: ['Systems']
|
||||
type: list
|
||||
elements: str
|
||||
command:
|
||||
required: false
|
||||
description:
|
||||
- List of commands to execute on OOB controller
|
||||
- List of commands to execute on OOB controller.
|
||||
type: list
|
||||
elements: str
|
||||
baseuri:
|
||||
required: true
|
||||
description:
|
||||
- Base URI of OOB controller
|
||||
- Base URI of OOB controller.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- User for authentication with OOB controller
|
||||
- Username for authenticating to OOB controller.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for authentication with OOB controller
|
||||
- Password for authenticating to OOB controller.
|
||||
type: str
|
||||
auth_token:
|
||||
description:
|
||||
- Security token for authentication with OOB controller
|
||||
- Security token for authenticating to OOB controller.
|
||||
type: str
|
||||
version_added: 2.3.0
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to OOB controller
|
||||
- Timeout in seconds for HTTP requests to OOB controller.
|
||||
default: 10
|
||||
type: int
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ class Zfs(object):
|
||||
elif prop == 'volblocksize':
|
||||
cmd += ['-b', value]
|
||||
else:
|
||||
cmd += ['-o', '%s="%s"' % (prop, value)]
|
||||
cmd += ['-o', '%s=%s' % (prop, value)]
|
||||
if origin and action == 'clone':
|
||||
cmd.append(origin)
|
||||
cmd.append(self.name)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
# Copyright: (c) 2014, Gabe Mulley <gabe.mulley@gmail.com>
|
||||
# Copyright: (c) 2015, David Wittman <dwittman@gmail.com>
|
||||
# Copyright: (c) 2022, Marius Rieder <marius.rieder@scs.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
@@ -17,6 +18,7 @@ description:
|
||||
- Manages symbolic links using the 'update-alternatives' tool.
|
||||
- Useful when multiple programs are installed but provide similar functionality (e.g. different editors).
|
||||
author:
|
||||
- Marius Rieder (@jiuka)
|
||||
- David Wittman (@DavidWittman)
|
||||
- Gabe Mulley (@mulby)
|
||||
options:
|
||||
@@ -47,10 +49,36 @@ options:
|
||||
not set it as the currently selected alternative for the group.
|
||||
- C(selected) - install the alternative (if not already installed), and
|
||||
set it as the currently selected alternative for the group.
|
||||
choices: [ present, selected ]
|
||||
- C(auto) - install the alternative (if not already installed), and
|
||||
set the group to auto mode. Added in community.general 5.1.0.
|
||||
- C(absent) - removes the alternative. Added in community.general 5.1.0.
|
||||
choices: [ present, selected, auto, absent ]
|
||||
default: selected
|
||||
type: str
|
||||
version_added: 4.8.0
|
||||
subcommands:
|
||||
description:
|
||||
- A list of subcommands.
|
||||
- Each subcommand needs a name, a link and a path parameter.
|
||||
type: list
|
||||
elements: dict
|
||||
aliases: ['slaves']
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- The generic name of the subcommand.
|
||||
type: str
|
||||
required: true
|
||||
path:
|
||||
description:
|
||||
- The path to the real executable that the subcommand should point to.
|
||||
type: path
|
||||
required: true
|
||||
link:
|
||||
description:
|
||||
- The path to the symbolic link that should point to the real subcommand executable.
|
||||
type: path
|
||||
version_added: 5.1.0
|
||||
requirements: [ update-alternatives ]
|
||||
'''
|
||||
|
||||
@@ -78,6 +106,23 @@ EXAMPLES = r'''
|
||||
path: /usr/bin/python3.5
|
||||
link: /usr/bin/python
|
||||
state: present
|
||||
|
||||
- name: Install Python 3.5 and reset selection to auto
|
||||
community.general.alternatives:
|
||||
name: python
|
||||
path: /usr/bin/python3.5
|
||||
link: /usr/bin/python
|
||||
state: auto
|
||||
|
||||
- name: keytool is a subcommand of java
|
||||
community.general.alternatives:
|
||||
name: java
|
||||
link: /usr/bin/java
|
||||
path: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
|
||||
subcommands:
|
||||
- name: keytool
|
||||
link: /usr/bin/keytool
|
||||
path: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
|
||||
'''
|
||||
|
||||
import os
|
||||
@@ -90,10 +135,235 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
class AlternativeState:
|
||||
PRESENT = "present"
|
||||
SELECTED = "selected"
|
||||
ABSENT = "absent"
|
||||
AUTO = "auto"
|
||||
|
||||
@classmethod
|
||||
def to_list(cls):
|
||||
return [cls.PRESENT, cls.SELECTED]
|
||||
return [cls.PRESENT, cls.SELECTED, cls.ABSENT, cls.AUTO]
|
||||
|
||||
|
||||
class AlternativesModule(object):
|
||||
_UPDATE_ALTERNATIVES = None
|
||||
|
||||
def __init__(self, module):
|
||||
self.module = module
|
||||
self.result = dict(changed=False, diff=dict(before=dict(), after=dict()))
|
||||
self.module.run_command_environ_update = {'LC_ALL': 'C'}
|
||||
self.messages = []
|
||||
self.run()
|
||||
|
||||
@property
|
||||
def mode_present(self):
|
||||
return self.module.params.get('state') in [AlternativeState.PRESENT, AlternativeState.SELECTED, AlternativeState.AUTO]
|
||||
|
||||
@property
|
||||
def mode_selected(self):
|
||||
return self.module.params.get('state') == AlternativeState.SELECTED
|
||||
|
||||
@property
|
||||
def mode_auto(self):
|
||||
return self.module.params.get('state') == AlternativeState.AUTO
|
||||
|
||||
def run(self):
|
||||
self.parse()
|
||||
|
||||
if self.mode_present:
|
||||
# Check if we need to (re)install
|
||||
subcommands_parameter = self.module.params['subcommands']
|
||||
if (
|
||||
self.path not in self.current_alternatives or
|
||||
self.current_alternatives[self.path].get('priority') != self.priority or
|
||||
(subcommands_parameter is not None and (
|
||||
not all(s in subcommands_parameter for s in self.current_alternatives[self.path].get('subcommands')) or
|
||||
not all(s in self.current_alternatives[self.path].get('subcommands') for s in subcommands_parameter)
|
||||
))
|
||||
):
|
||||
self.install()
|
||||
|
||||
# Check if we need to set the preference
|
||||
if self.mode_selected and self.current_path != self.path:
|
||||
self.set()
|
||||
|
||||
# Check if we need to reset to auto
|
||||
if self.mode_auto and self.current_mode == 'manual':
|
||||
self.auto()
|
||||
else:
|
||||
# Check if we need to uninstall
|
||||
if self.path in self.current_alternatives:
|
||||
self.remove()
|
||||
|
||||
self.result['msg'] = ' '.join(self.messages)
|
||||
self.module.exit_json(**self.result)
|
||||
|
||||
def install(self):
|
||||
if not os.path.exists(self.path):
|
||||
self.module.fail_json(msg="Specified path %s does not exist" % self.path)
|
||||
if not self.link:
|
||||
self.module.fail_json(msg='Needed to install the alternative, but unable to do so as we are missing the link')
|
||||
|
||||
cmd = [self.UPDATE_ALTERNATIVES, '--install', self.link, self.name, self.path, str(self.priority)]
|
||||
|
||||
if self.subcommands is not None:
|
||||
subcommands = [['--slave', subcmd['link'], subcmd['name'], subcmd['path']] for subcmd in self.subcommands]
|
||||
cmd += [item for sublist in subcommands for item in sublist]
|
||||
|
||||
self.result['changed'] = True
|
||||
self.messages.append("Install alternative '%s' for '%s'." % (self.path, self.name))
|
||||
|
||||
if not self.module.check_mode:
|
||||
self.module.run_command(cmd, check_rc=True)
|
||||
|
||||
if self.module._diff:
|
||||
self.result['diff']['after'] = dict(
|
||||
state=AlternativeState.PRESENT,
|
||||
path=self.path,
|
||||
priority=self.priority,
|
||||
link=self.link,
|
||||
)
|
||||
if self.subcommands:
|
||||
self.result['diff']['after'].update(dict(
|
||||
subcommands=self.subcommands
|
||||
))
|
||||
|
||||
def remove(self):
|
||||
cmd = [self.UPDATE_ALTERNATIVES, '--remove', self.name, self.path]
|
||||
self.result['changed'] = True
|
||||
self.messages.append("Remove alternative '%s' from '%s'." % (self.path, self.name))
|
||||
|
||||
if not self.module.check_mode:
|
||||
self.module.run_command(cmd, check_rc=True)
|
||||
|
||||
if self.module._diff:
|
||||
self.result['diff']['after'] = dict(state=AlternativeState.ABSENT)
|
||||
|
||||
def set(self):
|
||||
cmd = [self.UPDATE_ALTERNATIVES, '--set', self.name, self.path]
|
||||
self.result['changed'] = True
|
||||
self.messages.append("Set alternative '%s' for '%s'." % (self.path, self.name))
|
||||
|
||||
if not self.module.check_mode:
|
||||
self.module.run_command(cmd, check_rc=True)
|
||||
|
||||
if self.module._diff:
|
||||
self.result['diff']['after']['state'] = AlternativeState.SELECTED
|
||||
|
||||
def auto(self):
|
||||
cmd = [self.UPDATE_ALTERNATIVES, '--auto', self.name]
|
||||
self.messages.append("Set alternative to auto for '%s'." % (self.name))
|
||||
self.result['changed'] = True
|
||||
|
||||
if not self.module.check_mode:
|
||||
self.module.run_command(cmd, check_rc=True)
|
||||
|
||||
if self.module._diff:
|
||||
self.result['diff']['after']['state'] = AlternativeState.PRESENT
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.module.params.get('name')
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
return self.module.params.get('path')
|
||||
|
||||
@property
|
||||
def link(self):
|
||||
return self.module.params.get('link') or self.current_link
|
||||
|
||||
@property
|
||||
def priority(self):
|
||||
return self.module.params.get('priority')
|
||||
|
||||
@property
|
||||
def subcommands(self):
|
||||
if self.module.params.get('subcommands') is not None:
|
||||
return self.module.params.get('subcommands')
|
||||
elif self.path in self.current_alternatives and self.current_alternatives[self.path].get('subcommands'):
|
||||
return self.current_alternatives[self.path].get('subcommands')
|
||||
return None
|
||||
|
||||
@property
|
||||
def UPDATE_ALTERNATIVES(self):
|
||||
if self._UPDATE_ALTERNATIVES is None:
|
||||
self._UPDATE_ALTERNATIVES = self.module.get_bin_path('update-alternatives', True)
|
||||
return self._UPDATE_ALTERNATIVES
|
||||
|
||||
def parse(self):
|
||||
self.current_mode = None
|
||||
self.current_path = None
|
||||
self.current_link = None
|
||||
self.current_alternatives = {}
|
||||
|
||||
# Run `update-alternatives --display <name>` to find existing alternatives
|
||||
(rc, display_output, dummy) = self.module.run_command(
|
||||
[self.UPDATE_ALTERNATIVES, '--display', self.name]
|
||||
)
|
||||
|
||||
if rc != 0:
|
||||
self.module.debug("No current alternative found. '%s' exited with %s" % (self.UPDATE_ALTERNATIVES, rc))
|
||||
return
|
||||
|
||||
current_mode_regex = re.compile(r'\s-\s(?:status\sis\s)?(\w*)(?:\smode|.)$', re.MULTILINE)
|
||||
current_path_regex = re.compile(r'^\s*link currently points to (.*)$', re.MULTILINE)
|
||||
current_link_regex = re.compile(r'^\s*link \w+ is (.*)$', re.MULTILINE)
|
||||
subcmd_path_link_regex = re.compile(r'^\s*slave (\S+) is (.*)$', re.MULTILINE)
|
||||
|
||||
alternative_regex = re.compile(r'^(\/.*)\s-\s(?:family\s\S+\s)?priority\s(\d+)((?:\s+slave.*)*)', re.MULTILINE)
|
||||
subcmd_regex = re.compile(r'^\s+slave (.*): (.*)$', re.MULTILINE)
|
||||
|
||||
match = current_mode_regex.search(display_output)
|
||||
if not match:
|
||||
self.module.debug("No current mode found in output")
|
||||
return
|
||||
self.current_mode = match.group(1)
|
||||
|
||||
match = current_path_regex.search(display_output)
|
||||
if not match:
|
||||
self.module.debug("No current path found in output")
|
||||
else:
|
||||
self.current_path = match.group(1)
|
||||
|
||||
match = current_link_regex.search(display_output)
|
||||
if not match:
|
||||
self.module.debug("No current link found in output")
|
||||
else:
|
||||
self.current_link = match.group(1)
|
||||
|
||||
subcmd_path_map = dict(subcmd_path_link_regex.findall(display_output))
|
||||
if not subcmd_path_map and self.subcommands:
|
||||
subcmd_path_map = dict((s['name'], s['link']) for s in self.subcommands)
|
||||
|
||||
for path, prio, subcmd in alternative_regex.findall(display_output):
|
||||
self.current_alternatives[path] = dict(
|
||||
priority=int(prio),
|
||||
subcommands=[dict(
|
||||
name=name,
|
||||
path=spath,
|
||||
link=subcmd_path_map.get(name)
|
||||
) for name, spath in subcmd_regex.findall(subcmd) if spath != '(null)']
|
||||
)
|
||||
|
||||
if self.module._diff:
|
||||
if self.path in self.current_alternatives:
|
||||
self.result['diff']['before'].update(dict(
|
||||
state=AlternativeState.PRESENT,
|
||||
path=self.path,
|
||||
priority=self.current_alternatives[self.path].get('priority'),
|
||||
link=self.current_link,
|
||||
))
|
||||
if self.current_alternatives[self.path].get('subcommands'):
|
||||
self.result['diff']['before'].update(dict(
|
||||
subcommands=self.current_alternatives[self.path].get('subcommands')
|
||||
))
|
||||
if self.current_mode == 'manual' and self.current_path != self.path:
|
||||
self.result['diff']['before'].update(dict(
|
||||
state=AlternativeState.SELECTED
|
||||
))
|
||||
else:
|
||||
self.result['diff']['before'].update(dict(
|
||||
state=AlternativeState.ABSENT
|
||||
))
|
||||
|
||||
|
||||
def main():
|
||||
@@ -109,109 +379,16 @@ def main():
|
||||
choices=AlternativeState.to_list(),
|
||||
default=AlternativeState.SELECTED,
|
||||
),
|
||||
subcommands=dict(type='list', elements='dict', aliases=['slaves'], options=dict(
|
||||
name=dict(type='str', required=True),
|
||||
path=dict(type='path', required=True),
|
||||
link=dict(type='path'),
|
||||
)),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
params = module.params
|
||||
name = params['name']
|
||||
path = params['path']
|
||||
link = params['link']
|
||||
priority = params['priority']
|
||||
state = params['state']
|
||||
|
||||
UPDATE_ALTERNATIVES = module.get_bin_path('update-alternatives', True)
|
||||
|
||||
current_path = None
|
||||
all_alternatives = []
|
||||
|
||||
# Run `update-alternatives --display <name>` to find existing alternatives
|
||||
(rc, display_output, dummy) = module.run_command(
|
||||
['env', 'LC_ALL=C', UPDATE_ALTERNATIVES, '--display', name]
|
||||
)
|
||||
|
||||
if rc == 0:
|
||||
# Alternatives already exist for this link group
|
||||
# Parse the output to determine the current path of the symlink and
|
||||
# available alternatives
|
||||
current_path_regex = re.compile(r'^\s*link currently points to (.*)$',
|
||||
re.MULTILINE)
|
||||
alternative_regex = re.compile(r'^(\/.*)\s-\s(?:family\s\S+\s)?priority', re.MULTILINE)
|
||||
|
||||
match = current_path_regex.search(display_output)
|
||||
if match:
|
||||
current_path = match.group(1)
|
||||
all_alternatives = alternative_regex.findall(display_output)
|
||||
|
||||
if not link:
|
||||
# Read the current symlink target from `update-alternatives --query`
|
||||
# in case we need to install the new alternative before setting it.
|
||||
#
|
||||
# This is only compatible on Debian-based systems, as the other
|
||||
# alternatives don't have --query available
|
||||
rc, query_output, dummy = module.run_command(
|
||||
['env', 'LC_ALL=C', UPDATE_ALTERNATIVES, '--query', name]
|
||||
)
|
||||
if rc == 0:
|
||||
for line in query_output.splitlines():
|
||||
if line.startswith('Link:'):
|
||||
link = line.split()[1]
|
||||
break
|
||||
|
||||
changed = False
|
||||
if current_path != path:
|
||||
|
||||
# Check mode: expect a change if this alternative is not already
|
||||
# installed, or if it is to be set as the current selection.
|
||||
if module.check_mode:
|
||||
module.exit_json(
|
||||
changed=(
|
||||
path not in all_alternatives or
|
||||
state == AlternativeState.SELECTED
|
||||
),
|
||||
current_path=current_path,
|
||||
)
|
||||
|
||||
try:
|
||||
# install the requested path if necessary
|
||||
if path not in all_alternatives:
|
||||
if not os.path.exists(path):
|
||||
module.fail_json(msg="Specified path %s does not exist" % path)
|
||||
if not link:
|
||||
module.fail_json(msg="Needed to install the alternative, but unable to do so as we are missing the link")
|
||||
|
||||
module.run_command(
|
||||
[UPDATE_ALTERNATIVES, '--install', link, name, path, str(priority)],
|
||||
check_rc=True
|
||||
)
|
||||
changed = True
|
||||
|
||||
# set the current selection to this path (if requested)
|
||||
if state == AlternativeState.SELECTED:
|
||||
module.run_command(
|
||||
[UPDATE_ALTERNATIVES, '--set', name, path],
|
||||
check_rc=True
|
||||
)
|
||||
changed = True
|
||||
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
module.fail_json(msg=str(dir(cpe)))
|
||||
elif current_path == path and state == AlternativeState.PRESENT:
|
||||
# Case where alternative is currently selected, but state is set
|
||||
# to 'present'. In this case, we set to auto mode.
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True, current_path=current_path)
|
||||
|
||||
changed = True
|
||||
try:
|
||||
module.run_command(
|
||||
[UPDATE_ALTERNATIVES, '--auto', name],
|
||||
check_rc=True,
|
||||
)
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
module.fail_json(msg=str(dir(cpe)))
|
||||
|
||||
module.exit_json(changed=changed)
|
||||
AlternativesModule(module)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -268,7 +268,7 @@ class Ext(Filesystem):
|
||||
if None not in (block_size, block_count):
|
||||
break
|
||||
else:
|
||||
raise ValueError(out)
|
||||
raise ValueError(repr(out))
|
||||
|
||||
return block_size * block_count
|
||||
|
||||
@@ -319,7 +319,7 @@ class XFS(Filesystem):
|
||||
if None not in (block_size, block_count):
|
||||
break
|
||||
else:
|
||||
raise ValueError(out)
|
||||
raise ValueError(repr(out))
|
||||
|
||||
return block_size * block_count
|
||||
|
||||
@@ -364,7 +364,7 @@ class Btrfs(Filesystem):
|
||||
for line in stdout.splitlines():
|
||||
if "Device size" in line:
|
||||
return int(line.split()[-1])
|
||||
raise ValueError(stdout)
|
||||
raise ValueError(repr(stdout))
|
||||
|
||||
|
||||
class Ocfs2(Filesystem):
|
||||
@@ -405,7 +405,7 @@ class F2fs(Filesystem):
|
||||
if None not in (sector_size, sector_count):
|
||||
break
|
||||
else:
|
||||
raise ValueError(out)
|
||||
raise ValueError(repr(out))
|
||||
|
||||
return sector_size * sector_count
|
||||
|
||||
@@ -428,12 +428,15 @@ class VFAT(Filesystem):
|
||||
dummy, out, dummy = self.module.run_command([cmd, '--info', str(dev)], check_rc=True, environ_update=self.LANG_ENV)
|
||||
fssize = None
|
||||
for line in out.splitlines()[1:]:
|
||||
param, value = line.split(':', 1)
|
||||
if param.strip() == 'Size':
|
||||
parts = line.split(':', 1)
|
||||
if len(parts) < 2:
|
||||
continue
|
||||
param, value = parts
|
||||
if param.strip() in ('Size', 'Cur size'):
|
||||
fssize = int(value.strip())
|
||||
break
|
||||
else:
|
||||
raise ValueError(out)
|
||||
raise ValueError(repr(out))
|
||||
|
||||
return fssize
|
||||
|
||||
@@ -477,7 +480,7 @@ class UFS(Filesystem):
|
||||
if None not in (fragmentsize, providersize):
|
||||
break
|
||||
else:
|
||||
raise ValueError(out)
|
||||
raise ValueError(repr(out))
|
||||
|
||||
return fragmentsize * providersize
|
||||
|
||||
|
||||
74
plugins/modules/system/gconftool2_info.py
Normal file
74
plugins/modules/system/gconftool2_info.py
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2022, Alexei Znamensky <russoz@gmail.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
module: gconftool2_info
|
||||
author:
|
||||
- "Alexei Znamensky (@russoz)"
|
||||
short_description: Retrieve GConf configurations
|
||||
version_added: 5.1.0
|
||||
description:
|
||||
- This module allows retrieving application preferences from the GConf database, with the help of C(gconftool-2).
|
||||
options:
|
||||
key:
|
||||
description:
|
||||
- The key name for an element in the GConf database.
|
||||
type: str
|
||||
required: true
|
||||
notes:
|
||||
- See man gconftool-2(1) for more details.
|
||||
seealso:
|
||||
- name: gconf repository (archived)
|
||||
description: Git repository for the project. It is an archived project, so the repository is read-only.
|
||||
link: https://gitlab.gnome.org/Archive/gconf
|
||||
'''
|
||||
|
||||
EXAMPLES = """
|
||||
- name: Get value for a certain key in the database.
|
||||
community.general.gconftool2_info:
|
||||
key: /desktop/gnome/background/picture_filename
|
||||
register: result
|
||||
"""
|
||||
|
||||
RETURN = '''
|
||||
value:
|
||||
description:
|
||||
- The value of the property.
|
||||
returned: success
|
||||
type: str
|
||||
sample: Monospace 10
|
||||
'''
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
|
||||
from ansible_collections.community.general.plugins.module_utils.gconftool2 import gconftool2_runner
|
||||
|
||||
|
||||
class GConftoolInfo(ModuleHelper):
|
||||
output_params = ['key']
|
||||
module = dict(
|
||||
argument_spec=dict(
|
||||
key=dict(type='str', required=True, no_log=False),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
def __init_module__(self):
|
||||
self.runner = gconftool2_runner(self.module, check_rc=True)
|
||||
|
||||
def __run__(self):
|
||||
with self.runner.context(args_order=["get", "key"]) as ctx:
|
||||
rc, out, err = ctx.run(get=True)
|
||||
self.vars.value = None if err and not out else out.rstrip()
|
||||
|
||||
|
||||
def main():
|
||||
GConftoolInfo.execute()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -99,7 +99,7 @@ msg:
|
||||
import os
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
||||
CmdModuleHelper, ArgFormat, ModuleHelperException
|
||||
CmdModuleHelper, ArgFormat
|
||||
)
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ class MkSysB(CmdModuleHelper):
|
||||
|
||||
def __init_module__(self):
|
||||
if not os.path.isdir(self.vars.storage_path):
|
||||
raise ModuleHelperException("Storage path %s is not valid." % self.vars.storage_path)
|
||||
self.do_raise("Storage path %s is not valid." % self.vars.storage_path)
|
||||
|
||||
def __run__(self):
|
||||
if not self.module.check_mode:
|
||||
@@ -149,7 +149,7 @@ class MkSysB(CmdModuleHelper):
|
||||
|
||||
def process_command_output(self, rc, out, err):
|
||||
if rc != 0:
|
||||
raise ModuleHelperException("mksysb failed.")
|
||||
self.do_raise("mksysb failed.")
|
||||
self.vars.msg = out
|
||||
|
||||
|
||||
|
||||
@@ -51,6 +51,11 @@ options:
|
||||
description:
|
||||
- Puppet environment to be used.
|
||||
type: str
|
||||
confdir:
|
||||
description:
|
||||
- Path to the directory containing the puppet.conf file.
|
||||
type: str
|
||||
version_added: 5.1.0
|
||||
logdest:
|
||||
description:
|
||||
- Where the puppet logs should go, if puppet apply is being used.
|
||||
@@ -179,6 +184,7 @@ def main():
|
||||
puppetmaster=dict(type='str'),
|
||||
modulepath=dict(type='str'),
|
||||
manifest=dict(type='str'),
|
||||
confdir=dict(type='str'),
|
||||
noop=dict(type='bool'),
|
||||
logdest=dict(type='str', default='stdout', choices=['all', 'stdout', 'syslog']),
|
||||
# The following is not related to Ansible's diff; see https://github.com/ansible-collections/community.general/pull/3980#issuecomment-1005666154
|
||||
@@ -255,6 +261,8 @@ def main():
|
||||
cmd += " --server %s" % shlex_quote(p['puppetmaster'])
|
||||
if p['show_diff']:
|
||||
cmd += " --show_diff"
|
||||
if p['confdir']:
|
||||
cmd += " --confdir %s" % shlex_quote(p['confdir'])
|
||||
if p['environment']:
|
||||
cmd += " --environment '%s'" % p['environment']
|
||||
if p['tags']:
|
||||
|
||||
@@ -145,31 +145,15 @@ RETURN = '''
|
||||
sample: '"96" or ["red", "blue", "green"]'
|
||||
'''
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
||||
CmdStateModuleHelper, ArgFormat, ModuleHelperException
|
||||
)
|
||||
|
||||
|
||||
def fix_bool(value):
|
||||
vl = value.lower()
|
||||
return vl if vl in ("true", "false") else value
|
||||
|
||||
|
||||
@ArgFormat.stars_deco(1)
|
||||
def values_fmt(values, value_types):
|
||||
result = []
|
||||
for value, value_type in zip(values, value_types):
|
||||
if value_type == 'bool':
|
||||
value = fix_bool(value)
|
||||
result.extend(['--type', '{0}'.format(value_type), '--set', '{0}'.format(value)])
|
||||
return result
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import StateModuleHelper
|
||||
from ansible_collections.community.general.plugins.module_utils.xfconf import xfconf_runner
|
||||
|
||||
|
||||
class XFConfException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class XFConfProperty(CmdStateModuleHelper):
|
||||
class XFConfProperty(StateModuleHelper):
|
||||
change_params = 'value',
|
||||
diff_params = 'value',
|
||||
output_params = ('property', 'channel', 'value')
|
||||
@@ -191,28 +175,20 @@ class XFConfProperty(CmdStateModuleHelper):
|
||||
)
|
||||
|
||||
default_state = 'present'
|
||||
command = 'xfconf-query'
|
||||
command_args_formats = dict(
|
||||
channel=dict(fmt=('--channel', '{0}'),),
|
||||
property=dict(fmt=('--property', '{0}'),),
|
||||
is_array=dict(fmt="--force-array", style=ArgFormat.BOOLEAN),
|
||||
reset=dict(fmt="--reset", style=ArgFormat.BOOLEAN),
|
||||
create=dict(fmt="--create", style=ArgFormat.BOOLEAN),
|
||||
values_and_types=dict(fmt=values_fmt)
|
||||
)
|
||||
|
||||
def update_xfconf_output(self, **kwargs):
|
||||
self.update_vars(meta={"output": True, "fact": True}, **kwargs)
|
||||
|
||||
def __init_module__(self):
|
||||
self.does_not = 'Property "{0}" does not exist on channel "{1}".'.format(self.module.params['property'],
|
||||
self.module.params['channel'])
|
||||
self.runner = xfconf_runner(self.module)
|
||||
self.does_not = 'Property "{0}" does not exist on channel "{1}".'.format(self.vars.property,
|
||||
self.vars.channel)
|
||||
self.vars.set('previous_value', self._get(), fact=True)
|
||||
self.vars.set('type', self.vars.value_type, fact=True)
|
||||
self.vars.meta('value').set(initial_value=self.vars.previous_value)
|
||||
|
||||
if self.module.params['disable_facts'] is False:
|
||||
raise ModuleHelperException('Returning results as facts has been removed. Stop using disable_facts=false.')
|
||||
if self.vars.disable_facts is False:
|
||||
self.do_raise('Returning results as facts has been removed. Stop using disable_facts=false.')
|
||||
|
||||
def process_command_output(self, rc, out, err):
|
||||
if err.rstrip() == self.does_not:
|
||||
@@ -229,11 +205,12 @@ class XFConfProperty(CmdStateModuleHelper):
|
||||
return result
|
||||
|
||||
def _get(self):
|
||||
return self.run_command(params=('channel', 'property'))
|
||||
with self.runner.context('channel property', output_process=self.process_command_output) as ctx:
|
||||
return ctx.run()
|
||||
|
||||
def state_absent(self):
|
||||
if not self.module.check_mode:
|
||||
self.run_command(params=('channel', 'property', {'reset': True}))
|
||||
with self.runner.context('channel property reset', check_mode_skip=True) as ctx:
|
||||
ctx.run(reset=True)
|
||||
self.vars.value = None
|
||||
|
||||
def state_present(self):
|
||||
@@ -252,22 +229,14 @@ class XFConfProperty(CmdStateModuleHelper):
|
||||
# or complain if lists' lengths are different
|
||||
raise XFConfException('Number of elements in "value" and "value_type" must be the same')
|
||||
|
||||
# fix boolean values
|
||||
self.vars.value = [fix_bool(v[0]) if v[1] == 'bool' else v[0] for v in zip(self.vars.value, value_type)]
|
||||
|
||||
# calculates if it is an array
|
||||
self.vars.is_array = \
|
||||
bool(self.vars.force_array) or \
|
||||
isinstance(self.vars.previous_value, list) or \
|
||||
values_len > 1
|
||||
|
||||
params = ['channel', 'property', {'create': True}]
|
||||
if self.vars.is_array:
|
||||
params.append('is_array')
|
||||
params.append({'values_and_types': (self.vars.value, value_type)})
|
||||
|
||||
if not self.module.check_mode:
|
||||
self.run_command(params=params)
|
||||
with self.runner.context('channel property create force_array values_and_types', check_mode_skip=True) as ctx:
|
||||
ctx.run(create=True, force_array=self.vars.is_array, values_and_types=(self.vars.value, value_type))
|
||||
|
||||
if not self.vars.is_array:
|
||||
self.vars.value = self.vars.value[0]
|
||||
|
||||
@@ -74,7 +74,7 @@ RETURN = '''
|
||||
properties:
|
||||
description:
|
||||
- List of available properties for a specific channel.
|
||||
- Returned by passed only the I(channel) parameter to the module.
|
||||
- Returned by passing only the I(channel) parameter to the module.
|
||||
returned: success
|
||||
type: list
|
||||
elements: str
|
||||
@@ -116,14 +116,15 @@ RETURN = '''
|
||||
- Tmp
|
||||
'''
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import CmdModuleHelper, ArgFormat
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
|
||||
from ansible_collections.community.general.plugins.module_utils.xfconf import xfconf_runner
|
||||
|
||||
|
||||
class XFConfException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class XFConfInfo(CmdModuleHelper):
|
||||
class XFConfInfo(ModuleHelper):
|
||||
module = dict(
|
||||
argument_spec=dict(
|
||||
channel=dict(type='str'),
|
||||
@@ -135,16 +136,9 @@ class XFConfInfo(CmdModuleHelper):
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
command = 'xfconf-query'
|
||||
command_args_formats = dict(
|
||||
channel=dict(fmt=['--channel', '{0}']),
|
||||
property=dict(fmt=['--property', '{0}']),
|
||||
_list_arg=dict(fmt="--list", style=ArgFormat.BOOLEAN),
|
||||
)
|
||||
check_rc = True
|
||||
|
||||
def __init_module__(self):
|
||||
self.vars.set("_list_arg", False, output=False)
|
||||
self.runner = xfconf_runner(self.module, check_rc=True)
|
||||
self.vars.set("list_arg", False, output=False)
|
||||
self.vars.set("is_array", False)
|
||||
|
||||
def process_command_output(self, rc, out, err):
|
||||
@@ -167,7 +161,7 @@ class XFConfInfo(CmdModuleHelper):
|
||||
return lines
|
||||
|
||||
def __run__(self):
|
||||
self.vars._list_arg = not (bool(self.vars.channel) and bool(self.vars.property))
|
||||
self.vars.list_arg = not (bool(self.vars.channel) and bool(self.vars.property))
|
||||
output = 'value'
|
||||
proc = self.process_command_output
|
||||
if self.vars.channel is None:
|
||||
@@ -176,15 +170,15 @@ class XFConfInfo(CmdModuleHelper):
|
||||
elif self.vars.property is None:
|
||||
output = 'properties'
|
||||
proc = self._process_list_properties
|
||||
result = self.run_command(params=('_list_arg', 'channel', 'property'), process_output=proc)
|
||||
if not self.vars._list_arg and self.vars.is_array:
|
||||
with self.runner.context('list_arg channel property', output_process=proc) as ctx:
|
||||
result = ctx.run(**self.vars)
|
||||
if not self.vars.list_arg and self.vars.is_array:
|
||||
output = "value_array"
|
||||
self.vars.set(output, result)
|
||||
|
||||
|
||||
def main():
|
||||
xfconf = XFConfInfo()
|
||||
xfconf.run()
|
||||
XFConfInfo.execute()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user