Created
April 19, 2016 15:55
-
-
Save jaohaohsuan/985e8add7d6ff0afed4368ab0e40c6df to your computer and use it in GitHub Desktop.
post elasticsearch index mapping with ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - uri: | |
| url: http://localhost:9200/stored-query | |
| method: HEAD | |
| status_code: 200,404 | |
| register: index_status | |
| - debug: var=index_status | |
| - debug: msg="{{ lookup('file','stored-query.mapping.json') }}" | |
| - uri: | |
| url: http://localhost:9200/stored-query | |
| method: PUT | |
| body: "{{ lookup('file','stored-query.mapping.json') }}" | |
| HEADER_Content-Type: "application/json" | |
| body_format: json | |
| register: index_status | |
| when: index_status.status == 404 | |
| - debug: var=index_status |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't forget use
body_format: jsonwhen sending http request with json