--- - name: "Install openjdk" hosts: target tasks: - name: "Update apt" apt: update_cache: yes when: ansible_distribution == "Ubuntu" - name: "Install openjdk package" apt: pkg: "{{ item }}" state: present with_items: - openjdk-8-jre-headless when: ansible_distribution == "Ubuntu" - name: "Update yum cache" yum: update_cache: yes when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS" - name: "Install openjdk package" yum: name: "{{ item }}" state: present with_items: - openjdk when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS" - name: "Install icedtea package" portage: name: "{{ item }}" state: present with_items: - dev-java/icedtea:8 when: ansible_distribution == "Gentoo" <<<<<<< HEAD ======= - name: "Set icedtea-8 as default java" shell: java-config -S icedtea-8 when: ansible_distribution == "Gentoo" >>>>>>> 5d6764d17db282814ad18a15f08a74115dfa36f6