--- - name: install dependencies packages apt: name: apt-transport-https retries: 2 register: result until: result is succeeded tags: elasticsearch - name: add repository key apt_key: url: https://artifacts.elastic.co/GPG-KEY-elasticsearch retries: 2 register: result until: result is succeeded tags: elasticsearch - name: add repository apt_repository: repo: deb https://artifacts.elastic.co/packages/7.x/apt stable main tags: elasticsearch - name: install package apt: name: elasticsearch retries: 2 register: result until: result is succeeded tags: elasticsearch - name: copy config file copy: content: '{{ elasticsearch_full_config|to_yaml }}' dest: /etc/elasticsearch/elasticsearch.yml owner: root group: elasticsearch mode: 0640 notify: restart elasticsearch tags: elasticsearch - name: enable and start service systemd: name: elasticsearch state: started enabled: true tags: elasticsearch