zoukankan      html  css  js  c++  java
  • Ansible学习 安装

      对于运维人员来说,自动化工具是日常工作中比不可少的。Ansible是一个很好的自动化工具。

      Ansible默认使用SSH协议管理机器,在管理主机上安装Ansible,管理主机和被管理主机只要安装了python,即可使用

    1、安装,管理主机环境如下

    操作系统:

    [root@client01 ansible]# cat /etc/redhat-release
    CentOS Linux release 7.3.1611 (Core)

    python版本:

    [root@client01 ansible]# python -V
    Python 2.7.5

    查看yum是否配置完成

    [root@client01 ansible]# yum repolist
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    * base: mirrors.aliyun.com
    * extras: mirrors.zju.edu.cn
    * updates: mirrors.aliyun.com
    repo id                                                              repo name                                            status
    !base/7/x86_64                                                       CentOS-7 - Base                                      9,591
    !extras/7/x86_64                                                     CentOS-7 - Extras                                    327
    !updates/7/x86_64                                                    CentOS-7 - Updates                                   1,573
    repolist: 11,491   

    2、安装ansible

    yum install ansible

    安装完查看ansible版本

    [root@client01 ansible]# ansible --version
    ansible 2.4.1.0
    config file = /etc/ansible/ansible.cfg
    configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python2.7/site-packages/ansible
    executable location = /usr/bin/ansible
    python version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

    3、初次尝试

    [root@client01 ansible]# ansible all -i 192.168.144.130, -m ping -k
    SSH password:
    192.168.144.130 | SUCCESS => {
    "changed": false,
    "failed": false,
    "ping": "pong"
    }

    -i 选项后可以接主机,也可以接inventory文件(hosts文件),-m选择执行模块,-k输入被管理主机密码

    如果在被管理主机上配置了管理主机的公钥,则不需要再通过-k输入密码,提高自动化执行效率

    [root@client01 ansible]# ansible all -i 192.168.144.130, -m ping
    192.168.144.130 | SUCCESS => {
    "changed": false,
    "failed": false,
    "ping": "pong"
    }

  • 相关阅读:
    DVWA-14.1 JavaScript(JS攻击)-Low
    DVWA-13.4 CSP Bypass(绕过浏览器的安全策略)-Impossible
    DVWA-13.3 CSP Bypass(绕过浏览器的安全策略)-High?
    DVWA-13.2 CSP Bypass(绕过浏览器的安全策略)-Medium
    DVWA-13.1 CSP Bypass(绕过浏览器的安全策略)-Low
    DVWA-12.4 XSS (Stored)(存储型跨站脚本)-Impossible
    DVWA-12.3 XSS (Stored)(存储型跨站脚本)-High
    DVWA-12.2 XSS (Stored)(存储型跨站脚本)-Medium
    《C#高级编程》读书笔记(七):集合
    《C#高级编程》读书笔记(六):字符串和正则表达式
  • 原文地址:https://www.cnblogs.com/pigwan7/p/8178400.html
Copyright © 2011-2022 走看看