- name: ensure htpasswd service is specified fail: when: - name: set variable for realm generation set_facts: htpasswd_credentials_: "{{ htpasswd_user }}:{{ htpasswd_password }}" htpasswd_file_: "{{ htpasswd_dir }}/{{ htpasswd_service }}" - name: generate realm file shell: echo "{{ htpasswd_credentials_ }}" | htpasswd -I "{{ htpasswd_file_ }}"