zoukankan      html  css  js  c++  java
  • Ansible 实战之部署Web架构

    WEB架构(ubuntu 16.04): 

    Proxy -- WebServer(Nginx+PHP+Django) -- Nosql -- MariaDB

    一、 定义Inventory

    [proxy]
    192.168.20.180
    
    [app]
    192.168.20.181
    192.168.20.182 [nosql] 192.168.20.183 [db] 192.168.20.184

    二、Proxy安装Nginx

    ansible proxy -m apt -a "name=nginx state=present"
    
    ansible proxy -m command -a "/etc/init.d/nginx status"
    

    三、APP安装php

    ansible app -m apt -a "name=php state=present"
    
    ansible app -m command -a "/etc/init.d/php7.0-fpm status"
    

    四、APP安装Django

    ansible app -m apt -a "name=django state=present"
    
    ansible app -m command -a "python -c 'import django; print django.get_version()' "
    

    五、NoSQL安装redis

    ansible nosql -m apt -a "name=redis-server state=present"
    
    ansible nosql -m command -a "redis-cli --version"
    

    六、DB安装mariadb

    ansible db -m apt -a "name=mariadb-server state=present"
    
    ansible db -m command -a "/etc/init.d/mysql status"
    

    七、启动服务

    root@ubuntu:~# ansible webserver -m service -a "name=rabbitmq-server state=started enabled=yes"
    192.168.20.180 | SUCCESS => {
        "changed": false, 
        "enabled": true, 
        "name": "rabbitmq-server", 
        "state": "started"
    }
    192.168.20.182 | SUCCESS => {
        "changed": false, 
        "enabled": true, 
        "name": "rabbitmq-server", 
        "state": "started"
    }
    root@ubuntu:~# 
    

      

  • 相关阅读:
    北科的秋天
    最大子段和问题(dp)
    cmd应用
    问题 H: 抽奖活动(大数)
    大数算法
    模板整理(三)
    在CMD中建立一个不能删除的文件
    波利亚(Polya)罐子模型
    51nod-迷宫问题(Dijkstra算法)
    优先队列
  • 原文地址:https://www.cnblogs.com/vincenshen/p/6657877.html
Copyright © 2011-2022 走看看