Skip to content

ubuntu openjdk not working without first running apt-get update #7

@cfclrk

Description

@cfclrk

I'm using this to provision a vagrant ubuntu/trusty64 box. Like this:


---
- name: My New Play
  hosts: all
  vars:
    java_packages:
      - openjdk-7-jre

  roles:
    - { role: smola.java, sudo: yes}

For some reason, the oracle javas install just fine, but the openjdk javas fail with a plethora of errors that look like this:

Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-7/openjdk-7-jre-headless_7u71-2.5.3-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]

This is a problem with ubuntu's apt cache being out of date. It's easily fixed by running sudo apt-get update, and then running the ansible playbook again.

I think the ansible-java-role could avoid this problem by using the update_cache option in the apt task for Ubuntu, like so:

- name: Install Java packages
  apt: pkg={{ item }} state=latest update_cache=yes
  with_items: java_packages

Right now my workaround is to use a pre_task, which works:


---
- name: My New Play
  hosts: all
  vars:
    java_packages:
      - openjdk-7-jre

  pre_tasks:
    - name: Update the apt cache
      apt: update_cache=yes
      sudo: yes

  roles:
    - { role: smola.java, sudo: yes}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions