At the end of the year although there are a variety of alarms, but still need to do a full network patrol, here to disk utilization rate as an example. Because the current platform is using the commercial version of the BMC, the Automation tool in the implementation of the distribution are very not, but do not do well in the return of the value--of course, and it is the commercialization of tools, a lot of things do not open source, with the shell of the concept of grammar to write NSH when the
Development CMDB, in addition to record the server's account password, but also need to record the server hardware and software information, if the use of manual records, if the server is large, the workload is relatively large, so I need to be able to automatically obtain this information method, I used the ansible to get, Ansible with the Setup module, you can get this information to the server, and then
Background information:There are a lot of facts in ansible, but not enough in many cases.For example, Ansible has no ansible_private_ipv4_address such a facts, which is used to save a private network IP address.And we just need such a facts, because we have a lot of server's default network card is not eth0, some bond0,eth1,em0,em1, and the public network IP address and private network IP address also does
/ aei83eoiitnzkzhwbumcgfiwjqxo6mqso03v6cbwbbrbhcimspdi+lpiomjk5p6 mfptrvi6rd7g0inpjuh4wzyunz3ezpv1zicohpkqsf4rtwlegpv8m/ u6rq==[emailprotected][[emailprotected]~]#mkdir/root/.ssh[[email protected]~]#chmod600/root/.ssh[[emailNbsp;protected]~]#vim/root/.ssh/authorized_keys three. Verify that there is no success [[emailprotected]~]#sshweb9.gz.comthe authenticityofhost ' web9.gz.com (172.7.15.106) ' can ' tbeestablished. rsakeyfingerprintis67:31:c8:49:f6:17:59:88:e3:4a:61:a8:2b:44:20:55.areyou
Ansible @ an efficient configuration management tool-Ansible configure management-translation (10), ansible-ansibleNo written permission. Do not reprint it
Custom ModulesUntil now we have been working solely with the tools provided to us by Ansible.This does afford us a lot of power, and make many things possible. However, if youhave something particularly compl
Ansible @ an efficient configuration management tool-Ansible configure management-translation (4), ansible-ansibleDo not reprint without written permission
Due to the long content in Chapter 3, I will divide it into several parts for translation.
Advanced PlaybooksSo far the playbooks that we have looked at are simple and just run a number ofmodules in order.
Ansible @ an efficient configuration management tool-Ansible configure management-translation (8), ansible-ansibleIf you do not have written authorization, do not repeat Chapter 4. Use of Ansible in large projects
RolesIf your playbooks start expanding beyond what includes can help you solve, or youstart gathering a l
Ansible @ an efficient configuration management tool-Ansible configure management-translation (5), ansible-ansibleDo not reprint advanced Playbook without written permission
Extra variablesYou may have seen in our template example in the previous chapter that we used avariable called group_names . This is one of the magic variables that are provided byAnsible it
from a place not included in the system library search path? Using an LD_PRELOAD hack while running a module
Environment variables
Some UNIX commands are often run with environment variables. Typical examples include C makefiles, installers, and AWS command line tools. Fortunately, it is very simple to do this with ansible. For example, when we want to upload a file to the S3 server, we need to mention a
, and, as with the command module, it supports the creates property. However, the Shell module does not support the removes property. Examples are as follows:$ ansible MachineName -m shell -a ‘/opt/kingsoft/bin/monitor.sh > /data/log/ops/ksm.log creates=/data/log/ops/ksm.log’Get the module to help ansible a lot of modules, we need to go to the official website on
this particular line if set to NO/FA Lse.6. Verify by password, add-k parameter#提供了三种方式: A password is added to the Hosts file, one is a key-free method, one is to use the-K method to manually enter the password, often used for temporary testing.[Email protected] ansible]# ansible all-m ping-kSSH Password:192.168.10.192 | Success >> {"Changed": false,"Ping": "Pong"}192.168.10.191 | Success >> {"Changed": f
you can start after installationDownload ansible:
Https://pypi.python.org/pypi/ansibleHttp://pkgs.org/download/ansibleHttps://pypi.python.org/packages/source/a/ansible/ansible-2.0.1.0.tar.gzFirst, compile and install Ansible1, install the dependency pack:
Yum install python-jinja2 pyyaml python-paramiko python-babel python-crypto pip* gcc python-develWget-p/us
group and belongs to the HTTP2 group but does not belong to the HTTP1 group Delete/tmp/test.txt file contentsansible ‘web_server:!http1:http2‘ -a "rm -f /tmp/test.txt"(10) wildcard use to view the character encoding of the host for all groups beginning with HTTPansible http* -a "cat /etc/locale.conf"(11) View disk usage for all hosts with all groups and web_server groups that begin with HTTPansible http*:web_server -a "df -h"(12) View the hostname of the first host of the Web_server groupansibl
This book is created by senior Wiecheng division, through a number of examples, detailed explanation of ansible this automated Maintenance tool basic principles and use of skills; from the basic architecture analysis, installation configuration, to the typical application case analysis, the author shared his work in the actual combat experience, for all types of operations, DevOps developers provide a detai
@localhost ~]# vim/etc/ansible/hosts directly defined after the host
[web]
192.168.0.101 Host=mail
192.168.0.102
192.168.0.103
4 Group variable: A variable defined on a group in inventory (for example, edit on the default file/etc/ansible/hosts)
Copy Code code as follows:
[Group_name:vars]
Var1=value
Var2=value
Note: The group name must exist beforehand, and
this tutorial may require sudo permissions. The file path, user name, and target server depend on your environment.Create an Ansible Playbook to install NGINX (CentOS)
First, create a working directory for NGINX deployment, including subdirectories and deployment configuration files. I usually recommend that you create this directory in your main directory, which is described in all examples in the article
key values in the map are separated by ":". Yaml file extension is typically. Yaml, such as Example.yaml2. Playbook can be used to manage complex tasksFor more complex tasks that need to be performed repeatedly, we can define Playbook. Playbook is a truly powerful place for Ansible, which allows for the use of variables, conditions, loops, and templates, as well as the ability to reuse existing content through roles and include directives. Let's take
displayed in brief formCommon modules: command, user, copy, cron, file, filesystem, group, hostname, Ping, yumService, Shell, scriptCommand module does not support shell variables and pipelines, etc., if you want to use the shell to execute, you should call the shell module⑵ansible: Performing TasksAnsible -M Module_name: Specifies the called module-A args: Specifies the parameters passed to the module-F #: Specifies the number of concurrent-K: Defau
Ansible automated O M tool and ansible automated
1 Ansible
1> introduction to ansible
Ansible is a new automatic O M tool developed based on Python. It integrates the advantages of many O M tools (puppet, cfengine, chef, func, fabric, implements batch system configuration
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.