Обновить playbooks/inventory.yml

This commit is contained in:
2025-12-10 09:43:20 +00:00
parent d25087207d
commit 862dfe9a62

View File

@@ -152,7 +152,20 @@
inventory: "{{ inventory_content }}"
status_code: [201, 200]
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: Успех
debug:
msg: "Инвентарь создан! ID: {{ api_response.json.id | default('OK') }}"
msg: "Инвентарь создан! ID: {{ api_response.json.id | default('OK') }}"