即使在Ansible中使用“成为:是”之后,也会出现sudo错误

时间:2017-01-28 18:45:42

标签: ansible

我在become: yes文件中使用了.yml条件。然而,我收到以下错误:

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE"}

这是我的Ansible剧本供参考:

- hosts: localhost
  connection: local
  remote_user: test
  become: yes
  gather_facts: no
  vars_files: 
  - files/awscreds.yml
  - files/info.yml
  tasks:
    - name: Basic provisioning of EC2 instances
      ec2:
        aws_access_key: "{{ aws_id }}"
        aws_secret_key: "{{ aws_key }}"
        region: "{{ aws_region }}"
        image: "{{ standard_ami }}"
        instance_type: "{{ free_instance }}"
        key_name: "{{ ssh_keyname }}"
        count: 1
        state: present
        group_id: "{{ secgroup_id }}"
        wait: no
        instance_tags:
          Name: Dawny33_template
      register: e2info
    - name: Print the results
      debug: var=ec2info

我在哪里出错?

1 个答案:

答案 0 :(得分:2)

  1. 您不需要sudo来运行ec2模块。
  2. 错误 sudo:需要密码表示您没有设置无密码的sudo。