#!/usr/bin/env -S bash -i if [[ -z "${ANSIBLE_BECOME_PASS}" ]]; then echo "ANSIBLE_BECOME_PASS is not set. Please configure your .env correctly. Exiting." exit 1 fi 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}"