--- - name: Add Elasticsearch apt key. apt_key: url: https://packages.elastic.co/GPG-KEY-elasticsearch state: present - name: Add Elasticsearch repository. apt_repository: repo: 'deb http://packages.elastic.co/elasticsearch/2.x/debian stable main' state: present update_cache: yes - name: Install Elasticsearch. apt: pkg=elasticsearch state=present