--- - name: Install debian packages import_tasks: packages_debian.yml when: ansible_facts['os_family'] == 'Debian' - name: Install rhel packages import_tasks: packages_redhat.yml when: ansible_facts['os_family'] == 'RedHat' - name: Ensure service is started and enabled ansible.builtin.systemd: name: docker state: started enabled: yes