4ogyuw
Last Updated: November 17, 2017
·
11.31K
· 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

18324

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 ·
19980

thanks, very useful !

over 1 year ago ·
Filed Under