web analytics

Monthly Archives August 2020

fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required.”}

While creating a playbook for mysql, I cam across the following error while creating database on an AWS Amazon Linux instance.

fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required.”}

To correct it, we need to install the dependencies and add them to the playbook as required below

– name: “Installing pip”
yum:
name: python2-pip
state: present

– name: “Installing pymysql for dependency”
pip:
name: pymysql
state: present

Read More

Running ansible playbook locally

To run an ansible playbook in your localhost, just add the following entry to your inventory file

localhost ansible_host=127.0.0.1 ansible_connection=local

 

Then, in your playbook, add localhost to the hosts section

hosts: localhost

 

Read More