导航

ansible高级用法

Posted on 2015-12-19 17:53  ggzone  阅读(200)  评论(0编辑  收藏  举报

将多个符合正则的文件拷贝到目标机器

- name: Copy
copy: src={{ item }} dest=/root/.sshkeys mode=0600
owner=root group=root
with_fileglob:
- keys/*.pub

将多个文件合并

- name: Assemble keys into authorized_keys file
assemble: src=/root/.sshkeys dest=/root/.ssh/authorized_keys
mode=0600 owner=root group=root

register

把任务的输出定义为变量,然后用于其他任务

http://xdays.me/ansible状态管理.html