=tomcat-initscript.sh dest=/etc/init.d/tomcat mode=0755- name: Start Tomcat service: name=tomcat state=started enabled=yes- name: deploy iptables rules template: src=iptables-save dest=/etc/sysconfig/iptables notify: restart iptables- name: wait for tomcat to start wait_for: port={{http_port}}
Just follow the above arrangement. Some of the modules have not been introduced before, as a subject for your own research :).The playbook above is located in roles/tomcat/tasks/main. yml.Playbook atta
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 is an automated operations tools, based on the development of Python, the collection of many operations tools (puppet, Cfengine, Chef, func, fabric) The advantages of the implementation of batch system configuration, batch program deployment, batch Run command and other functions.Ansible is a module-based capability that does not have the ability to deploy in batches. The real batch
Ansible learning-ansible
Ansible technologies (Automated O M tools) are developed based on python.
Installation methods include yum, apt, pip, etc.
For example, pip: pip install ansible
The only requirement of ansible for the client is to have SSH and Python (if the python
management system of natural integration, simple that is effective, no more wonderful things. So, let's have a taste of ansible. Sam, Ansible's manual three words ansible ansible is a python package, is a complete unpack and play software, the client's only requirement is to have ssh with Python, and installed Python-simplejson package,
into the machine, with "ssh ‘-o StrictHostKeyChecking=no [emailprotected]‘",and check in:.ssh/authorized_keysto make sure we haven‘t added extra keys that you weren‘t expecting.??[[emailprotected] ~]# sshpass -p123456 ssh-copy-id -i /root/.ssh/id_dsa.pub "-o StrictHostKeyChecking=no [emailprotected]"Now try logging into the machine, with "ssh ‘-o StrictHostKeyChecking=no [emailprotected]‘",and check in:.ssh/authorized_keysto make sure we haven‘t added extra keys that you weren‘t expecting.??[[e
In the field of automation operations, in addition to Saltstack, there are ansible this batch installation Deployment tool, in writing the specific content first, first of all I used two tools after the sentiment.Saltstack is the C/s framework, in order to install software in the client, and start the service to manage, ansible is connected via SSH to the client,
If there is no written authorization, please do not reprint the fifth chapter of your own definition moduleExternal Inventoriesin The first chapter we saw how Ansible needs an inventory file, so that it knowswhere it hosts is a nd how to access them. Ansible also allows you to specify Ascript this allows you to fetch the inventory from another source. Externalinventory scripts can be written in any language
If 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 large number of templates, you may want to use roles. Roles inAnsible allow you to group files together in a defined format. They are essentiallyan extension to includes that handles a few things automatically, and this helps youorganize them insid
If 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 large number of templates, you may want to use roles. Roles inAnsible allow you to group files together in a defined format. They are essentiallyan extension to includes that handles a few things automatically, and this helps youorganize them inside
First, IntroductionAnsible, an open source platform for integrated IT system configuration management, application deployment, and execution-specific tasks, is a project owned by Ansibleworks Company, founded in 2012 by the authors of Cobbler and Func.Ansible is based on the Python language, and is built from two key modules of Paramiko and Pyyaml.Ansible Features:>> deployment is simple, just deploy the
Ansible is based on modularity, with specific modules to complete specific tasksBased on the Python language implementation, implemented by three key modules of Paramiko, Pyyaml and JINJA2Simple deployment, agentless (no client deployment, client management via SSH protocol)Based on master-slave modeSupports custom modules (other programming language-written modu
First, the basic introduction of Ansible:
What's the ansible type?Ansible is a very simple IT operations automation tool engine for configuration management, application deployment, internal service orchestration, and more, for hundreds of thousands of managed nodes, based on Python development. She does not need a
First, what kind of situation requires a lot of deployment
1, the installation of the operating system
Common is collber,red hat satelite (Redhat) system dedicated.
2, the operating system configuration
Common to have cfengine,puppet,chef,func. One of the most popular puppet
3, the deployment of batch programs
4, the volume command run View status information
Ii. introduction of
Ansible module-lineinfile example, ansible-lineinfileLineinfile module details
The lineinfile module is similar to the sed tool in linux, but the articles on the Internet generally only have simple instances, and there are no examples of complicated points.
The following is a common example of the lineinfile Module I have summarized based on my actual operations.
Directory
;#Ansible: TimeSync* * * * */5 */usr/sbin/ntpdate 172.16.0.1 >/dev/nullDelete Crontab[Email protected] ~]# ansible cce-m cron-a ' name= "TimeSync" state= "absent" '6. Use the Fetch module to pull the directory on the remote host to the local[Email protected] ~]# ansible cce-m fetch-a ' Src=/root/cce dest=/root/cce '7. Use the file module to manage files on the re
Do 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 itself. At the time of writing there are seven such variables, described in thefollowing sections.
External variables
You have seen in the previous template example that we have a variable named group_names, which is a magic variable provided by
Use Ansible to publish Tomcat service in CentOS 71. About ansible
Ansible is an Open Server Deployment Tool for Python.Using yum for configuration is very simple and easy to learn.2. Install
Http://docs.ansible.com/ansible/intro_installation.htmlRefer to the official website
Use redis to accelerate ansible and redis to accelerate ansibleUse redis to accelerate ansible
We know that every time we use ansible, we need to collect system information. This step takes a lot of time. We can use redis to save the GATHERING time.1. ansible. cfg
[Defaults] gathering = smartfact_caching = redisfact_
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.