Add ansible provisioning (#122)
* first ansible skeleton * first commit of ansible installation of vulnwhisperer outside docker * first ansible skeleton * first commit of ansible installation of vulnwhisperer outside docker * refactor the ansible role a bit * update readme, add fail validation step to provision.yml and fix typo when calling a logging funciton
This commit is contained in:

committed by
Quim Montal

parent
a8671a7303
commit
3a09f60543
52
ansible/roles/elastic.elasticsearch/tasks/java.yml
Normal file
52
ansible/roles/elastic.elasticsearch/tasks/java.yml
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
|
||||
- name: set fact java_state to present
|
||||
set_fact: java_state="present"
|
||||
|
||||
- name: set fact java_state to latest
|
||||
set_fact: java_state="latest"
|
||||
when: update_java == true
|
||||
|
||||
- name: RedHat - Ensure Java is installed
|
||||
become: yes
|
||||
yum: name={{ java }} state={{java_state}}
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Get the installed java path
|
||||
shell: "update-alternatives --display java | grep '^/' | awk '{print $1}' | grep 1.8.0"
|
||||
become: yes
|
||||
register: java_full_path
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: correct java version selected
|
||||
alternatives:
|
||||
name: java
|
||||
path: "{{ java_full_path.stdout }}"
|
||||
link: /usr/bin/java
|
||||
when: ansible_os_family == 'RedHat' and java_full_path is defined
|
||||
|
||||
- name: Refresh java repo
|
||||
become: yes
|
||||
apt: update_cache=yes
|
||||
changed_when: false
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Debian - Ensure Java is installed
|
||||
become: yes
|
||||
apt: name={{ java }} state={{java_state}}
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: register open_jdk version
|
||||
shell: java -version 2>&1 | grep OpenJDK
|
||||
register: open_jdk
|
||||
ignore_errors: yes
|
||||
changed_when: false
|
||||
|
||||
#https://github.com/docker-library/openjdk/issues/19 - ensures tests pass due to java 8 broken certs
|
||||
- name: refresh the java ca-certificates
|
||||
become: yes
|
||||
command: /var/lib/dpkg/info/ca-certificates-java.postinst configure
|
||||
when: ansible_distribution == 'Ubuntu' and open_jdk.rc == 0
|
||||
changed_when: false
|
Reference in New Issue
Block a user