geerlingguy.elasticsearch-curator
Ansible Role: Elasticsearch Curator
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-curatorto 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: 1This 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 usecurator_clito run actions individually. You can set values likeminute,hour,day,weekday, andmonth. If you don't specify a value, it defaults to*. You can also usestateto indicate whether the job should bepresentorabsent.elasticsearch_curator_config_directory: ~/.curatorThis 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 customelasticsearch_curator_yaml, you may not need these._hostsis a list of hosts and ports, and_http_authis 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.ymland 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.ymland 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-pipandpip.
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.
Elasticsearch curator for Linux.
ansible-galaxy install geerlingguy.elasticsearch-curator