updatedb is usually has a daily cron job to update the default database(‘/var/lib/mlocate/mlocate.db’). To manually update the database, you can manually run the ‘updatedb’ command first. That will take a while depending on the number of files you have on your system, the last time updatedb ran or other file related changes.

First time – update the default database, run any of the below command depending on your requirements. Most likely, the first and/or third command is what you need.

Customizing updatedb
updatedb can be customized to output the search database to a different file than the default db, in addition to this we can change the directory to index other than the default root tree. We can then tell locate to use the custom db.

In the below example, I am indexing the files under home directory in /tmp/home.db database, and then run locate to use this custom DB. As you can see the number of files and directories is way lower and thus the search much faster although since it has to scan specific directory.

Infoblox provides a product to manage your DNS, DHCP and IPAM through a single management interface. In this short article, I will walk you through automating some of the day to day operations work in managing DNS using Infoblox REST API. The REST based api tool can be also used to manage DHCP and IPAM.

The Infoblox WAPI is the REST interface we will interact with. In a highly available DNS setup, the WAPI requests go to the HA Grid Master IP or hostname. The requests typically have arguments and body. A great resource that helped me get started is a github repo of Infoblox Api python modules.

If you can’t find the particular method in the infoblox module, it should’t be difficult to write one. Follow the api reference documentation on the structure of the WAPI Api calls.

Note – in some cases, you have to make multiple api calls to perform certain tasks. One example is updating the TTL for a DNS entry. On the first call, you need to get the host reference id and on second call update the TTL. The below example shows a simple python script to update the TTL (in seconds) for an existing FQDN entry.

Making a change to live servers in production is something which has to be done with extreme care and planning. Several deployment types such as blue/green, canary, rolling update are in use today to minimize user impact. Ansible can be used to orchestrate a zero-downtime rolling change to a service.

A typical upgrade of an application, such as patching, might go like this –

disable monitoring alerts for a node

disable or pull out from load balancer

make changes to server

Reboot node

wait for node to be UP and do sanity check

put node back to load balancer

turn on monitoring of node

Rinse and repeat.

Ansible would be a great choice in orchestrating above steps. Let us start with an inventory of web servers, a load balancer and a monitoring node with nagios –

The web servers are running apache2, and we will patch apache and the kernel. For the patch to take effect, the servers need to be recycled. We will perform the patching one node at a time, wait for the node to be healthy and go to the next. The first portion of our playbook would be something like this –

I haven’t included the playbook tasks for disabling/enabling monitoring as well as removing/adding node to the load balancer. The procedures might differ depending on what type of monitoring system or load balancer technology you are using. In addition to this, the sanity check show is a simple port 80 probing, in reality a much more sophisticated validation can be done.

Google provides the same cloud services as other cloud providers such as Amazon Web Services(AWS) and Microsoft (Azure). It refers it as Google Cloud Platform or GCP. You can easily get started by signing up for free – https://cloud.google.com/free/

The gcloud toolkit is a command line interface tool to interact with GCP resources. Very useful in automating cloud tasks, with its command completion and help pages, it is almost a necessity to familiarize yourself with this tool.

3. Cloud deployment manager
GCP deployment manager allows you to create, delete and update GCP resources in parallel by declaring a set of templates written in jinja2 or python. Templates can be shared with other teams and can be re-used with little modification.

If you have a large playbook it may become useful to be able to run a specific part of it or only a single task without running the whole playbook. Both plays and tasks support a “tags:” attribute for this reason.

In this specific scenario, I have a playbook which configures all productions servers from the moment the servers boot till they start taking traffic. While testing the plays in dev environment, I was debugging an issue on the parts which does dns configuration. This is where the “tags” attributes comes handy –

By default, Ansible logs the output of playbooks to the standard output only. In order to enable logging to a file for later review or auditing, it can be turned on by setting log_path to a path location where Ansible has a write access.

In my case, i have added the “log_path” setting in the ansible configuration file “/etc/ansible/ansible.cfg” –

On Wednesday Nov 22nd 2017, the FCC has published a new proposal to undo the existing net neutrality rules meant to prevent ISPs from creating a multi-tiered Internet, where they can freely charge extra fees for faster access to some websites. This new proposal if passed, will basically make the cable companies the gate keepers. They will be able to pick and choose winners and losers, whoever pays them a big check will have their content delivered faster to users, while small businesses and individuals will have a big barrier erected against them to enter the market and deliver innovative products to the public.

This is against the philosophy which created the Internet in the first place, an open and innovative Internet, which provides a level playing field for all.

While connected to a remote host through an ssh connection using Putty or other ssh clients, your client might freeze and not respond to any keyboard activity. In order to force an exit, there is a “secret” keyboard shortcut – Enter~.[ Enter followed by ~ followed by .(dot) ]