web analytics

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”
name: python2-pip
state: present

– name: “Installing pymysql for dependency”
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= ansible_connection=local


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

hosts: localhost


Read More

Failed to start crond.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files

Sometimes you might come across some errors as follows, when you start services in servers.

Failed to start crond.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files 


Nothing to worry, it could just be because you don’t have the proper permission to do so, or you failed to add a ‘sudo’ infront of the command. Juts try with sudo and it will work.

[abc@greproot ~]$ sudo systemctl start crond.service
[abc@greproot ~]$ sudo systemctl status crond.service
● crond.service – Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-05-28 10:29:05 UTC; 10s ago

Read More

Create local yum repo in Centos7

To create a local yum repo, all you need to do is to make sure the packages are available in a path in the server, say /downloaded_packages/

Now, create a repo file. Be default, all repo files are present in the path /etc/yum.repos.d/ . I am going to name my repo as local_yum, so I will create a repo file named local_yum.repo and add the following contents in it.

cat /etc/yum.repos.d/local_yum.repo


The above files tells the programme to take the packages from the baseurl mentioned in the file, which in our case is our local folder /downloaded_packages/

Now check if our repo is listed correctly. In my case, I have not set any other repos, so only my local repo is listed...

Read More

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/nginx/json: dial unix /var/run/docker.sock: connect: permission denied

I was getting this error when I was trying to run a docker container using jenkins declarative pipeline script. This was being run on my localhost and below is what I needed to correct it.

Added jenkins user to docker group

sudo usermod -a -G docker jenkins

The solution that actually worked was to change the permission of the sock file to 666

devops-04:~$ ls -al /var/run/docker.sock
srw-rw—- 1 root docker 0 Oct 28 11:54 /var/run/docker.sock

devops-04:~$ sudo chmod 666 /var/run/docker.sock

devops-04:~$ ls -al /var/run/docker.sock


Once this was done my pipeline script started working!

Read More

Install PHP7.2 on Centos7

PHP 7.2 does not come by default with Centos base repo. Hence, in order to install it we first need to install and enable the remi repo and then install PHP. Execute the following commands in the below order to get PHP 7.2 installed on Centos7.

[root@de56f5fc317d ~]# yum update

[root@de56f5fc317d ~]# yum install yum-utils

[root@de56f5fc317d ~]# yum install epel-release

[root@de56f5fc317d ~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

[root@de56f5fc317d ~]# yum-config-manager –enable remi-php72

Now, check if PHP 7.2 packages are available.

[root@de56f5fc317d yum.repos.d]# yum list available php72
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: centos.mirrors.nublue.co.uk
* epel: lon.mirror.rackspace.com
* extras: mirror...

Read More

mysqldump: Got error: 1449: The user specified as a definer (‘user’@’%’) does not exist when using LOCK TABLES

I came across this error while taking the database dump of a database. The database was originally created in another server and transferred to my server after long. When I tried to take a database dump as a part of my backup script, I came across this error.

mysqldump: Got error: 1449: The user specified as a definer (‘edulanche’@’%’) does not exist when using LOCK TABLES

Basically this error is caused by a definer which was created in the previous server but is not present in the new server. The easiest way to get past this error is to go to the original dump file and search for ‘definer’ in it.

/*!50013 DEFINER=`user`@`%` SQL SECURITY DEFINER */

If found, modify it to reflect the root user or database user in your new server.

/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINE...

Read More

Securing Solr Admin Console

The solr admin console, by default, is not secured or password protected. Anyone with the link can access all the details in the console. This post describes the steps required to secure the console. The post assumes that you followed the steps in the following two posts to

  1. Install Java and Jetty in the server
  2. Install Solr in the server

Our jetty installation is at /opt/jetty which is our java web server. Our solr installation is at /opt/solr which is our search platform.

We need to modify the following three files in order to secure the admin console.

  1. /opt/jetty/etc/jetty.xml
  2. /opt/jetty/etc/webdefault.xml
  3. /opt/jetty/etc/realm.properties

If you are not sure which files are to be edited, run the following command in the server and check for java_home variable...

Read More

Install solr with jetty in Ubuntu

Solr is a search platform which is built on Apache Lucene. It makes search easier and faster. Solr can be installed along with tomcat or jetty. This post explains the installation based on jetty.

First you should install java and jetty as mentioned in the link here.

We will install solr also in /opt. First download the latest version of solr from https://archive.apache.org/dist/lucene/solr/

I am going to download version 4.10.4. Once downloaded, uncompress it and copy the war file from dist directory to jetty webapps folder.

[root@test ~]#cd /opt

[root@test ~]# wget https://archive.apache.org/dist/lucene/solr/4.10.4/solr-4.10.4.tgz

[root@test ~]# tar -xzvf solr-4.10.4.tgz

[root@test ~]#cp  solr-4.10.4/dist/solr-4.10.4.war   /opt/jetty/webapps/solr.war

Now, a few more files need to be ...

Read More

Installing Jetty in Ubuntu 14.04

Jetty is a java web server like tomcat, and java servlet container. This post describes how to install the latest version of Jetty in Ubuntu.

Latest version of Jetty can be downloaded from http://download.eclipse.org/jetty/stable-9/dist/

Jetty requires java and hence the first step is to install java. The latest version of Jetty, as of this writing is Jetty 9.3.8. Check the link here which shows what version of Java is required for the version of Jetty you are installing. If the version of Java does not match the version in which Jetty is compiled, then it will result in version conflict and Jetty will fail to start.

I am going to install Jetty 9.3.8, hence I need JVM 1.8. Login to your ubuntu machine and switch to root. Then issue the following commands to install java in the server.


Read More