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
67
ansible/roles/vulnwhisperer/tasks/main.yml
Normal file
67
ansible/roles/vulnwhisperer/tasks/main.yml
Normal 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
|
12
ansible/roles/vulnwhisperer/vars/main.yml
Normal file
12
ansible/roles/vulnwhisperer/vars/main.yml
Normal file
@ -0,0 +1,12 @@
|
||||
base_packages:
|
||||
- zlib1g-dev
|
||||
- libxml2-dev
|
||||
- libxslt1-dev
|
||||
- libffi-dev
|
||||
- libssl-dev
|
||||
|
||||
python_packages:
|
||||
- python2.7
|
||||
- python2.7-dev
|
||||
- python-virtualenv
|
||||
- virtualenvwrapper
|
Reference in New Issue
Block a user