- hosts: localhost
  tasks:
    - name: Setup libxcrypt if requested
      include_role:
        name: setup_libxcrypt
      when: use_libxcrypt|default(false)

    - name: Skip macOS when not using libxcrypt (no usable crypt)
      meta: end_host
      when:
        - not expect_libxcrypt|default(false)
        - ansible_facts.distribution == 'MacOSX'

    - name: Skip Alpine and FreeBSD when libxcrypt is expected (not available)
      meta: end_host
      when:
        - expect_libxcrypt | default(false)
        - ansible_facts.distribution == 'Alpine' or ansible_facts.system == 'FreeBSD'

    - import_role:
        name: filter_core
        tasks_from: password_hash.yml
      vars:
        is_crypt: true
