Add ensure_dbus so that firewalld cli commands work
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
---
|
||||
# tasks file for ensure_dbus
|
||||
- name: include variables
|
||||
when: ["ansible_facts[\"system\"] == 'Linux'"]
|
||||
ansible.builtin.include_vars:
|
||||
file: '{{ lookup("first_found", findme) }}'
|
||||
name: ensure_dbus
|
||||
vars:
|
||||
findme:
|
||||
files:
|
||||
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
|
||||
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
|
||||
- '{{ ansible_facts["distribution"] }}-default.yml'
|
||||
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
|
||||
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
|
||||
- '{{ ansible_facts["os_family"] }}-default.yml'
|
||||
- default.yml
|
||||
paths: [../vars/]
|
||||
errors: ignore
|
||||
|
||||
- name: package discovery
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ansible_facts["packages"] is not defined
|
||||
ansible.builtin.package_facts:
|
||||
|
||||
- name: service discovery
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ansible_facts["services"] is not defined
|
||||
ansible.builtin.service_facts:
|
||||
|
||||
- name: ensure packages
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ensure_dbus is defined
|
||||
- ensure_dbus.package_list is defined
|
||||
- ensure_dbus.package_list is iterable
|
||||
ansible.builtin.package:
|
||||
name: '{{ item.name }}'
|
||||
state: '{{ item.state }}'
|
||||
loop: '{{ ensure_dbus.package_list }}'
|
||||
loop_control:
|
||||
label: '{{ item.name }} will be {{ item.state }}'
|
||||
notify: [ensure_dbus.package_facts, ensure_dbus.service_facts]
|
||||
|
||||
- name: ensure services
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ensure_dbus is defined
|
||||
- ensure_dbus.service_list is defined
|
||||
- ensure_dbus.service_list is iterable
|
||||
ansible.builtin.service:
|
||||
enabled: '{{ item.enabled }}'
|
||||
name: '{{ item.name }}'
|
||||
state: '{{ item.state }}'
|
||||
loop: '{{ ensure_dbus.service_list }}'
|
||||
loop_control:
|
||||
label: '{{ item.name }} will be {{ item.state }}'
|
||||
notify: [ensure_dbus.package_facts, ensure_dbus.service_facts]
|
||||
|
||||
- name: flush handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
Reference in New Issue
Block a user