Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On the remote system, add your SSH public key to ~/.ssh/authorized_keys.

vars.yml

Create a file called vars.yml. This file will have some values for our setup, as well as some options that we shall pass to the driver when we run it. (Those options could alternatively be passed through the command line.)

Code Block
### TODO Maybe some AWS stuff

### SVN credentials
# FIXME these ought to be secured using ansible-vault, or at least this file should not be readable
svn_username: jmft2  # CHANGEME
svn_password: something  # CHANGEME

### Where do you want to store output?
mountpoint: /media/apollo
storagedir: /media/apollo
driver_dir: MyDriver
driver: MyDriver

######

### Options for the driver itself 
series: ansible
simulation: tut3 # TODO can we do a loop here?
flags: -name "{{series}}_{{simulation}}" 



 

Playbook

In your base directory, create the file playbook.yml:

Code Block
languagetext
titleplaybook.yaml
linenumberstrue
--- 
- name: Mount S3 storage
  hosts: albatross
  remote_user: pi
  become: no
  gather_facts: no

  vars_files:
    - vars.yml

  roles:
    - role: mountstorage


- name: Build and run MercuryDPM
  hosts: albatross
  remote_user: pi
  become: no
# FIXME Do we have to run everything as root?
  gather_facts: no

  vars_files:
    - vars.yml

  roles: 
    - role: workhorse

...

Code Block
languagebash
titleworkhorse/templates/build_and_run_driver.sh.j2
linenumberstrue
#!/bin/bash
set -eux
DPMDIR=/opt/MercuryDPM
SIMDIR=/mnt/s3gf/{{series}}/{{simulation}}
DRIVER_DIR=$DPMDIR/MercuryBuild/Drivers/{{driver_dir}}
DRIVER_PATH=$DRIVER_DIR/{{driver}}
SIMDIR={{storagedir}}/{{series}}/{{simulation}}

cd $DRIVER_DIR 
make {{driver}}

mkdir -p $SIMDIR
cd $SIMDIR
$DRIVER_PATH {{flags}}