diff --git a/resources/ansible/start_uploaders.yml b/resources/ansible/start_uploaders.yml index 1a2e5eb1..43ab38d9 100644 --- a/resources/ansible/start_uploaders.yml +++ b/resources/ansible/start_uploaders.yml @@ -3,10 +3,15 @@ hosts: all become: True tasks: - - name: stop all autonomi uploader service + - name: get list of ant users + ansible.builtin.shell: "getent passwd | grep '^ant[0-9]\\+:' | cut -d: -f1" + register: ant_users + changed_when: false + + - name: start all ant uploader services ansible.builtin.systemd: - name: "ant_uploader_{{ item }}" + name: "ant_uploader_{{ item | regex_replace('ant([0-9]+)', '\\1') }}" state: started enabled: yes become: true - loop: "{{ range(1, ant_uploader_instances | int + 1) | list }}" + loop: "{{ ant_users.stdout_lines }}" diff --git a/resources/ansible/stop_uploaders.yml b/resources/ansible/stop_uploaders.yml index e10d2e2e..c30876c0 100644 --- a/resources/ansible/stop_uploaders.yml +++ b/resources/ansible/stop_uploaders.yml @@ -1,13 +1,17 @@ --- -- name: ensure the safe uploader service is stopped +- name: ensure the ant uploader service is stopped hosts: all become: True tasks: - - name: stop all autonomi uploader service + - name: get list of ant users + ansible.builtin.shell: "getent passwd | grep '^ant[0-9]\\+:' | cut -d: -f1" + register: ant_users + changed_when: false + + - name: stop all ant uploader services ansible.builtin.systemd: - name: "ant_uploader_{{ item }}" + name: "ant_uploader_{{ item | regex_replace('ant([0-9]+)', '\\1') }}" state: stopped enabled: yes become: true - loop: "{{ range(1, ant_uploader_instances | int + 1) | list }}" - ignore_errors: "{{ skip_err | default(false) }}" + loop: "{{ ant_users.stdout_lines }}" \ No newline at end of file