-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
342 additions
and
6 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
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
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,317 @@ | ||
- name: Prepare for VM build | ||
|
||
hosts: "{{ build_hosts | default('vagrant-ssh') }}" | ||
gather_facts: false | ||
|
||
pre_tasks: | ||
|
||
- name: test configuration | ||
tags: [init] | ||
debug: | ||
msg: RUNNING PLAYBOOK FOR '{{ vm_name }}' VERSION '{{ vm_version }}' | ||
|
||
- name: testing ansible environment | ||
tags: [init] | ||
debug: | ||
msg: Connecting to host '{{ inventory_hostname }}' as user '{{ ansible_user }}' | ||
|
||
- name: Install linux-headers-generic for guest-additions | ||
tags: [init] | ||
when: "inventory_hostname.startswith('vagrant')" | ||
become: true | ||
apt: | ||
cache_valid_time: 86400 # One day | ||
name: | ||
- linux-headers-generic | ||
|
||
- name: Make local dist folder | ||
tags: [init] | ||
local_action: | ||
module: file | ||
state: directory | ||
path: "{{ local_dist_folder }}/" | ||
when: release_notes_locally is defined and release_notes_locally | ||
|
||
- name: Build VM | ||
hosts: "{{ build_hosts | default('vagrant-ssh') }}" | ||
|
||
tasks: | ||
|
||
# Generic Tasks | ||
# These tasks are run for any VM build, regardless of the software installed | ||
# They setup the VM user, commandline interface, and (optionally) desktop GUI | ||
|
||
- name: Update system package managers (apt, pip) | ||
tags: [init] | ||
include_tasks: local/tasks/ensure-apt-pip.yml | ||
|
||
- name: "Add QM user '{{ vm_user }}'" | ||
tags: [add_user, ci_test] | ||
import_tasks: local/tasks/add-qm-user.yml | ||
|
||
- name: "Add release notes section for the operating system" | ||
tags: [release_notes] | ||
import_tasks: local/tasks/release-notes-system.yml | ||
|
||
- name: Customise bash terminal for QM | ||
tags: [customise-bash] | ||
become: true | ||
become_user: "{{ vm_user }}" | ||
import_tasks: local/tasks/customise-bash.yml | ||
|
||
- name: Install common text editors | ||
tags: [editors] | ||
import_role: | ||
name: marvel-nccr.editors | ||
vars: | ||
editors_vm_user: "{{ vm_user }}" | ||
|
||
- name: Add desktop GUI | ||
tags: [ubuntu_desktop] | ||
when: not vm_headless | ||
import_role: | ||
name: marvel-nccr.ubuntu_desktop | ||
vars: | ||
ubuntu_desktop_vm_user: "{{ vm_user }}" | ||
ubuntu_desktop_browser: "{{ vm_browser }}" | ||
|
||
- name: Customise GUI for QM | ||
tags: [customise-gui] | ||
when: not vm_headless | ||
become: true | ||
become_user: "{{ vm_user }}" | ||
import_tasks: local/tasks/customise-gui.yml | ||
|
||
- name: Setup QM to run simulations | ||
tags: [simsetup] | ||
import_tasks: local/tasks/simulation-setup.yml | ||
|
||
# Build Specific Tasks | ||
# These tasks can be customised for specific VM builds, | ||
# depending on the software one requires to be installed | ||
|
||
# - name: "Add user README" | ||
# tags: [add_readme] | ||
# become: true | ||
# become_user: "{{ vm_user }}" | ||
# template: | ||
# src: local/tasks/files/README.md.j2 | ||
# dest: "{{ readme_vm_path }}" | ||
# vars: | ||
# software_urls: | ||
# Quantum ESPRESSO: http://www.quantum-espresso.org/ | ||
|
||
# - name: Install plotting tools (via apt) | ||
# # TODO we may want to eventually install these with conda | ||
# # (jmol and gnuplot are already installed via conda-forge) | ||
# tags: [plotting] | ||
# import_tasks: local/tasks/plotting-tools.yml | ||
# vars: | ||
# packages: [grace, xcrysden, default-jre] | ||
|
||
# - name: install SLURM service | ||
# tags: [slurm] | ||
# import_role: | ||
# name: marvel-nccr.slurm | ||
|
||
# # TODO control version | ||
# # could install with conda, but how to set up the systemd service? | ||
# - name: install RabbitMQ server service | ||
# tags: [rabbitmq] | ||
# become: true | ||
# become_user: "{{ root_user }}" | ||
# import_tasks: local/tasks/rabbitmq.yml | ||
|
||
# # TODO control version | ||
# # could install with conda, but how to set up the systemd service? | ||
# - name: install PostrgeSQL server service | ||
# tags: [postgresql] | ||
# become: true | ||
# become_user: "{{ root_user }}" | ||
# import_tasks: local/tasks/postgresql.yml | ||
|
||
# - name: install conda+mamba | ||
# tags: [conda] | ||
# import_role: | ||
# name: chrisjsewell.conda.user_install | ||
# become: true | ||
# become_user: "{{ vm_user }}" | ||
# vars: | ||
# conda_folder: "~/.conda" | ||
# conda_installer_url: https://github.com/conda-forge/miniforge/releases/download/22.11.1-4/Mambaforge-22.11.1-4-Linux-x86_64.sh | ||
# conda_installer_checksum: sha256:16c7d256de783ceeb39970e675efa4a8eb830dcbb83187f1197abfea0bf07d30 | ||
# conda_activate_alias: workon | ||
|
||
# - name: Install code environment | ||
# tags: [code-envs] | ||
# # TODO ideally this would be import_tasks, but then we can't use loop | ||
# include_tasks: local/tasks/conda-env-install.yml | ||
# vars: | ||
# conda_env: "{{ item.name }}" | ||
# code_packages: "{{ item.pkgs }}" | ||
# # TODO allow for `conda env config vars set` to be used, | ||
# # e.g. for export OMP_NUM_THREADS=1 | ||
# loop: | ||
# # note here we specify exact versions of libxc/openmpi/mpich | ||
# # this is because we want conda to re-use as many packages as possible | ||
# # since re-used packages do not incur more disk memory usage | ||
# - {name: qespresso, pkgs: [qe=7.2, libxc=5.2.3, openmpi=4.1.2]} | ||
# - {name: visualise, pkgs: [jmol, gnuplot, cif2cell, python=3.9]} | ||
# loop_control: | ||
# label: "{{ item.name }}" | ||
|
||
# - name: Install AiiDA environment | ||
# tags: [aiida-env] | ||
# become: true | ||
# become_user: "{{ vm_user }}" | ||
# import_tasks: local/tasks/aiida-conda-env.yml | ||
# vars: | ||
# conda_env: "{{ aiida_conda_env }}" | ||
# aiida_packages: | ||
# - python=3.9 | ||
# - pip | ||
# - aiida-core=2 | ||
# - aiida-core.notebook | ||
# - aiida-quantumespresso=4 | ||
# - aiida-pseudo=1 | ||
# - ipykernel | ||
# - jupyterlab | ||
# - jupyterlab-tour | ||
# - jupyterlab-spellchecker | ||
# - mamba_gator # Provides Conda/Mamba management as a standalone application or as extension for JupyterLab. | ||
|
||
# - name: Create an aiida-profile | ||
# tags: [aiida-profile] | ||
# become: true | ||
# become_user: "{{ vm_user }}" | ||
# import_tasks: local/tasks/aiida-profile.yml | ||
# vars: | ||
# name: "{{ aiida_profile }}" | ||
# aiida_run_verdi: "~/.conda/bin/conda run -n {{ aiida_conda_env }} verdi" | ||
# postgres_user: postgres | ||
# parameters: | ||
# first_name: Max | ||
# last_name: Scientist | ||
# email: aiida@localhost | ||
# institution: Quantum Mobile | ||
# db_host: localhost | ||
# db_port: 5432 | ||
# db_name: aiidadb | ||
# db_username: aiida | ||
# db_password: "ne9N_LDK-*JSS" | ||
# daemon_service: true | ||
|
||
# - name: Create AiiDA Jupyter service | ||
# tags: [aiida-jupyter] | ||
# become: true | ||
# become_user: "{{ vm_user }}" | ||
# import_tasks: local/tasks/aiida-jupyter.yml | ||
|
||
# - name: "Create AiiDA computers" | ||
# tags: [aiida-computers] | ||
# become: true | ||
# become_user: "{{ vm_user }}" | ||
# verdi_computer: | ||
# verdi: "~/.conda/bin/conda run -n {{ aiida_conda_env }} verdi" | ||
# profile: "{{ aiida_profile }}" | ||
# label: "{{ item.l }}" | ||
# scheduler: "{{ item.s }}" | ||
# transport: core.local | ||
# hostname: localhost | ||
# work_dir: "~/.aiida_run" | ||
# mpirun_command: "mpirun -np {tot_num_mpiprocs}" | ||
# mpiprocs_per_machine: 2 | ||
# configure: "--safe-interval=0" | ||
# loop: | ||
# - {l: local_direct, s: core.direct} | ||
# - {l: local_slurm, s: core.slurm} | ||
# loop_control: | ||
# label: "{{ item.l }}" | ||
|
||
# - name: "Add AiiDA Codes" | ||
# tags: [aiida-codes] | ||
# become: true | ||
# become_user: "{{ vm_user }}" | ||
# verdi_code: | ||
# verdi: ~/.conda/bin/conda run -n {{ aiida_conda_env }} verdi | ||
# profile: "{{ aiida_profile }}" | ||
# label: "{{ item.label }}" | ||
# description: "Local code for '{{ item.exec }}' in Conda env '{{ item.env }}'" | ||
# computer: local_slurm | ||
# input_plugin: "{{ item.plugin }}" | ||
# remote_abs_path: "/home/max/.conda/envs/{{ item.env }}/bin/{{ item.exec }}" | ||
# prepend_text: | | ||
# ulimit -s unlimited | ||
# eval "$(conda shell.bash hook)" | ||
# conda activate {{ item.env }} | ||
# {{ item.prepend | default('') }} | ||
# loop_control: | ||
# label: "{{ item.label }}" | ||
# loop: | ||
# - {label: qe.pw, plugin: quantumespresso.pw, env: qespresso, exec: pw.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.cp, plugin: quantumespresso.cp, env: qespresso, exec: cp.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.pp, plugin: quantumespresso.pp, env: qespresso, exec: pp.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.ph, plugin: quantumespresso.ph, env: qespresso, exec: ph.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.neb, plugin: quantumespresso.neb, env: qespresso, exec: neb.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.epw, plugin: quantumespresso.epw, env: qespresso, exec: epw.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.projwfc, plugin: quantumespresso.projwfc, env: qespresso, exec: projwfc.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.pw2wannier90, plugin: quantumespresso.pw2wannier90, env: qespresso, exec: pw2wannier90.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.dos, plugin: quantumespresso.dos, env: qespresso, exec: dos.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.q2r, plugin: quantumespresso.q2r, env: qespresso, exec: q2r.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: qe.matdyn, plugin: quantumespresso.matdyn, env: qespresso, exec: matdyn.x, prepend: export OMP_NUM_THREADS=1} | ||
# - {label: nwchem.main, plugin: nwchem.nwchem, env: nwchem, exec: nwchem} | ||
# - {label: siesta.main, plugin: siesta.siesta, env: siesta, exec: siesta} | ||
# - {label: cp2k.main, plugin: cp2k, env: cp2k, exec: cp2k.psmp} | ||
# - {label: abinit.main, plugin: abinit, env: abinit, exec: abinit} | ||
|
||
# TODO release notes for aiida computers/codes | ||
|
||
# - name: Download and install SSSP potentials | ||
# tags: [aiida-pseudo] | ||
# import_tasks: local/tasks/aiida-pseudo-sssp.yml | ||
# vars: | ||
# # for quantum mobile | ||
# aiida_pseudo_cmd: "~/.conda/bin/conda run -n {{ aiida_conda_env }} aiida-pseudo" | ||
# aiida_pseudo_base_folder: "{{ vm_data_folder }}" | ||
# aiida_pseudo_functional: PBE | ||
# aiida_pseudo_protocol: efficiency | ||
# aiida_pseudo_version: "1.1" | ||
# aiida_pseudo_profile: "{{ aiida_profile }}" | ||
|
||
# - name: Download and install DOJO potentials | ||
# tags: [aiida-pseudo] | ||
# import_tasks: local/tasks/aiida-pseudo-dojo.yml | ||
# vars: | ||
# # for sisesta | ||
# aiida_pseudo_cmd: "~/.conda/bin/conda run -n {{ aiida_conda_env }} aiida-pseudo" | ||
# aiida_pseudo_base_folder: "{{ vm_data_folder }}" | ||
# aiida_pseudo_functional: PBE | ||
# aiida_pseudo_relativistic: FR | ||
# aiida_pseudo_protocol: standard | ||
# aiida_pseudo_format: psml | ||
# aiida_pseudo_version: "0.4" | ||
# aiida_pseudo_profile: "{{ aiida_profile }}" | ||
|
||
# - name: aiida-example scripts | ||
# tags: [aiida-examples] | ||
# become: true | ||
# become_user: "{{ vm_user }}" | ||
# import_tasks: local/tasks/aiida-examples.yml | ||
# vars: | ||
# aiida_examples_folder: "~/Desktop/aiida-examples" | ||
# aiida_verdi_cmd: "~/.conda/bin/conda run -n {{ aiida_conda_env }} verdi" | ||
|
||
|
||
post_tasks: | ||
|
||
# These break idempotency, | ||
# so only run once all other tasks have completed | ||
|
||
- name: "Clean caches" | ||
tags: [never, cleanup] | ||
import_tasks: local/tasks/clean-caches.yml | ||
|
||
- name: "Remove {{ build_dir }} content" | ||
tags: [never, cleanup] | ||
become: true | ||
command: rm -rf {{ build_dir }}/* |
Oops, something went wrong.