首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >可能的win_credentials失败(请求成为,尽管它是给定的)

可能的win_credentials失败(请求成为,尽管它是给定的)
EN

Stack Overflow用户
提问于 2020-09-17 23:19:46
回答 1查看 175关注 0票数 0

在centos 7上运行ansible 2.9,在windows_7目标上创建凭据

代码语言:javascript
复制
- name: "Save nw credentials for mapped drive {{ item.value.letter }}"
  win_credential:
    name: "{{ item.value.path }}"
    type: domain_password
    username: "DOMAIN\\{{ item.value.user }}"
    secret:  "{{ item.value.pass}}"
    state: present

  become: true
  become_method: runas
  become_flags: logon_type=new_credentials logon_flags=net_credentials_only
  vars:
    ansible_become_user: "{{ become_user  }}"
    ansible_become_password: "{{ become_passwd  }}"

我仍然得到了错误,要求运行模块与成为...

代码语言:javascript
复制
The full traceback is:
Exception calling "GetCredential" with "2" argument(s): "Failed to access the user's credential store, run the module with become"
At line:576 char:1
+ $existing_credential = [Ansible.CredentialManager.Credential]::GetCre ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidOperationException

ScriptStackTrace:
at <ScriptBlock>, <No file>: line 576
fatal: [FF-10]: FAILED! => {
    "changed": false, 
    "msg": "Unhandled exception while executing module: Exception calling \"GetCredential\" with \"2\" argument(s): \"Failed to access the user's credential store, run the module with become\""
}

如能提供任何帮助或建议,我们将不胜感激。

提前致以亲切的问候

EN

回答 1

Stack Overflow用户

发布于 2021-03-12 18:24:03

根据模块中的测试任务,您应该能够使用:

代码语言:javascript
复制
   12 - name: create domain user credential (check mode)
   13   win_credential:
   14     name: '{{ test_hostname }}'
   15     type: domain_password
   16     username: DOMAIN\username
   17     secret: password
   18     state: present
   19   register: domain_user_check
   20   check_mode: True
   21   vars: &become_vars
   22     ansible_become: True
   23     ansible_become_method: runas
   24     ansible_become_user: '{{ ansible_user }}'
   25     ansible_become_pass: '{{ ansible_password }}'

https://fossies.org/linux/ansible/test/integration/targets/win_credential/tasks/tests.yml

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63941225

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档