Last Updated: February 25, 2016
· sairez

Bootstrap old CentOS/RedHat VMs for use with Ansible

If you have old CentOS/RedHat VMs that you can't run Ansible playbooks on, receiving the error "Error: ansible requires a json module, none found!," you can bootstrap these machines to work with Ansible with the following raw command.

ansible raw command

ansible vms -i oldvms -u jsmith -s -U root -m raw -a "sudo yum install -y python-simplejson" -k -K

inventory file: oldvms


You may find that if your old VMs have bad .repo files in /etc/yum.repos.d that don't resolve, you'll have to move them out of the way before you can successfully install anything with yum. In this case just:

ansible vms -i oldvms -u jsmith -s -U root -m raw -a "sudo mv /etc/yum.repos.d/badrepo.repo /etc/yum.repos.d/" -k -K