[英]automate elastic enterprise with ansible playbook
我真的很希望有人在这个平台上帮助我解决这个问题。
任务:我想使用 ansible playbooks 弹性搜索部署模板进行部署,而不是在控制台中手动创建它,我想自动化流程。
这是通过 cli 执行此命令的命令,但是如果我将以下命令转换为 ansible 剧本,那会是什么样子?
curl -k -X POST -H "Authorization: ApiKey $ECE_API_KEY" https://$COORDINATOR_HOST:12443/api/v1/deployments -H 'content-type: application/json' -d '
我试过这个但没有成功:
- hosts: primary
become: true
tasks:
- name: Create Deployment
uri:
url: "https://eastus2.azure.elastic-dev.xxx.com/deployments/create"
method: POST
user: admin
password: password
body: "{{ lookup('file','deployments.json') }}"
force_basic_auth: yes
status_code: 200
body_format: json
这是答案,以防万一有人偶然发现这种情况:
---
- hosts: primary
become: true
tasks:
- name: Create Deployment
uri:
url: "{{ url_deploy }}"
method: POST
body: "{{ lookup('file','deployments.json') }}"
force_basic_auth: yes
status_code: 201
body_format: json
headers:
Content-Type: "application/json"
Authorization: "ApiKey {{ ECE_API_KEY }}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.