--- - name: Debian/Ubuntu | Install apt-transport-https and ca-certificates apt: name: - apt-transport-https - ca-certificates state: present register: elasticsearch_ca_packages_installed until: elasticsearch_ca_packages_installed is succeeded - name: "Install Java Repo for Trusty" apt_repository: repo='ppa:openjdk-r/ppa' when: - ansible_distribution == "Ubuntu" - ansible_distribution_major_version | int == 14 - name: Update and upgrade apt packages become: true apt: upgrade: yes update_cache: yes cache_valid_time: 86400 #One day when: - ansible_distribution == "Ubuntu" - ansible_distribution_major_version | int == 14 - name: Install Oracle Java 8 become: true apt: name=openjdk-8-jdk state=latest when: - ansible_distribution == "Ubuntu" - ansible_distribution_major_version | int == 14 - name: Update and upgrade apt packages become: true apt: upgrade: yes update_cache: yes cache_valid_time: 86400 #One day when: - ansible_distribution == "Ubuntu" - ansible_distribution_major_version | int == 14 - name: Debian/Ubuntu | Add Elasticsearch GPG key. apt_key: url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch" state: present - name: Debian/Ubuntu | Install Elastic repo apt_repository: repo: 'deb https://artifacts.elastic.co/packages/7.x/apt stable main' state: present filename: 'elastic_repo' update_cache: true changed_when: false - name: Debian/Ubuntu | Install Elasticsarch apt: name: "elasticsearch={{ elastic_stack_version }}" state: present cache_valid_time: 3600 register: elasticsearch_main_packages_installed until: elasticsearch_main_packages_installed is succeeded tags: install