我从我的打包器脚本中调用这个剧本。
hosts: all
become: true
gather_facts: true
tasks:
- name: Install Sophos
include_role:
name: install_sophos因为我使用的是Ansible Remote Provisioner for Packer,所以我知道我没有在正在构建的远程EC2实例上设置{{role_path和{{ansible_env.HOME}}。我不知道如何最好地传递这些信息,或者控件主机是否应该拥有这些信息。下面是我的角色下的task/main.yml代码片段。
- name: Copy sophos script to server
copy:
src: "{{ role_path }}/files/SophosInstall.sh"
dest: "{{ ansible_env.HOME }}/SophosInstall.sh"
mode: 0775
register: si发布于 2020-12-09 07:59:15
我不得不添加vars部分
hosts: all
become: true
remote_user: ubuntu
gather_facts: true
tasks:
- name: Install Sophos
include_role:
name: install_sophos
vars:
role:
template: true 我必须更新用户,因为我是从我的主目录运行的,而这个主目录在remote_user: ubuntu行的EC2实例上并不存在
https://stackoverflow.com/questions/65201566
复制相似问题