41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
---
|
|
- name: install gawk package
|
|
homebrew:
|
|
name: gawk
|
|
state: latest
|
|
|
|
- name: get list of running launchd services
|
|
command: launchctl list
|
|
register: launchd_running_services
|
|
changed_when: false
|
|
|
|
- set_fact:
|
|
system_info_plist_dir: '{{ansible_env.HOME}}/Library/LaunchAgents'
|
|
|
|
- name: create plist directory
|
|
file:
|
|
state: directory
|
|
path: '{{system_info_plist_dir}}'
|
|
|
|
- name: determine if system-info is currently running
|
|
set_fact:
|
|
system_info_debug: true
|
|
system_info_plist_path:
|
|
'{{system_info_plist_dir}}/system-info.plist'
|
|
system_info_running:
|
|
"{{'system-info' in launchd_running_services.stdout}}"
|
|
|
|
- name: install system-info launchd plist
|
|
template:
|
|
src: system-info.plist.j2
|
|
dest: '{{system_info_plist_path}}'
|
|
register: system_info_plist
|
|
|
|
- name: unload running system-info launchd service
|
|
when: system_info_plist.changed and system_info_running
|
|
command: 'launchctl unload -w {{system_info_plist_path}}'
|
|
|
|
- name: load system-info launchd service
|
|
when: system_info_plist.changed or not system_info_running
|
|
command: 'launchctl load -w {{system_info_plist_path}}'
|