Обновить playbooks/inventory.yml
This commit is contained in:
@@ -152,7 +152,20 @@
|
|||||||
inventory: "{{ inventory_content }}"
|
inventory: "{{ inventory_content }}"
|
||||||
status_code: [201, 200]
|
status_code: [201, 200]
|
||||||
register: api_response
|
register: api_response
|
||||||
|
|
||||||
|
- name: DEBUG - Попробовать через CURL (чтобы увидеть текст ошибки)
|
||||||
|
command: >
|
||||||
|
curl -v -X POST "{{ semaphore_url }}/api/project/{{ semaphore_project_id }}/inventory"
|
||||||
|
-H "Authorization: Bearer {{ semaphore_api_token }}"
|
||||||
|
-H "Content-Type: application/json"
|
||||||
|
-d '{"name": "{{ inventory_name }}", "project_id": {{ semaphore_project_id }}, "type": "static", "ssh_key_id": {{ semaphore_key_id }}, "become_key_id": null, "inventory": "localhost ansible_connection=local"}'
|
||||||
|
register: curl_output
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Вывод ошибки CURL
|
||||||
|
debug:
|
||||||
|
var: curl_output.stderr_lines
|
||||||
|
|
||||||
- name: Успех
|
- name: Успех
|
||||||
debug:
|
debug:
|
||||||
msg: "Инвентарь создан! ID: {{ api_response.json.id | default('OK') }}"
|
msg: "Инвентарь создан! ID: {{ api_response.json.id | default('OK') }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user