03-ansible Admin Command _ansible

Source: Internet
Author: User
Tags documentation
First, ansible Management command

There are several ansible management commands:
(1) Ansible: This command is one of the very high usage in daily work, mainly used for temporary one-time operation;
(2) Ansible-doc:ansible module document description, for each module has detailed usage instructions and application case introduction;
(3) Ansible-galaxy: Can be simply understood as the function of Github or PIP, is the Ansible official a function platform to share role. The sharing and installation of role can be realized easily by the Ansible-galaxy command;
(4) Ansible-playbook: is the daily use of the highest frequency of the command, its working mechanism is, through the reading of prepared playbook files to achieve batch management;
(5) Another mode of operation of ansible-pull:ansible, pull mode, ansible using push mode by default;
(6) Ansible-vault: Mainly used for configuration file encryption;
(7) Ansible-console: Allows users to use the Ansible built-in commands on ansible-console virtual terminals like a Shell.

The following is an introduction to common management commands. Second, ansible order

Ansible is one of the very high usage commands in daily work, which is mainly used in the following scenarios:
(1) Non-curing requirements
(2) Temporary one-time operation
(3) Two times development interface calls

This command is used in the following ways:

Ansible 

For example: At work I temporarily want to see if the Web1 server survives, or I want to temporarily replicate local/etc/fstab to WEB1 server's/tmp directory for testing, and so on.

The specific commands are used as follows:
Check that the server is alive

Ansible web1-m Ping

Copy local file to remote

Ansible web1-m copy-a "Src=/etc/fstab dest=/tmp/fstab owner=root group=root mode=644 backup=yes"

Detailed parameters to view Help:

[Root@ansible-manager ~]# ansible-h usage:ansible  

The relevant options are explained and are no longer detailed here. Iii. Ansible-doc Order

Ansible-doc is a ansible module documentation description, with detailed usage instructions and application case descriptions for each module, similar to the Linux System Man command. This command is used in the following ways:

Ansible-doc [Options] [module ...]

The Ansible-doc command follows the [options] parameter or module name to display the module usage instructions, as shown in the following example:

List the supported modules

Ansible-doc-l

Ping Module Feature description

Ansible-doc Ping
Iv. Ansible-playbook Order

Ansible-playbook is the most frequently used command in everyday applications, and its working mechanism is to achieve batch management by reading the playbook file that is written in advance. The functionality to be implemented is the same as the command ansible, which can be understood as a ansible set of tasks that are made up of certain conditions.

After the Ansible-playbook command, follow the playbook file in the YML format, perform a predefined set of tasks, using the following instructions:

Ansible-playbook playbook.yml

The specific examples are as follows:
Perform all the set of tasks defined in this playbook nginx.yml

Ansible-playbook nginx.yml

Playbook has the characteristics of simple writing, high customization, flexible and convenient at the same time can be cured daily operation of all the features, operations and maintenance personnel should be skilled master. V. Summary

This section describes the series of Ansible management commands and provides a brief introduction to Common Ansible, Ansible-doc, and Ansible-playbook commands. In the next section, we learn Inventory.

Reference Documentation:
http://www.ilurker.cn/?post=283
http://www.sohu.com/a/128270825_610730
"Ansible Authority Guide"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.