-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathelasticsearch_template.txt
More file actions
116 lines (99 loc) · 3.07 KB
/
Copy pathelasticsearch_template.txt
File metadata and controls
116 lines (99 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
> ELASTICSEARCH_TEMPLATE
Allow to create ES templates in an idempotent way.
OPTIONS (= is mandatory):
- ca_bundle_file
Useful if elasticsearch connection is using SSL. Allow to
specify a CA_BUNDLE file, a file that contains root and
intermediate certificates to validate the server certificate.
In its simplest case, it could be a file containing the server
certificate in .pem format.
This file will be looked up on the remote system, on which this
module will be executed.
[Default: None]
= definition
Template definition as a json string or as a YAML definition
[Default: None]
= elasticsearch_url
The Elasticsearch server base URL to access API. Typically
http://elastic1.myserver.com:9200
[Default: None]
= name
Template name
[Default: None]
- password
The password associated with the username
[Default: None]
- state
Whether to create (present) or remove (absent) this template.
Also accept 'get' value, which return the template definition
(Choices: present, absent, get)[Default: present]
- username
The user name to log on the elasticsearch cluster. Must have
enough rights to create templates
[Default: None]
- validate_certs
Useful if elasticsearch connection is using SSL. If no, SSL
certificates will not be validated. This should only be used on
personally controlled sites using self-signed certificates.
[Default: True]
NOTES:
* All operations are performed using elasticsearch REST API
AUTHOR: Serge ALEXANDRE
EXAMPLES:
- hosts: elastic1
roles:
- elastic_modules
tasks:
- name: Create template
elasticsearch_template:
name: tmpl1
elasticsearch_url: "http://elastic1.mydomain.com:9200"
definition: |
{
"index_patterns": ["xte*", "bar*"],
"settings": {
"index": {
"number_of_shards": 1
}
},
"mappings": {
"type1": {
"_source": {
"enabled": false
},
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z YYYY"
}
}
}
}
}
state: present
# One can also use a pure YAML notation.
- name: Create template
elasticsearch_template:
name: tmpl1
elasticsearch_url: "http://elastic1.mydomain.com:9200"
definition:
index_patterns:
- "xte*"
- "bar*"
settings:
index:
number_of_shards: 1
mappings:
type1:
_source:
enabled: False
properties:
host_name:
type: keyword
created_at:
type: date
format: "EEE MMM dd HH:mm:ss Z YYYY"
state: present