殇帝刘玢你 发表于 2018-1-2 14:06:32

ansible基本使用教程

# echo "test " >> /root/install.log# ansible testservers -m copy -a 'src=/root/install.log dest=/tmp/install.log owner=testuser group=testgroup backup=yes'
  192.168.100.132 | success >> {
  "backup_file": "/tmp/install.log.2016-02-25@16:01:26~",
  "changed": true,
  "checksum": "b5da7af32ad02eb98f77395b28f281a965b4c1f5",
  "dest": "/tmp/install.log",
  "gid": 1100,
  "group": "testgroup",
  "md5sum": "d39956add30a18019cb5ad2381a0cd43",
  "mode": "0644",
  "owner": "testuser",
  "size": 9464,
  "src": "/root/.ansible/tmp/ansible-tmp-1456387285.87-128685659798967/source",
  "state": "file",
  "uid": 1000
  }
  192.168.100.131 | success >> {
  "backup_file": "/tmp/install.log.2016-02-25@16:01:26~",
  "changed": true,
  "checksum": "b5da7af32ad02eb98f77395b28f281a965b4c1f5",
  "dest": "/tmp/install.log",
  "gid": 1100,
  "group": "testgroup",
  "md5sum": "d39956add30a18019cb5ad2381a0cd43",
  "mode": "0644",
  "owner": "testuser",
  "size": 9464,
  "src": "/root/.ansible/tmp/ansible-tmp-1456387285.86-134452201968647/source",
  "state": "file",
  "uid": 1000
  }
# ansible testservers -m raw -a 'ls -lrth /tmp/install*'
  192.168.100.131 | success | rc=0 >>
  -rw-r--r-- 1 root root 9.3K 2 25 16:00 /tmp/install.log.2016-02-25@16:01:26~
  -rw-r--r-- 1 testuser testgroup 9.3K 2 25 16:01 /tmp/install.log
  192.168.100.132 | success | rc=0 >>
  -rw-r--r-- 1 root root 9.3K 2 25 16:00 /tmp/install.log.2016-02-25@16:01:26~
  -rw-r--r-- 1 testuser testgroup 9.3K 2 25 16:01 /tmp/install.log
页: [1]
查看完整版本: ansible基本使用教程