2017-01-28 35 views
0

我在我的.yml文件中使用了become: yes條件。然而,我發現了以下錯誤:即使在Ansible中使用「變爲:是」後sudo錯誤

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 

哪兒我去錯在這裏?

回答

2
  1. 您不需要sudo來運行ec2模塊。
  2. 錯誤sudo:需要密碼表明您沒有設置無密碼sudo。
+0

謝謝!刪除線工作:) – Dawny33