- name: Gather running services shell: cmd: systemctl --user --type service --state running --plain --quiet |grep ^project- |sed -E 's#\.service.*##' register: running_services # В curl body - это --data '{"dataSources": ["main","thingy","bonanza"]}' - name: Update API uri: url: https://localhost/admin/api/update_metadata user: admin password: {{ pass }} force_basic_auth: true method: POST validate_certs: false body_format: json body: dataSources: - "{{ services[item] }}" with_items: - "{{ running_services['stdout_lines'] }}" when: item in services | list