Skip to content

feixiao/learning-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

learning-ansible

入门实例

连接受控机器

  • 创建hello/hosts文件,添加如下内容

    tpd ansible_ssh_host=172.28.104.225 ansible_ssh_port=22 ansible_ssh_user=frank ansible_ssh_pass=1
  • 执行如下命令

     ansible tpd -i hosts   -m ping

    返回结果

    tpd | FAILED! => {
        "failed": true,
        "msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"
    }
    
  • 安装sshpass

    sudo apt-get install  sshpass 
  • 执行如下命令

    ansible tpd -i hosts   -m ping
    
    # 返回结果
    tpd | SUCCESS => {
        "changed": false,
        "failed": false,
        "ping": "pong"
    }
    

执行Playbooks

使用ansible安装nginx

资料索引

About

learning-ansible

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published