diff --git a/group_vars/all.yml b/group_vars/all.yml index 504b203..9487dde 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -118,7 +118,7 @@ gnome_extensions: - no-overview@fthx macos: - hostname: "maximus" + hostname: "{{ macos_hostname }}" dock_apps: - /System/Applications/Calendar.app - /Applications/Todoist.app diff --git a/roles/macos_02_packages/tasks/main.yml b/roles/macos_02_packages/tasks/main.yml index 6411bf9..180efb4 100644 --- a/roles/macos_02_packages/tasks/main.yml +++ b/roles/macos_02_packages/tasks/main.yml @@ -7,3 +7,4 @@ community.general.mas: id: "{{ macos.mas_remove }}" state: absent + become: true diff --git a/roles/macos_04_tweaks/tasks/main.yml b/roles/macos_04_tweaks/tasks/main.yml index f0fb109..e3edf89 100644 --- a/roles/macos_04_tweaks/tasks/main.yml +++ b/roles/macos_04_tweaks/tasks/main.yml @@ -3,8 +3,8 @@ community.general.osx_defaults: domain: com.apple.dock key: tilesize - type: int - value: 36 + type: float + value: 36.0 state: present - name: Set dock orientation diff --git a/run-macos.sh b/run-macos.sh index df10625..335de2c 100755 --- a/run-macos.sh +++ b/run-macos.sh @@ -1,8 +1,31 @@ #!/usr/bin/env -S bash -i if [[ -z "${ANSIBLE_BECOME_PASS}" ]]; then - echo "ANSIBLE_BECOME_PASS is not set. Exiting." + echo "ANSIBLE_BECOME_PASS is not set. Please configure your .env correctly. Exiting." exit 1 fi -ansible-playbook macos.yml -e "ansible_become_pass=${ANSIBLE_BECOME_PASS}" \ No newline at end of file +while getopts "h:" opt; do + case ${opt} in + h ) + MACOS_HOSTNAME=$OPTARG + ;; + \? ) + echo "Invalid option: -$OPTARG" 1>&2 + exit 1 + ;; + : ) + echo "Invalid option: -$OPTARG requires an argument" 1>&2 + exit 1 + ;; + esac +done + +if [[ -z "${MACOS_HOSTNAME}" ]]; then + echo "The -h option is required. Exiting." + exit 1 +else + echo "Setting hostname to ${MACOS_HOSTNAME}" +fi + +ansible-playbook macos.yml -e "ansible_become_pass=${ANSIBLE_BECOME_PASS} macos_hostname=${MACOS_HOSTNAME}" \ No newline at end of file