Last Updated: November 17, 2017
·
17.67K
· felbus

ansible install java 8

tasks:
    - name: add repo for java 8
      apt_repository: repo='ppa:webupd8team/java' state=present

    - name: set licence selected
      shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
      sudo: yes

    - name: set licence seen
      shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 seen true | /usr/bin/debconf-set-selections
      sudo: yes

    - name: install java 8
      apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
      sudo: yes

2 Responses
Add your response

Instead of using two times shell command, we can use the debconf module to accept the licence.

debconf: name='oracle-java8-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'

Thanks

over 1 year ago ·

thanks, very useful !

over 1 year ago ·