Ansible Modules and Collections

Ansible Modules and Collections

Ansible Modules and Collections Ansible Modules Ansible executes tasks through modules, such as <span>ansible.builtin.hostname</span> for setting the hostname. <span>ansible.builtin</span> is the namespace for modules. Different modules belong to different namespaces. Generally, module names do not conflict, but as the number of modules increases, the possibility of name conflicts cannot be ruled out. Therefore, different modules … Read more

Ansible User Guide: A Powerful Tool for Automated Operations

Ansible User Guide: A Powerful Tool for Automated Operations

Introduction In modern operations and IT management, the use of automation tools is becoming increasingly widespread. Ansible, as a lightweight and easy-to-use automation tool, has gained favor among many operations engineers and developers. 1. Overview of Ansible Ansible is an automation tool developed in Python, primarily used for configuration management, application deployment, and task orchestration. … Read more

Ansible Playbook: From Introduction to Mastery (Part 7)

Ansible Playbook: From Introduction to Mastery (Part 7)

Ansible Playbook Ansible Playbooks use YAML format and have strict indentation requirements. A playbook consists of multiple plays. Playbook Example — – name: init # Define the name of the Playbook hosts: all # Define the range of managed hosts tasks: # Define the tasks to be executed, each – corresponds to one task (a … Read more

Deploying Ansible Learning Environment on Hi168 Cloud Platform

Deploying Ansible Learning Environment on Hi168 Cloud Platform

Introduction The previous article introduced how to deploy an openEuler learning environment on the Hi168 cloud platform. Since we can deploy openEuler, various other learning environments can naturally be deployed as well. Introduction to Ansible Ansible is an automation tool for IT operations that can manage remote hosts via SSH protocol, performing batch operations on … Read more

Ansible’s Cron Module for Managing Scheduled Tasks

Ansible's Cron Module for Managing Scheduled Tasks

The Ansible `cron` module is used to manage scheduled tasks (cron jobs) on remote hosts, allowing you to create, modify, and delete scheduled tasks to ensure specified tasks are executed automatically at designated times. 1. Features of Ansible’s `cron` Module Manage crontab and environment variable entries: You can create environment variables and named crontab entries, … Read more

Ansible Commands: From Basics to Mastery (Part 5)

Ansible Commands: From Basics to Mastery (Part 5)

Ansible Commands Ansible has multiple commands, each serving different functions. Below are some commonly used commands and their parameters. Common Commands # Set the ansible configuration file ansible-config # View ansible related modules and module documentation ansible-doc # View ansible's inventory ansible-inventory # Execute ad-hoc tasks ansible # Execute ansible playbooks ansible-playbook # Set ansible … Read more

Practical Automation in Operations: Managing Thousands of Servers with Ansible and Python

Practical Automation in Operations: Managing Thousands of Servers with Ansible and Python

At three o’clock that morning, I was dealing with an unexpected online failure with my colleagues, where dozens of service nodes needed urgent configuration updates. Manual operation? Not realistic. Writing a temporary script? Too slow. At that moment, I remembered the Ansible + Python automation framework I had configured earlier. Within three minutes, all node … Read more

Basic Usage of Ansible Playbook

Basic Usage of Ansible Playbook

Introduction to Ansible Playbook A Playbook is a component of Ansible used for configuration management. While Ansible’s AD-Hoc command functionality is powerful and can accomplish some basic configuration management tasks, AD-Hoc commands cannot support the configuration management of complex environments. In our practical use of Ansible, most of the time is spent writing Playbooks. In … Read more

Using Ansible Playbook to Copy Files from Remote Server

Using Ansible Playbook to Copy Files from Remote Server

Copy files from a remote server to a local computer. This can be accomplished using the Ansible fetch module. This is useful when you want to copy certain log files from a remote server to your local machine. By default, a directory named after each host you are connecting to will be created in the … Read more

Ansible Inventory Management: From Basics to Advanced Usage (Part 4)

Ansible Inventory Management: From Basics to Advanced Usage (Part 4)

Ansible Inventory The inventory is used to define which hosts are managed by Ansible. The inventory supports the following formats: • IP addresses • Hostnames • Ranges (<span>server[b:c]</span>) • Host groups (<span>webserver</span>) • Subgroups (<span>lnmp:children</span>) Inventory 172.25.250.10 [webserver] server[b:c] [mysql] 172.25.250.1[3:4] [lnmp:children] webserver mysql • Directly defining a hostname or address, currently <span>172.25.250.10</span> does not … Read more