* pacman: Fix removing locally installed packages
Without this, using `absent` state for a locally installed package (for example from AUR, or from a package that was dropped from repositories) would return that package is already removed, despite remaining installed
* Undo unwanted whitespace removal
* Add changelog fragment
* Update changelogs/fragments/4464-pacman-fix-local-remove.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add test.
Co-authored-by: Felix Fontein <felix@fontein.de>
If `all=True` is not set then by default only 20 records will be
returned when calling `list()`. Use `all=True` so that all records
will be returned.
For the `list()` use where do not desire to retrieve all entries then
use`all=False` to show explicityly that we don't want to get all of
the entries.
Fixes: #3729Fixes: #4460
* Adds optional `-upgrade` flag to terraform init.
This allows Terraform to install provider dependencies into an existing project when the provider constraints change.
* fix transposed documentation keys
* Add integration tests for terraform init
* Revert to validate_certs: yes for general public testing
* skip integration tests on irrelevant platforms
* skip legacy Python versions from CI tests
* add changelog fragment
* Update plugins/modules/cloud/misc/terraform.py
Adds version_added metadata to the new module option.
Co-authored-by: Felix Fontein <felix@fontein.de>
* Change terraform_arch constant to Ansible fact mapping
* correct var typo, clarify task purpose
* Squashed some logic bugs, added override for local Terraform
If `existing_terraform_path` is provided, the playbook will not download Terraform or check its version.
I also tested this on a local system with Terraform installed, and squashed some bugs related to using of an
existing binary.
* revert to previous test behavior for TF install
* readability cleanup
* Update plugins/modules/cloud/misc/terraform.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Only get monitor if it is not null api response
* Add changelog fragment
* Update changelogs/fragments/4459-only-get-monitor-if-it-is-not-null-api-response.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/net_tools/dnsmadeeasy.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: drevai <revai.dominik@gravityrd.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* add support for datadog monitors of type event-v2
See https://docs.datadoghq.com/events/guides/migrating_to_new_events_features/
* add changelog fragement for PR
* typos
* add link to PR
* minor_fetaure, not bugfix
* add to description when we added event-v2 type
* Update changelogs/fragments/4457-support-datadog-monitors-type event-v2.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add error handling to check correct SDK version installed
* Fix CI errors
* Added changelog fragment
* Changed exeption type
* Update changelogs fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* fixed issue with specified package versions
zypper.py was doing nothing on state=present, when ALL requestet/checked packages had a specific version stated. This was caused by get_installed_state() being called with an empty package list, which in this case returns information about all ALL installed packages. This lead to an exessive filter list prerun_state, essentially removing all packages that are installed in ANY version on the target system from the request list.
* Create 4421-zypper_package_version_handling_fix
added changelog fragment for https://github.com/ansible-collections/community.general/pull/4421
* Delete 4421-zypper_package_version_handling_fix
* Create 4421-zypper_package_version_handling_fix.yml
* added templating to the url, user, and password
* added changelog fragment
* typo in description for url, and password
* clarify in the changelog what can you change
* update documentation and added an example
* missing quote from examples
* Apply suggestions from code review
Changed to I for option names
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/proxmox.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix: missing `validate_certs` parameters for `open_url` calls
As stated in the documentation, the `validate_certs` parameter can be
used to verify (or not) the TLS certificates. But, for some modules (at
least for the `keycloak_authentication` module), this parameter is not
used with the `open_url` function.
* add changelog fragment
* Update changelogs/fragments/4382-keycloak-add-missing-validate_certs-parameters.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Laurent Meunier <lme@atolcd.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Proxmox inventory plugin - Fix tags parsing
* In some cases the Proxmox API returns a tags string that consists in
a single space. The Proxmox inventory plugin parsed that into a
single, empty tag. Stripping the initial string then checking
whether it actually contains something fixes that.
* Do not call `_to_safe` on the concatenation of a known safe string
and a string that was already made safe.
* Changelog fragment for Proxmox inventory plugin tags fix
* Proxmox inventory plugin - Include link to PR in fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* feat: sudoers module supports runas parameter with default of root
* fix: sudoers tests now pass
* chore: add changelog fragment for 4380
* fix: runas feature now a non-breaking change wh no def with no default
* fix: no trailing space in sudoers.py
* Update plugins/modules/system/sudoers.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* plugins/inventory/lxd.py: fix listing of containers without os / release
In some cases, a container might be present, that was initialized empty, therefore lacking meta information about the os or the release.
Test if the data entry is None to avoid calling lower on it.
* Update plugins/inventory/lxd.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/lxd.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Create 4351-inventory-lxd-handling_metadata_wo_os_and_release.yml
* fix yaml readability of changelog fragment
* Update changelogs/fragments/4351-inventory-lxd-handling_metadata_wo_os_and_release.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Malte Kuhn <mkuhn@maxcluster.de>
* Proxmox inventory plugin - Fix string to dict conversion (#4348)
* Re-use the (defined but unused) `plaintext_configs` variable to list
configuration entries that should be ignored by the string to
dictionary conversion code. At this point, it only contains the
`description` string.
* Convert to a dictionary if the all substrings obtained by splitting
off the initial value with commas contain a `=` character
* Limit substring splitting to a single split, so that a substring
containing `a=b=c` will generate an `a` entry with value `b=c`.
* Added changelog fragment for PR #4349
* Fix changelog fragment for #4349
* Proxmox inventory plugin - Initial implementation of filters
* This is an attempt at implementing something that would satisfy
issue #3553
* A rather massive code rewrite was needed as adding the host to the
inventory, setting its variables and adding it to various groups
used to be done as soon as the information became available. This is
not possible when it is not known whether the host should be added
to the inventory before all data has been gathered.
* The code for both LXC containers and Qemu VMs was refactored into a
single loop.
* Helper functions to generate group and fact names were added.
* Proxmox inventory plugin - Warnings for filter errors
* When an error occurs while compositing a filter's value and strict
mode is disabled, display a warning.
* Proxmox inventory plugin - Fixed pool groups building
* Hosts that were excluded by the host filters were still being added
to pool groups, causing errors.
* Proxmox inventory plugin - Refactoring
* Split off the VM/container handling code from the
`_populate()` method
* Split off pool group attribution from the `_populate()` method
* Proxmox inventory filters - Changelog fragment
* proxmox inventory - Simplify _can_add_host() method
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* ldap_entry - Recursive deletion
* Recursive deletion can be enabled with the `recursive` option. It is
disabled by default.
* When enabled, deletion is attempted by sending a single delete
request with the Subtree Delete control. If that request fails with
the `NOT_ALLOWED_ON_NONLEAF` error, try deleting the whole branch in
reverse order using individual delete requests.
* ldap_entry recursive deletion - Changelog fragment
* ldap_entry - Refactored to avoid lint message
* Update changelogs/fragments/4355-ldap-recursive-delete.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* ldap_entry - Add version_added to the recursive flag
Co-authored-by: Felix Fontein <felix@fontein.de>
* ldap_entry - Moved member assignment to a more suitable location
Co-authored-by: Felix Fontein <felix@fontein.de>
* Implement change detection for update_cache=true. Add cache_updated return value.
* ...
* Make sure pacman --sync --list is called only as often as necessary.
* Fix linode inventory filtering
There was a regression introduced in the addition of caching. The
`_consume_options` method was added and provided the `config_data`
dictionary. This `pop`s every entry, resulting in an empty `config_data`
dict, which was then reused and expected to be populated.
After reviewing, `_consume_data` doesn't need to be called. Also, once
the ``_read_config_data` method has been called, we no longer need the
config_data dict, and can instead use the `get_option` method throughout.
Once those were removed, the filtering function seemed a bit odd, since
we were no longer using the file. I used that opportunity to move the
filter calls into the populate function directly.
* Remove tests that target removed methods
This removes tests that targeted some custom methods on configuration
file handling. These are no longer necessary since they are now handled
by the BaseInventoryPlugin `_read_config_data` method.
* Add changelog entry for linode inventory bugfix
* Revert filters back to their own method
This moves filters back into their own method, but now uses the
get_option calls to pull filter configuration items.
* jira: Use fields in comment to merge in additional data
* changlog fragment added
* Update changelogs/fragments/4304-jira-fields-in-comment.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* updated fields documentation
* Update plugins/modules/web_infrastructure/jira.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add tls parameter to redis module
* Rename changelog fragment to match PR
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Port redis module to redis auth module util
* Update changelogs/fragments/4207-add-redis-tls-support.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/database/misc/redis.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Undo reuse of redis auth doc fragment
* Use doc fragment.
Co-authored-by: Julian Faude <julian.faude@zweiacht.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* npm - add '--production` support to 'npm ci' flag
* add changelog fragement for 4299
* Add backticks
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* pacman: add support for remove_nosave
New parameter: remove_nosave
When enabled, will pass --nosave to pacman when removing packages.
--nosave cannot be used with --print-format and thus it couldn't be
passed via extra_args. See #4315
The code adds the option right before the actual removal of the pkgs.
(This is based on an initial diff from MorphBonehunter)
* changelog
* Update plugins/modules/packaging/os/pacman.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* wording
* ssss
* remove_package: simplify {force,extra,nosave}_args
Co-authored-by: Felix Fontein <felix@fontein.de>
* pacman: don't always return changed w/ update_cache
This used to be the behavior before the recent refactoring. [1]
Allows the following to return changed only when packages were upgraded:
- pacman:
update_cache: yes
upgrade: yes
And the following to return changed only when the foo package wasn't at
the latest version:
- pacman:
name: foo
state: latest
update_cache: yes
[1] https://github.com/ansible-collections/community.general/pull/3907
* Update changelogs/fragments/4318-pacman-restore-old-changed-behavior.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Remove nmcli modify dependency on type parameter
* Add fragment
* Add newline for lint
* Fixed linting for tests
* Fix fragment
* Move aliases to ip_conn_type function
* Remove connection_map
* Updated fragment
* Fixed fragment
Co-authored-by: Trey West <--local>
* s/group/groups/
Pacman accepts --group but the actual option name is --groups.
Allows use of other binaries with the same CLI interface as pacman (yay)
* changelog
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add note regarding pacman compat + --print-format
* Update plugins/modules/packaging/os/pacman.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Fix error when checking if VM exists.
* Add changelog entry.
* Reword changelog entry.
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* pacman: re-adding support for URL based pkgs
* Update plugins/modules/packaging/os/pacman.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/packaging/os/pacman.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* cmd=cmd in every call to self.fail()
* pacman: integration test for mixed pkg sources
* Add more tests + fix minor bug with URL packages
Version checking for URL packages is left to pacman, so add a check
after the dry run to see if it would actually install anything.
* remove double templating
Co-authored-by: Felix Fontein <felix@fontein.de>
* zypper: support automatic removal of orphaned dependencies
* zypper: support automatic removal of orphaned dependencies
- Add support for --clean-deps option during package removal, which
will clean up packages that were only installed as dependencies
of the package being removed.
* Update changelogs/fragments/4192-zypper-add-clean-deps.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/packaging/os/zypper.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/packaging/os/zypper.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix sparse file creation on Alpine linux
* re-enable tests for Alpine
* remove `conv=sparse` flag (rely only on `seek=fullsize` & `count=0`)
* doc: add a reference to busybox's dd
* doc: remove restrictions for OpenBSD, Solaris & AIX (should work as
for Alpine linux now)
* add a changelog fragment
* fix typo
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* keycloak: fix creating a user federation w/ idempotent id
Creating a user federation while specifying an id (that doesn't exist
yet) will fail with a 404. This commits fix this behavior.
* keycloak: fix user federation mapper duplication
This commit fixes a bug where mappers are duplicated instead of
configured when creating a user federation.
When creating a user federation, some mappers are autogenerated by
keycloak. This commit lets the keycloak_user_federation module recompute
mappers final values after the user federation is created so that the
module can try to merge them by their name.
* add missing fragment for pr #4212
* passwordstore: Add configurable locking
Passwordstore cannot be accessed safely in parallel, which causes
various issues:
- When accessing the same path, multiple different secrets are
returned when the secret didn't exist (missing=create).
- When accessing the same _or different_ paths, multiple pinentry
dialogs will be spawned by gpg-agent sequentially, having to enter
the password for the same gpg key multiple times in a row.
- Due to issues in gpg dependencies, accessing gpg-agent in parallel
is not reliable, causing plays to fail (this can be fixed by adding
`auto-expand-secmem` to _~/.gnupg/gpg-agent.conf_ though).
These problems have been described in various github issues in the past,
e.g., ansible/ansible#23816 and ansible/ansible#27277.
This cannot be worked around in playbooks by users in a non-error-prone
way.
It is addressed by adding new configuration options:
- lock:
- readwrite: Lock all operations
- write: Only lock write operations (default)
- none: Disable locking
- locktimeout: Time to wait for getting a lock (s/m/h suffix)
(defaults to 15m)
These options can also be set in ansible.cfg, e.g.:
[passwordstore_lookup]
lock=readwrite
locktimeout=30s
Also, add a note about modifying gpg-agent.conf.
* Tidy up locking config
There is no reason why lock configuration should be part of self.paramvals.
Now locking and its configuration happen all in one place.
* Change timeout description wording to the suggested value.
* Rearrange plugin setup, apply PR feedback