> 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

