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,67 @@
---
- name: install required packages
package:
name: "{{ item }}"
state: present
with_items: "{{ base_packages }}"
tags:
- install
- name: install python packages
package:
name: "{{ item }}"
state: present
with_items: "{{ python_packages }}"
tags:
- install
- name: create required directories
file:
state: directory
path: "{{ item }}"
with_items:
- "{{ vulnwhisperer.prefix }}"
- "{{ vulnwhisperer.prefix }}/{{ vulnwhisperer.location }}"
tags:
- install
- name: deploy application
git:
accept_hostkey: yes
clone: yes
dest: "{{ vulnwhisperer.prefix }}/{{ vulnwhisperer.location }}"
force: yes
repo: "{{ vulnwhisperer.repository }}"
register: repository
tags:
- install
- update
- name: create virtualenv
pip:
virtualenv: "{{ vulnwhisperer.prefix }}/{{ vulnwhisperer.venv_location }}"
requirements: "{{ vulnwhisperer.prefix }}/{{ vulnwhisperer.location }}/requirements.txt"
virtualenv_python: /usr/bin/python2.7
tags:
- install
- update
- name: install vulnwhisperer in virtualenv
command: "{{ vulnwhisperer.prefix }}/{{ vulnwhisperer.venv_location }}/bin/python setup.py install"
args:
chdir: "{{ vulnwhisperer.prefix }}/{{ vulnwhisperer.location }}"
tags:
- install
- update
- name: load configuration file from provided path
set_fact:
configuration_file_contents: "{{lookup('file', configuration_file )}}"
- name: install vulnwhisperer configuration file
copy:
dest: "{{ vulnwhisperer.prefix }}/{{ vulnwhisperer.location }}/configs/{{ vulnwhisperer.configuration_file_name }}"
content: "{{ configuration_file_contents }}"
tags:
- install
- update