首页 > 其他 > 详细

ansible基本操作指南

时间:2019-08-07 01:28:08      阅读:115      评论:0      收藏:0      [点我收藏+]

1、服务端安装server

yum install ansible -y
yum install tree

 2、修改/etc/ansible/hosts

[tomcat]
192.168.1.8 ansible_user=root ansible_ssh_pass="123456"

 3、修改/etc/ansible/ansible.cfg

host_key_checking = False

 4、创建push.ssh.yaml

# Using alternate directory locations:
  - hosts: tomcat
    user: root
    tasks:
     - name: ssh-copy
       authorized_key: user=root key="{{ lookup(‘file‘, ‘/root/.ssh/id_rsa.pub‘) }}"
       tags:
         - sshkey

 5、执行

ansible-playbook push.ssh.ymal

 6、基本操作

批量执行shell
ansible all -m shell -a "echo 345678|passwd --stdin"
批量copy
ansible all -m copy -a "src=/etc/ansible/soft/111.tar.gz dest=/root/"

 

ansible基本操作指南

原文:https://www.cnblogs.com/allen-GC/p/11312642.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!