首页 > 其他 > 详细

ansible剧本playbook

时间:2020-09-04 09:53:12      阅读:50      评论:0      收藏:0      [点我收藏+]
格式 .yml | .yaml

--- ======>剧本开头

- hosts: jack7 ======>指定主机或主机组

remote_user: root ====>客户端执行用户

tasks: =========>任务标记

- name: FIRST PLAYBOOK ===>PLAY名称

fetch: =======>调用的模块

src: /tmp/test =======>模块的参数及值

dest: /root/ =======>其他参数及值

注意yaml的语法缩进,必须对齐,并且“:”后面有空格

如下两种写法也是可以的

[root@jack7-1 ansible]# cat test4.yml test5.yml


  • hosts: PD
    remote_user: root
    tasks:
    • name: touch wang.txt
      file: path=/root/wang.txt state=touch mode=0777 owner=jack group=root

  • hosts: PD
    remote_user: root
    tasks:
    • name: absent file
      file: path=/root/wang.txt
      state=absent

ansible剧本playbook

原文:https://blog.51cto.com/13434656/2527951

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