Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Switch to failed_when structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Shapiro committed Nov 28, 2016
1 parent 4f6eff2 commit 19a468b
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions playbooks/edx-east/manage_edxapp_users_and_groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,5 @@
{% if item.get('unusable_password') %}--unusable-password{% endif %}
{% if item.get('initial_password_hash') %}--initial-password-hash {{ item.initial_password_hash | quote }}{% endif %}
with_items: django_users
ignore_errors: yes
register: manage_users_result

# Note that we're doing something a bit odd with this play. Unfortunately, it appears that the
# version of Ansible we're using (1.9.3-edx as of October 2016) does not support variable statements
# in the `ignore_errors` field. As a result, we're capturing the result of that play, and using it
# to determine if we execute an explicit `fail` play.

- name: "Managing users fails on error unless {{ ignore_user_creation_errors }}"
fail: item
when:
- item|failed
- not ignore_user_creation_errors | bool
with_items: manage_users_result.results
failed_when: (manage_users_result | failed) and not (ignore_user_creation_errors | bool)

0 comments on commit 19a468b

Please sign in to comment.