David Cao

David Cao

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

selectattr in Ansible

selectattr in Ansible selectattr is a filter plugin in Ansible that allows you to select a subset of elements from a list of dictionaries based on the value of a particular attribute.  Its syntax is as follows: <list of dictionaries>…

Get MAC address with Ansible

This article is part of the following series.   Get MAC address with Ansible You can use the ansible_default_ipv4.macaddress variable to get the MAC address using Ansible.This is a variable that contains the MAC address of default network interface. Here…

2 ways to get disks info with Ansible

This article is part of the following series.   Get all the disks with ansible_facts in Ansible You can use the ansible_facts module in Ansible to gather information about disks on remote hosts. The ansible_facts module automatically collects facts about…

How to use when statement in Ansible

When statement in Ansible In Ansible, the “when” keyword is used to specify a condition or a set of conditions that must be met in order for a task to be executed. It allows you to add conditional logic to…

2 ways to Get IP address with Ansible

This article is part of the following series.   Get IP address using fact variable with Ansible If you want to get the IP address of a host using Ansible, you can use the ansible_default_ipv4 variable, which is a built-in…

how to get file size with Ansible

In Ansible, you can use the stat module to get the size of a file on a remote host. The stat module retrieves information about a file, including its size, permissions, and other attributes. Get file size with stat module…

How to get Postgresql server uptime

In this post, we will delve into the concept of PostgreSQL server uptime, why it matters, and how to accurately measure it using SQL queries and built-in functions. By understanding how to obtain the uptime of a PostgreSQL server, you…