Ansible 同一任务中有多个with_项

Ansible 同一任务中有多个with_项,ansible,Ansible,我们可以在同一任务中使用多个with_项吗?该项如何知道选择哪一项? 例如: command: cat /{{item}}/{{item}} with_items: - etc - var - game - logs 第一项是etc和var,第二项是游戏和日志。我怎样才能准确地选择 更新: 事实上,我想要cat/etc/game和cat/etc/logs cat/var/game cat/var/logs和_items在一个项目列表上迭代,所以很自然,这

我们可以在同一任务中使用多个with_项吗?该项如何知道选择哪一项? 例如:

command: cat /{{item}}/{{item}}
with_items:
     - etc
     - var
     - game
     - logs
第一项是etc和var,第二项是游戏和日志。我怎样才能准确地选择

更新:
事实上,我想要cat/etc/game和cat/etc/logs cat/var/game cat/var/logs

和_items在一个项目列表上迭代,所以很自然,这个列表包含多个项目

您的示例将运行以下命令:

cat /etc/etc
cat /var/var
cat /game/game
cat /logs/logs
您似乎想要的是:


实际上我想要cat/etc/game和cat/etc/logs cat/var/game cat/var/logs
- command: cat /{{item.0}}/{{item.1}}
  with_nested:
    - ['etc', 'var']
    - ['game', 'logs']