Learn Ansible
上QQ阅读APP看书,第一时间看更新

Ansible Run Analysis

ARA, which is a recursive acronym that stands for Ansible Run Analysis, records Ansible. It is a tool written in Python that records your playbook runs and displays the results in an intuitive web interface. To install it on macOS, I had to use the following command:

$ sudo pip install ara --ignore-installed pyparsing

To install on Ubuntu, I could use just this:

$ sudo pip install ara

Once installed, you should be able to run the following commands to configure your environment to record your Ansible playbook runs:

$ export ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))")
$ export ANSIBLE_CALLBACK_PLUGINS=$ara_location/plugins/callbacks
$ export ANSIBLE_ACTION_PLUGINS=$ara_location/plugins/actions
$ export ANSIBLE_LIBRARY=$ara_location/plugins/modules

When you have your environment configured, you can run a playbook. For example, let's rerun the playbook from the Ansible Vault section of this chapter using:

$ ansible-playbook --vault-id @prompt playbook.yml

Once the playbook has been executed, running the following command will start the ARA web server:

$ ara-manage runserver

Opening your browser and going to the URL mentioned in the output of the previous command, http://127.0.0.1:9191/, will give you the results of your playbook run:

As you can see, I have run the playbook four different times, and one of those executions failed. Clicking on the elements will show you more detail:

Again, we will be using ARA in later chapters in a lot more detail; we have just touched upon the very basics here.