Control-M Automation X Ansible X Scripts
Here’s three modest python scripts to work with batch jobs in order to automate the PPT reports with Ansible.
The first one, “control_m-ansible-list_jobs.py” allows to list all jobs for a specific application with the state of your choice :
control_m-ansible-list_jobs.py -u Matthieu.Paturot -p XXXXX -h XXXXX -app XXXXX -appli XXXXX -i -s "Ended OK" |
Or simply to list all jobs whatever the state:
control_m-ansible-list_jobs.py -u Matthieu.Paturot -p XXXXX -h "All" |
The second one, “control_m-ansible-action_jobs.py” allows to do an action (run, rerun, hold) on all jobs with a specific state and a specific application as well :
control_m-ansible-action_jobs.py -u Matthieu.Paturot -p XXXXX -h XXXXX -app XXXXX -appli XXXXX -i -s "Ended OK" -a rerun |
BONUS: The big one, the last one, “control_m-interactive-action_jobs.py” as its name implies, it’s interactive. You can choose the state of your choice for a specific application and an action to do (run, rerun, hold) on the job chosen. It’s only on a case-by-case basis:
control_m-interactive-action_jobs.py -u Matthieu.Paturot -p XXXXX -h XXXXX -app XXXXX -appli XXXXX -i -s "Wait Condition" |
Or you can choose to see all jobs for a specific application but you can only see details about the job chosen:
control_m-interactive-action_jobs.py -u Matthieu.Paturot -p XXXXX -h XXXXX -app XXXXX -appli XXXXX -i -s "All" |
PS: You need a token to use API services
endpoint=
"https://XXXXXX/automation-api"
curl -k -H
"Content-Type: application/json"
-X POST -d
'{"username": "pXXX", "password": "XXX"}'
$endpoint/session/login
# from the output
token=.......
Reply