Semaphore REST API lab
Trigger the same playbooks via REST API call to Ansible Semaphore as did on day 3 with web UI directly.
curl -v -c /tmp/semaphore-cookie -XPOST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"auth": "YOUR_LOGIN", "password": "YOUR_PASSWORD"}' \
https://s01.apnic56.anuragbhatia.com/api/auth/login
Create new token
curl -v -b /tmp/semaphore-cookie -XPOST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
https://s01.apnic56.anuragbhatia.com/api/user/tokens
Check existing tokens
curl -v -b /tmp/semaphore-cookie \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
https://s01.apnic56.anuragbhatia.com/api/user/tokens
curl -X 'GET' \
-H 'Authorization: Bearer <Token here from step 1>' \
-H 'accept: text/plain; charset=utf-8' \
'https://s01.apnic56.anuragbhatia.com/api/projects'
curl -X 'GET' \
-H 'Authorization: Bearer <Token here from step 1>' \
-H 'accept: text/plain; charset=utf-8' \
'https://s01.apnic56.anuragbhatia.com/api/project/1/templates'
curl -XPOST -H 'Content-Type: application/json' \
-H 'Accept: application/json' -H 'Authorization: Bearer <Token here from step 1>' \
-d '{"template_id": 1, "debug": false, "dry_run": false, "playbook": "", "environment": ""}' \
https://s01.apnic56.anuragbhatia.com/api/project/1/tasks -v