官网
当前这个只能支持linux机器作为主机。
主页
安装
在centos中安装:
sudo yum install ansible -y
sudo pip install paramiko PyYAML Jinja2 httplib2 six
ubuntu安装:
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible -y
sudo pip install paramiko PyYAML Jinja2 httplib2 six
配置自己的hosts文件
$ echo "127.0.0.1" > ~/ansible_hosts
$ export ANSIBLE_HOSTS=~/ansible_hosts
[cq]
gs1 ansible_ssh_user=cq ansible_ssh_host=39.106.154.40
gs2 ansible_ssh_user=cq ansible_ssh_host=47.93.13.164
gs3 ansible_ssh_user=cq ansible_ssh_host=101.200.55.213
[local]
sss2 ansible_ssh_user=zqj ansible_ssh_host=192.168.22.223
sss3 ansible_ssh_user=zqj ansible_ssh_host=192.168.22.225
sss4 ansible_ssh_user=zqj ansible_ssh_host=192.168.22.224
拷贝文件
ansible-doc -s copy
ansible [dst_name] -m copy -a 'src=httpd.conf dest=/tmp/ owner=root group=root mode=644 backup=yes'
参考文档
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。