mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-10 22:55:27 +01:00
respawn firewalld module when selinux is missing
This commit is contained in:
parent
34a9cf3e4d
commit
ad414c87b4
3 changed files with 5 additions and 7 deletions
|
|
@ -4,3 +4,5 @@ minor_changes:
|
||||||
(https://github.com/ansible-collections/ansible.posix/pull/460)."
|
(https://github.com/ansible-collections/ansible.posix/pull/460)."
|
||||||
- "selinux - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter``
|
- "selinux - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter``
|
||||||
(https://github.com/ansible-collections/ansible.posix/pull/460)."
|
(https://github.com/ansible-collections/ansible.posix/pull/460)."
|
||||||
|
- "firewalld - respawn module to use the system python interpreter when the ``firewall`` python module is not available for ``ansible_python_interpreter``
|
||||||
|
(https://github.com/ansible-collections/ansible.posix/pull/460)."
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
from ansible_collections.ansible.posix.plugins.module_utils.version import LooseVersion
|
from ansible_collections.ansible.posix.plugins.module_utils.version import LooseVersion
|
||||||
|
from ansible_collections.ansible.posix.plugins.module_utils._respawn import respawn_module, HAS_RESPAWN_UTIL
|
||||||
from ansible.module_utils.basic import missing_required_lib
|
from ansible.module_utils.basic import missing_required_lib
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
@ -314,6 +315,8 @@ class FirewallTransaction(object):
|
||||||
installed version (%s) likely too old. Requires firewalld >= 0.2.11" % FW_VERSION)
|
installed version (%s) likely too old. Requires firewalld >= 0.2.11" % FW_VERSION)
|
||||||
|
|
||||||
if import_failure:
|
if import_failure:
|
||||||
|
if HAS_RESPAWN_UTIL:
|
||||||
|
respawn_module("firewall")
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg=missing_required_lib('firewall') + '. Version 0.2.11 or newer required (0.3.9 or newer for offline operations)'
|
msg=missing_required_lib('firewall') + '. Version 0.2.11 or newer required (0.3.9 or newer for offline operations)'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,6 @@
|
||||||
state: present
|
state: present
|
||||||
# This doesn't work for CentOS 6 because firewalld doesn't exist in CentOS6
|
# This doesn't work for CentOS 6 because firewalld doesn't exist in CentOS6
|
||||||
|
|
||||||
- name: Check to make sure the firewalld python module is available.
|
|
||||||
shell: "{{ansible_python.executable}} -c 'import firewall'"
|
|
||||||
register: check_output
|
|
||||||
ignore_errors: true
|
|
||||||
|
|
||||||
- name: Enable dbus-broker daemon
|
- name: Enable dbus-broker daemon
|
||||||
service:
|
service:
|
||||||
name: dbus-broker
|
name: dbus-broker
|
||||||
|
|
@ -30,7 +25,6 @@
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- import_tasks: run_all_tests.yml
|
- import_tasks: run_all_tests.yml
|
||||||
when: check_output.rc == 0
|
|
||||||
|
|
||||||
- name: Test Offline Operations
|
- name: Test Offline Operations
|
||||||
block:
|
block:
|
||||||
|
|
@ -40,7 +34,6 @@
|
||||||
state: stopped
|
state: stopped
|
||||||
|
|
||||||
- import_tasks: run_all_tests.yml
|
- import_tasks: run_all_tests.yml
|
||||||
when: check_output.rc == 0
|
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version is version('7', '>=')
|
- ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version is version('7', '>=')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue