Ansible Debug Print All Variables

Published on Author gryzli

I have written a post about how to debug playbooks by dumping all variables in file (on remote server) by using Ansible template file. Here is some faster and more convenient way to print multiple variables or all with debug purpose inside a playbook.   Ansible provides very handy module – debug_module, which is described… Continue reading Ansible Debug Print All Variables

Ansible – Dump all variables

Published on Author gryzli1 Comment

Sometimes you need all ansible variables for a debugging purpose or just to choose some from it. This is explanation how to make a nice dump of the variables to a file residing on the remote host. If you want to print multiple/all variables in a more convenient way by seeing them directly on the… Continue reading Ansible – Dump all variables

Ansible – Failing playbook with Error: AttributeError: ‘str’ object has no attribute ‘format’

Published on Author gryzliLeave a comment

The problem My playbook task was looking like this:

The error persisted even after changing “command:” to “shell:”   If you happen to hit ansible error like this: failed: [some_host] => {“failed”: true, “parsed”: false} Traceback (most recent call last): File “/root/.ansible/tmp/ansible-tmp-1425474902.88-6397676824195/command”, line 129, in ? PARAM_REGEX = re.compile( AttributeError: ‘str’ object has no… Continue reading Ansible – Failing playbook with Error: AttributeError: ‘str’ object has no attribute ‘format’

Ansible – Failing playbook with Error: ansible requires a json module, none found!

Published on Author gryzliLeave a comment

If your ansible-playbook happens to fail with the following error message: Error: ansible requires a json module, none found! Most probably your solution will be to: install “python-simplejson” on the remote host (where ansible-playbook tries to connect) In my case the remote host is running Centos 5.x, but if you are using a different distro,… Continue reading Ansible – Failing playbook with Error: ansible requires a json module, none found!

Ansible Commands

Published on Author gryzliLeave a comment

Here I will describe some ansible related commands, which I use in my day-to-day ansible usage.   ansible-playbook Execute test_job.yml playbook

  Ansible ansible-playbook limit playbook execution to a certain hosts only Sometime you may want to execute a given playbook (or part of it), only on certain hosts. Instead of making different inventory… Continue reading Ansible Commands

Ansible – Basic installation

Published on Author gryzli1 Comment

Here are the very basic steps of getting running copy of Ansible.   Clone ansible from Git:

  Alternatively run ansible from the git cloned directory If you don’t want to make a system wide ansible install, you could run it from the git cloned directory. Here are the commands:

You could make… Continue reading Ansible – Basic installation