zoukankan      html  css  js  c++  java
  • Ansible(一) 配置安装

    puppet    ruby开发
    salt         python开发,有客户端,使用Rabbitmq消息队列,支持并发,在机器数量很多时效果比ansible好。
    ansible   python开发, 没有客户端,基于ssh,同时只能建立一个隧道,不支持并发,适于维护数量不是很多的机器。
    
    
    -m 指定模块
    command  只支持单条命令
    shell   支持管道符等
    
    1.安装
    pip install ansible
    ansible --version
    
    2.创建配置文件
    mkdir /etc/ansible
    vim /etc/ansible/hosts
    172.16.100.100
    
    3.拷贝公钥
    ssh-keygen -t rsa
    ssh-copy-id -i id_rsa.pub -p 22 root@172.16.100.100
    
    4.测试执行
    [09:51:40] [root@ansible-server ~]# ansible all -m ping
    172.16.100.100 | SUCCESS => {
        "changed": false, 
        "failed": false, 
        "ping": "pong"
    }
    
    默认使用command模块,只能运行一条命令。
    -m 使用shell模块,-a指定模块参数,支持多条命令。
    [09:57:13] [root@ansible-server ~]# ansible all -m shell -a "ls -l && ls -l /"
    172.16.100.100 | SUCCESS | rc=0 >>
    总用量 150056
    5.分组 inventory
    [10:02:26] [root@ansible-server ~]# vim /etc/ansible/hosts
    [vpsgroup]
    172.16.100.100
    
    [10:03:28] [root@ansible-server ~]# ansible vpsgroup -m shell -a "ls"
    
    [10:07:47] [root@ansible-server ~]# ansible 172.16.100.100 -m shell -a "ls"
    
    
    
    requests库
    1.安装
    pip install requests
    yum install python-devel
    pip install gunicorn httpbin
    gunicorn httpbin:app -b 172.17.52.88:8000
    

      

  • 相关阅读:
    【NOIP模拟】寻找
    【NOIP模拟】行走
    【UVA11795】 Mega Man's Mission
    【UVA11825】Hackers' Crackdown
    【UVA1252】Twenty Questions
    BZOJ1718: [Usaco2006 Jan] Redundant Paths 分离的路径
    BZOJ1151: [CTSC2007]动物园zoo
    BZOJ1123: [POI2008]BLO
    BZOJ1040: [ZJOI2008]骑士
    POJ3417:Network
  • 原文地址:https://www.cnblogs.com/i-honey/p/7844633.html
Copyright © 2011-2022 走看看