diff --git a/roles/coturn/tasks/main.yml b/roles/coturn/tasks/main.yml index 11fc057..3422aa5 100644 --- a/roles/coturn/tasks/main.yml +++ b/roles/coturn/tasks/main.yml @@ -100,16 +100,16 @@ - name: Remove users with unknown realm shell: | - for U in $(turnadmin --list | grep -v '\[{{ turn_realm | default(ansible_domain) }}\]'); do + for U in $(turnadmin --list | grep -vP '^0:\s+:\s+(log file opened|SQLite connection)'); do user=$(echo $U | cut -d'[' -f1) realm=$(echo $U | perl -pe 's/.*\[(.*)\]/$1/') - turnadmin --delete --user=$user --realm=$realm + [ "$realm" == "{{ turn_realm | default(ansible_domain) }}" ] || turnadmin --delete --user=$user --realm=$realm done changed_when: False tags: turn - name: List long term users - shell: turnadmin --list | grep -vP '^0:\s+(log file opened|SQLite connection)' | cut -d'[' -f1 + shell: turnadmin --list | grep -vP '^0:\s+:\s+(log file opened|SQLite connection)' | cut -d'[' -f1 register: turn_lt_existing_users changed_when: False tags: turn