小编jug*_*gal的帖子

使用ansible创建多个目录

我想创建具有2个子目录(/ home/test1/bin和/ home/test2/conf)的多个目录(test1,test2),类似于test2.我的剧本看起来像这样:

--
- hosts: localhost
  tasks:
    - name: Create directory
      file: path=/home/{{item}}/bin  state=directory
      file: path=/home/{{item}}/conf state=directory
      with_items:
          - test1
          - test2
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/root/ansible/lib/ansible/executor/process/worker.py", line 122, in run
    executor_result = TaskExecutor(host, task, job_vars, new_play_context, self._new_stdin, self._loader, shared_loader_obj).run()
  File "/root/ansible/lib/ansible/executor/task_executor.py", line 89, in run
    items = self._get_loop_items()
  File "/root/ansible/lib/ansible/executor/task_executor.py", line 179, in _get_loop_items
    items = self._shared_loader_obj.lookup_loader.get(self._task.loop, loader=self._loader, templar=templar).run(terms=loop_terms, variables=vars_copy)
  File "/root/ansible/lib/ansible/plugins/lookup/items.py", line 26, in …
Run Code Online (Sandbox Code Playgroud)

ansible ansible-playbook

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

使用ansible在Windows中运行批处理文件

我想使用我的控制节点(CentOS)运行远程Windows节点上的run.bat文件.可能吗?如果没有,有没有其他选择吗?

windows batch-file ansible

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

标签 统计

ansible ×2

ansible-playbook ×1

batch-file ×1

windows ×1