1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
Commit graph

1072 commits

Author SHA1 Message Date
Petr Lautrbach
4c52fdb9d9
seport: add local argument (#5203)
Using `local: true` users can enforce to work only with local policy
modifications. i.e.

    # Without `local`, no new modification is added when port already exists
    $ sudo ansible -m seport -a 'ports=22 state=present setype=ssh_port_t proto=tcp' localhost

    localhost | SUCCESS => {
        "changed": false,
        "ports": [
            "22"
        ],
        "proto": "tcp",
        "setype": "ssh_port_t",
        "state": "present"
    }

    $ sudo semanage port -l -C

    # With `local`, a port is always added/changed in local modification list
    $ sudo ansible -m seport -a 'ports=22 state=present setype=ssh_port_t proto=tcp local=true' localhost

    localhost | CHANGED => {
        "changed": true,
        "ports": [
            "22"
        ],
        "proto": "tcp",
        "setype": "ssh_port_t",
        "state": "present"
    }

    $ sudo semanage port -l -C
    SELinux Port Type              Proto    Port Number

    ssh_port_t                     tcp      22

    # With `local`, seport removes the port only from local modifications
    $ sudo ansible -m seport -a 'ports=22 state=absent setype=ssh_port_t proto=tcp local=true' localhost

    localhost | CHANGED => {
        "changed": true,
        "ports": [
            "22"
        ],
        "proto": "tcp",
        "setype": "ssh_port_t",
        "state": "absent"
    }

    $ sudo semanage port -l -C

    # Even though the port is still defined in system policy, the module
    # result is success as there's no port local modification
    $ sudo ansible -m seport -a 'ports=22 state=absent setype=ssh_port_t proto=tcp local=true' localhost

    localhost | SUCCESS => {
        "changed": false,
        "ports": [
            "22"
        ],
        "proto": "tcp",
        "setype": "ssh_port_t",
        "state": "absent"
    }

    # But it fails without `local` as it tries to remove port defined in
    # system policy
    $ sudo ansible -m seport -a 'ports=22 state=absent setype=ssh_port_t proto=tcp' localhost

    An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: Port tcp/22 is defined in policy, cannot be deleted
    localhost | FAILED! => {
        "changed": false,
        "msg": "ValueError: Port tcp/22 is defined in policy, cannot be deleted\n"
    }

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2022-09-03 11:53:57 +02:00
Markus Reiter
82d69bb871
Fix exception when agent argument is not specified. (#5194) 2022-08-28 12:03:27 +02:00
jixj5
766c109d47
Update redfish module for compatibility with VirtualMedia resource location (#5124)
* Update redfish module for compatibility with VirtualMedia resource location from Manager to Systems

* Add changelogs fragments for PR 5124

* Update some issue according to the suggestions

* update changelogs fragment to list new features in the minor_changes catagory

Co-authored-by: Tami YY3 Pan <panyy3@lenovo.com>
2022-08-24 21:36:35 +02:00
Tom Reeb
9f39294f50
adding nested try block for tss.py to import new Delinea library (#5151)
* adding nested try block to import delinea library

* whitespace

* Update plugins/lookup/tss.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* adding changelog fragment

* Update changelogs/fragments/5151-add-delinea-support-tss-lookup.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Tom Reeb <Thomas.Reeb_e@morganlewis.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-23 21:53:06 +02:00
Felix Fontein
02d9a1de9e
Make reuse conformant (#5138)
* Add .license files.

* Add reuse test.

* Update README.

* Also remove .yaml changelog fragments.

* Add changelog fragment.

* Normalize licenses extra sanity test.

* Declare REUSE conformance.

* Update README.md
2022-08-21 08:27:01 +02:00
Michal Hybner
3c2d7eb193
dig: Fix evaluation of boolean parameters (#5129)
* Add lookup_dig tests

* Fix boolean evaluation

* Add changelog fragment

* Apply review changes

* Add license
2022-08-20 14:31:15 +02:00
Jonathan Lung
ad8965218d
Fix nsupdate when updating NS record (#5112)
* Fix nsupdate when updating NS record

* Changelog fragment

* Update changelogs/fragments/5112-fix-nsupdate-ns-entry.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Switch to fallback to AUTHORITY instead of using with NS type.

* Update plugins/modules/net_tools/nsupdate.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/net_tools/nsupdate.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: jonathan lung <lungj@heresjono.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-20 13:22:13 +02:00
Markus Reiter
0be7b6e7b9
Change Proxmox agent argument to string. (#5107)
* Change Proxmox `agent` argument to string.

* Add changelog entry.

* Pass boolean directly to `proxmoxer`.
2022-08-20 13:21:07 +02:00
Alexei Znamensky
3c960ac620
pipx: add state latest (#5105)
* pipx: add state latest

* add changelog fragment

* Update plugins/modules/packaging/language/pipx.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-18 06:44:18 +02:00
Felix Fontein
c8925058aa
Update copyright statements. (#5106) 2022-08-13 16:56:40 +02:00
Felix Fontein
a54af8909c
Fix linting errors; fix some real bugs (#5111)
* Fix linting errors.

* Fix bugs.

* Another linter error ignored.

* More fixes.

* Ignore sanity errors with older versions.

ci_complete

* Forgot to commit more changes.
2022-08-12 11:07:30 +02:00
Markus Reiter
0338eb7a7c
Fix Proxmox node, name condition. (#5108)
* Fix Proxmox `node`, `name` condition.

* Add changelog entry.
2022-08-12 14:03:57 +12:00
Alexei Znamensky
83317419d7
pipx: add required_if fo upgrade and reinstall (#5100)
* pipx: add required_if for upgrade and reinstall

* add changelog fragment
2022-08-09 10:15:51 +02:00
Felix Fontein
aab22e7f32
Add remaining copyright statements, add licenses sanity test (#5098)
* Add sanity test (currently fails).

* doc_fragments can also be non-GPLv3+.

* Replace 'Author:' by 'Copyright:' in some specific cases.

* Avoid matching string for license checkers.

* Reformulate not to throw license detection off.

* Add PSF copyright notice for plugins/module_utils/_mount.py.

* Add generic copyright notices.

* Update changelog fragment.
2022-08-08 23:23:08 +02:00
Felix Fontein
424d706f92
Fix more copyright lines, add more default copyright lines (#5095)
* Fix copyright lines.

* Add default copyright line.
2022-08-08 14:24:58 +02:00
Felix Fontein
9327b12c4d
Add more default license and copyright notices (#5087)
* Add more default license and copyright notices.

* Fix tests.

* Fix typos.

* Fix task type.

* Add URL to changelog fragment.

* Improve headers for setup_wildfly_server.
2022-08-08 08:44:19 +02:00
Alexei Znamensky
2ecaa91f68
pipx: use CmdRunner (#5085)
* pipx: use CmdRunner

* added BOTMETA entry for pipx module_utils

* add changelog fragment

* add missing line

* Update plugins/module_utils/pipx.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/module_utils/pipx.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-08 08:02:56 +02:00
Felix Fontein
2a9fd7359f
Add more license statements (#5079)
* Add more license statements. These were modified manually incorporating existing data.

* Remove accidentally added line.
2022-08-07 13:37:23 +02:00
Mike Moerk
6062ae8fae
WDC Redfish support for chassis indicator LED toggling. (#5059)
* WDC Redfish support for chassis indicator LED toggling.

* Added changelog fragment.

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-07 09:56:07 +02:00
Felix Fontein
496bf27b5c
Fix copyright lines (make sure 'Copyright' is there). (#5083) 2022-08-05 22:12:10 +02:00
Felix Fontein
68e7e52557
Add simple license headers, not completely at top. (#5080) 2022-08-05 21:31:34 +02:00
Felix Fontein
fa6c009ff0
Make sure all files have trailing newline (#5076)
* Make sure all files have trailing newline.

* Adjust tests.
2022-08-05 21:08:41 +02:00
Felix Fontein
1ab2a5f1bc
Add default license header to files which have no copyright or license header yet (#5074)
* Add default license header to files which have no copyright or license header yet.

* yml extension should have been xml...
2022-08-05 14:03:38 +02:00
Felix Fontein
123c7efe5e
Move licenses to LICENSES/, run add-license.py, add LICENSES/MIT.txt (#5065)
* Move licenses to LICENSES/, run add-license.py, add LICENSES/MIT.txt.

* Replace 'Copyright:' with 'Copyright'

sed -i 's|Copyright:\(.*\)|Copyright\1|' $(rg -l 'Copyright:')

Co-authored-by: Maxwell G <gotmax@e.email>
2022-08-05 12:28:29 +02:00
Alexei Znamensky
5933d28dc4
xfconf: add command output to results (#5037)
* xfconf: add command output to results

* add changelog fragment

* add docs for return value cmd

* Update plugins/modules/system/xfconf.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-01 11:21:06 +02:00
Jonathan Lung
e8e6b9bbd7
lastpass lookup: use config manager, improve documentation (#5022)
* LastPass lookup: use config manager, improve documentation

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/5022-lastpass-lookup-cleanup.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: jonathan lung <lungj@heresjono.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-01 09:36:07 +02:00
Dishant Pandya
88a3daf2ec
Fix: Add user-agent header to allow request through WAF with bot protection (#5024)
* Fix: Add user agent header to allow request through CDN/WAF with bot protection

* upate doc-fragment

* move http_agent variable assignment

* set http_agent param for all Keycloak API Requests

* Update plugins/doc_fragments/keycloak.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/5023-http-agent-param-keycloak.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix formatting

* Update plugins/doc_fragments/keycloak.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-01 09:35:05 +02:00
Richard Tuin
3fe9592cf1
Slack: Add support for (some) groups (#5019)
* Slack: Add support for (some) groups

Some of the older private channels in the workspace I'm working in have channel ID's starting with `G0` and `GF` and this resulted to false positive `channel_not_found` errors.
I've added these prefixes to the list to maintain as much backwards compatibility as possible.

Ideally the auto-prefix of the channel name with `#` is dropped entirely, given the Channel ID's have become more dominant in the Slack API over the past years.

* Add changelog fragment for slack channel prefix fix

* Update changelogs/fragments/5019-slack-support-more-groups.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-31 23:35:07 +02:00
PKehnel
c273498a03
Module listen ports facts extend output (#4953)
* Initial Rework of netstat and ss to include additional information.
State, foreign address, process.

* Fixed sanity tests. Python 2 compatible code. pylint errors resolved.

* Sanity tests. ss_parse fix minor error I created before.

* Rename variable for clarity

* Python2 rsplit takes no keyword argument. -> remove keyword argument

* Generic improvments for split_pid_name. Added changelog

* Sanity Test (no type hints for python2.7)

* add include_non_listening param. Add param to test. Add documentation. Only return state and foreign_address when include_non_listening

* Update changelogs/fragments/4953-listen-ports-facts-extend-output.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add info to changelog fragment. Clarify documentation.

* The case where we have multiple entries in pids for udp eg: users:(("rpcbind",pid=733,fd=5),("systemd",pid=1,fd=30)) is not in the tests. So roll back to previous approach where this is covered. Fix wrong if condition for include_non_listening.

* Rewrite documentation and formatting.

* Last small documentation adjustments.

* Update parameters to match description.

* added test cases to check if include_non_listening is set to no by default. And test if ports and foreign_address exists if set to yes

* undo rename from address to local_address -> breaking change

* Replace choice with bool, as it is the correct fit here

* nestat distinguishes between tcp6 and tcp output should always be tcp

* Minor adjustments in the docs (no -> false, is set to yes -> true)

Co-authored-by: Paul-Kehnel <paul.kehnel@ocean.ibm.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-31 22:12:38 +02:00
Minei3oat
9f3841703f
Pacman: Add support for install reason (#4956)
* Pacman: Add support for setting install reason

* Improved description

* Fix documentation

* Add changelog fragment

* Use source for installation

* Get all reasons at once

* Removed default for reason

* Added version info to documentation

* Fix NameError

* Moved determination of reason to _build_inventory

* Fix duplication and sanity errors

* adjust tests for changed inventory

* Documentation: remove empty default for reason

* mention packages with changed reason in exit params/info

* Added integration tests for reason and reason_for

Inspired by the integration tests for url packages

* Correct indentation

* Fix indentation

* Also sort changed packages in normal mode

* Also sort result in unit test

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-31 22:10:49 +02:00
wilfriedroset
d214f49be7
consul: add support for session TTL (#4996)
Signed-off-by: Wilfried Roset <wilfriedroset@users.noreply.github.com>
2022-07-31 13:17:43 +02:00
Alexei Znamensky
aba089369e
mh base: add verbosity() property (#5035)
* mh base: add verbosity property

* add changelog fragment
2022-07-31 11:28:17 +02:00
Sylvia van Os
3eb29eb4b6
Fix returnall for gopass (#5027)
* Fix returnall for gopass

Gopass was always given the --password flag, despite there being no need for this.

* Add changelog fragment

Co-authored-by: Sylvia van Os <sylvia.van.os@politie.nl>
2022-07-29 14:24:15 +02:00
Felix Fontein
c64dd16f1c Fix changelog fragment. 2022-07-29 12:09:10 +02:00
Alexei Znamensky
f544aac024
gconftool2: deprecate state get (#4778)
* gconftool2: deprecate state get

* added changelog fragment

* Update plugins/modules/system/gconftool2.py

* Update plugins/modules/system/gconftool2.py
2022-07-29 11:38:37 +02:00
Felix Fontein
9290381bea
xfconf: fix setting of boolean values (#5007) 2022-07-27 07:42:25 +02:00
CactiChameleon9
be0e47bfdc
Apk: add support for a custom world file (#4976)
* Apk: add support for a custom world file

* Apk: Add changelog fragment for custom world file
2022-07-26 11:14:17 +02:00
Raul Gabriel Verdi
a2677fd051
Expose unredirected_headers on maven_artifact (#4812)
* Expose unredirected_headers to module

In some cases, when the initial request returns a redirect and we want
to follow it to get the artifact, we might not want to include certain
headers in the redirection request. Specially headers like
Authorization and Cookies.
Or perhaps the redirect server returns a 400 because it included some
unexpected headers.
Fetch url already supports this feature, but it was being shadowed by
maven_artifact. In here we just expose it.

* Fix Linting errors

* Applied Comments

 - Specified version added
 - Changed description of unredirected_headers

* Check for ansible version

If it's 2.11 or older, we ignore unredirected_headers, otherwise we use
it, as fetch_url has them

* Applied comments

- Removed duplicated code in the call of fetch_url. Used kwargs instead
- Added check if unredirected_params is not empty and the fetch_url
  function does not support it
- Changed function that checks for ansible version
- Removed unused import

* Remove 2.11 breaking change

Made default only for ansible-core version 2.12 and above, but for keep
it empty for ansible-core version 2.11 and below.
Also include the following changes:
  - change doc to use C() on the function description
  - changed doc to use ansible-core instead of Ansible

* Changes in description for readability

* Add changelog fragment

* Change description changelog fragment
2022-07-24 12:09:58 +02:00
Alexei Znamensky
31ef6c914b
xfconf and xfconf_info: use do_raise (#4975)
* remove redundant XfConfException class

* adjusted indentation in the documentaiton blocks

* add changelog fragment
2022-07-24 12:09:24 +02:00
Benjamin
2662bc881f
Introduce dig lookup argument fail_on_error (#4973)
with default False for backwards compatibility.

Allows fail-fast behavior on lookup failures instead of returning strings and continuing.
2022-07-24 12:08:47 +02:00
Sargun Vohra
e2426707e2
Fix keyring_info when using keyring library (#4964)
* Fix keyring_info when using keyring library

This line used to always clobber the passphrase retrieved via the `keyring` library, making it useless on everything except gnome-keyring. After this change, it'll only use the alternate method if the default one didn't work.

* delete whitespace

* add changelog fragment

* Update changelogs/fragments/4964-fix-keyring-info.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-24 12:08:12 +02:00
Minei3oat
788cfb624a
Pacman: Fix name of URL packages (#4959)
* Strip downloading... of unseen URLs

* Added changelog fragment

* Added integration tests for reason and reason_for

Inspired by the integration tests for url packages

* Revert "Added integration tests for reason and reason_for"

This reverts commit f60d92f0d7.

Accidentally commited to the wrong branch.
2022-07-21 13:58:03 +02:00
miyuk
c57204f9a9
proxmox module_utils: fix get_vm int parse handling (#4945)
* add int parse handling

* Revert "add int parse handling"

This reverts commit db2aac4254.

* fix: vmid check if state is absent

* add changelogs fragments

* Update changelogs/fragments/4945-fix-get_vm-int-parse-handling.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-21 07:19:44 +02:00
Sylvia van Os
c31e6413f2
Fix path detection for gopass (#4955)
* Fix path detection for gopass

As per fc8c9a2286/docs/features.md (initializing-a-password-store), gopass defaults to ~/.local/share/gopass/stores/root for its password store root location.

However, the user can also override this, and this will be stored in the gopass config file (ed7451678c/docs/config.md (configuration-options)).

This patch ensures that the config setting in gopass is respected, falling back to the default gopass path. pass' behaviour remains unchanged.

* Formatting improvements

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add changelog fragment

* Formatting improvement

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-07-21 07:19:31 +02:00
ube
aa03c71267
proxmox inventory: fix for agent enabled (#4910)
* Update proxmox.py

* Forgot a debug print.

* pep

* Check if int, old school way.

* pep, once again.

* Create 4910-fix-for-agent-enabled.yml

* Must check the first listentry for enabled=1

* Update changelogs/fragments/4910-fix-for-agent-enabled.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-12 11:03:13 +02:00
Louis Seubert
35ddf31b5f
added password prompt support for machinectl (#4849)
* added password prompt support for machinectl

* include review comments

This includes the review comments as well as changelog fragment. This also gives more information about the polkit rule.

* fix yaml doc with leftover bracket

* include review comments 2

* move regex compile to global scope
2022-07-08 23:11:14 +02:00
Evgeni Golov
a5ff53f2ae
allow configuring opentelementry callback via config file (#4916)
this is especially useful for the `enable_from_environment` option, as
this allows to set a default for the whole project, instead of relying
on everyone setting the environment variable
2022-07-07 21:51:04 +02:00
Teddy Caddy
9a928d5ffb
Fix syntax in rax_clb_nodes that breaks in Python3 (#4933)
* Use syntax that works in both Python 2 and 3 when iterating through a
    dict that's going to be mutated during iteration
  * Fixes `dictionary changed size during iteration` error
  * Fixes #4932
2022-07-07 21:49:45 +02:00
antonc42
905f9ec399
fix lxd connection plugin inventory_hostname (#4912)
* fixes lxd connection plugin issue #4886

remote_addr value was set to literal string 'inventory_hostname' instead
of the value for inventory_hostname variable. solution found in PR
ansible/ansible#77894

* changelog fragment - bugfix - lxd connection plugin

* correct changelog fragment

* Update changelogs/fragments/4886-fix-lxd-inventory-hostname.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* replace _host instance variable with calls to get 'remote_addr' option

suggested by felixfontein

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-07 21:49:10 +02:00
andrii-zakurenyi
7ffa2b525c
Do not ignore tld option in DSV lookup plugin (#4911)
* Do not ignore tld option in DSV lookup plugin

* add changelog fragment

* Update changelogs/fragments/4911-dsv-honor-tld-option.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-04 20:25:34 +02:00