--- # Copyright 2018, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - name: Install Curator hosts: "elastic-logstash" become: true vars: haproxy_ssl: false vars_files: - vars/variables.yml environment: "{{ deployment_environment_variables | default({}) }}" pre_tasks: - name: Ensure virtualenv is installed apt: name: "{{ item }}" state: "present" update_cache: true with_items: - python-virtualenv - virtualenv tags: - package_install - name: Ensure curator is installed pip: name: "elasticsearch-curator<6" state: "{{ elk_package_state | default('present') }}" extra_args: --isolated virtualenv: /opt/elasticsearch-curator register: _pip_task until: _pip_task is success retries: 3 delay: 2 tags: - package_install - name: exit playbook after uninstall meta: end_play when: - elk_package_state | default('present') == 'absent' tasks: - name: create the system group group: name: "curator" state: "present" system: "yes" - name: Create the curator system user user: name: "curator" group: "curator" comment: "curator user" shell: "/bin/false" createhome: "yes" home: "/var/lib/curator" - name: Create curator data path file: path: "{{ item }}" state: directory owner: "curator" group: "curator" mode: "0755" recurse: true with_items: - "/var/lib/curator" - "/var/log/curator" - "/etc/curator" - name: Drop curator conf file template: src: templates/curator.yml.j2 dest: /var/lib/curator/curator.yml - name: Drop curator action file template: src: templates/curator-actions.yml.j2 dest: /var/lib/curator/actions.yml post_tasks: - name: Run the systemd service role include_role: name: systemd_service private: true vars: systemd_service_enabled: true systemd_user_name: curator systemd_group_name: curator systemd_services: - service_name: "curator" execstarts: - /opt/elasticsearch-curator/bin/curator --config /var/lib/curator/curator.yml /var/lib/curator/actions.yml timer: state: "started" options: OnBootSec: 30min OnUnitActiveSec: 24h Persistent: true - name: Enable and restart curator.timer systemd: name: "curator.timer" enabled: true state: restarted tags: - beat-install