tech:ansible_uri_-_tower_api
Ceci est une ancienne révision du document !
Table des matières
Ansible uri - Tower API
Avec curl
curl -k -u username:'P@ssw0rd' -H 'Content-Type: application/json' -X GET https://tower.acme.fr/api/v2/job_templates/93/launch/ -d ' { "extra_vars": { "git_path": "/project/plop", "git_user": "gittoken" } }'
Via Ansible
#!/usr/bin/env ansible-playbook --- - hosts: localhost tasks: - name: call api register: plop uri: url: https://tower.acme.fr/api/v2/job_templates/93/launch/ method: POST force: true force_basic_auth: true user: username password: 'P@ssw0rd' validate_certs: false # body_format: form-urlencoded body_format: json headers: Content-Type: "application/json" body: | { "extra_vars": { "git_path": "/project/plop", "git_user": "gittoken" } } status_code: 201 - name: DEBUG 10 debug: var=plop
Ou encore
#!/usr/bin/env ansible-playbook --- - hosts: localhost tasks: - name: call api register: plop uri: url: https://tower.acme.fr/api/v2/job_templates/93/launch/ method: POST force: true force_basic_auth: true user: username password: 'P@ssw0rd' validate_certs: false body_format: json headers: Content-Type: "application/json" src: plop.json status_code: 201
- plop.json
{ "extra_vars": { "git_path": "/project/plop", "git_user": "gittoken" } }
Pb
Pb de logs tronqués
Consulter la sortie : https:<tower-FQDN>/api/v2/job_templates/<job-template-id>/
tech/ansible_uri_-_tower_api.1742825205.txt.gz · Dernière modification : de 127.0.0.1
