geerlingguy.elasticsearch-curator

Ansible Role: Elasticsearch Curator

CI

This is an Ansible Role designed to install Elasticsearch Curator on RedHat/CentOS or Debian/Ubuntu systems.

Requirements

There are no specific requirements, but having Elasticsearch running will make this role much more useful!

For RedHat/CentOS, ensure you have the EPEL repository set up to install the python-pip package. You can do this by adding geerlingguy.repo-epel to your playbook's roles.

Role Variables

Here are the available variables, with their default values (check defaults/main.yml for more details):

  • elasticsearch_curator_version: ''

    This specifies which version of elasticsearch-curator to install. You can find available versions on the Python Package Index. If no version is mentioned, the latest version will be installed by default.

  • elasticsearch_curator_cron_jobs:

    - name: "Run elasticsearch curator actions."
      job: "/usr/local/bin/curator ~/.curator/action.yml"
      minute: 0
      hour: 1
    

    This is a list of cron jobs. You usually have one cron job that runs the actions in action.yml, but you can create multiple cron jobs or use curator_cli to run actions individually. You can set values like minute, hour, day, weekday, and month. If you don't specify a value, it defaults to *. You can also use state to indicate whether the job should be present or absent.

  • elasticsearch_curator_config_directory: ~/.curator

    This is the directory where Curator's configuration and action file will be saved.

  • elasticsearch_curator_hosts:

    - 'localhost:9200'
    

    This variable defines the hosts used in the default elasticsearch_curator_yaml. If you have your own custom elasticsearch_curator_yaml, you may not need these. _hosts is a list of hosts and ports, and _http_auth is for basic HTTP authentication (user:pass) if your Elasticsearch needs it.

  • elasticsearch_curator_yaml: |

    ---
    client:
      hosts: {{ elasticsearch_curator_hosts | to_yaml }}
      url_prefix:
      use_ssl: False
      certificate:
      client_cert:
      client_key:
      ssl_no_validate: False
      http_auth: {{ elasticsearch_curator_http_auth }}
      timeout: 30
      master_only: False
    logging:
      loglevel: INFO
      logfile:
      logformat: default
      blacklist: ['elasticsearch', 'urllib3']
    

    This YAML content is written to ~/.curator/curator.yml and holds the connection details for Elasticsearch Curator.

  • elasticsearch_curator_action_yaml: |

    ---
    actions:
      1:
        action: delete_indices
        options:
          ignore_empty_list: True
          disable_action: False
        filters:
        - filtertype: pattern
          kind: prefix
          value: logstash-
          exclude:
        - filtertype: age
          source: name
          direction: older
          timestring: '%Y.%m.%d'
          unit: days
          unit_count: 45
          exclude:
    

    This YAML is for ~/.curator/action.yml and defines the actions Curator runs based on the cron job. For more details, see the Curator actions file documentation.

  • elasticsearch_curator_pip_package: 'python3-pip'

  • elasticsearch_curator_pip_executable: "{{ 'pip3' if elasticsearch_curator_pip_package.startswith('python3') else 'pip' }}"

    These specify the system pip package to install and the command to run pip. If using older operating systems or Python 2, you might need to change these to python-pip and pip.

Dependencies

  • geerlingguy.repo-epel (For RedHat/CentOS only)

Example Playbook

- hosts: search
  roles:
    - { role: geerlingguy.elasticsearch-curator }

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling, the author of Ansible for DevOps.

Informazioni sul progetto

Elasticsearch curator for Linux.

Installa
ansible-galaxy install geerlingguy.elasticsearch-curator
Licenza
mit
Download
110.2k
Proprietario
Father, author, developer, maker. Sometimes called "an inflammatory enigma". #stl #drupal #ansible #k8s #raspberrypi #crohns