-id command to replicate the Ansible public key into the node.Fourth step: Define a list of nodes for AnsibleFile/etc/ansible/hosts maintains a list of servers in Ansible.[Email protected] ~]# vi/etc/ansible/hosts[Test-servers]192.168.1.9192.168.1.10Save and exit the file.Fifth step: Try running the command on the
"play". The main function of play is to dress up as a group of hosts in advance through the task defined by the Ansible role.A simple playbook configuration is as follows:
The code is as follows:-Hosts:localRemote_user:rootTasks-Name:echo HiShell:echo "HI"Ansible also supports setting up handlers,handlers to be invoked after the server changes after the tasks are performed, using the following handler:
The
machine192.168.0.200192.168.40.70:88 Ansible_ssh_user=root ansible_ssh_pass=1234567899Server ansible_ssh_host=192.168.40.20 ansible_ssh_pass= "1234567899" ansible_ssh_port=8822Note. There are several ways to do this. The default port is 22. The default user is root. Server is the host name. Recommended for the next 2, when you copy the public key to the management host, you can password-free2) Generate SSH key pair in control hostSSH-KEYGEN-T RSAAlwa
TIDB Binlog #如果有从此 tidb the need for cluster synchronization data, you can change to True to turn on enable_binlog = False The installation process can be divided into root user installation and normal user installation two ways. The root user is of course the best, modify the system parameters, create directories, etc. will not involve insufficient permissions
Basic concept of ansible, ad-hoc operationsBasic concept of ansible, ad-hoc operations
Ansible is an automated tool used to manage configuration files and deploy applications.Very efficient
Through the ssh protocol, mq, database, and agentless do not need to be installed on the client, which is lightweight and has better compatibility.Ansible common parameters
Co
://occasionalutility.blogspot.com/ 2013/11/everyday-powershell-part-7-powershell.html # Some Ansible modules that could use PowerShell 3 features, so systems m Ay need # to be upgraded. This is used by a sample playbook. Refer to the Windows # documentation in docs.ansible.com for details. #-Hosts:windows # tasks: #-Script:upgrade_to_ps3.ps1 # Get version of OS # 6.0 is $ # 6.1 is R2 # 6.2 Is 6.3 R2 if ($PSVersionTable. Psversion.major-ge 3) {write-
directory does not exist in the user's home directory in the controlled host, it is created.# then append the uploaded public key file to the user's Authorized_keys file
Method Two:
Add through the Authorized_key module[[Email protected] ~] #ansible para-i/tmp/inventory.txt-m authorized_key-a "User=root key= ' {{lookup (' file ', '/ROOT/.SS H/id_rsa.pub ')}} ' "-K650) this.width=650; "src=" H
Ansible learning-simple learning notes 2, ansible-learning notes
Roles is used for hierarchical and structured organization playbook, and the encryption process in previous note 1 is used.
My directory svnrepos has two directories.
Ansible_test and test
Under the test directory:
The directory structure of ansible_test is:
The file content is as follows:
Copyright Disclaimer: Thi
.1) The Hosts file is configured from the server's IP, port, user name, password and other information, such as:' Host1 ansible_ssh_host=192.168.10.129 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass= ' 123456 ' #host_to _replace`2) The Tomcat.yaml file is a [playbook] (http://www.ansible.com.cn/docs/playbooks.html) (script) that defines the entire deployment process for Tomcat:```----Hosts:allTasks-Name:stop Tomcat service #调用脚本shutdown_to
present, the configuration under the Playbook directory overrides the configuration of the inventory directory.-----------------------------------------------------------------------------------Description of the Inventory parameterAs mentioned earlier, by setting the following parameters, you can control how ansible interacts with the remote host, some of which we have already talked about:Ansible_ssh_hostThe name of the remote host that will be con
firewall command: systemctl stop firewalld // disable firewall-Name: APACHE service: name = httpd enabled = true state = started // start the HTTPd service and set it to enable self-starting ansible-playbook-c aaa. yml checks whether the syntax and process are correct and does not actually execute it!
Handlers Introduction
Handlers is used to take actions when the monitored resource changes. The accumulative operations in handler y become handler,
What is automated operation and maintenanceWith the continuous development of the information age, IT operations has become an important part of IT service connotation. In the face of more and more complex business, in the face of more and more diverse user needs, expanding IT applications need more and more reasonable mode to ensure that IT services can be flexible, secure and stable continuous protection, the security factor in this model is IT oper
default in the/etc/ansible/directory, which prompts ansible to support the domain name and IP two client naming formats, where a "slave" group is defined vim/etc/ansbile/hosts [slave]192.168.17.18192.168.17.19vim/etc/ansible/hosts [webhosts] 172.16. 10.22 ansible_ssh_user=root ansible_ssh_pass=172.16. 10.33 ansible_ssh_user=root ansible_ssh_pass=guoting expla
Application code Automation deployment.
System administration configuration Automation.
Support continuous delivery automation.
Support environments such as cloud computing, big data platforms such as AWS, OpenStack, VMware, and more.
Lightweight, there is no need to install agent on the client, only one update on the control machine is required when updating.
Bulk task execution can be written as a script that can be executed without being distributed to the remote
Common ad-hoc commands are used to solve some common simple configuration commands, and these commands are executed quickly. Adhoc can be easy to use without having to write playbooks.
Man ansibleansible File transferansible can transmit files to a remote host through SCP # ansible webservers-M copy-a "src =/etc/hosts DEST =/tmp/hosts" to/etc/ copy the hosts file to/tmp/hosts of all hosts in the webservers remote host group. The file module can change
AnsibleHost group Management:Ansible ConfigurationDescription: About the parameters available in the Ansible Hosts file:Ansible_ssh_port=22 #远程主机登陆端口Ansible_ssh_user=root #远程主机登陆用户名Ansible_ssh_pass=chekir #远程主机登陆用户名的密码Ansible_ssh_private_key_file=/etc/ansible/hosts #指定管理主机群列表文件Host_key_checking=false #跳过第一次连接检测询问是否登陆的提示 (yes/no)Here Hosts file I did a mutual trust authentication, so the hosts file I wrote a
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.