摘要: 1. 变量来源 inventoryfile中定义 playbook中定义 include文件和角色中定义变量 系统facts ansible hostname -m setup local facts 2. 变量的使用 {{ ansible_eth0["ipv4"]["address"] }} 或者 阅读全文
posted @ 2016-06-17 17:03 mxking 阅读(14538) 评论(1) 推荐(0)
摘要: 标准循环 嵌套循环 字典循环(with_dict) 文件循环(with_file, with_fileglob) with_file 是将每个文件的文件内容作为item的值 with_fileglob 是将每个文件的全路径作为item的值, 在文件目录下是非递归的, 如果是在role里面应用改循环, 阅读全文
posted @ 2016-06-17 10:45 mxking 阅读(28140) 评论(0) 推荐(2)
摘要: Strategies 控制task的执行方式, 在2.0中增加了"free" Strategies, 可以允许每个host尽快的执行完一个play. 默认是Strategies是linear, 表示任何host必须等待所有的host完成一个task后才能开始执行下一个task Strategies 阅读全文
posted @ 2016-06-17 08:48 mxking 阅读(787) 评论(0) 推荐(0)