fal*_*sch 28 ansible ansible-playbook ansible-inventory
对于备份,我需要遍历清单文件中的所有主机,以确保备份目标存在.我的结构看起来像
/var/backups/
example.com/
sub.example.com/
Run Code Online (Sandbox Code Playgroud)
所以我需要一个(内置)变量/方法来列出库存文件中的所有主机,而不仅仅是一个组.
对于团体,它看起来像这样
- name: ensure backup directories are present
action: file path=/var/backups/{{ item }} state=directory
owner=backup group=backup mode=0700
with_items: groups['group_name']
tags:
- backup
Run Code Online (Sandbox Code Playgroud)
fal*_*sch 43
这个解决方案:
with_items: groups['all']
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20606 次 |
| 最近记录: |