---
# Script to run clean.sh SellYourSaas command on servers
#
# To run the script:
# ansible-playbook -K launch_clean.yml -i hosts-xxx -e 'target=targethost command=(test|confirm)'
# ansible-playbook -K launch_clean.yml -i hosts-xxx -e 'target=targethost command=(test|confirm)' --limit=*.mydomain.com
#

- name: Cleanup servers
  hosts: '{{target}}'
  become: yes
  become_method: sudo
  become_user: root
  tasks:
  - name: Launch clean.sh
    command: "/home/admin/wwwroot/dolibarr_sellyoursaas/scripts/clean.sh {{command}}"
    register: command_output

  - debug:
      var: command_output.stdout_lines