blob: d44ba52773dbdc9239eb67c89260cddb39274520 [file] [log] [blame]
- name: Remove any legacy install of Swarming.
# Swarming's dir used to live here before macOS 10.15, at which point it
# became an unwriteable location.
become: true
file:
path: /b/s
state: absent
- name: Make Swarming dir.
# test_machine_monitor's swarming/bootstrap() would do it, but it does it
# with 0777 because that dir is being mounted inside a Docker container on
# Linux. We can be a little tighter here.
become: true
file:
path: /opt/s
state: directory
recurse: true
owner: '{{ skolo_account }}'
mode: 0755
- name: Install Rosetta on ARM machines if it's absent.
# The Python installer package isn't marked as being ARM-native, so it refuses
# to run unless Rosetta 2 is around. This is true as of the 3.10.1 universal2
# installer.
command:
cmd: softwareupdate --install-rosetta --agree-to-license
creates: /Library/Apple/usr/libexec/oah/libRosettaRuntime
when: ansible_facts['machine'] == 'arm64'
- name: Install Python 3.
vars:
# Contains universal binaries. Happily runs on macOS 10.9+, despite name.
python_pkg: python-3.9.6-macos11.pkg
block:
- name: Download Python installer.
# Do this with curl instead of the get_url module because 10.12's Python
# has too old a version of TLS to work.
command:
cmd: curl -O 'https://www.python.org/ftp/python/3.9.6/{{ python_pkg }}'
chdir: ~{{ skolo_account }}/Downloads
creates: ~{{ skolo_account }}/Downloads/{{ python_pkg }}
warn: false
- name: Run installer.
become: true
command:
cmd: /usr/sbin/installer -verboseR -package ~{{ skolo_account }}/Downloads/{{ python_pkg }} -target /
creates: /usr/local/bin/python3
- name: Install pyobjc.
block:
- name: Pick temp filename to hold requirements.
tempfile:
register: requirements
- name: Overwrite temp file with requirments.
copy:
src: files/pyobjc_requirements.txt
dest: '{{ requirements.path }}'
mode: 0600
force: true
- name: Run pip against requirements.
# The Python 3.9 and above versions of pyobjc ship as universal binaries.
# The pyobjc distro is a stub which depends on packages like
# https://pypi.org/project/pyobjc-core/#files, where the actual binaries
# live. Version is pinned just for uniformity.
pip:
# Dodge /usr/bin/pip3, which triggers an xcode-select interruption.
executable: /usr/local/bin/pip3
requirements: '{{ requirements.path }}'
- name: Allow chrome-bot to sudo shutdown.
become: true
lineinfile:
path: /private/etc/sudoers.d/swarming
state: present
create: true
line: '{{ skolo_account }} ALL=NOPASSWD: ALL'
regexp: '^{{ skolo_account }} ALL=NOPASSWD:.*'
validate: /usr/sbin/visudo -cf %s
mode: 0644
owner: root
group: wheel