Amazon web services 收集EC2 windows计算机的事实-错误';外壳模块&x27;对象没有属性';回声&x27;
我正在尝试在Ansible上配置运行Windows的EC2计算机。我正在使用AWX来做这件事。连接到EC2机器后,我将其添加到主机列表中,然后尝试对其进行配置, 当试图从新的ec2系统收集信息时,我发现以下错误:Amazon web services 收集EC2 windows计算机的事实-错误';外壳模块&x27;对象没有属性';回声&x27;,amazon-web-services,ansible,ansible-awx,Amazon Web Services,Ansible,Ansible Awx,我正在尝试在Ansible上配置运行Windows的EC2计算机。我正在使用AWX来做这件事。连接到EC2机器后,我将其添加到主机列表中,然后尝试对其进行配置, 当试图从新的ec2系统收集信息时,我发现以下错误: Error 'ShellModule' object has no attribute 'ECHO' 当我将“收集事实”设置为false时,一切正常,但我需要收集事实,因此需要启用此选项 代码如下所示: - name: Connecting to existing EC2 insta
Error 'ShellModule' object has no attribute 'ECHO'
当我将“收集事实”设置为false时,一切正常,但我需要收集事实,因此需要启用此选项
代码如下所示:
- name: Connecting to existing EC2 instance to retrieve metadata information
ec2_instance_facts:
region: "{{ region }}"
filters:
tag:Name: "{{ hostname }}"
register: ec2
# Add machine to hosts in order to connect to it and apply changes
- name: add {{hostname}}.{{domain}} to setup_ec2 group
add_host:
name: "{{ hostname }}"
ansible_host: "{{ hostname }}"
ansible_password: "{{ service_pw }}"
ansible_user: "{{ service_user }}"
groups: setup_ec2
ansible_connection: winrm
ansible_winrm_transport: kerberos
ansible_winrm_server_cert_validation: ignore
ansible_ssh_port: 5986
- name: Change to read permissions for ansible pem file
file:
path: ./keys.pem
owner: root
group: root
mode: '0400'
- name: ADD HOST FOR ANSIBLE --> EDIT /etc/hosts on Docker
add_host:
hostname: ansible
groupname: ansible
ansible_ssh_host: "{{ ansible_ip }}"
ansible_user: ansible
ansible_private_key_file: ./keys.pem
# Adding ec2 instance to ansible AWX in order to connect to it
- hosts: ansible
gather_facts: true
tasks:
- set_fact:
ec2: "{{ hostvars['localhost']['ec2'] }}"
- set_fact:
hostname: "{{ hostvars['localhost']['hostname'] }}"
- name: copy /tmp/hosts to /etc/hosts
command: docker exec -u 0 awx_task bash -c "echo '{{ ec2.instances[0].private_ip_address }} {{ hostname }}{{ domain }}' >> /etc/hosts"
become: true
# Connecting to ec2 host and applying changes e.g. roles
- hosts: setup_ec2
gather_facts: true << here comes this error
-name:连接到现有EC2实例以检索元数据信息
ec2_实例_事实:
区域:“{{region}}”
过滤器:
标记:名称:“{{hostname}”
注册号码:ec2
#将计算机添加到主机,以便连接到它并应用更改
-名称:将{{hostname}.{{domain}}添加到setup_ec2组
添加\u主机:
名称:“{{hostname}}”
ansible_主机:“{{hostname}}”
ansible_密码:{{service_pw}}”
ansible_用户:“{{service_user}}”
组:设置\u ec2
ansible_连接:winrm
ansible_winrm_传输:kerberos
ansible\u winrm\u服务器\u证书\u验证:忽略
ansible_ssh_端口:5986
-名称:更改为ansible pem文件的读取权限
文件:
路径:./keys.pem
所有者:root
组:根
模式:“0400”
-名称:在Docker上为ANSIBLE-->编辑/etc/hosts添加主机
添加\u主机:
主机名:ansible
组名:ansible
ansible_ssh_主机:“{{ansible_ip}”
ansible_用户:ansible
ansible_私有密钥文件:./keys.pem
#将ec2实例添加到ansible AWX以连接到它
-主持人:ansible
收集事实:真实
任务:
-设定事实:
ec2:“{{hostvars['localhost']['ec2']}”
-设定事实:
主机名:“{{hostvars['localhost']['hostname']}”
-名称:将/tmp/hosts复制到/etc/hosts
命令:docker exec-u 0 awx_task bash-c“echo'{{ec2.instances[0].private_ip_address}{{hostname}}{{domain}}'>/etc/hosts”
变成:真的
#连接到ec2主机并应用更改,例如角色
-主机:安装程序\u ec2
收集事实:第一个结果是在我的搜索引擎上是真的。在docker中使用kerberos对Windows进行身份验证,或者在linux中使用kerberos,或者无论您在那里做了什么,都会遇到trickyHi@mdaniel,是的,这就是问题所在,但是,最后我必须关闭AWX仪表板中的权限升级,以便此功能正常工作。。。我不知道最终导致此erorr的特权升级模式的影响,但您是对的,错误与链接中描述的问题有关