geerlingguy.elasticsearch-curator

Ansible角色:Elasticsearch Curator

CI

一个在RedHat/CentOS或Debian/Ubuntu上安装Elasticsearch Curator的Ansible角色。

需求

没有特别要求,但如果你有Elasticsearch在运行会更有帮助!

在RedHat/CentOS上,请确保你已经配置了EPEL仓库,以便能够安装python-pip包。你可以通过将geerlingguy.repo-epel添加到你的剧本角色中来安装EPEL仓库。

角色变量

可用的变量列表如下,包含默认值(见defaults/main.yml):

elasticsearch_curator_version: ''

要安装的elasticsearch-curator版本。可用的版本可以在Python包索引中找到。默认情况下,不指定版本,因此将安装最新版本。

elasticsearch_curator_cron_jobs:
  - name: "运行elasticsearch curator操作。"
    job: "/usr/local/bin/curator ~/.curator/action.yml"
    minute: 0
    hour: 1

一系列定时任务。通常情况下,你会通过action.yml中定义的操作运行一个定时任务,但你可以拆分定时任务或使用curator_cli单独运行操作而不是通过操作文件。你可以在定时任务中添加minutehourdayweekdaymonth,没有明确设定的值将默认为*。你还可以使用state来定义任务是否应该存在present或缺失absent

elasticsearch_curator_config_directory: ~/.curator

Curator的配置(和操作文件)将存储的目录。

elasticsearch_curator_hosts:
  - 'localhost:9200'
elasticsearch_curator_http_auth: ''

这些变量控制默认的elasticsearch_curator_yaml中使用的参数。如果你定义了自己的自定义elasticsearch_curator_yaml,则可能不需要定义或覆盖这些变量。_hosts是一个包含端口的主机列表,而_http_auth则是一个基本的http_auth user:pass字符串,如果你的Elasticsearch实例需要基本的HTTP授权。

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']

这个YAML文件会被写入~/.curator/curator.yml,并存储Elasticsearch Curator在连接到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:

这个YAML文件会被写入~/.curator/action.yml,并定义当默认定时任务运行时Curator所执行的操作。请参阅文档:Curator 操作文件

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

需要安装的系统pip包,以及要运行的pip可执行文件。对于较旧的操作系统或使用Python 2时,可能需要将其覆盖为python-pippip

依赖

  • geerlingguy.repo-epel (仅限RedHat/CentOS)

示例剧本

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

许可证

MIT / BSD

作者信息

这个角色是由Jeff Geerling在2014年创建的,他是Ansible for DevOps的作者。

安装
ansible-galaxy install geerlingguy.elasticsearch-curator
许可证
mit
下载
110.2k
拥有者
Father, author, developer, maker. Sometimes called "an inflammatory enigma". #stl #drupal #ansible #k8s #raspberrypi #crohns