You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/win_shortcut/tasks/main.yml

157 lines
3.9 KiB
YAML

- name: Clean up Ansible website link
win_file:
path: '%UserProfile%\Desktop\Ansible website.url'
state: absent
- name: Add Ansible website link on the desktop
win_shortcut:
src: 'https://ansible.com/'
dest: '%UserProfile%\Desktop\Ansible website.url'
state: present
register: ansible_website_link_add
- name: Check there was a change
assert:
that:
- ansible_website_link_add.changed == true
- name: Add Ansible website link on the desktop again
win_shortcut:
src: 'https://ansible.com/'
dest: '%UserProfile%\Desktop\Ansible website.url'
state: present
register: ansible_website_link_add_again
- name: Check there was no change
assert:
that:
- ansible_website_link_add_again.changed == false
- name: Remove link
win_shortcut:
dest: '%UserProfile%\Desktop\Ansible website.url'
state: absent
register: ansible_website_link_remove
- name: Check there was a change
assert:
that:
- ansible_website_link_remove.changed == true
- name: Remove link again
win_shortcut:
dest: '%UserProfile%\Desktop\Ansible website.url'
state: absent
register: ansible_website_link_remove_again
- name: Check there was no change
assert:
that:
- ansible_website_link_remove_again.changed == false
- name: Clean up Registry Editor shortcut
win_file:
path: '%Public%\Desktop\Registry Editor.lnk'
state: absent
- name: Add a regedit shortcut on the desktop
win_shortcut:
description: "Registry Editor"
src: regedit.exe
dest: '%Public%\Desktop\Registry Editor.lnk'
state: present
register: regedit_shortcut_add
- name: Check there was a change
assert:
that:
- regedit_shortcut_add.changed == true
- name: Add a regedit shortcut on the desktop again
win_shortcut:
description: "Registry Editor"
src: regedit.exe
dest: '%Public%\Desktop\Registry Editor.lnk'
state: present
register: regedit_shortcut_add_again
- name: Check there was no change
assert:
that:
- regedit_shortcut_add_again.changed == false
- name: Update a regedit shortcut on the desktop
win_shortcut:
description: "Registry Editor"
src: C:\BogusPath\regedit.exe
dest: '%Public%\Desktop\Registry Editor.lnk'
state: present
register: regedit_shortcut_update
- name: Check there was a change
assert:
that:
- regedit_shortcut_update.changed == true
- name: Update a regedit shortcut on the desktop again
win_shortcut:
description: "Registry Editor"
src: C:\BogusPath\regedit.exe
dest: '%Public%\Desktop\Registry Editor.lnk'
state: present
register: regedit_shortcut_update_again
- name: Check there was no change
assert:
that:
- regedit_shortcut_update_again.changed == false
- name: Add an (explicit) icon
win_shortcut:
description: "Registry Editor"
src: C:\Windows\regedit.exe
dest: '%Public%\Desktop\Registry Editor.lnk'
icon: 'C:\Windows\regedit.exe,0'
state: present
register: regedit_shortcut_add_icon
- name: Check there was a change
assert:
that:
- regedit_shortcut_add_icon.changed == true
- name: Add an (explicit) icon again
win_shortcut:
description: "Registry Editor"
src: C:\Windows\regedit.exe
dest: '%Public%\Desktop\Registry Editor.lnk'
icon: 'C:\Windows\regedit.exe,0'
state: present
register: regedit_shortcut_add_icon_again
- name: Check there was no change
assert:
that:
- regedit_shortcut_add_icon_again.changed == false
- name: Remove shortcut
win_shortcut:
dest: '%Public%\Desktop\Registry Editor.lnk'
state: absent
register: regedit_shortcut_remove
- name: Check there was a change
assert:
that:
- regedit_shortcut_remove.changed == true
- name: Remove shortcut again
win_shortcut:
dest: '%Public%\Desktop\Registry Editor.lnk'
state: absent
register: regedit_shortcut_remove_again
- name: Check there was no change
assert:
that:
- regedit_shortcut_remove_again.changed == false