Command ModuleThe command module is the ansible default module, the command module is used when the-m parameter is not specified;Comand modules are simple, common commands can be used, but the execution of their commands is not performed through the shell, so, such as "Example: displaying the current user[[email protected] ~]# ansible all-a ' whoami ' db |SUCCESS |Rc=0 >>rootweb |SUCCESS |Rc=0 >>root192.168
Iv. Configuration of InventoryAnsible defines hosts and groups through inventory, allowing time to be read through-I, default/etc/ansible/hosts. Multiple inventory can exist, enabling dynamic generation.1. Define hosts and Groups# vim/etc/ansible/hosts192.168.12.22 #可以直接为IP地址Nfs.magedu.com #可以是域名ntp.magedu.com:2200 #可以: Connect to SSH Port[webserver] #[] is a group name, the following are the group membersw
Ansible Push SSH Public key1 The management of the machine can be directly push the pastUsing ssh-keygen-t RSA to generate a key pair,!miyaoqq20141225124030.png!Id_rsa the private key, which remains on the host, Id_rsa.pub is the public key that needs to be pushed to the management machine and renamed to the Authorized_keys filePush to remote machine ssh-copy-id-i ~/.ssh/id_rsa.pub [email protected][ip,hostname]2 machine Many cases, the use of Ssh-cop
Speaking of variables, the variables in ansible are almost the same as those in the pillar + grains in the salt-stack.
The main sources of variables in ansible are as follows:
Inventory (host vars, group vars)
Playbook
Command Line
The Playbook generates results during task execution. It can be register and used as a variable for the following task.
Roles
Facts from nodes
These types of variables, 1
"or" and "non" in ansible
We often need to operate a number of groups in the day-to-day work, this time we need to know some common methods of merging collections, the most important way is::::! "Directly below the example
Cat hosts[Lab]Lab1.503error.comLab2.503error.com
[web]Web1.503error.comWeb2.503error.com
[Data]Data1.503error.comData2.503error.com
[SSSS]Web1.503error.comWeb2.503error.comData1.503error.com
Specify a group:
$
After Ansible 2.0, there was no run this API, On the internet to find a lot of officials 2.0 of the API, found that the call, the return result is only 0 and 1, can not get the same results as running, after research, finally use the following code can get results, this is my encapsulated API. Look at the code directly
ansible_api.py
# coding=utf-80 #!/bin/env python "" "@version: 1.0 @author: Hogan @project: Cloudmanage @file: ansible_api.py @time:
Tags: ansible tornado mongodbhttp://blog.csdn.net/smallfish1983/article/details/38078019According to the above man wrote, beginners, do not spit blood, basic skills can be achieved.650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4B/06/wKioL1QnvwOSkcQiAADRwubmzMo149.jpg "style=" float: none; "title=" Index.png "alt=" Wkiol1qnvwoskcqiaadrwubmzmo149.jpg "/>650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4B/06/wKioL1QnvwPwAo3UAADQorQ
Solve the problem of slow access to the official ansible website.
Recently, I have been familiar with ansile many times, so I need to read the official website from time to time. However, the loading speed is really tough and super slow.1. Open the chrome developer Tool
It is found that this url needs to be stuck when it is obtained.
Request URL:https://www.google.com/cse/brand?form=search-form-idinputbox=s
Tags: mariadb compiling and installing shell Automation Ansible Project PracticeIn the previous blog has been demonstrated, through scripting MySQL Universal binary installation, the following through the demonstration script to implement the source code compilation MARIADB Automation, in large-scale deployment of multiple mariadb, where the use of ansible to implement its automated deployment, Can greatly
Playbook is a list of one or more "play"The main function of play is to dress up a pre-set host as a role defined in advance through the task in ansible. Fundamentally, the so-called task is nothing more than a call to Ansible's module. By organizing multiple play in one playbook, you can connect them to run in a pre-programmed mechanism.Playbook use Yaml language to write each ansible Playbook is a yaml fo
Ansible series (8) zypper ModuleZypper
Zypper is an rpm package management tool for suse or opensuse. This refers to ansible's zypper module.Module Parameters
Parameter Name
Required?
Default Value
Option value
Parameter description
Disable_gpg_check
No
No
Yes/no
This parameter is used to check the signature of the GPG package. The default value is check. This p
Ansible series (7) apt ModuleApt Module
This module is the most used when ubuntu is the OS of a remote node. Apt is a package management tool for ubuntu/debian.Module Parameters
Parameter Name
Required?
Default Value
Option value
Parameter description
Cache_valid_time
No
IfUpdate_cacheThis parameter takes effect only when it takes effect. Used to controlUpdate
First, about AnsibleSimple, agentless, powerful open source it automation toolsSimple,agentless and powerful open source IT automationDescription1. The host is managed by default via the SSH protocol.2. Managing hosts to install python2.6 or 2.7 (control host does not support Windows systems)Second, installation2.1 Configuring an open source image sourceOpen http://mirrors.skyshe.cn/#generator650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7E/D5/wKioL1cKSeuR_pYEAACanTPGbQ8367.png "tit
The use of Ansible also has a long time, the previous machine is a good template, configuration of SSH without password landing, push up generally very convenient. Today, there is nothing to do, just have a thing to do, the plaintext password push sample paste out to share.Straight into the topic,Requirements: Modify the Hosts file of a batch of machines, require sudo permission, and sudo account (I am here is CentOS account,) No SSH password login is
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.