2017-04-11 59 views
0

我有一個包含掛載任務的劇本,當我嘗試使用credentials選項時似乎失敗。Ansible使用憑證文件

下面的任務成功

- name: "mount share" 
    mount: 
    state: "mounted" 
    fstype: "cifs" 
    name: "/opt/shared" 
    src: "//192.168.2.5/my_shared_drive" 
    opts: "username=john,password=secretpass,file_mode=0644,dir_mode=0755,gid=root,uid=root" 

儘管下一個失敗,一個憑據丟失相關的錯誤信息。

- name: "mount share" 
    mount: 
    state: "mounted" 
    fstype: "cifs" 
    name: "/opt/shared" 
    src: "//192.168.2.5/my_shared_drive" 
    opts: "credentials=/root/secretcreds,file_mode=0644,dir_mode=0755,gid=root,uid=root" 

下面是證書的內容文件

[[email protected]]# cat /root/secretcreds 
         username=john 
         password=secretpass 

回答