How to test sendmail from the terminal

Sendmail is an open source smtp server. Many different languages and frameworks interface with sendmail, and when debugging it’s good to be able to quickly test whether or not sendmail is working.

The following is a quick way to verify that sendmail is working.

enter image description here

WordPress display the_meta() of in custom page

I have some meta values on my wordpress custom page that I need to be displayed in a table. Is there any way I can do that.

Here’s the code I’m using now: <?php the_meta(); ?>

And this is what it shows:

enter image description here

I want to do something like:

enter image description here

I found out that:

the_meta() is located in wp-includes/post-template.php

This makes the output:


So it’s not recommended to edit files in that folder because of the wordpress update.

You can make a table in html and display each value individually, like this:


Here‘s the documentation or

How to Find the ID Facebook Page

Facebook requires you to input the Page ID when creating social plugins and chat widgets for the Messenger platform but they do not offer any easy way to determine the ID of Facebook pages. This simple guide should help.

Find Facebook Page ID

Step 1: Open any Facebook Page in your desktop browser and right-click the profile image of the page.

Step 2: Click “Copy Link Address” from the right-click menu to copy the photo link to your clipboard.

Step 3: Open Notepad (or Text Edit on your Mac) and paste the URL of the image. It would look something like this:

And the Page ID is 5550296508

Ansible task executed if file not exists condition

In this post, I will share an ansible task that is executed only if a condition is matched, the condition here is to check if file NOT exists on the system.

Ansible playbook create a new nginx vhost by template for wp at nginx proxy, then install wordpress latest if wp-config.php is not exists

if wp-config.php exists, the task Download WP is skipping.

Happy reading!

Up and running kubernetes cluster on aws eks in 10 minutes

In this post, I will share the post Up and running kubernetes cluster on aws eks in 10 minutes with cli tool called eksctl.

eksctl is cli tool written in GO by weaveworks and based on Amazon’s official CloudFormation templates.

Install eksctl

In our example, we will use wget, so make sure it is installed before you proceed.

On MAC you can do

Configure AWS API credentials

Install pip:

You can now install an awscli package using pip:

Let’s configure aws key/secret

Create Amazon EKS Cluster with eksctl

When all settings have been saved, you can now create a new cluster on EKS:

Options that can be used include:

Let’s begin creating our first kubernetes cluster with eksctl

Once you have created a cluster, the cluster credentials will be added in ~/.kube/config

To enable Auto Scaling Group for worker nodes group, use the options:

To get details about the deployed cluster or delete cluster:

Deploying Kubernetes on AWS EKS service with eksctl is easy, you do not need to struggle with aws console in UI. All cluster configurations are saved on deployment machine, you can quickly make changes and update your cluster.

Ansible structure layout – the best approach

This is called Ansible structure layout – the best approach that we used to use it as a template for our projects. This may be not the best but you can customized it as to fit your own.

Directory Layout

The top level of the directory would contain files and directories like so:

How to Arrange Inventory, Stage vs Production

  • production.ini: contains the inventory of all production hosts
  • stage.ini: contains the inventory of all staging hosts

It is suggested that you define groups based on the purpose of the host (roles) and also geography or data center location (if applicable):

Group And Host Variables

We can also assign variables to all hosts in a group or specific group or specific hosts. Let’s set those now:

If we had any default values or values that were universally true, we would put them in a file called group_vars/all:

We can define specific hardware variance in systems in a host_vars file, but avoid doing this unless you need to:

Playbooks Are Separated By Role

Playbook webservers.yml is used for all hosts in group webservers with roles common, nginx

Task And Handler Organization For A Role

Below is an example tasks file that explains how a role works. Our common role here just sets up NTP, but it could do more if we wanted:

Here is an example handlers file. As a review, handlers are only fired when certain tasks report changes and are run at the end of each play:

Let’s run your playbook

What about just reconfiguring NTP on everything? Easy.:

What about just reconfiguring my webservers?:

What about just my webservers in Boston?:

What about just the first 10, and then the next 10?:

And of course, just basic ad-hoc stuff is also possible.:

Stage vs Production

As also mentioned above, a good way to keep your stage (or testing) and production environments separate is to use a separate inventory file for stage and production. This way you pick with -i what you are targeting. Keeping them all in one file can lead to surprises!

Bash script recursively find all files in directory

Bash script recursively find all files in current and subfolders based on wildcard matching, you can use find normally but tree with -P option is easier to read.

find will find all files that match a pattern:

However, if you want a picture:

Hope this helps!

Ansible template module for wordpress nginx vhost

In this post, I will share a simple playbook that run on localhost to demonstrate ansible template module with  nginx vhost for WordPress.



Directory structure layout:

How to run playbook:

Bash script arguments example

In this post, I will shortly share Bash script arguments via an easy example so it can help you understand how it works and write a bash script with parameters input from command line in terminal.

Let’s imagine the following command line:

If your_bash_program were a bash shell script, we could read each item on the command line because the positional parameters contain the following:

  • $0 would contain “your_bash_program
  • $1 would contain “word1”
  • $2 would contain “word2”
  • $3 would contain “word3”

Here is a script you can use to try this out:

Kubernetes Objects Tutorial – The Easy Way

Kubernetes Objects Tutorial – Let’s understand it in an easy way. In this blog post, I will help you to understand kubernetes objects and how we can express those in the .yaml file. Let’s enjoy our post.

Kubernetes Objects

Kubernetes Objects are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster. Specifically, they can describe:

  • What containerized applications are running (and on which nodes)
  • The resources available to those applications
  • The policies around how those applications behave, such as restart policies, upgrades, and fault-tolerance

Once the kubernetes object is created, the Kubernetes system will check it constantly to make sure that object exists.

Kubernetes Objects Spec and Status

Every Kubernetes object includes 2 nested object fields that describe the object’s configuration:

  • Object spec: describe the characteristics of the object
  • Object status: describe the actual state of the object

For example, a Kubernetes Deployment is an object that can represent an application running on your cluster.

  • Object spec: 3 replicas of the application
  • Object status: 3 replicas are running or 2 replications are running….

Kubernetes Objects Example

Here’s an example .yaml file that shows the required fields and objects spec for a Kubernetes Deployment:

Download: nginx-deployment.yaml


The output is similar to this:

Required Fields To Create Kubernetes Objects

  • apiVersion – Which version of the Kubernetes API you’re using to create this object
  • kind – What kind of object you want to create
  • metadata – Data that helps uniquely identify the object, including a name string, UID, and optional namespace

You’ll also need to provide the object spec field. The precise format of the object spec is different for every Kubernetes object, and contains nested fields specific to that object.