This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate installation and compilation of Lotus
An inventory file listing the IP addresses of the machines is NOT part of the repository. It must be created separately and passed to ansible-playbook as an argument.
- Loading branch information
1 parent
e3f30f8
commit a887cb2
Showing
5 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Run custom script | ||
hosts: all | ||
gather_facts: False | ||
become: False | ||
tasks: | ||
- name: "Run custom script" | ||
ansible.builtin.script: | ||
cmd: scripts/custom.sh | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SSH key for ansible to use when logging in the remote machines. | ||
ansible_ssh_private_key_file: ~/.ssh/spacenet-ec2-key # Meaningless example value. Set to your own ssh key location. | ||
|
||
# Git repository to obtain the Lotus code from. | ||
git_repo: https://github.com/consensus-shipyard/lotus.git | ||
|
||
# Version of the code to check out from the Mir repository at setup. This can be a branch name, a commit hash, etc... | ||
git_version: "adlrocha/mir-sync" # Meaningless example value. Set to desired code version to check out from Git. | ||
|
||
# Username to use when logging in the remote machines. | ||
ansible_user: ubuntu # Example value (default on EC2 Ubuntu virtual machines) | ||
|
||
# Other variables Ansible might use, probably no need to touch those... | ||
ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' | ||
host_count: "{{ groups['all'] | length }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
# Write any ad-hoc script here and run it using the custom-script.yaml playbook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
- name: Initialize Mir benchmark VM | ||
hosts: all | ||
gather_facts: False | ||
become: False | ||
environment: | ||
PATH: "{{ ansible_env.PATH }}:/home/{{ ansible_user }}/go/bin" | ||
tasks: | ||
- name: "Install Go" | ||
become: True | ||
community.general.snap: | ||
name: | ||
- go | ||
classic: True | ||
channel: 1.18/stable | ||
state: present | ||
- name: "Install snaps" | ||
become: True | ||
community.general.snap: | ||
name: | ||
- tmux | ||
classic: True | ||
state: present | ||
- name: "Run apt update" | ||
become: True | ||
ansible.builtin.apt: | ||
update_cache: True | ||
- name: "Install apt packages" | ||
become: True | ||
ansible.builtin.apt: | ||
name: | ||
- mesa-opencl-icd | ||
- ocl-icd-opencl-dev | ||
- gcc | ||
- git | ||
- bzr | ||
- jq | ||
- pkg-config | ||
- curl | ||
- clang | ||
- build-essential | ||
- hwloc | ||
- libhwloc-dev | ||
- wget | ||
- make | ||
state: present | ||
- name: "Run apt upgrade" | ||
become: True | ||
ansible.builtin.apt: | ||
upgrade: yes | ||
- name: Clone Lotus repo from GitHub | ||
ansible.builtin.git: | ||
repo: "{{ git_repo }}" | ||
dest: ~/lotus | ||
- name: "Check out the selected code version: {{ git_version }}" | ||
ansible.builtin.git: | ||
repo: "{{ git_repo }}" | ||
dest: ~/lotus | ||
single_branch: True | ||
version: "{{ git_version }}" | ||
force: True | ||
- name: compile spacenet code | ||
make: | ||
chdir: ~/lotus | ||
target: spacenet | ||
- name: "Run setup script" | ||
ansible.builtin.script: | ||
# Single quotes are important here (https://github.com/ansible/ansible/issues/44897) | ||
cmd: scripts/setup.sh | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: Stop all nodes | ||
hosts: all | ||
gather_facts: False | ||
become: False | ||
tasks: | ||
- name: "Kill tmux servers" | ||
ansible.builtin.shell: "tmux kill-server" | ||
... |