--- # tasks file for ensure_git - name: Include Variables when: ["ansible_facts[\"system\"] == 'Linux'"] ansible.builtin.include_vars: file: '{{ lookup("first_found", findme) }}' name: ensure_git 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_git is defined - ensure_git.package_list is defined - ensure_git.package_list is iterable ansible.builtin.package: name: '{{ item.name }}' state: '{{ item.state }}' loop: '{{ ensure_git.package_list }}' loop_control: label: '{{ item.name }} will be {{ item.state }}' notify: [ensure_git.package_facts, ensure_git.service_facts] - name: Ensure Configurations when: - ansible_facts["system"] == 'Linux' - ensure_git is defined - ensure_git.template_list is defined - ensure_git.template_list is iterable ansible.builtin.template: backup: 'no' dest: '{{ item.dest }}' group: '{{ item.group | default(omit) }}' mode: '{{ item.mode | default(omit) }}' owner: '{{ item.owner | default(omit) }}' selevel: '{{ iteml.selevel | default(omit) }}' serole: '{{ item.serole | default(omit) }}' setype: '{{ item.setype | default(omit) }}' seuser: '{{ item.seuser | default(omit) }}' src: '{{ item.src }}' loop: '{{ ensure_git.template_list }}' loop_control: label: '{{ item.dest }} will be ensured' notify: - ensure_git.package_facts - ensure_git.service_facts - ensure_git.service_reload - ensure_git.service_restart - name: Ensure Services when: - ansible_facts["system"] == 'Linux' - ensure_git is defined - ensure_git.service_list is defined - ensure_git.service_list is iterable ansible.builtin.service: enabled: '{{ item.enabled }}' name: '{{ item.name }}' state: '{{ item.state }}' loop: '{{ ensure_git.service_list }}' loop_control: label: '{{ item.name }} will be {{ item.state }}' notify: [ensure_git.package_facts, ensure_git.service_facts] - name: Ensure Selinux Is Configured when: - ansible_facts["system"] == 'Linux' - ensure_git is defined - ensure_git.selinux_policy is defined - ensure_git.selinux_state is defined ansible.posix.selinux: policy: '{{ ensure_git.selinux_policy }}' state: '{{ ensure_git.selinux_state }}' register: results notify: - ensure_git.package_facts - ensure_git.service_facts - ensure_git.service_reload - ensure_git.service_restart - name: Reboot If Required when: - ansible_facts["system"] == 'Linux' - ensure_git is defined - ensure_git.selinux_policy is defined - ensure_git.selinux_state is defined - results is defined - results.reboot_required is defined - results.reboot_required reboot: - name: Ensure Seboolean when: - ansible_facts["system"] == 'Linux' - ensure_git is defined - ensure_git.seboolean_list is defined - ensure_git.seboolean_list is iterable ansible.posix.seboolean: name: '{{ item.name }}' persistent: '{{ item.persistent }}' state: '{{ item.state }}' loop: '{{ ensure_git.seboolean_list }}' loop_control: label: '{{ item.name }} will be {{ item.state }}' notify: - ensure_git.package_facts - ensure_git.service_facts - ensure_git.service_reload - ensure_git.service_restart - name: Flush Handlers ansible.builtin.meta: flush_handlers