首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ansible -带有项的模板不起作用

Ansible -带有项的模板不起作用
EN

Server Fault用户
提问于 2020-11-20 09:19:54
回答 1查看 613关注 0票数 0

我在ansible剧本中运行这个命令,从ansible角色的目录“模板”复制文件,然后得到错误.

代码语言:javascript
复制
- name:  "Copy templates"
templates: src={{item.src}} dest={{item.dest}}
with_items:
    - { src: 'tpl1', dest: '/etc/tpl1' }
    - { src: 'tpl2', dest: '/etc/tpl2' }
    - { src: 'tpl3', dest: '/etc/tpl3' }

错误输出:

代码语言:javascript
复制
ERROR! couldn't resolve module/action 'templates'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/home/myuser/Desktop/mydir/roles/rolename/tasks/main.yml': line 73, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name:  "Copy templates"
^ here

你能帮帮我吗?

EN

回答 1

Server Fault用户

发布于 2020-11-20 09:22:56

该模块名为template,而不是templates

代码语言:javascript
复制
- name: "Copy templates"
  template:
    src="{{item.src}}"
    dest="{{item.dest}}"
票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1043306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档