# # Create user and define if they are admin # # /usr/local/bin/matrix-synapse-register-user # - name: Set admin bool to zero set_fact: admin_bool: 0 when: admin_access == 'false' - name: Examine if server admin set set_fact: admin_bool: 1 when: admin_access == 'true' - name: Set boolean value to exit playbook set_fact: end_playbook: true - name: Create user account command: | /usr/local/bin/matrix-synapse-register-user {{ new_username | quote }} {{ new_password | quote }} {{ admin_bool }} register: cmd - name: Delete the AWX session token for executing modules awx.awx.tower_token: description: 'AWX Session Token' scope: "write" state: absent existing_token_id: "{{ awx_session_token.ansible_facts.tower_token.id }}" tower_host: "https://{{ awx_host }}" tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}" - name: Result debug: msg="{{ cmd.stdout }}" - name: End playbook if this task list is called. meta: end_play when: end_playbook is defined and end_playbook|bool