小编Mus*_*med的帖子

如何使用 Ansible 将远程文件复制到本地计算机上?

我在我的剧本中使用命令模块,它目前看起来像这样。

- hosts: all

  tasks:   
   - name: Update tar file
     command: sudo scp -r username@hostname:/path/from/destination /path/to/destination
Run Code Online (Sandbox Code Playgroud)

出于可读性的目的,我省略了在此任务之前发生的任务,但是当我运行此 playbook 时,它会在此任务处停止。它根本不会前进。我确定这是因为 sudo,所以它可能需要密码。但是,我不确定如何解决这个问题。

ansible

3
推荐指数
1
解决办法
1万
查看次数

如何格式化和遍历包含数组的数组,并且每个数组包含一个数组?

我正在尝试在包含在数组中的数组中创建多维。

tests=("'0' '1 2'" "'4' '5 6'")
Run Code Online (Sandbox Code Playgroud)

在测试中的每个数组中,我想要子数组。使用第一个数组“'0''1,2'”,创建另一个 for 循环以遍历子数组的内容。

bash shell

1
推荐指数
1
解决办法
5138
查看次数

标签 统计

ansible ×1

bash ×1

shell ×1