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:
Andrea Lusuardi
2018-11-14 10:14:12 +01:00
committed by Quim Montal
parent a8671a7303
commit 3a09f60543
95 changed files with 4459 additions and 1 deletions

View 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