From 508a9cf9d87fe89989138acbca655a8d5969f972 Mon Sep 17 00:00:00 2001 From: Conor Finn Date: Tue, 7 Feb 2023 17:26:06 +0000 Subject: [PATCH] Create initial playbook for mac agents RE #62 --- .../ansible/.jenkins-agent.yml.swp | Bin 0 -> 12288 bytes .../ansible/jenkins-agent.yml | 8 +++ .../ansible/roles/agent/tasks/main.yml | 48 ++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 jenkins-node/mantid-builder-macos/ansible/.jenkins-agent.yml.swp create mode 100644 jenkins-node/mantid-builder-macos/ansible/jenkins-agent.yml create mode 100644 jenkins-node/mantid-builder-macos/ansible/roles/agent/tasks/main.yml diff --git a/jenkins-node/mantid-builder-macos/ansible/.jenkins-agent.yml.swp b/jenkins-node/mantid-builder-macos/ansible/.jenkins-agent.yml.swp new file mode 100644 index 0000000000000000000000000000000000000000..ff14650d7d9b389f14387923a5a0e93f908407c2 GIT binary patch literal 12288 zcmeI&Jx;?g7zSX6iGd0P7cgZ`(iS0A-4JB}QILSLJBibVI(C(Wp##5%;0&Arv6TyO z1qRN+=QMzX)b5Da$}7wE=R|q7C=MDI2R+{QT8!EnW3}OXI9+*hK29AL8f`K!PPDd* z^V@Ov=)AepZuWNf<`>b*&Cd<}OpZ7fIv>SBZ*b z=B6T~YN7KaQ1ZJ{45Ti+Nvak;6^jsn0J|z;w_WRRx0(&Bu~pyX8|!_*KmY;|fB*y_ z009U<00RF=pcp&smfm-%dgtY;cYgKN5FG>{009U<00Izz00bZa0SG_<0)J3IM2zjP zGImd~|NptGPgiCY2pNk$E}e^2{h2mqj#VM|sEIVQBJ#whN`0%eAnZx^k?{ Zgwx6SlQVueJ6k{7$zzl8UU|UYW1oOhV}$?! literal 0 HcmV?d00001 diff --git a/jenkins-node/mantid-builder-macos/ansible/jenkins-agent.yml b/jenkins-node/mantid-builder-macos/ansible/jenkins-agent.yml new file mode 100644 index 0000000..6fc973d --- /dev/null +++ b/jenkins-node/mantid-builder-macos/ansible/jenkins-agent.yml @@ -0,0 +1,8 @@ +- name: Deploy macOS Jenkins agent for Mantid. + hosts: all + + roles: + - role: agent + become: yes + tags: "agent" + diff --git a/jenkins-node/mantid-builder-macos/ansible/roles/agent/tasks/main.yml b/jenkins-node/mantid-builder-macos/ansible/roles/agent/tasks/main.yml new file mode 100644 index 0000000..23342fa --- /dev/null +++ b/jenkins-node/mantid-builder-macos/ansible/roles/agent/tasks/main.yml @@ -0,0 +1,48 @@ +--- + +- name: Deploy Jenkins agent on macOS + tasks: + # Install Requirements + + - name: Install homebrew + include_role: + name: geerlingguy.mac.homebrew + + - name: Make sure homebrew bin is in the path + ansible.builtin.lineinfile: + path: /etc/paths + state: present + line: '/opt/homebrew/bin' + become: true + become_user: root + + - name: Install git + community.general.homebrew: + name: git + state: latest + + - name: Install Java 11 + community.general.homebrew: + name: java11 + state: present + + # Configure macOS Settings + + - name: Disable screensaver + shell: defaults write com.apple.screensaver idleTime 0 + + - name: Disable saved application states to avoid dialog + shell: defaults write org.python.python NSQuitAlwaysKeepsWindows -bool false + + # TODO: Disable autolock (this seems to change between versions, so might not be possible to script) + + - name: Download jenkins slave script + shell: curl -o ~/jenkins-slave.sh https://raw.githubusercontent.com/mantidproject/mantid/main/buildconfig/Jenkins/jenkins-slave.sh + + - name: Start script as chrontab entry + ansible.builtin.cron: + name: "Run slave script" + minute: "*/5" + job: "$HOME/jenkins-slave.sh {{ agent_name }} {{ agent_secret }}" + +