ansible/test/integration/targets/win_credential/tasks/main.yml
Jordan Borean 8e92cca139
win_credential: new module to manage credentials (#48840)
* win_credential_manager: new module to manage credentials

* fix sanity issues and removed CredSSP references

* renamed module to win_credential

* fix typo on test variable

* fix sanity ignore line
2018-11-22 06:55:48 +10:00

64 lines
1.5 KiB
YAML

---
- name: ensure test dir is present
win_file:
path: '{{ test_credential_dir }}'
state: directory
- name: copy the pfx certificate
win_copy:
src: cert.pfx
dest: '{{ test_credential_dir }}\cert.pfx'
- name: import the pfx into the personal store
win_certificate_store:
path: '{{ test_credential_dir }}\cert.pfx'
state: present
store_location: CurrentUser
store_name: My
password: '{{ key_password }}'
vars: &become_vars
ansible_become: True
ansible_become_method: runas
ansible_become_user: '{{ ansible_user }}'
ansible_become_pass: '{{ ansible_password }}'
- name: ensure test credentials are removed before testing
win_credential:
name: '{{ test_hostname }}'
type: '{{ item }}'
state: absent
vars: *become_vars
with_items:
- domain_password
- domain_certificate
- generic_password
- generic_certificate
- block:
- name: run tests
include_tasks: tests.yml
always:
- name: remove the pfx from the personal store
win_certificate_store:
state: absent
thumbprint: '{{ cert_thumbprint }}'
store_location: CurrentUser
store_name: My
- name: remove test credentials
win_credential:
name: '{{ test_hostname }}'
type: '{{ item }}'
state: absent
vars: *become_vars
with_items:
- domain_password
- domain_certificate
- generic_password
- generic_certificate
- name: remove test dir
win_file:
path: '{{ test_credential_dir }}'
state: absent