New in version 2.3.
Parameter | Choices/Defaults | Comments |
---|---|---|
args | Additional arguments for the executable defined in src . | |
description | Description for the shortcut. This is usually shown when hoovering the icon. | |
dest path required | Destination file for the shortcuting file. File name should have a .lnk or .url extension. | |
directory path | Working directory for executable defined in src . | |
hotkey | Key combination for the shortcut. This is a combination of one or more modifiers and a key. Possible modifiers are Alt, Ctrl, Shift, Ext. Possible keys are [A-Z] and [0-9]. | |
icon path | Icon used for the shortcut. File name should have a .ico extension.The file name is followed by a comma and the number in the library file (.dll) or use 0 for an image file. | |
src | Executable or URL the shortcut points to. The executable needs to be in your PATH, or has to be an absolute path to the executable. | |
state |
| When absent , removes the shortcut if it exists.When present , creates or updates the shortcut. |
windowstyle |
| Influences how the application is displayed when it is launched. |
Note
dest
, args
, description
, dest
, directory
, icon
src
dest
and src
- name: Create an application shortcut on the desktop win_shortcut: src: C:\Program Files\Mozilla Firefox\Firefox.exe dest: C:\Users\Public\Desktop\Mozilla Firefox.lnk icon: C:\Program Files\Mozilla Firefox\Firefox.exe,0 - name: Create the same shortcut using environment variables win_shortcut: description: The Mozilla Firefox web browser src: '%ProgramFiles%\Mozilla Firefox\Firefox.exe' dest: '%Public%\Desktop\Mozilla Firefox.lnk' icon: '%ProgramFiles\Mozilla Firefox\Firefox.exe,0' directory: '%ProgramFiles%\Mozilla Firefox' hotkey: Ctrl+Alt+F - name: Create an application shortcut for an executable in PATH to your desktop win_shortcut: src: cmd.exe dest: Desktop\Command prompt.lnk - name: Create an application shortcut for the Ansible website win_shortcut: src: '%ProgramFiles%\Google\Chrome\Application\chrome.exe' dest: '%UserProfile%\Desktop\Ansible website.lnk' args: --new-window https://ansible.com/ directory: '%ProgramFiles%\Google\Chrome\Application' icon: '%ProgramFiles%\Google\Chrome\Application\chrome.exe,0' hotkey: Ctrl+Alt+A - name: Create a URL shortcut for the Ansible website win_shortcut: src: https://ansible.com/ dest: '%Public%\Desktop\Ansible website.url'
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/win_shortcut_module.html