Ansible is the core part of the instruction, which is mainly used to execute the AD-HOC (Point-to-point) command, which is a single command. The default is to follow the host and Options section, which is the command module when the module is not specified by default.
2. The module that is used by default can be modified in ansible.cfg. /etc/ansible/ansible.cfg
Ansible Common Command parsing:
See which modules are currently supported by Ansible: Ansible-doc-l
To view the parameters that a module can use: Ansible-doc-s copy (eg:copy module)
Ansible usage:
Ansible host name-M module name-a module parameter
-M: The name of the module, if a single command does not have to add-M, the default GO command
-A: module parameters, if the module is command,-a followed by the command parameters
-I: Specify the Hosts file location default:/etc/ansible/hosts
-F: Number of parallel tasks, must be integers
-U: Specify remote user, default is root
Ansible-playbook: It is important to accumulate the standard of writing.
The ansible-galaxy instruction is used to easily download third-party extensions from the https://galaxy.ansible.com/site, and we can visually understand them like Yum under CentOS, Pip or easy_install under Python.
Ansible-vault is mainly used in the configuration file contains sensitive information, do not want him to be seen, vault can help you encrypt/decrypt this configuration file, is a high-level usage. Mainly for playbooks for example, when it comes to configuring passwords or other variables, it can be encrypted by this directive, so that what we see through cat is a cipher string class of files that need to be entered in a pre-set password to open the edit. This playbook file needs to be added with the –ask-vault-pass parameter when it executes, and the password must be entered before it can be executed properly.
Common modules:
Copy module: Src=/dir/file dest=/dir/
File module:
Cron module:
Group module:
User module:
Yum module:
Service module:
Script module:
Ping module:
Command module:
Raw modules:
Get_url module:
Synchronize module:
Please refer to ansible website for all remaining modules:
Http://docs.ansible.com/ansible/list_of_all_modules.html
Playbook Writing Specification:
Http://docs.ansible.com/ansible/playbooks_intro.html
This article is from the "Ignatius Blog" blog, make sure to keep this source http://ignatius.blog.51cto.com/10028892/1882312
How to use ansible common commands and modules