---
# Script to change an option=value of an entry into htdocs/conf/conf.php
#
# Examples to run the script:
# ansible-playbook -K change_sellyoursaas_config.yml -i hosts-xxx -e 'target=targethost option=<your_option> value=<new_value>'
# ansible-playbook -K change_sellyoursaas_config.yml -i hosts-xxx -e 'target=targethost option=<your_option> value=<new_value>' --limit=*.mydomain.com
#

- name: Change value in crontab
  hosts: '{{target}}'
  become: yes
  become_method: sudo
  become_user: root

  tasks:
    - name: Find backup_backup.sh line and change it if found
      replace:
        path: /var/spool/cron/crontabs/{{username}}
        regexp: 'backup_backup.sh'
        replace: 'backup_backup.sh'
  
    - name: Find perms.ksh line and change it into perms.sh if found
      replace:
        path: /var/spool/cron/crontabs/{{username}}
        regexp: 'perms.ksh'
        replace: 'perms.sh'


