1
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2024-12-24 10:27:04 +02:00
matrix-docker-ansible-deploy/roles/matrix-awx/tasks/create_user.yml

42 lines
1.2 KiB
YAML
Raw Normal View History

---
2021-08-13 10:05:57 +02:00
#
# Create user and define if they are admin
#
# /usr/local/bin/matrix-synapse-register-user <your_username> <your_password> <admin access: 0 or 1>
#
- name: Set admin bool to zero
set_fact:
2021-10-10 07:23:49 +02:00
awx_admin_bool: 0
when: awx_admin_access == 'false'
2021-08-13 10:05:57 +02:00
- name: Examine if server admin set
set_fact:
2021-10-10 07:23:49 +02:00
awx_admin_bool: 1
when: awx_admin_access == 'true'
2021-08-13 10:05:57 +02:00
- name: Create user account
command: |
2021-10-10 07:23:49 +02:00
/usr/local/bin/matrix-synapse-register-user {{ awx_new_username | quote }} {{ awx_new_password | quote }} {{ awx_admin_bool }}
register: awx_cmd_output
2021-08-13 10:05:57 +02:00
- 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 }}"
2021-10-10 07:23:49 +02:00
- name: Set boolean value to exit playbook
set_fact:
awx_end_playbook: true
2021-08-13 10:05:57 +02:00
- name: Result
2021-10-10 07:23:49 +02:00
debug: msg="{{ awx_cmd_output.stdout }}"
2021-08-13 10:05:57 +02:00
- name: End playbook if this task list is called.
meta: end_play
2021-10-10 07:23:49 +02:00
when: awx_end_playbook is defined and awx_end_playbook|bool