- name: Configure all hosts hosts: all gather_facts: true pre_tasks: - name: Check if community.general collection is installed ansible.builtin.command: ansible-galaxy collection list community.general register: collection_check changed_when: false ignore_errors: true delegate_to: localhost - name: Install required collections ansible.builtin.command: ansible-galaxy collection install -r "{{ playbook_dir }}/requirements.yml" delegate_to: localhost when: collection_check.rc != 0 or "community.general" not in collection_check.stdout changed_when: collection_check.rc != 0 or "community.general" not in collection_check.stdout run_once: true tasks: - name: Include global tasks ansible.builtin.import_tasks: tasks/global/global.yml - name: Include workstation tasks ansible.builtin.import_tasks: tasks/workstations/workstation.yml when: hostname in ['mennos-laptop', 'mennos-desktop'] - name: Include server tasks ansible.builtin.import_tasks: tasks/servers/server.yml when: hostname in ['mennos-server', 'mennos-hobbypc', 'mennos-vm']