Skip to content

Commit

Permalink
Install a specific version and test that.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed May 11, 2023
1 parent 6b5000b commit ebaa8eb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/

roles:
- role: robertdebock.java
java_version: 8
```
The machine needs to be prepared. In CI this is done using [`molecule/default/prepare.yml`](https://github.com/robertdebock/ansible-role-java/blob/master/molecule/default/prepare.yml):
Expand Down
1 change: 1 addition & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

roles:
- role: ansible-role-java
java_version: 8
13 changes: 12 additions & 1 deletion molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@
gather_facts: no

tasks:
- name: check if java can be started
- name: Check if java can be started
ansible.builtin.command:
cmd: java -version
changed_when: no
register: output

- name: Show output
ansible.builtin.debug:
msg: "{{ output }}"

- name: Check if version 8 was found.
ansible.builtin.assert:
that:
- output.stderr is search('openjdk version "1.8.')
quiet: yes

0 comments on commit ebaa8eb

Please sign in to comment.