<commit_before># python-ovirt-foreman-api
Python scripts to interact with oVirt and Foreman for automatic server deployment and provisioning

## Requirements
* CentOS / RHEL 7 machine

Some scripts of this repo assume a specific environment:
* deploy-and-build-vm.py
  * ovirt / rhev hypervisor
  * foreman (pxe)
  * Zookeeper (to store the server role. Zookeeper is used as a hiera backend for the puppetmaster)
  * Puppetmaster (not needed to just deploy a server, but is is needed when you want to auto-provision a server upon creation)
* destroy-vm.py
  * ovirt / rhev hypervisor
  * foreman (to remove host record)
  * Zookeeper (removes role and ossec auth information)
  * Puppetmaster (revokes certificate of host)
* revert-vm-to-snapshot.py
  * ovirt / rhev hypervisor
* ovirt-list-vm.py
  * ovirt / rhev hypervisor

## Dependencies installation
Not all scripts need the same packages to be installed.
These steps are needed for all scripts to work:
```bash
# yum install python-pip gcc python-devel libxml2-devel
# pip install --upgrade pip
# pip install ovirt-engine-sdk-python
```

The scripts `revert-vm-to-snapshot.py` and `ovirt-list-vm.py` should function now.

The other scripts also need these packages:
```bash
# pip install pysphere
# pip install python-foreman
# pip install kazoo
# pip install https://github.com/daradib/pypuppet/archive/master.tar.gz
# pip install pyyaml
```

##Installation
```bash
# yum install git
$ git clone https://github.com/Fabian1976/python-ovirt-foreman-api.git
```

##Usage
All scripts use a custom config class to read the config file. Because of this, all config files must have the same structure and same fields, even if you don't need those fields.
Based on the script you use the specific fields are used.

You can find an example config file in the vm\_config folder.

The usage of each script is very easy and simular:
```
<script_name> <config_file>
```

If you plan on comunicating with a puppetmaster, be sure to create the appropiate SSL certificates and autherization configuration on the puppetmaster. The steps below will describe how to enable the destroy script to revoke a certificate for the destroyed host.<commit_msg>Added simple-crypt dependency and fixed headings<commit_after># python-ovirt-foreman-api
Python scripts to interact with oVirt and Foreman for automatic server deployment and provisioning

## Requirements
* CentOS / RHEL 7 machine

Some scripts of this repo assume a specific environment:
* deploy-and-build-vm.py
  * ovirt / rhev hypervisor
  * foreman (pxe)
  * Zookeeper (to store the server role. Zookeeper is used as a hiera backend for the puppetmaster)
  * Puppetmaster (not needed to just deploy a server, but is is needed when you want to auto-provision a server upon creation)
* destroy-vm.py
  * ovirt / rhev hypervisor
  * foreman (to remove host record)
  * Zookeeper (removes role and ossec auth information)
  * Puppetmaster (revokes certificate of host)
* revert-vm-to-snapshot.py
  * ovirt / rhev hypervisor
* ovirt-list-vm.py
  * ovirt / rhev hypervisor

## Dependencies installation
Not all scripts need the same packages to be installed.
These steps are needed for all scripts to work:
```bash
# yum install python-pip gcc python-devel libxml2-devel
# pip install --upgrade pip
# pip install ovirt-engine-sdk-python
# pip install simple-crypt
```

The scripts `revert-vm-to-snapshot.py` and `ovirt-list-vm.py` should function now.

The other scripts also need these packages:
```bash
# pip install pysphere
# pip install python-foreman
# pip install kazoo
# pip install https://github.com/daradib/pypuppet/archive/master.tar.gz
# pip install pyyaml
```

## Installation
```bash
# yum install git
$ git clone https://github.com/Fabian1976/python-ovirt-foreman-api.git
```

## Usage
All scripts use a custom config class to read the config file. Because of this, all config files must have the same structure and same fields, even if you don't need those fields.
Based on the script you use the specific fields are used.

You can find an example config file in the vm\_config folder.

The usage of each script is very easy and simular:
```
<script_name> <config_file>
```

If you plan on comunicating with a puppetmaster, be sure to create the appropiate SSL certificates and autherization configuration on the puppetmaster. The steps below will describe how to enable the destroy script to revoke a certificate for the destroyed host.
{'fraction_non_alphanumeric': 0.07181449797388564, 'fraction_numerical': 0.0027014858171994596, 'mean_word_length': 4.23938679245283, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '581828', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1258, 'n_words': 577}