- name: Add Elastic repo include: install-repo.yml - name: Install ElasticSearch from apt become: true apt: name: elasticsearch - name: Update config become: true template: src: elasticsearch.j2 dest: /etc/elasticsearch/elasticsearch.yml backup: yes - name: UFW allow http_port become: true when: ufw_http_port == true ufw: rule: allow port: "{{ http_port }}" - name: UFW allow transport_port become: true when: ufw_transport_port == true ufw: rule: allow port: "{{ transport_port }}" - name: systemd enable elasticsearch become: true when: systemd_enabled == true systemd: name: elasticsearch enabled: true - name: systemd restart elasticsearch become: true when: systemd_restart == true systemd: name: elasticsearch state: restarted