Note
This module is part of the community.general collection (version 10.7.3).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: community.general.launchd.
New in community.general 1.0.0
The below requirements are needed on the host that executes this module.
Parameter | Comments |
|---|---|
enabled boolean | Whether the service should start on boot. At least one of state and enabled are required. Choices:
|
force_stop boolean | Whether the service should not be restarted automatically by launchd. Services might have the Set this option to Choices:
|
name string / required | Name of the service. |
plist string added in community.general 10.1.0 | Name of the Defaults to |
state string |
Choices:
|
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
Note
- name: Make sure spotify webhelper is started
community.general.launchd:
name: com.spotify.webhelper
state: started
- name: Deploy custom memcached job definition
template:
src: org.memcached.plist.j2
dest: /Library/LaunchDaemons/org.memcached.plist
- name: Run memcached
community.general.launchd:
name: org.memcached
state: started
- name: Stop memcached
community.general.launchd:
name: org.memcached
state: stopped
- name: Stop memcached
community.general.launchd:
name: org.memcached
state: stopped
force_stop: true
- name: Restart memcached
community.general.launchd:
name: org.memcached
state: restarted
- name: Unload memcached
community.general.launchd:
name: org.memcached
state: unloaded
- name: restart sshd
community.general.launchd:
name: com.openssh.sshd
plist: ssh.plist
state: restarted
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
status dictionary | Metadata about service status. Returned: always Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/launchd_module.html