Tags: style OCA python development source file has a copy int exec bashAnsible automation software based on Python developmentFeatures Overview:Configuration files do not require too much configuration to understand it.# # #部署ansble软件# #受控主机部署 Backup Nfs01 web01Yum Install-y Libselinux-python# #管理主机部署m01Yum-y Install AnsibleAt this point ansible software deployment is complete# # #软件配置应用Architecture:To implement public key batch management before inst
First, installation1, install third-party Epel sourceEpel of CentOS 5rpm-ivhhttp://mirrors.sohu.com/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpmcentos 6的epelrpm-ivhhttp://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpmInstallation of 6 Epel because it is version 62, Installation Ansibleyuminstallansible(ansible主机安装ip:192.168.1.100,下面的hosts里面机器不需要安装,所有执行操作都是在ansible主机完成)cd/etc/
-cmdb-i/etc/ansible/hosts out/> overview.html
Note that this/etc/ansible/hosts, in fact, you can customize, like mine, is differentiated by business, such as
[cust.megacorp]
db1.dev.megacorp.comdtap=devcomment="Olddatabaseserver"
db2.dev.megacorp.comdtap=devcomment="Newdatabaseserver"
test.megacorp.comdtap=test
acc.megacorp.comdtap=acccomment="24/7s
][email protected]#] () 'These variables are used in the template file.Hosts: List of hosts, i.e. inventory library files[[email protected] ansible]# more hosts[Test]10.24.16.14010.46.77.24Roles: Role DirectoryZabbix: List of rolesSITE.YML: Arranging roles, task portals[Email protected] ansible]# more SITE.YML-Name:instal Zabbix AgentHosts:testRoles-ZabbixLearnin
Ansible + Corosync + Pacemaker + NFS for http High Availability
Directory:
(1) experiment environment(2) Preparations(3) Configure basic configurations for node1 and node2(4) deploying nfs using ansible(5) deploying corosync and pacemaker using ansible(6) Use ansible to install the crmsh Tool(7) Use crmsh to configure
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 in
Tags: Automated ansible
Ansible is an open-source automated O M tool that neither requires a database nor runs background programs (daemons)
Easy to use, relatively simple compared with other similar tools (such as puppet)
I. Control Machine requirements:
The requirements for the ansible control machine are extremely simple. You can install Python or a later ve
0x00. To automate the management of Windows servers, test Ansbile manage windowsTest tools, Environment: Ubuntu 14.04 lts,windows SP2, python2.7, Ipython, ansible1.70x01. Initial configuration of WinRM on Windows ServerA. Upgrading PowerShellHttps://github.com/cchurch/ansible/blob/devel/examples/scripts/upgrade_to_ps3.ps1B. Configuring WinRMHttps://github.com/ansible
I. Preparation of the first order
Ansible installation is complete, below learn how to use ansible.Just like learning a programming language, first write a Hello World sample program. We also write a ansible "Hello World":
Ansible 192.168.128.83-m Ping
This command means ping 192.168.128.83 through the admin hostThe "-M ping" in the command indicates that the pi
list of plug-ins have a filter_plugins, and then looked at the following instructions, it is him!Ansible supports the default built-in filter usage in JINJA2, which is part of the! Each of the specific features I do not say in detail, we will know the use of the test.
The code is as follows
Copy Code
ABS (number)Absoluteattr (obj, name)Property{{My_variable|default (' my_variabl
#ssh连接时默认使用的用户名
Ansible_ssh_pass
#ssh连接时的密码
Ansible_sudo_pass
#使用sudo连接用户时的密码
ansible_sudo_exec
#如果sudo命令不在默认路径, you need to specify the sudo command path ansible_ssh_private_key_file
#秘钥文件路径, key file This option is available if you do not want to use Ssh-agent management Ansible_shell_type
#目标系统的shell的类型, the default SH
ansible_connection
type of #SSH connection: local, SSH, Paramiko, default is Paramiko before Ansible 1.2, later smart selection, p
script is located scriptdir=`pwd'/jenkinsdeploy/mkdir-P $scriptdir # backup record backupfile= $scriptdir/backup.txt# Gets the record of the last backup Bakdir=`Tail-1$backupfile 'if["$bakdir"=""]; Then Echo "Unable to get backup directory. "ExitfiEcho "backup directory: $bakdir"Echo "Web directory: $opt _webdir"CD $bakdirCP-RF--parents./*$opt _webdir/echo "successfully rolled back. "Jenkins configuration: Add an optional parameterThis build is parameterized--Choice ParameterThe variable
First, host planning
Create 4 virtual machines as a demo ansible environment, install the operating system as CentOS 7.4. 1 of them as management host, the other 3 as the managed host. IP and host name are: IP host name note 192.168.128.10 Ansible-manager Management host 192.168.128.11 Ansible-demo1 managed host 1 192.168.128.12
Use of ansible
Introduction:
Ansible is designed for convenient and quick configuration management. With ansible, You can simplify and standardize complex configurations and make them easier to control. Ansible can achieve 100 and 1000 batch deployment.
Ansible features:
(1
In the operation of the tool, the choice of using the Ansible API to interact with the server, the purpose of using ansible is simple, and the client does not need to install the agent, server installation after the Ansbile, the new machine can be managed.In order to combine the asset management system (CMDB), the method of dynamically acquiring inventory is used, which eliminates the need to configure host
the shell, one without.Shell=true is not recommended in official documentation, as this can lead to shell injection security issues, but in some cases it is convenient to use shell modules, such as I want to delete some files in bulk,Ansible-i inventory all-m command-a "Rm-f/etc/yum.repos.d/centos. Repo "-u root-s-F 50-kkIf you execute the above command, you will not delete those files, why?Because your command line contains a wildcard character, the
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.