Repository: ansible/ansible

Issue:
libsemanage-python not listed as requirement for seboolean module
##### ISSUE TYPE

- Documentation Report

##### COMPONENT NAME

`seboolean` module

##### ANSIBLE VERSION

`devel` branch (as of a5b12ff)

##### SUMMARY

Attempting to use the `seboolean` module against a host that is missing the `libsemanage-python` package (i.e. it is not installed) results in `ansible-playbook` (correctly) exiting with an error:

```
TASK [os_hardening : abrt_upload_watch_anon_write = off] ***********************
fatal: [centos-7-x64-qemu-h0168]: FAILED! => {"changed": false, "failed": true, "msg": "This module requires libsemanage-python support"}
```

The [documentation for the module](https://docs.ansible.com/ansible/seboolean_module.html) does not list `libsemanage-python` under "Requirements".  I believe that the package should be included as a dependency since the [documentation for the selinux module](https://docs.ansible.com/ansible/selinux_module.html) similarly lists `libselinux-python` under "Requirements".

(To be clear, the module is functioning correctly / "as designed" when throwing the error. This is simply in regard to the incorrect module documentation page.)

##### STEPS TO REPRODUCE

On the host against which I am executing tasks:

```sh
$ cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)

$ rpm -q libsemanage-python
package libsemanage-python is not installed
```

On the control machine:

```sh
$ ansible --version | head -n 1
ansible 2.2.1.0
```

To reproduce, simply attempt to use the `seboolean` module as seen below.

##### ACTUAL RESULTS

Here, `devel` is a group which includes the CentOS 7 host:

```sh
$ ansible devel -m seboolean -a "name=abrt_upload_watch_anon_write state=no"
centos-7-x64-qemu-h0168 | FAILED! => {
    "changed": false,
    "failed": true,
    "msg": "This module requires libsemanage-python support"
}
```
After installing `libsemanage-python` on the target, the above task successfully executes.

I'll send a patch / pull request in case you want it, although it is a very trivial "fix" (one-liner).

Thanks!
libsemanage-python not listed as requirement for seboolean module
##### ISSUE TYPE

- Documentation Report

##### COMPONENT NAME

`seboolean` module

##### ANSIBLE VERSION

`devel` branch (as of a5b12ff)

##### SUMMARY

Attempting to use the `seboolean` module against a host that is missing the `libsemanage-python` package (i.e. it is not installed) results in `ansible-playbook` (correctly) exiting with an error:

```
TASK [os_hardening : abrt_upload_watch_anon_write = off] ***********************
fatal: [centos-7-x64-qemu-h0168]: FAILED! => {"changed": false, "failed": true, "msg": "This module requires libsemanage-python support"}
```

The [documentation for the module](https://docs.ansible.com/ansible/seboolean_module.html) does not list `libsemanage-python` under "Requirements".  I believe that the package should be included as a dependency since the [documentation for the selinux module](https://docs.ansible.com/ansible/selinux_module.html) similarly lists `libselinux-python` under "Requirements".

(To be clear, the module is functioning correctly / "as designed" when throwing the error. This is simply in regard to the incorrect module documentation page.)

##### STEPS TO REPRODUCE

On the host against which I am executing tasks:

```sh
$ cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)

$ rpm -q libsemanage-python
package libsemanage-python is not installed
```

On the control machine:

```sh
$ ansible --version | head -n 1
ansible 2.2.1.0
```

To reproduce, simply attempt to use the `seboolean` module as seen below.

##### ACTUAL RESULTS

Here, `devel` is a group which includes the CentOS 7 host:

```sh
$ ansible devel -m seboolean -a "name=abrt_upload_watch_anon_write state=no"
centos-7-x64-qemu-h0168 | FAILED! => {
    "changed": false,
    "failed": true,
    "msg": "This module requires libsemanage-python support"
}
```
After installing `libsemanage-python` on the target, the above task successfully executes.

I'll send a patch / pull request in case you want it, although it is a very trivial "fix" (one-liner).

Thanks!


Discussion:

Resolving patch:
diff --git a/lib/ansible/modules/system/seboolean.py b/lib/ansible/modules/system/seboolean.py
--- a/lib/ansible/modules/system/seboolean.py
+++ b/lib/ansible/modules/system/seboolean.py
@@ -49,7 +49,7 @@
     choices: [ 'yes', 'no' ]
 notes:
    - Not tested on any debian based system
-requirements: [ ]
+requirements: [ libselinux-python, libsemanage-python ]
 author: "Stephen Fromm (@sfromm)"
 '''
 


Test patch: