Update nmcli.py to support VRF commands (#9658)
Adding VRF support and documentation to the nmcli module
Signed-off-by: Andreas Karis <ak.karis@gmail.com>
(cherry picked from commit a842a26849)
Co-authored-by: Andreas Karis <akaris@redhat.com>
test helper: remove magically finding the testcasemock in the test module (#9675)
(cherry picked from commit 4a31c753e7)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
test helper: add support for check and diff modes (#9666)
(cherry picked from commit c0f57b5c62)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Add module proxmox_backup_info (#9437)
* Create proxmox_backup_info.py
The `proxmox_backup_info` module displays information such as backup times, VM name, VM ID, mode, backup type, and backup schedule using the Proxmox Server API.
* Create test_proxmox_backup_info.py
create test for proxmox_backup_info.py module
* Update plugins/modules/proxmox_backup_info.py
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* check tests proxmox_backup_info.py
* check tests test_proxmox_backup_info.py
* Update check tests test_proxmox_backup_info.py
* Update check tests proxmox_backup_info.py
* Update authors proxmox_backup_info.py
* Update active maintainers for proxmox_backup_info module
* Update add proxmox_backup_info module in proxmox group
* edit timestamp to UTC test_proxmox_backup_info.py
* Update vm name or vmid to VM name or VM id proxmox_backup_info.py
* update documentation in proxmox_backup_info.py
* Update backup_section decription in proxmox_backup_info.py
* Update plugins/modules/proxmox_backup_info.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* change backup_section to backup_jobs
* change backup_section to backup_jobs
* remove whitespace in line 35 and 36
* improve descriptions
* check again proxmox_backup_info.py module
* change vmid type and some descriptions proxmox_backup_info.py
* delete comment #if ...
* solve trailing whitespace error
* Update the name of the functions
* Update proxmox_backup_info.py
* Update proxmox_backup_info.py
* Update tests/unit/plugins/modules/test_proxmox_backup_info.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update test_proxmox_backup_info.py
* Update runtime.yml
* add proxmox_backup_schedule module in runtime.yml
* add proxmox_backup_schedule.py module in BOTMETA.yml
* remove proxmox_backup_schedule module runtime.yml
* remove proxmox_backup_schedule.py module in BOTMETA.yml
* change some id to ID proxmox_backup_info.py
* Update proxmox_backup_info.py
* remove required: falsefrom documentations
* change vimd values to str format
* add samples to output documentations
* the exact output of vimd in endpoint of proxmox resoures is like int
---------
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: mmayabi <137920552+mmayabi@users.noreply.github.com>
(cherry picked from commit 96f465ddf8)
Co-authored-by: raoufnezhad <72685312+raoufnezhad@users.noreply.github.com>
Keycloak modules retry request on authentication error, support refresh token parameter (#9494)
* feat: begin refactor to support refresh token in keycloak modules
* chore: add start of tests for shared token usage
* feat: progress towards supporting refresh token; token introspection not yet working [8857]
* chore: reset to main branch previous state; a different approach is needed [8857]
* feat: add request methods to keycloak class, which will be expanded with retry logic [8857]
* feat: all requests to keycloak use request methods instead of open_url [8857]
* fix: data argument is optional in keycloak request methods [8857]
* feat: add integration test for keycloak module authentication methods [8857]
* chore: refactor get token logic to separate logic using username/pass credentials [8857]
* chore: refactor token request logic further to isolate request logic [8857]
* chore: fix minor lint issues [8857]
* test: add (currently failing) test for request with invalid auth token, valid refresh token [8857]
* chore: allow realm to be provided to role module with refresh_token, without username/pass [8857]
* feat: add retry logic to requests in keycloak module utils [8857]
* chore: rename keycloak module fail_open_url method to fail_request [8857]
* chore: update all keycloak modules to support refresh token param [8857]
* chore: add refresh_token param to keycloak doc_fragments [8857]
* chore: restore dependency between auth_realm and auth_username,auth_password params [8857]
* chore: rearrange module param checks to reduce future pr size [8857]
* chore: remove extra comma [8857]
* chore: update version added for refresh token param [8857]
* chore: add changelog fragment [8857]
* chore: re-add fail_open_url to keycloak module utils for backward compatability [8857]
* fix: do not make a new request to keycloak without reauth when refresh token not provided (#8857)
* fix: only make final auth attempt if username/pass provided, and return exception on failure (#8857)
* fix: make re-auth and retry code more consistent, ensure final exceptions are thrown (#8857)
* test: fix arguments for invalid token, valid refresh token test (#8857)
* feat: catch invalid refresh token errors during re-auth attempt (#8857)
Add test to verify this behaviour works.
* test: improve test coverage, including some unhappy path tests for authentication failures (#8857)
* chore: store auth errors from token request in backwards compatible way (#8857)
* fix: ensure method is still specified for all requests (#8857)
* chore: simplify token request logic (#8857)
* chore: rename functions to request tokens using refresh token or username/password (#8857)
To emphasize their difference from the `get_token` function,
which either gets the token from the module params
*or* makes a request for it.
* doc: add docstrings for new or significantly modified functions (#8857)
* test: repair unit test following change to exception message upon key error during auth request (#8857)
(cherry picked from commit af0118278b)
Co-authored-by: Mark Armstrong <markparmstrong@gmail.com>
use open() as context manager (#9579)
* use open() as context manager
* add changelog frag
(cherry picked from commit 0de39a6f47)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
feat(nmcli): support the fail_over_mac parameter (#9571)
* feat(nmcli): support the fail_over_mac parameter
* add fail_over_mac to +bond.options
* update unit tests
* Update changelogs/fragments/9570-feat-nmcli-add-fail-over-mac-parameter.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/nmcli.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* change to type str and add choices according to documentation
* Update plugins/modules/nmcli.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit d6863eaec3)
Co-authored-by: cnfrancis <37379852+cnfrancis@users.noreply.github.com>
redhat_subscription: stop manual unsubscribing on unregistration (#9578)
Unregistering a system also drops all the resources for it
automatically, so there is no need to manually unsubscribing (which
actually means removing all the subscriptions).
In addition to that, newer versions of subscription-manager drop all the
support for entitlements, so the "remove" subcommand (used by
unsubscribe()) does not exist anymore, and thus the unregistration fails
with those versions.
This fixes the registration on EL 10 systems, and Fedora 41 and greater.
(cherry picked from commit bcc92e8aac)
Co-authored-by: Pino Toscano <ptoscano@redhat.com>
Proxmox remote pct connection (#8424)
* First Revision (squashed)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* Second Revision (squashed)
* implement data_in
* Removed quot()
There is no need for quoting, exec_command gets the command already quoted with shell from Ansible
* Use shell from self._shell
* Improved error handling
* updated docs
* Use Int for Container ID
* Updated docs to include detailed description for non root usage
* Fix ansible_user var in example
* Fix become method
We need to differentiate between become method used in Proxmox and the one inside the container.
* Implement review findings
- f-Strings
- lower() when input
- yaml indent
- consistent quotes
- use to_text()
- Enhanced examples
- Ansibullbot findings
* remove ssh cache
* Ensure we delete the tempfile
* use octal mode
* Use FileLock().lock_file
* ansibullbot findings
* refactor _connect()
* Update plugins/connection/pct_remote.py
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* renamed plugin to proxmox_pct_remote
* Use ansible.builtin.ping as example
* added unit tests
* fixed bugs in close()
* catch invalid host key
* test invalid host key
* Added integration test
* cleanup
* setup test via ansible
* Revised notes based on review feedback
* Review findings
Co-authored-by: Felix Fontein <felix@fontein.de>
* gather_facts hint in example
* Update tests/integration/targets/connection_proxmox_pct_remote/aliases
Co-authored-by: Felix Fontein <felix@fontein.de>
* Fix FreeBSD, deactivate macOS
* Test and Fix: Hang on copy with empty content
---------
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cee62a4069)
Co-authored-by: Nils <31704359+mietzen@users.noreply.github.com>
Add cpanm option --with-recommends (#9555)
* Add cpanm option --with-recommands
Fix#9554
* With accepted suggestions
* Use install_recommendations for cpanm option --with-recommends
* Fix typo in changelogs/fragments/9554
recommands -> recommends
* Doc for options users have for recommands and suggests dependencies
* Add new args to the command runner.
* Add test for cpanm --with-recommends
(cherry picked from commit e2d19a968b)
Co-authored-by: Erwan Colin <zephone@protonmail.com>
Fix#9538 Inventory iocage fails when DHCP is enabled (#9539)
* Fix#9538 Inventory iocage fails when DHCP is enbled.
* Add changelog fragment 9539-iocage-inventory-dhcp.yml
* Keep iocage_ip4 a string.
* Rename the variable iocage_ip4 to iocage_ip4_dict in _parse_ip4.
* Update the changelog fragment.
* Rename _parse_ip4 parameter ip4_addr to ip4.
* Fix changelog frangment present tense.
* If IP is not available set iocage_ip4='-' instead of the empty string.
* Update changelogs/fragments/9539-iocage-inventory-dhcp.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 94d5256adb)
Co-authored-by: Vladimir Botka <vbotka@gmail.com>
test helper: adjusted unit tests using new features (#9563)
(cherry picked from commit 3dcac2b030)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
xfconf/xfconf_info: add return value version (#9226)
* xfconf/xfconf_info: add return value version
* add changelog frag
* adapt test to helper improvements
* rollback copyright update
* replace tab with spaces in test yamls
(cherry picked from commit b429e8a2cf)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Add SR-IOV support to nmcli module (#9168)
* Add SR-IOV support to nmcli module (#9168)
* Add SR-IOV support to nmcli module (#9168)
Fixes
* Add SR-IOV support to nmcli module (#9168)
Add test
* Update changelogs/fragments/9168-nmcli-add-sriov-parameter.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/nmcli.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/nmcli.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/nmcli.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Populate sriov options
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 82462e407e)
Co-authored-by: Ian Bishop <151477169+ianb-mp@users.noreply.github.com>
Add backup module for proxmox (#9197)
* Defined configuration variables, main backup function todo
* Defined configuration variables, main backup function todo
* wip
* permission checks and basic flow done, final request missing
* ansible-test and unit test open
* Improve documentation
* fix pep8 errors
* remove f-string and fix bugs through manual testing
* longer full example
* improve docs
* error message for fail + timeout
* move sleep location
* remove residual debugger
* include newline for better readability
* more linting errors fixed
* Include UPIDs as return value
* Output logs as comma separated value, move exception and create new abstraction for api calls
* pretter logs
* Update project to final version
* Remove accidential placeholder for integration test
* Fix missing explizit string in docstring
* Reorder imports below docstrings
* remove type annotations and fix indendation of options dict
* prettier idendation and aplhabetic ordering of options dict
* aplhabetic ordering of docstring options
* Remove the rest of type hinting as well :(
* fix version
* improve documentation
* add change detection mode
* refactor list comprehension to filter function
* remove storage availability check for node
* refactor to quotation marks
* Fix trailing newline and incorrect RV usage
* rollback filter plugin
* Remove action_group reference and add proxmox_backup to meta/runtime.yml
* Include note about missing idempotency
---------
Co-authored-by: IamLunchbox <r.grieger@hotmail.com>
(cherry picked from commit c38b474982)
Co-authored-by: IamLunchbox <56757745+IamLunchbox@users.noreply.github.com>
gio_mime: fix bug when looking for version (#9171)
* gio_mime: fix bug when looking for version
* add changelog frag
(cherry picked from commit 152339a8f9)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
dnf_config_manager: use --assumeyes when changing state (#9124)
* dnf_config_manager: use --assumeyesm when changing state
* changelog fragment
* update tests
* format fix
* Update changelogs/fragments/9124-dnf_config_manager.yml
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
---------
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
(cherry picked from commit 36c7e56005)
Co-authored-by: Andrew Hyatt <4400272+ahyattdev@users.noreply.github.com>
* jenkins_node: Add set offline message
* Implement offline_message parameter for updating a Jenkins node
offline cause reason when the state is "disabled" (offline).
* Fix enabled, disable and absent node state redirect authorization
issues, same as was present for present.
* Add unit tests for redirect authorization workarounds.
* * Make docs clearer re: offline_message behaviour
* Exit with fail_json() instead of raising when
create/delete/enable/disable node fail.
* * Add changelog fragment
* Update changelog fragments.
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
* add return value version
* add changelog frag
* fix indentation
* fix RV name and tests
* Update plugins/modules/cpanm.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
* github_app_access_token: add support for private key fact
Adds support for specifying the GitHub App private key via an ansible
fact instead of a path to a file.
This is useful when you want to generate registration tokens for a
remote host but don't want to put secrets on the host.
* Add license file
* Fix pep8 formatting
* Add changelog fragment
* Run sanity tests on changelog
* Apply suggestions from code review
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add input validation check
* Add import
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add error for mutually exclusive options
* Update plugins/lookup/github_app_access_token.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* New module: Jenkins node management
* Fix sanity errors
* (Try to) fix mock import for Python 2.7
* Remove encoding from XML tostring in hopes of appeasing py27
Default encoding is probably always good enough.
* Turns out that encoding parameter was important for python3...
It's not super obvious how to resolve in a 2 + 3 compatible way,
so branch and omit encoding for 2.
* Implement review fixes and suggestions
* add support for getting secrets in the current version of bitwarden secrets manager
* format
* format2
* fragment
* fix formatting errors
* strip out junk before the version in cli output
* mock the --version command in the unit tests
* use LooseVersion comparison - russoz suggestion
* add blank line
* Bump version to 10.0.0, remove deprecated modules and plugins.
* Remove redhat module utils.
* Drop support for ansible-core 2.13 and ansible-core 2.14.
* Add VM id and VM host to opennebula inventory data
##### SUMMARY
<!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
<!--- Please do not forget to include a changelog fragment:
https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
Read about more details in CONTRIBUTING.md.
-->
##### ISSUE TYPE
<!--- Pick one or more below and delete the rest.
'Test Pull Request' is for PRs that add/extend tests without code changes. -->
- Feature Pull Request
##### COMPONENT NAME
<!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py
##### ADDITIONAL INFORMATION
<!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->
<!--- Paste verbatim command output below, e.g. before and after your change -->
```paste below
"host": "foo23.host",
"id": 1234,
```
* Create 8532-expand-opennuebula-inventory-data.yml
* Update opennebula.py
* Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add check for empty records and add test
* fix attribute test
* fix attribute test
* fix attribute test
* fix attribute test
* Update plugins/inventory/opennebula.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* update as per guidance
* restore attribute checks
* fix attr
* fix indent
* PR Fixes
* add attribute check in case of empty variable
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Александр Бакановский <abakanovskii@astralinux.ru>
* deserialize fetched `kc.user.profile.config` and serialize it before sending
* change `kc.user.profile.config` to JSON formatted string in mock `get_component` responses
* add changelog fragment
* initial commit
* multiple changes:
- TestCaseContext fixture no longer need to autouse=True
- Helper.from_module() allows extra param to specify yaml file
- test_django_check: adjusted .py and .yaml
* set fixtures per testcase
* set fixtures per testcase
* rollback to original state
* patch_ansible_module fixture
- now it works not only in parametrized functions but also directly with args
* tests/unit/plugins/modules/helper.py
- improved encapsulation, class Helper no longer knows details about test cases
- test functions no longer parametrized, that allows using test case fixtures per test function
- renamed 'context' to 'mock'
* enable Helper.from_list(), better param name 'ansible_module'
* adjusted test fiels to new helper
* remove unnecessary .license file
* fix bracket
* fix reference name
* Update tests/unit/plugins/modules/helper.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* revert to parametrized test func instead of multiple funcs
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
* Remove pool option from redhat_subscription.
* Remove proxmox_default_behavior option from proxmox_kvm.
* Remove the logging option from ejabberd_user.
* Remove the ack_params_state_absent option from consul.
* irc: change defaults of use_tls and validate_certs to true.
* rhsm_repository: remove states present and absent.
* Re-add 'using'.
* Fix typo.