<commit_before>Ansible
=======

[Ansible](https://www.ansible.com/) is software for configuring remote machines over ssh. We use ansible to configure our cloud, to launch VMs,
to install and configure software on VMs. The Ansible [documentation](http://docs.ansible.com/ansible/index.html) is very comprehensive.

Ansible is idempotent, which means you can safely run ansible tasks over and over again, without changing the system.
You could set up the entire cloud from scratch by running our ansible playbooks - this will launch and configure all VMs.
Alternatively, you could run our ansible playbooks on an existing cloud setup, and it will update the system only where necessary.

Setup to use this repo
========================

You must have python and pip installed on your local machine. Next, install the following dependencies on your local machine:

    pip install ansible shade

Source your environment variables from embassy-openrc.sh. This enables you to interact with Embassy from your local machine over the openstack API. To do this you must have a admin username and password for the EBiSC project in Embassy.

    source embassy-openrc.sh

Install the ansible modules listed in ansible-requirements.yml. These are some third-party modules which we use to configure our VMs:

    ansible-galaxy install -r ansible-requirements.yml -p vendor/

Download the openstack.py inventory file and put it in your inventory directory. This inventory file tells ansible how to find information about VMs on openstack.

    curl -L https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/openstack.py > inventory/openstack.py
    chmod +x openstack.py

Check your private key is in group_vars/all.yml. These keys are copied onto the VMs, so only these users can ssh in.

Check you have a key on your local machine that gives you access to the git repo at https://github.com/DouglasConnect/ebisc. The remote VM will use your local private key to access github.

Ansible Vault
=============

[Ansible vault](http://docs.ansible.com/ansible/playbooks_vault.html) is a feature allows keeping sensitive data such as passwords and keys. We encrypt our secrets with ansible vault, which means it is safe to keep the encrypted files in source control.

This means you need the password before you can run the ansible playbooks.  The [Ansible vault documentation](http://docs.ansible.com/ansible/playbooks_vault.html#running-a-playbook-with-vault) describes how to pass the password on the command line.
The rest of this documentation assumes you have the ``ANSIBLE_VAULT_PASSWORD_FILE`` environment set, as described in the [vault documentation](http://docs.ansible.com/ansible/playbooks_vault.html#running-a-playbook-with-vault).

Playbooks
=========

You should run all of these commands from your local machine. Ansible is "idempotent" which means it is safe to run the commands over and over again.

## 1. launch_cloud.yml
<commit_msg>fix minor issue in ansible doc<commit_after>Ansible
=======

[Ansible](https://www.ansible.com/) is software for configuring remote machines over ssh. We use ansible to configure our cloud, to launch VMs,
to install and configure software on VMs. The Ansible [documentation](http://docs.ansible.com/ansible/index.html) is very comprehensive.

Ansible is idempotent, which means you can safely run ansible tasks over and over again, without changing the system.
You could set up the entire cloud from scratch by running our ansible playbooks - this will launch and configure all VMs.
Alternatively, you could run our ansible playbooks on an existing cloud setup, and it will update the system only where necessary.

Setup to use this repo
========================

You must have python and pip installed on your local machine. Next, install the following dependencies on your local machine:

    pip install ansible shade

Source your environment variables from embassy-openrc.sh. This enables you to interact with Embassy from your local machine over the openstack API. To do this you must have a admin username and password for the EBiSC project in Embassy.

    source embassy-openrc.sh

Install the ansible modules listed in ansible-requirements.yml. These are some third-party modules which we use to configure our VMs:

    ansible-galaxy install -r ansible-requirements.yml -p vendor/

Download the openstack.py inventory file and put it in your inventory directory. This inventory file tells ansible how to find information about VMs on openstack.

    curl -L https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/openstack.py > inventory/openstack.py
    chmod +x inventory/openstack.py

Check your private key is in group_vars/all.yml. These keys are copied onto the VMs, so only these users can ssh in.

Check you have a key on your local machine that gives you access to the git repo at https://github.com/DouglasConnect/ebisc. The remote VM will use your local private key to access github.

Ansible Vault
=============

[Ansible vault](http://docs.ansible.com/ansible/playbooks_vault.html) is a feature allows keeping sensitive data such as passwords and keys. We encrypt our secrets with ansible vault, which means it is safe to keep the encrypted files in source control.

This means you need the password before you can run the ansible playbooks.  The [Ansible vault documentation](http://docs.ansible.com/ansible/playbooks_vault.html#running-a-playbook-with-vault) describes how to pass the password on the command line.
The rest of this documentation assumes you have the ``ANSIBLE_VAULT_PASSWORD_FILE`` environment set, as described in the [vault documentation](http://docs.ansible.com/ansible/playbooks_vault.html#running-a-playbook-with-vault).

Playbooks
=========

You should run all of these commands from your local machine. Ansible is "idempotent" which means it is safe to run the commands over and over again.

## 1. launch_cloud.yml

{'fraction_non_alphanumeric': 0.07122411180333389, 'fraction_numerical': 0.0003367570298029971, 'mean_word_length': 4.525581395348837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7171265', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1498, 'n_words': 771}