Learning DevOps
上QQ阅读APP看书,第一时间看更新

Increasing the log level output

In case of error, it is possible to add more logs during the output by adding the -v, -vvv, or -vvvv option to the Ansible command. 

The -v option enables the basic verbose mode, the -vvv option enables the verbose mode with more outputs, and the -vvvv option adds the verbose mode and the connection debugging information.

Executing the following command applies a playbook and will display more log information using the -v option that has been added:

ansible-playbook -i inventory playbook.yml -v

This can be useful for debugging in case of Ansible errors.

The complete documentation on the ansible-playbook command is available here:  https://docs.ansible.com/ansible/2.4/ansible-playbook.html.

We have just studied the execution of Ansible with its inventory and playbook by exploring some options that allow the following:

  • Previewing the changes that will be made by Ansible
  • Increasing the level of logs to make debugging easier

In the next section, we will talk about data security with the use of Ansible Vault.