Ansible缺少sudo密码

时间:2019-12-22 12:39:57

标签: ansible

我在执行此剧本时遇到问题。在运行时,它会向我抛出缺少sudo密码的错误。 请指导我如何解决

[cloud_user@control ansible]$ cat nfs.yml
- hosts: nfs
  become: yes
  vars:
    share_path: /mnt/nfsroot
  tasks:
    - name: install nfs
      yum:
        name: nfs-utils
        state: latest
    - name: start and enable nfs-server
      service:
        name: nfs-server
        state: started
        enabled: yes
    - name: configure exports
      template:
        src: /home/ansible/exports.j2
        dest: /etc/exports
      notify: update nfs
  handlers:
    - name: update nfs exports
      command: exportfs -a
      listen: update nfs
[cloud_user@control ansible]$ ansible-playbook nfs.yml --check

PLAY [nfs] **********************************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************
fatal: [nfs]: FAILED! => {"msg": "Missing sudo password"}

PLAY RECAP **********************************************************************************************************************************************
nfs                        : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

0 个答案:

没有答案