Wednesday, October 11, 2017

Thinking of migration from Ansible to HashiCorp

Convincing clients to move from Ansible to HashiCorp Terraform for provisioning infrastructure on AWS. Hashi is a good team having a lot of efficient products in different cloud technologies. The attached image is one of the most informative slides of the presentation.


Saturday, October 7, 2017

Ansible plugin for Jenkins

I need to utilize my ansible playbook in jenkins. We do have a plugin called Ansible Plugin.
You can install this plugin from jenkins itself. Once you login in jenkins --> Manage Jenkins --> Manage Plugins search for ansible plugin. Select, download and install plugin with restart of jenkins.

What we are doing here in this example:

I had a playbook, which contains two hosts, office.lan and lb.lan, the play book will just print a message "Hello from Ansible!!" when it runs.

Here is my ansible directory structure:

Directory: /home/shivin/Desktop/ansible-workshop
File : main.yml
Other directory: inventories/localdc

Run this play book from shell : 

ansible-playbook main.yml -i inventories/localdc --user root --ask-pass

This will ask for the password and will get a result, if everything is configured correctly.

How we can configure in Jenkins:

First need to give the ansible path in jenkins. Login to Jenkins --> Manage Jenkins --> Global Tool Configuration

Give a name : Ansible<version>
Path to ansible executables directory: /usr/bin/

For job configuration:
In my jenkins job, i am downloading the ansible playbook files from GIT to the workspace.


 Then run the job :)
 

Tuesday, August 22, 2017

Jenkins Pipeline code to run in a particular label


    node('TestLabel') {

        stage('Build') {
           
                echo 'Building..'
           
        }
        stage('Test') {
           
                echo 'Testing..'
           
        }
        stage('Deploy') {
           
                echo 'Deploying....'
           
        }

    }

Tuesday, August 15, 2017

Mongodb integration with PHP

In my CentOs box, i installed php5.5 and mongodb. Now i am getting the error
Mongodb is not enabled with PHP.

Solution to fix the issue.

Install gcc php-pear php-devel
yum install gcc php-pear php-devel php5-dev openssl-devel -y 

pecl install mongo
Cyrus SASL as "no"

vim /etc/php.ini
extension=mongo.so

Restart apache
service httpd restart

Verify
php -m | grep -i mongo