Skip to content

Commit 8c2646d

Browse files
committed
alpine
1 parent 497a02d commit 8c2646d

8 files changed

Lines changed: 60 additions & 19 deletions

File tree

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ install:
1919
before_script:
2020
- docker run --name xenial -d codeyourinfra/python3:xenial
2121
- docker run --name bionic -d codeyourinfra/python3:bionic
22+
- docker run --name alpine -d codeyourinfra/python3:alpine
2223

2324
script:
2425
- ansible-playbook tests/test.yml -i tests/inventory
2526

2627
after_script:
27-
- docker stop xenial bionic
28-
- docker rm xenial bionic
28+
- docker stop xenial bionic alpine
29+
- docker rm xenial bionic alpine
2930

3031
after_success:
3132
- curl -LO https://raw.github.com/stephanmg/travis-dependent-builds/master/trigger.sh

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ Ansible role to install Oracle Java 8.
1313
- codeyourinfra.oracle_java8
1414
```
1515
16+
The role requires the *ansible_distribution* variable, obtained through the [gathering facts phase](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#information-discovered-from-systems-facts). So please don't turn off facts.
17+
1618
## Build process
1719
18-
The build process is performed in [Travis CI](https://travis-ci.org/codeyourinfra/oracle_java8). During the build, the role is tested by using [Ubuntu Docker images with Python 3](https://hub.docker.com/r/codeyourinfra/python3).
20+
The build process is performed in [Travis CI](https://travis-ci.org/codeyourinfra/oracle_java8). During the build, the role is tested by using [Docker images with Python 3](https://hub.docker.com/r/codeyourinfra/python3).
1921
2022
If the build is succeeded, dependent roles may have also its builds triggered, thanks to the [travis-dependent-builds project](https://github.com/stephanmg/travis-dependent-builds). One example is the [Codeyourinfra Jenkins Ansible role](https://galaxy.ansible.com/codeyourinfra/jenkins).
2123

meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ galaxy_info:
1111
versions:
1212
- bionic
1313
- xenial
14+
- alpine
1415

1516
galaxy_tags:
1617
- oracle

tasks/alpine.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
- name: Install required packages
3+
apk:
4+
name: tar
5+
- name: Create the Java directory
6+
file:
7+
path: /opt/java
8+
state: directory
9+
- name: Download the Oracle JDK 1.8.0_191 tar.gz file
10+
get_url:
11+
url: http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-i586.tar.gz
12+
headers:
13+
Cookie: oraclelicense=accept-securebackup-cookie
14+
dest: /tmp
15+
- name: Unarchive the Oracle JDK 1.8.0_191 tar.gz file
16+
unarchive:
17+
src: /tmp/jdk-8u191-linux-i586.tar.gz
18+
dest: /opt/java
19+
remote_src: yes
20+
owner: root
21+
group: root
22+
- name: Set the Oracle JDK 1.8.0_191 as the current Java
23+
file:
24+
src: /opt/java/jdk1.8.0_191
25+
dest: /opt/java/current
26+
state: link
27+
- name: Enable Java binaries
28+
file:
29+
src: "/opt/java/current/bin/{{ item }}"
30+
dest: "/usr/bin/{{ item }}"
31+
state: link
32+
loop:
33+
- java
34+
- javac

tasks/main.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
---
2-
- name: Install required packages
3-
apt:
4-
name: software-properties-common
5-
- name: Add the Oracle Java repository into sources list
6-
apt_repository:
7-
repo: 'ppa:webupd8team/java'
8-
- name: Accept the Oracle License
9-
debconf:
10-
name: oracle-java8-installer
11-
question: shared/accepted-oracle-license-v1-1
12-
value: 'true'
13-
vtype: select
14-
- name: Install latest Oracle JDK 1.8.0 update
15-
apt:
16-
name: oracle-java8-installer
2+
- name: Execute the appropriate tasks, depending on the distribution.
3+
include: "{{ ansible_distribution | lower }}.yml"

tasks/ubuntu.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
- name: Install required packages
3+
apt:
4+
name: software-properties-common
5+
- name: Add the Oracle Java repository into sources list
6+
apt_repository:
7+
repo: 'ppa:webupd8team/java'
8+
- name: Accept the Oracle License
9+
debconf:
10+
name: oracle-java8-installer
11+
question: shared/accepted-oracle-license-v1-1
12+
value: 'true'
13+
vtype: select
14+
- name: Install latest Oracle JDK 1.8.0 update
15+
apt:
16+
name: oracle-java8-installer

tests/inventory

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[containers]
22
bionic
33
xenial
4+
alpine
45

56
[containers:vars]
67
ansible_connection=docker

tests/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
- hosts: containers
3-
gather_facts: no
43
roles:
54
- oracle_java8
65
tasks:

0 commit comments

Comments
 (0)