| - name: Ensure Python is around for Ansible to use. | |
| # It stopped being included in macOS 13. | |
| import_playbook: prepare-mac-for-ansible.yml | |
| - hosts: all_mac | |
| user: chrome-bot | |
| gather_facts: true | |
| tasks: | |
| - name: Stop sleeping. | |
| import_role: | |
| name: stop_sleeping | |
| - name: Restart after power failure. | |
| # Some sources indicate this works only for desktop Macs. | |
| command: pmset -a autorestart 1 | |
| become: true | |
| - name: Set hostname, which should already be set. | |
| command: scutil --set HostName {{ inventory_hostname }} | |
| become: true | |
| - name: Set Bonjour hostname. | |
| command: scutil --set LocalHostName {{ inventory_hostname }} | |
| become: true | |
| - name: Set user-visible computer name. | |
| command: scutil --set ComputerName {{ inventory_hostname }} | |
| become: true | |
| - name: Turn off wifi radio. | |
| command: networksetup -setairportpower en1 off | |
| - name: Don't automatically download OS updates. | |
| # OSes are updated manually (if at all) to prevent surprises. There's no | |
| # sense spending network and disk on updates that might not be installed. | |
| command: defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -boolean FALSE | |
| become: true | |
| - name: Copy authorized keys. | |
| import_role: | |
| name: copy_authorized_keys | |
| - name: Copy service account key. | |
| import_role: | |
| name: copy_service_account_key | |
| - name: Install Swarming needs. | |
| import_role: | |
| name: swarming_needs | |
| - name: Install Switchboard needs. | |
| import_role: | |
| name: switchboard_needs | |
| - name: Install test_machine_monitor. | |
| import_role: | |
| name: install_test_machine_monitor |