


Seven commonly used commands for Ansible automated operation and maintenance
After installing ansible, we can use it through seven main instructions, which are: ansible, ansible-doc, ansible-galaxy, ansible-lint, ansible-playbook, ansible-pull, ansible-vault. We can learn how to use them by looking at the usage section of the command, and detailed information can be obtained by running "command -h".
Ansible common commands
ansible
The core part of Ansible is used to execute ad-hoc commands, that is, a single command. By default, the command needs to specify the host and option parts. If no module is specified, the command module is used by default. However, the module used by default can be modified in /etc/ansible/ansible.cfg, for example #module_name = command.
ansible 192.168.182.130 -a 'date'
ansible-doc
This command is used to view module information. Commonly used parameters include -l and -s
#列出所有已安装的模块ansible-doc-l ansible-doc-l #查看具体某模块的用法,这里如查看command模块 ansible-doc-s command
ansible-playbook
ansible-playbook command is the most commonly used command. It reads the playbook file and then performs corresponding actions. This will be discussed later.
ansible-galaxy
The ansible-galaxy command can easily download third-party extension modules from https://galaxy.ansible.com/, similar to centos' yum, python's pip or easy_install.
ansible-galaxy install aeriscloud.docker
ansible-lint
ansible-lint is a tool for checking the syntax of playbook. Usage is as follows:
ansible-lint playbook.yml
ansible-pull
The use of this instruction requires talking about another mode of ansible, pull mode, which is exactly the opposite of the push mode we usually use. It is suitable for the following scenarios: you have a huge number of machines that need to be configured, even if the usage is very high The threads still take a lot of time; you'll want to run Anisble on a machine without network connectivity, such as after installing it on boot.
ansible-vault
- ansible-vault is mainly used when the configuration file contains sensitive information and you don’t want it to be seen. Vault can help you encrypt/decrypt the configuration file, which is an advanced usage.
- Mainly for playbooks that involve configuring passwords or other variables, you can use this command to encrypt, so that what we see through cat will be a password string file. When editing, you need to enter the preset password. Open.
- When executing this kind of playbook file, you need to add the --ask-vault-pass parameter, and you also need to enter a password before it can be executed normally.
The above is the detailed content of Seven commonly used commands for Ansible automated operation and maintenance. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics


![WLAN expansion module has stopped [fix]](https://img.php.cn/upload/article/000/465/014/170832352052603.gif?x-oss-process=image/resize,m_fill,h_207,w_330)
If there is a problem with the WLAN expansion module on your Windows computer, it may cause you to be disconnected from the Internet. This situation is often frustrating, but fortunately, this article provides some simple suggestions that can help you solve this problem and get your wireless connection working properly again. Fix WLAN Extensibility Module Has Stopped If the WLAN Extensibility Module has stopped working on your Windows computer, follow these suggestions to fix it: Run the Network and Internet Troubleshooter to disable and re-enable wireless network connections Restart the WLAN Autoconfiguration Service Modify Power Options Modify Advanced Power Settings Reinstall Network Adapter Driver Run Some Network Commands Now, let’s look at it in detail

This article details methods to resolve event ID10000, which indicates that the Wireless LAN expansion module cannot start. This error may appear in the event log of Windows 11/10 PC. The WLAN extensibility module is a component of Windows that allows independent hardware vendors (IHVs) and independent software vendors (ISVs) to provide users with customized wireless network features and functionality. It extends the capabilities of native Windows network components by adding Windows default functionality. The WLAN extensibility module is started as part of initialization when the operating system loads network components. If the Wireless LAN Expansion Module encounters a problem and cannot start, you may see an error message in the event viewer log.

1. Introduction to the sys module The os module introduced earlier is mainly for the operating system, while the sys module in this article is mainly for the Python interpreter. The sys module is a module that comes with Python. It is an interface for interacting with the Python interpreter. The sys module provides many functions and variables to deal with different parts of the Python runtime environment. 2. Commonly used methods of the sys module. You can check which methods are included in the sys module through the dir() method: import sys print(dir(sys))1.sys.argv-Get the command line parameters sys.argv is used to implement the command from outside the program. The program is passed parameters and it is able to obtain the command line parameter column

In iOS 17.2, Apple lets you customize the sound your iPhone uses for default notifications. This is good news for anyone who doesn't like the "bounce" tone Apple is introducing in iOS 17. In previous iOS versions, Apple allowed users to choose ringtones and text tones, as well as custom alert sounds for email, calendar, and reminder alerts. Anything else that throws notifications uses the default sound, and there's no way to change it. In iOS17, Apple subsequently changed the original default alert sound from "Tri-tone" to "Rebound". Many users didn't like the change, and some thought the new sounds were harder to hear. Therefore, the default sound in iOS17.2 is changed to your

Preface This article continues to introduce the Python collection module. This time it mainly introduces the named tuples in it, that is, the use of namedtuple. Without further ado, let’s get started – remember to like, follow and forward~ ^_^Creating named tuples The named tuple class namedTuples in the Python collection gives meaning to each position in the tuple and enhances the readability of the code Sexual and descriptive. They can be used anywhere regular tuples are used, and add the ability to access fields by name rather than positional index. It comes from the Python built-in module collections. The general syntax used is: import collections XxNamedT

All data are automatically assigned a "DOB" (Date of Birth) at the beginning. Therefore, it is inevitable to encounter date and time data when processing data at some point. This tutorial will take you through the datetime module in Python and using some peripheral libraries such as pandas and pytz. In Python, anything related to date and time is handled by the datetime module, which further divides the module into 5 different classes. Classes are simply data types that correspond to objects. The following figure summarizes the 5 datetime classes in Python along with commonly used attributes and examples. 3 useful snippets 1. Convert string to datetime format, maybe using datet

Hello, my name is somenzz, you can call me Brother Zheng. Python's import is very intuitive, but even so, sometimes you will find that even though the package is there, we will still encounter ModuleNotFoundError. Obviously the relative path is very correct, but the error ImportError:attemptedrelativeimportwithnoknownparentpackage imports a module in the same directory and a different one. The modules of the directory are completely different. This article helps you easily handle the import by analyzing some problems often encountered when using import. Based on this, you can easily create attributes.

The working principle of Ansible can be understood from the above figure: the management end supports three methods of local, ssh, and zeromq to connect to the managed end. The default is to use the ssh-based connection. This part corresponds to the connection module in the above architecture diagram; you can press the application type HostInventory (host list) classification is carried out in other ways. The management node implements corresponding operations through various modules. A single module and batch execution of a single command can be called ad-hoc; the management node can implement a collection of multiple tasks through playbooks. Implement a type of functions, such as installation and deployment of web services, batch backup of database servers, etc. We can simply understand playbooks as, the system passes
