<commit_before># Automated rollout via Ansible
## Prerequisites
1. Install Ansible 2 on your local machine and run all the playbooks from there
1. Clone this repository to your local machine
1. Download the following binary files and put them either into the local ansible/binary directory or ensure they are already present on the layer1 host and configure the host_vars/layer1.yml paramter "layer1_binary_dir":
  - [RHEL-OSP overcloud binaries](https://access.redhat.com/downloads/content/191/ver=7/rhel---7/7/x86_64/product-software)
    - Overcloud image
    - Deployment ramdisk
    - Discovery ramdisk
  - [RHEL 7 binary DVD](https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.2/x86_64/product-software)
1. Download the manifest for your Organization for the Satellite and copy the manifest-zip file to the local ansible/binary directory and rename it to manifest.zip
1. Change into the ansible directory, and copy or create the necessary ssh key pairs in the binary directory (the first one is used for the communication between the RHOSP-director and the layer1 host, the second to connect to the layer1 host from the outside):
  - $ ssh-keygen -t rsa -f binary/undercloud
  - $ ssh-keygen -t rsa -f binary/hailstorm
1. Adapt the host_vars/layer1.yml settings
  - rhel_iso_img: to the name of the RHEL 7 binary DVD ISO image
  - ansible_host: to the ip address or DNS name of your layer1 host (which is prepared with a minimal RHEL install).  
  - If no ssh keys are available, set the ansible_ssh_pass parameter to the hosts root password (see [ansible documentation](http://docs.ansible.com/ansible/intro_inventory.html))
1. Adapt the host_vars/rhosp-director.yml settings:
  - deploy_ramdisk_image
  - discovery_ramdisk_image
  - overcloud_image
1. Adapt the host_vars/satellite.yml settings
  - ntpserver
  - poolid for the Satellite repository

## Running the playbook
Run all commands from the ansible directory

### Setting up the environment
Everything:
```
$ ansible-playbook -i hosts create.yml
```
Only layer1 and OpenStack (see create.yml source code for available tags):
```
$ ansible-playbook -i hosts create.yml --tags layer1,rhosp
```
### Tearing down the environment
Everything:
```
$ ansible-playbook -i hosts destroy.yml
```
Only OpenStack:
```
$ ansible-playbook -i hosts destroy.yml --tags rhosp
```

## Understanding the playbooks
The playbooks (create.yml, destroy.yml - both in this directory) describe a sequence of "roles" to be applied to groups of machines. Each role in itself is a sequence of idempotent steps, i.e. they can be run more than one time without affecting the result.<commit_msg>execute playbook locally<commit_after># Automated rollout via Ansible
## Prerequisites
1. Install Ansible 2 on your local machine and run all the playbooks from there
1. Clone this repository to your local machine
1. Download the following binary files and put them either into the local ansible/binary directory or ensure they are already present on the layer1 host and configure the host_vars/layer1.yml paramter "layer1_binary_dir":
  - [RHEL-OSP overcloud binaries](https://access.redhat.com/downloads/content/191/ver=7/rhel---7/7/x86_64/product-software)
    - Overcloud image
    - Deployment ramdisk
    - Discovery ramdisk
  - [RHEL 7 binary DVD](https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.2/x86_64/product-software)
1. Download the manifest for your Organization for the Satellite and copy the manifest-zip file to the local ansible/binary directory and rename it to manifest.zip
1. Change into the ansible directory, and copy or create the necessary ssh key pairs in the binary directory (the first one is used for the communication between the RHOSP-director and the layer1 host, the second to connect to the layer1 host from the outside):
  - $ ssh-keygen -t rsa -f binary/undercloud
  - $ ssh-keygen -t rsa -f binary/hailstorm
1. Adapt the host_vars/layer1.yml settings
  - rhel_iso_img: to the name of the RHEL 7 binary DVD ISO image
  - ansible_host: to the ip address or DNS name of your layer1 host (which is prepared with a minimal RHEL install).  
  - If no ssh keys are available, set the ansible_ssh_pass parameter to the hosts root password (see [ansible documentation](http://docs.ansible.com/ansible/intro_inventory.html))
1. Adapt the host_vars/rhosp-director.yml settings:
  - deploy_ramdisk_image
  - discovery_ramdisk_image
  - overcloud_image
1. Adapt the host_vars/satellite.yml settings
  - ntpserver
  - poolid for the Satellite repository

## Running the playbook
Run all commands on your laptop from the ansible directory. Since the server might reboot when the playbook executes, running the playbook on the server is discouraged.

### Setting up the environment
Everything:
```
$ ansible-playbook -i hosts create.yml
```
Only layer1 and OpenStack (see create.yml source code for available tags):
```
$ ansible-playbook -i hosts create.yml --tags layer1,rhosp
```
### Tearing down the environment
Everything:
```
$ ansible-playbook -i hosts destroy.yml
```
Only OpenStack:
```
$ ansible-playbook -i hosts destroy.yml --tags rhosp
```

## Understanding the playbooks
The playbooks (create.yml, destroy.yml - both in this directory) describe a sequence of "roles" to be applied to groups of machines. Each role in itself is a sequence of idempotent steps, i.e. they can be run more than one time without affecting the result.
{'fraction_non_alphanumeric': 0.07546125461254613, 'fraction_numerical': 0.014391143911439114, 'mean_word_length': 4.167778836987607, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3661892', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1517, 'n_words': 673}