- name: Gather facts setup: gather_subset: [min] - name: Install libxcrypt on RedHat/CentOS/Fedora when: ansible_facts.os_family == 'RedHat' become: yes package: name: libxcrypt state: present notify: libxcrypt was installed - name: Install libxcrypt on Debian/Ubuntu when: ansible_facts.os_family == 'Debian' become: yes package: name: libcrypt1 state: present notify: libxcrypt was installed - name: Install libxcrypt on macOS when: ansible_facts.distribution == 'MacOSX' block: - name: MACOS | Find brew binary command: which brew register: brew_which - name: MACOS | Get owner of brew binary stat: path: "{{ brew_which.stdout }}" register: brew_stat - name: MACOS | Install libxcrypt command: brew install libxcrypt notify: libxcrypt was installed become: yes become_user: "{{ brew_stat.stat.pw_name }}" vars: # Avoid using the current interpreter, which may be from a venv that the become user has no access to. ansible_python_interpreter: "{{ lookup('env', 'ANSIBLE_TEST_PYTHON_INTERPRETER') }}" environment: HOMEBREW_NO_AUTO_UPDATE: True