Fabric Automation Installation Mysql-server

Source: Internet
Author: User

1. Create File auto_install_mysql.py

Vim auto_install_mysql.py

-------------------------------------------->

1#!/usr/bin/env python2 3  fromFabric.colors Import *4  fromFABRIC.API Import *5Env.user='Root'6Env.roledefs = {7     'DBServer': ['172.16.1.207']//Here you can add more than one host8 }9Env.password = {Ten     '[email protected]':'Redhat' One } A  -@roles ('DBServer') - def dbtask (): thePrint yellow ("Install mysql-server ...") -With settings (warn_only=True): -Run"apt-get Install mysql-server-y") -Run"Service MySQL Restart") +  - def deploy (): +Execute (dbtask)//Here you can add multiple tasks

2. Execution of documents

Fab-f auto_install_mysql.py Deploy

The results of the implementation are as follows:

To enter the password interface, enter the password, then press the TAB key to jump to OK, and then press the SPACEBAR to set

Fabric Automation Installation Mysql-server

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.