--- # 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