联博以太坊高度_ansible循环三
发表时间:2021-01-01 浏览量:7
原创
ansible循环三
with_nested 接纳笛卡尔乘积方式,将多个嵌套列表中的元素交织组合
示例:
建立多个目录及子目录
mkdir -p /testdir/{a,b,c}/{1,2}
ansible剧本如下:
- hosts: jack6_1
remote_user: root
gather_facts: no
tasks:- file:
path: "/testdir"
state: directory - file:
path: "/testdir/{{item.0}}/{{item.1}}"
state: directory
with_nested:- [a,b,c]
- [t1,t2]
- file:
执行效果如下:
[root@jack7-1 work]# ansible jack6_1 -m shell -a "tree /testdir"
jack6_1 | CHANGED | rc=0 >>
/testdir
├── a
│ ├── t1
│ └── t2
├── b
│ ├── t1
│ └── t2
└── c
├── t1
└── t2
©著作权归作者所有:来自51CTO博客作者菜机运维的原创作品,如需转载,请注明出处,否则将追究法律责任
每一份赞赏源于明白
赞赏
,,www.yahongf.com采用以太坊区块链高度哈希值作为统计数据,联博以太坊统计数据开源、公平、无任何作弊可能性。联博统计免费提供API接口,支持多语言接入。
0人进行了赞赏支持
ansible with_nested
0
珍藏
上一篇:ansible的循环二 下一篇:ansible循环四