在centos 7上运行ansible 2.9,在windows_7目标上创建凭据
- 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 }}"我仍然得到了错误,要求运行模块与成为...
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\""
}如能提供任何帮助或建议,我们将不胜感激。
提前致以亲切的问候
发布于 2021-03-12 18:24:03
根据模块中的测试任务,您应该能够使用:
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
https://stackoverflow.com/questions/63941225
复制相似问题