cat << "_EOF_" > pb_redmine_server-els_kibana.yml
# install elasticsearch & kibana
# https://www.elastic.co/guide/en/elasticsearch/reference/7.9/rpm.html

- hosts: redmine_servers
  become: true
  become_method: su
  environment: "{{ proxy_env }}"

  tasks:
    - name: facts check
      fail:
        msg: "Not compatible with [{{ ansible_os_family }}] {{ ansible_distribution }} {{ ansible_distribution_major_version }}."
      when: ansible_os_family != 'RedHat' or ansible_distribution_major_version|int < 7

    - rpm_key:
        key: https://artifacts.elastic.co/GPG-KEY-elasticsearch
        state: present

    - copy:
        dest: /etc/yum.repos.d/elasticsearch.repo
        force: no
        content: |
          [elasticsearch]
          name=Elasticsearch repository for 7.x packages
          baseurl=https://artifacts.elastic.co/packages/7.x/yum
          gpgcheck=1
          gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
          enabled=1
          autorefresh=1
          type=rpm-md

    - name: install elasticsearch
      yum:
        name: elasticsearch
        state: latest

    - name: start elasticsearch
      systemd:
        name: elasticsearch
        state: started
        daemon_reload: yes
        enabled: yes

    - copy:
        dest: /etc/yum.repos.d/kibana.repo
        force: no
        content: |
          [kibana-7.x]
          name=Kibana repository for 7.x packages
          baseurl=https://artifacts.elastic.co/packages/7.x/yum
          gpgcheck=1
          gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
          enabled=1
          autorefresh=1
          type=rpm-md

    - name: install kibana
      yum:
        name: kibana 
        state: latest

    - lineinfile:
        dest: /etc/kibana/kibana.yml
        regexp: '^server.host: "0\.0\.0\.0"$'
        insertafter: '^#server.host: "localhost"$'
        line: 'server.host: "0.0.0.0"'

    - name: start kibana
      systemd:
        name: kibana
        state: started
        daemon_reload: yes
        enabled: yes

    - firewalld:
        port: 5601/tcp
        state: enabled
        permanent: true
        immediate: yes

_EOF_

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS