4ogyuw
Last Updated: November 17, 2017
·
7.057K
· felbus
64cfca6d478f167b528ee0e408a3ed49

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
Say Thanks
Respond

2 Responses
Add your response

18324
0 g13ym4l txivazbigrhtmskay0fzanbihbz3mu3dtm1ea 8wmzathrvik bbtlnfiri8tp1hisza

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
0 8d2tx42vr76okkuscum3xs2iregvkkwsg74dxs7wx79ouhyv2ipyevr5zxclf entaauijau4l7p

thanks, very useful !

over 1 year ago ·
Filed Under