--- - name: Install the elasticsearch repo key apt_key: url={{ elasticsearch_repo_key }} state=present tags: [ 'ELK', 'elasticsearch', 'elk' ] - name: Install the elasticsearch deb repository apt_repository: repo='{{ elasticsearch_repo }}' state=present update_cache=yes tags: [ 'ELK', 'elasticsearch', 'elk' ] - name: Install the elasticsearch deb packages apt: name='{{ item }}' state=present with_items: '{{ elasticsearch_packages }}' tags: [ 'ELK', 'elasticsearch', 'elk' ] - name: Ensure that elasticsearch is enabled and running service: name=elasticsearch state=started enabled=yes when: elasticsearch_enabled tags: [ 'ELK', 'elasticsearch', 'elk' ]