Ansible Command Module Practical Guide – Mastering Core Skills for Automated Operations

Ansible Command Module Practical Guide - Mastering Core Skills for Automated Operations

Table of Contents Ansible Command Module Operations Static Inventory Ansible Configuration File Ansible Modules INI Format Defining Nested Groups Static Inventory Example Simplifying Host Specifications through Patterns Validating Inventory Overriding Inventory Locations Defining Variables in Inventory Ad-hoc Use Cases Running Ad-hoc Commands Executing Tasks via Modules Ansible Inventory Deploying Ansible Inventory Files Ansible Command Module … Read more

Ansible: From Beginner to Abandonment (Part 23)

Ansible: From Beginner to Abandonment (Part 23)

Ansible Variable Usage Ansible can improve the efficiency of writing Playbooks through the use of variables. For example, when installing packages with Ansible, you can write the package names into a variable and then call that variable in the Playbook. This way, when you need to modify the packages to be installed, you only need … Read more

From Zero to Expert: A Comprehensive Guide to Ansible Configuration Automation (Includes Complete Project Case)

From Zero to Expert: A Comprehensive Guide to Ansible Configuration Automation (Includes Complete Project Case)

From Zero to Expert: A Comprehensive Guide to Ansible Configuration Automation (Includes Complete Project Case) 1. Introduction In the modern IT operations environment, configuration management automation has become a key technology for improving efficiency, ensuring consistency, and reducing human errors. Ansible, as an open-source configuration management tool, has become one of the preferred tools for … Read more

Ansible Playbook: Execute Specific Tasks Based on Task Status

Ansible Playbook: Execute Specific Tasks Based on Task Status

Ansible Playbook: Execute Specific Tasks Based on Task Status Using Handlers First, let’s take an example of using Ansible to modify the SSH service configuration file and restart the service. The following Playbook can achieve this functionality: – name: set sshd conf ansible.builtin.lineinfile: path: /etc/ssh/sshd_config backrefs: true regexp: "^#?\\s*PermitRootLogin" line: PermitRootLogin yes – name: restart … Read more

How to Deploy a Nacos Cluster with One Click Using Ansible?

How to Deploy a Nacos Cluster with One Click Using Ansible?

Use Ansible to achieve one-click deployment of a 3-node Nacos cluster. Definition of the hosts file [root@localhost ansible]# cat inventory/hosts [all:vars] # ansible_ssh_pass: Host password # ansible_user: Host account ansible_become=true ansible_ssh_pass=123456 ansible_ssh_user=weihu ansible_become_pass=123456 ansible_become_user=root ansible_become_method=sudo [nacos] 192.168.10.150 nacos_db_init=true 192.168.10.151 192.168.10.152 Definition of global variable file [root@localhost ansible]# cat inventory/all.yml all: vars: mysql_nacos_host: "192.168.10.128" mysql_nacos_port: "3306" … Read more

Learning Ansible the Elon Musk Way

Learning Ansible the Elon Musk Way

Click/the blue text above/to follow me🚀 Reply 【Evangelist】 in the public account to view the latest AI technology learning roadmap 🚀 Learning Ansible using Elon Musk’s method: A minimalist guide from principles to practical application. 1. First Principles: Shattering the illusion that “automation must be complex”. The essential requirements for server management (stripped of all … Read more

Comprehensive Guide to Common Ansible Modules and Commands

Comprehensive Guide to Common Ansible Modules and Commands

Command Module ansible all -m command -a “ls /home”: Executes the ls /home command on all remote hosts, directly returning the directory contents. ansible webservers -m command -a “pwd”: Executes the pwd command on all hosts in the webservers group, displaying the current working directory. ansible 192.168.1.10 -m command -a “date”: Executes the date command … Read more

A Comprehensive Guide to Ansible Automation from Basics to Advanced

A Comprehensive Guide to Ansible Automation from Basics to Advanced

Hello everyone, I am Vince, a veteran in operations with 10 years of experience. In an era where hundreds of servers are managed daily, manual operations have become a thing of the past. After introducing Ansible, the operations team of a certain e-commerce platform reduced deployment time from hours to minutes, and fault recovery efficiency … Read more

Ansible Solution for Bulk Upgrading OpenSSH and OpenSSL

Ansible Solution for Bulk Upgrading OpenSSH and OpenSSL

Complete Ansible Playbook (<span>upgrade_openssh_openssl.yml</span>) yaml —- name: Upgrade OpenSSH and OpenSSL to fix vulnerabilities hosts: all become: yes serial: 1 # Operate on one host at a time to reduce risk vars: # Target versions (modify according to actual needs) target_openssh_version: "8.9p1" target_openssl_version: "3.0.11" # Fallback versions (for emergency recovery) fallback_openssh_version: "8.4p1" fallback_openssl_version: "1.1.1w" tasks: … Read more

Ansible: From Introduction to Abandonment (Part 21)

Ansible: From Introduction to Abandonment (Part 21)

Asynchronous Operations Asynchronous operations and polling can be set using <span>async</span> and <span>poll</span>. Ansible Ad-Hoc Asynchronous, Concurrent, and Querying Starting Asynchronous Tasks [root@awx-1 ansible]# ansible localhost -B 3600 -P 5 -a "sleep 30" localhost | CHANGED =&gt; { "ansible_job_id": "j445703768934.50473", "changed": true, "cmd": [ "sleep", "30" ], "delta": "0:00:30.003839", "end": "2025-04-21 23:31:02.617454", "finished": 1, "msg": … Read more