Commit graph

119 commits

Author SHA1 Message Date
Ondrej Mosnacek
53d47e1763 selinux: update kernel boot params when disabling/re-enabling SELinux
The ability to disable SELinux from userspace based on the configuration
file is being deprecated in favor of the selinux=0 kernel boot
parameter. (Note that this affects only the "full" disable; switching
to/from permissive mode will work the same as before.)

Therefore, add an 'update_kernel_param' module parameter that will cause
it to set/unset the kernel command-line parameter using grubby when
enabling/disabling SELinux. (An explicit parameter was chosen for
backwards compatibility.)

More information:
https://lore.kernel.org/selinux/157836784986.560897.13893922675143903084.stgit@chester/
https://fedoraproject.org/wiki/Changes/Remove_Support_For_SELinux_Runtime_Disable

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-20 10:09:54 +05:30
ansible-zuul[bot]
7f16f56c5b
Merge pull request #248 from Akasurde/i247
firewalld: Correct usage of queryForwardPort

SUMMARY

Correct queryForwardPort API usage
Enable port_foward_test_cases tests

Fixes: #247
Signed-off-by: Abhijeet Kasurde akasurde@redhat.com
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/firewalld.py
tests/integration/targets/firewalld/tasks/run_all_tests.yml

Reviewed-by: Hideki Saito <saito@fgrep.org>
Reviewed-by: None <None>
2021-08-18 09:14:19 +00:00
Abhijeet Kasurde
249e64a64d sanity fixes for pylint test
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-08-16 16:04:29 +05:30
Abhijeet Kasurde
12941f6d9a firewalld: Correct usage of queryForwardPort
* Correct queryForwardPort API usage
* Enable port_foward_test_cases tests

Fixes: #247

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-08-16 14:12:22 +05:30
Abhijeet Kasurde
c244abd82f Fix integration test fedora 34 with firewalld
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-08-10 15:17:24 +05:30
mandar242
244c9b2066 sysctl: Fix integration test virtualization type 2021-08-04 21:52:50 +05:30
ansible-zuul[bot]
b3e395a4a3
Merge pull request #239 from Akasurde/firewalld_test
Enable firewalld tests

SUMMARY
Signed-off-by: Abhijeet Kasurde akasurde@redhat.com
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
tests/integration/targets/firewalld/aliases
tests/integration/targets/setup_pkg_mgr/tasks/main.yml

Reviewed-by: Adam Miller <maxamillion@fedoraproject.org>
Reviewed-by: None <None>
2021-08-02 22:36:00 +00:00
Abhijeet Kasurde
424004c4c0 Enable firewalld tests
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-08-02 20:26:42 +05:30
ansible-zuul[bot]
a03e652437
Merge pull request #214 from saito-hideki/pr/add_firewalld_info
Add new firewalld_info module to ansible.posix collection

SUMMARY
Add new firewalld_info module to ansible.posix collection.

Gathering information about firewalld zone settings
fixes #98

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

ansible.posix.firewalld_info

ADDITIONAL INFORMATION
None

Reviewed-by: Abhijeet Kasurde <None>
Reviewed-by: Hideki Saito <saito@fgrep.org>
2021-07-21 05:19:13 +00:00
ansible-zuul[bot]
e815909859
Merge pull request #215 from quasd/main
fix REJECT target name

SUMMARY
Fix setting default target to reject. The target name is %%REJECT%% not REJECT.
https://firewalld.org/documentation/zone/options.html
After this pull request to way to set REJECT would be
  - name: "Set target to REJECT for public"
    ansible.posix.firewalld:
      zone: public
      permanent: yes
      target: '%%REJECT%%'
      state: enabled
    become: true


ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
firewalld
ADDITIONAL INFORMATION



This snippet would fail due to there not being target called REJECT and using %%REJECT%% is not in allowed values for target
  - name: "Set target to REJECT for public"
    ansible.posix.firewalld:
      zone: public
      permanent: yes
      target: 'REJECT'
      state: enabled
    become: true

Ansible error
{
    "msg": "ERROR: Exception caught: org.fedoraproject.FirewallD1.Exception: INVALID_TARGET: REJECT Permanent operation",
    "invocation": {
        "module_args": {
            "zone": "public",
            "permanent": true,
            "target": "REJECT",
            "state": "enabled",
            "immediate": false,
            "timeout": 0,
            "icmp_block": null,
            "icmp_block_inversion": null,
            "service": null,
            "port": null,
            "port_forward": null,
            "rich_rule": null,
            "source": null,
            "interface": null,
            "masquerade": null,
            "offline": null
        }
    },
    "_ansible_no_log": false,
    "changed": false
}

syslog
Jun 29 09:49:39 <hostname retracted> ansible-ansible.posix.firewalld[9015]: Invoked with zone=public permanent=True state=enabled target=REJECT immediate=False timeout=0 icmp_[1850/7279] icmp_block_inversion=None service=None port=None port_forward=None rich_rule=None source=None interface=None masquerade=None offline=None                                                                 
Jun 29 09:49:39 <hostname retracted>  firewalld[915]: ERROR: INVALID_TARGET: REJECT

Reviewed-by: Abhijeet Kasurde <None>
Reviewed-by: None <None>
Reviewed-by: Amin Vakil <info@aminvakil.com>
Reviewed-by: quidame <None>
Reviewed-by: Hideki Saito <saito@fgrep.org>
2021-07-14 17:05:30 +00:00
ansible-zuul[bot]
f2601b01da
Merge pull request #213 from ndgit/fix-24-and-190
synchronize: quotes around arguments

fix quoting for specific cmd arguments
Fixes:

#24
#190

ISSUE TYPE:

Bugfix Pull Request

COMPONENT NAME:
module: synchronize

Reviewed-by: Abhijeet Kasurde <None>
Reviewed-by: Robert Rettig <None>
Reviewed-by: Hideki Saito <saito@fgrep.org>
Reviewed-by: Mike Graves <mgraves@redhat.com>
2021-07-14 15:20:20 +00:00
Hideki Saito
27434455e5 Add new firewalld_info module to ansible.posix collection
* fixes #98

Signed-off-by: Hideki Saito <saito@fgrep.org>
2021-07-09 23:47:12 +09:00
Robert Rettig
25cfc56f6f enable integration tests
ansible-collections/ansible.posix/pull/213#issuecomment-876480707
2021-07-09 02:28:39 +02:00
ansible-zuul[bot]
f6fa00bfff
Merge pull request #187 from smemsh/fix-synchronize-become-user
synchronize: fix to honor become_user when become_method sudo

SUMMARY

When become_method is sudo, the synchronize module ignores become_user, always running as root.  This means one cannot create files as a target user, when they need to get in via a third user and can only sudo via that one.  In my case, I'm connecting via a special provisioning user that has sudo privs, but I need to create the files as the become_user.  I'm using it to deposit skeleton files, and there should be no reason to run another task with chown; after all, the documentation already describes the desired behavior:

The user and permissions for the synchronize dest are those of the remote_user on the destination host or the become_user if become=yes is active.

This patch takes the running become_user (if it's not None) and adds it to the sudo command with the -u command line option, so the file gets created correctly.  I have tested this and it works.
Other become_methods are ignored, but they already were anyways (the code already has a TODO to add other methods, which we don't attempt in this patch)
Fixes #186

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

synchronize
ADDITIONAL INFORMATION


See reproduction in #186.
This appears to have been in place since ansible/ansible@811a906

Reviewed-by: Amin Vakil <info@aminvakil.com>
Reviewed-by: Sumit Jaiswal <sjaiswal@redhat.com>
2021-07-08 14:16:12 +00:00
ansible-zuul[bot]
68263bfc29
Merge pull request #217 from saito-hideki/pr/restructure_test_for_authorized_key
Restructure integration tests for authorized_key module

SUMMARY
Split the large tasks/main.yml in integration tests to each function block and use import_tasks to import for them.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME

tests/integration/targets/authorized_key/

ADDITIONAL INFORMATION

None
2021-07-08 12:27:01 +00:00
Hideki Saito
69d17ed4b7 Restructure integration tests for authorized_key module
* Split tasks/main.yml in integration tests to each function block.

Signed-off-by: Hideki Saito <saito@fgrep.org>
2021-07-02 16:27:02 +09:00
Mandar Kulkarni
ed573a8223 Clean up main.yml 2021-07-01 10:12:33 -07:00
Mandar Kulkarni
dd7d29495d Clean, use blocks in main.yml 2021-07-01 09:27:04 -07:00
Mandar Kulkarni
606e3cfe07 Update main.yml 2021-06-30 16:52:16 -07:00
Mandar Kulkarni
23fadc9f02 Update main.yml 2021-06-30 16:25:01 -07:00
Mandar Kulkarni
6d51660be4 Update main.yml 2021-06-30 15:57:39 -07:00
Mandar Kulkarni
957a7420ca Update main.yml 2021-06-30 15:26:33 -07:00
Mandar Kulkarni
b740bdaf3a Merge https://github.com/ansible-collections/ansible.posix into issues/126/mount-return-backup-file 2021-06-30 04:11:28 -04:00
quasd
310c68e6dd add tests for REJECT target 2021-06-29 11:37:20 +03:00
ansible-zuul[bot]
23afcce8b8
Merge pull request #207 from Andersson007/mount_tests
mount integration tests: make them more human readable

Reviewed-by: https://github.com/apps/ansible-zuul
2021-06-11 15:16:12 +00:00
Andrew Klychkov
0b597f2e66 mount integration tests: make them more human readable 2021-06-11 11:15:28 +02:00
Abhijeet Kasurde
07fe3a91b6 firewalld: Ensure idempotency
Use APIs like ``query*`` instead of ``get*``.

Fixes: #179

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-06-04 16:55:19 +05:30
Adam Miller
41e5b8428f mount return backup_file
Fixes https://github.com/ansible-collections/ansible.posix/issues/126

Signed-off-by: Adam Miller <admiller@redhat.com>
2021-06-04 10:52:38 +05:30
Hideki Saito
cfff8a3806 Modify boot option handling on Linux systems
* Address the issue #28
* Modified behavior to set noauto option if boot is 'no' on Linux system
* Modified integration test to use filesize module instead of dd

Signed-off-by: Hideki Saito <saito@fgrep.org>
2021-06-01 14:21:01 +09:00
ansible-zuul[bot]
92c6037900
Merge pull request #159 from quidame/fix/ansible_ssh_user
Fix ansible_ssh_user

Reviewed-by: https://github.com/apps/ansible-zuul
2021-05-24 15:22:50 +00:00
Scott Mcdermott
0e6f8ab976 Modify synchronize tests for '-u root' arg when become_user not supplied 2021-05-12 01:00:23 -07:00
Andrew Klychkov
da82df4004 Update codecov.sh URL 2021-04-30 07:54:51 +02:00
Hideki Saito
8b1b4df54f Add ignore file for sanity test for 2.12
* Add ignore file to cover sanity test for the current devel version 2.12

Signed-off-by: Hideki Saito <saito@fgrep.org>
2021-04-12 23:01:30 +09:00
quidame
d976add5da replace no more supported 'ansible_ssh_*' option names by the new ones
* Replace 'ansible_ssh_user' by 'ansible_user' everywhere.
* Replace 'ansible_ssh_port' by 'ansible_port' everywhere.
* Replace 'ansible_ssh_host' by 'ansible_host' everywhere.
2021-03-28 13:50:49 +02:00
ansible-zuul[bot]
d8fb68514c
Merge pull request #138 from Akasurde/sanity_fix
Fix sanity test for modules

Reviewed-by: https://github.com/apps/ansible-zuul
2021-03-02 16:27:55 +00:00
Abhijeet Kasurde
ea8fc70373 Fix sanity test for modules
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-03-02 18:53:06 +05:30
Abhijeet Kasurde
04f976d7d3 Update OS as per guidelines
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-03-02 17:43:15 +05:30
Andrew Klychkov
bbba9beb70 Add tests/sanity/ignore-2.11.txt 2021-03-02 11:20:44 +01:00
Andrew Klychkov
a8594c5477 Remove tests/sanity/requirements.txt 2021-03-01 16:47:09 +01:00
John R Barker
e1dad76ccb
AZP: Ensure collection dir is writable (#139) 2021-02-15 09:57:03 +00:00
Evan Anderson
1e7d82af6d firewalld: Add support for firewalld port forwarding
Fixes: ansible-collections/ansible.posix#100
2021-01-16 19:05:44 -06:00
John Barker
793b039691 Initial Azure Pipeline config 2020-12-11 13:29:10 +00:00
Adam Miller
34a12eb3f9 firewalld: add zone target set (#526)
* firewalld: add zone target set

Fixes https://github.com/ansible/ansible/issues/49232

Signed-off-by: Adam Miller <admiller@redhat.com>

* fix sanity tests, add example of zone target setting

Signed-off-by: Adam Miller <admiller@redhat.com>

* test different zone/target combination as we're not hitting default settings

Signed-off-by: Adam Miller <admiller@redhat.com>

* fix enabled values for zone operations

Signed-off-by: Adam Miller <admiller@redhat.com>

* Apply suggestions from code review

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

Co-authored-by: Felix Fontein <felix@fontein.de>
2020-11-16 12:14:10 +01:00
Martin Schurz
5935dce47f do not persist sysctl when value is invalid
the order of actions for setting, persisting and activation is changed,
to not persist an invalid sysctl value. This is only enforced when
sysct_set is True.
2020-10-02 23:03:14 +02:00
ansible-zuul[bot]
d1fff45191
Merge pull request #82 from bmv126/synchronize_private_key_issue
Fix for private_key overriding in synchronize module

Reviewed-by: Adam Miller <admiller@redhat.com>
             https://github.com/maxamillion
2020-09-18 05:24:11 +00:00
vishwas
4b0b50439d Fix for private_key overriding in synchronize module 2020-09-04 04:16:43 -04:00
jillr
2dfa6e28a1 Fix sanity test failures
Remove no longer necessary ignore
Fix shippable.sh to use correct ansible_version variable and don't
quote pattern to be matched by =~
2020-09-02 18:51:05 +00:00
Adam Miller
dd249846ec don't run coverage analyze on Ansible 2.9
Fixes #73
https://github.com/ansible-collections/ansible.posix/issues/73

Signed-off-by: Adam Miller <admiller@redhat.com>
2020-07-31 15:22:39 -05:00
ansible-zuul[bot]
ff154e5d3b
Merge pull request #68 from maxamillion/firewalld-migration
migrate firewalld from community.general

Reviewed-by: https://github.com/apps/ansible-zuul
2020-07-16 05:20:06 +00:00
Max Audron
b32447d107 patch - add integration test for ignore_whitespace 2020-07-12 12:09:56 +02:00
Adam Miller
ea952f0825 migrate firewalld from community.general
Signed-off-by: Adam Miller <admiller@redhat.com>
2020-07-06 16:59:19 -05:00
ansible-zuul[bot]
d9827556a4
Merge pull request #56 from maxamillion/shippable/test-stable-and-devel
shippable run against all stable and devel ansible

Reviewed-by: https://github.com/apps/ansible-zuul
2020-06-19 22:26:33 +00:00
ansible-zuul[bot]
916b96b4d9
Merge pull request #55 from maxamillion/issues/37/authorized_key-check_mode-inconsistent-return
authorized_keys - consistent behavior in check_mode

Reviewed-by: https://github.com/apps/ansible-zuul
2020-06-19 17:44:02 +00:00
Adam Miller
581349b700
Update tests/utils/shippable/shippable.sh
Co-authored-by: John R Barker <john@johnrbarker.com>
2020-06-19 10:36:35 -05:00
Adam Miller
d816868d49
Update tests/utils/shippable/shippable.sh
Co-authored-by: John R Barker <john@johnrbarker.com>
2020-06-19 10:36:02 -05:00
Adam Miller
f7ac380b82 remove references to ismount.py for tests
Signed-off-by: Adam Miller <admiller@redhat.com>
2020-06-19 10:26:09 -05:00
Adam Miller
11bd762953 fix up some of the import from community.general artifacts
Signed-off-by: Adam Miller <admiller@redhat.com>
2020-06-19 10:19:46 -05:00
Adam Miller
82daf8ba9f shippable run against all stable and devel ansible
Signed-off-by: Adam Miller <admiller@redhat.com>
2020-06-19 10:05:19 -05:00
Adam Miller
86a5950efa authorized_keys - consistent behavior in check_mode
Previously check_mode would incorrectly return changed=False even when a
change would have taken place if ran without check_mode, with
integration tests that confirmed this incorrect behavior. Also the
module did not correctly populate the return values when run in
check_mode. Both of these issues are resolved in this PR.

Fixes https://github.com/ansible-collections/ansible.posix/issues/37

Signed-off-by: Adam Miller <admiller@redhat.com>
2020-06-19 09:18:52 -05:00
Adam Miller
cb54073f65 selinux - add missing config keys when needed
Previously the selinux module would only edit the state of found
configuration keys SELINUX and SELINUXTYPE in /etc/selinux/config but
would not add them with desired state if they were not found.

Fixes #23

https://github.com/ansible-collections/ansible.posix/issues/23

Signed-off-by: Adam Miller <admiller@redhat.com>
2020-06-18 17:28:59 -05:00
Paul Belanger
21ce64a418 Remove sanity jobs from shippable
Add fixes to make sanity happy.

Depends-On: https://github.com/ansible/ansible-zuul-jobs/pull/533
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2020-06-16 19:46:58 -04:00
Adam Miller
2d5fb42acd
Revert "Enable at, patch and synchronize tests (#5)" (#35)
This reverts commit 27482c25f9.
2020-06-04 15:54:14 -05:00
Abhijeet Kasurde
75a5f83602
Partially revert "mount: Check if src exists before mounted (ansible/ansible#61752)" (#33)
This reverts part of ansible commit 72023d7462e78635264fd12bfdb23894b4163cba.

The immediate reason is that it breaks mounts where src is not a path.
Examples of such mounts are network-based filesystems such as nfs, cifs,
glusterfs, ceph, virtual filesystems such as tmpfs or overlayfs, and
also UUID-based mounts. It is too hard to come with an exhaustive list,
especially if we take non-Linux systems into account, so don't even try.

Additionally, it did not really fix the issue (ansible/ansible#59183) that
it intended to fix, because the mount could fail but leave a non-working
fstab entry for reasons other than non-existing src path.

Restore fstab and remove the mount point after a failed mount

Add a reminder that not only devices can be mounted

Fixes: ansible/ansible#65855
Fixes: ansible/ansible#67588
Fixes: ansible/ansible#67966

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

Co-authored-by: Alexander E. Patrakov <patrakov@gmail.com>
2020-05-29 15:34:53 -05:00
Alex Shafer
147caed10d
Copy and adjust changes from ansible/ansible#59530 (#14) 2020-04-29 16:41:50 -05:00
John R Barker
6b347f3725
CI should use devel (#6)
* CI should use devel

* Update shippable.sh
2020-03-24 08:30:32 +00:00
Matt Martz
27482c25f9
Enable at, patch and synchronize tests (#5)
* Enable at, patch and synchronize tests

* Remove commented out tasks

* Skip currently unsupported platforms

* Skip AIX on at
2020-03-20 12:37:05 +00:00
John R Barker
11c671adc7
Green CI for ansible.posix (#2)
* Disable tests that depend on `package`
* Remove incorrectly added gallaxy (fallaxy) tests
* Remove incorrectly added ignore-2.10.txt entries
* Remove interfaces_file unit tests (it's in community.general)
* Restore order to shippable.yml
2020-03-18 11:19:19 +00:00
John R Barker
07f1a2e98e
Bootstrap Collection (#1)
* Bootstrap Collection

* Basic common bootstrapping of repo
* Correct Galaxy settings
* Attempt to get Shippable working

* correct directory

* patch is part of ansible.posix (not community.general

* tests/utils/shippable/ missing from ignore.txt

* shippable/units.sh from a/a:devel

* ignore.txt:patch

* CI: Only use group1 for integration

* Correct Repo URLs

Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* HACK: Install community.general

* run integration tests first

* Install community.general in correct location

* deleted too much

* Use Extended FQCN for community.general

* Use temp-2.10-devel

* Update tests/utils/shippable/sanity.sh

Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2020-03-13 09:12:26 +00:00
Ansible Core Team
6f928621f0 Initial commit 2020-03-09 13:15:28 +00:00