1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/lib/ansible/modules/windows/win_shortcut.py
Matt Martz 829c0b8f62 Update validate-modules (#20932)
* Update validate-modules

* Validates ANSIBLE_METADATA
* Ensures imports happen after documentation vars
* Some pep8 cleanup

* Clean up some left over unneeded code

* Update modules for new module guidelines and validate-modules checks

* Update imports for ec2_vpc_route_table and ec2_vpc_nat_gateway
2017-02-02 11:45:22 -08:00

110 lines
3.5 KiB
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: win_shortcut
version_added: '2.3'
short_description: Manage shortcuts on Windows
description:
- Create, manage and delete Windows shortcuts
options:
src:
description:
- Executable or URL the shortcut points to.
description:
description:
- Description for the shortcut.
- This is usually shown when hoovering the icon.
dest:
description:
- Destination file for the shortcuting file.
- File name should have a C(.lnk) or C(.url) extension.
required: true
args:
description:
- Additional arguments for the executable defined in C(src).
directory:
description:
- Working directory for executable defined in C(src).
icon:
description:
- Icon used for the shortcut
- File name should have a C(.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.
hotkey:
description:
- Key combination for the shortcut.
windowstyle:
description:
- Influences how the application is displayed when it is launched.
choices:
- default
- maximized
- minimized
state:
description:
- When C(present), creates or updates the shortcut. When C(absent),
removes the shortcut if it exists.
choices:
- present
- absent
default: 'present'
author: Dag Wieers (@dagwieers)
notes:
- 'The following options can include Windows environment variables: C(dest), C(args), C(description), C(dest), C(directory), C(icon) C(src)'
- 'Windows has two types of shortcuts: Application and URL shortcuts. URL shortcuts only consists of C(dest) and C(src)'
'''
EXAMPLES = r'''
# 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
# 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'
# Create a URL shortcut to the Ansible website
- win_shortcut:
src: 'https://ansible.com/'
dest: '%PUBLIC%\Desktop\Ansible website.url'
# Create an application shortcut for the Ansible website
- win_shortcut:
src: '%PROGRAMFILES%\Google\Chrome\Application\chrome.exe'
dest: '%PUBLIC%\Desktop\Ansible website.lnk'
args: '--new-window https://ansible.com/'
directory: '%PROGRAMFILES%\Google\Chrome\Application'
icon: '%PROGRAMFILES%\Google\Chrome\Application\chrome.exe,0'
'''
RETURN = '''
'''