Skip to content

Commit 4ce5461

Browse files
committed
Merge pull request #15 from fangohr/development
INF-010
2 parents 475a2f6 + 04c1486 commit 4ce5461

11 files changed

+174
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ full:
99
# This target builds a virtual hard disk file containing various open
1010
# micromagnetics simulation technologies.
1111
lite:
12-
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-lite playbook=provision_virtualmicromagnetics_lite.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
12+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-lite playbook=provision_virtualmicromagnetics_lite.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
13+
14+
# This target builds a virtual hard disk file containing a fidimag
15+
# installation.
16+
fidimag:
17+
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="vm_name=virtualmicromagnetics-fidimag playbook=provision_virtualmicromagnetics_fidimag.yml hookbook=hook.yml extra_resources_dir=guest_resources/"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# This vagrantfile is not to be used to create a virtual machine using this
5+
# repository. Instead, it is a vagrantfile that is to be embedded (built in) to
6+
# the box file created by 'make full'. For more information about built-in
7+
# vagrantfiles, see:
8+
#
9+
# https://docs.vagrantup.com/v2/vagrantfile/index.html#load-order
10+
#
11+
# This particular vagrant file changes the user credentials that connects to
12+
# the Virtual Micromagnetics environment with, and enables a GUI by default.
13+
14+
VAGRANTFILE_API_VERSION = "2"
15+
16+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
17+
18+
config.vm.provider :virtualbox do |vb|
19+
vb.gui = true
20+
end
21+
22+
config.ssh.username = "virtualmicromagnetics"
23+
config.ssh.password = "virtualmicromagnetics"
24+
25+
end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
# This Ansible playbook is a provision playbook designed to be used with
3+
# vagrant. This playbook provisions a machine suitable for micromagnetic
4+
# simulation, and includes other convenient softwares for such an
5+
# environment. It is executed by the virtual machine.
6+
7+
- hosts: all
8+
9+
# We install docutils here instead of using the role directly, so that the
10+
# welcome file can be created before the superuser is added.
11+
pre_tasks:
12+
13+
- name: Install pip.
14+
apt:
15+
pkg=python-pip
16+
state=latest
17+
update_cache=yes
18+
cache_valid_time=86400
19+
sudo: yes
20+
21+
- name: Install docutils for Python to build documentation.
22+
pip:
23+
name=docutils
24+
sudo: yes
25+
26+
- name: Define directory in which to place welcome file.
27+
set_fact:
28+
WELCOME_DIR: /etc/skel/Desktop
29+
30+
- name: Create welcome directory.
31+
file:
32+
name={{ WELCOME_DIR }}
33+
state=directory
34+
sudo: yes
35+
36+
- name: Convert documentation to HTML and place in welcome directory.
37+
shell: rst2html.py /vagrant/extra_resources/welcome.rst Welcome.html
38+
chdir={{ WELCOME_DIR }}
39+
creates={{ WELCOME_DIR }}/Welcome.html
40+
sudo: yes
41+
42+
roles:
43+
- fidimag
44+
- xserver
45+
- { role: add_super_user, AUTOLOGIN: true }
46+
- { role: set_hostname, HOSTNAME: virtualmicromagnetics-fidimag }

jobs/provision_virtualmicromagnetics_full.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
- magpar_examples
4848
- nmag
4949
- nmag_examples
50+
- fidimag
5051
- xserver
5152
- { role: add_super_user, AUTOLOGIN: true }
5253
- { role: set_hostname, HOSTNAME: virtualmicromagnetics-full }

jobs/provision_virtualmicromagnetics_lite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
- magpar_examples
4646
- nmag
4747
- nmag_examples
48+
- fidimag
4849
- xserver
4950
- { role: add_super_user, AUTOLOGIN: true }
5051
- { role: set_hostname, HOSTNAME: virtualmicromagnetics-lite }
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# This Ansible include-playbook clones Fidimag source.
3+
4+
- name: Ensure that Git and openssh-client are installed.
5+
apt:
6+
pkg: "{{ item }}"
7+
state: latest
8+
update_cache: yes
9+
cache_valid_time: 86400
10+
with_items:
11+
- git
12+
- openssh-client
13+
sudo: yes
14+
15+
- name: Clone the Fidimag source.
16+
git:
17+
repo: "{{ FIDIMAG_REPO_URL }}"
18+
dest: "{{ FIDIMAG_INSTALL_PATH }}"
19+
version: "{{ FIDIMAG_VERSION }}"
20+
sudo: yes
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
# This Ansible include-playbook installs Fidimag dependencies from packages.
3+
4+
- name: Install dependencies in Ubuntu packages.
5+
apt:
6+
pkg: "{{ item }}"
7+
state: latest
8+
update_cache: yes
9+
cache_valid_time: 86400
10+
with_items:
11+
- gcc
12+
- ipython
13+
- mayavi2
14+
- python-dev
15+
- python-matplotlib
16+
- python-numpy
17+
- python-pip
18+
- python-pytest
19+
- python-pyvtk
20+
- python-scipy
21+
sudo: yes
22+
23+
- name: Install dependencies with Pip.
24+
pip:
25+
name: cython
26+
extra_args: --upgrade
27+
sudo: yes

roles/fidimag/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# This Ansible role installs Fidimag on the virtual machine.
3+
4+
- include: clone_fidimag_version.yml
5+
- include: install_dependencies_from_packages.yml
6+
- include: make_fidimag.yml
7+
- include: set_paths.yml
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
# This Ansible playbook build Fidimag from scripts in the Fidimag
3+
# repository. This include installing local dependencies including FFTW and
4+
# SUNDIALS.
5+
6+
# Install local dependencies.
7+
- name: Install FFTW and SUNDIALS from the Fidimag installation script.
8+
command: bash install.sh
9+
args:
10+
chdir: "{{ FIDIMAG_INSTALL_PATH }}/bin"
11+
sudo: yes
12+
13+
# Build Fidimag. Makefile module?
14+
- name: Build Fidimag.
15+
command: make
16+
args:
17+
chdir: "{{ FIDIMAG_INSTALL_PATH }}"
18+
sudo: yes

roles/fidimag/tasks/set_paths.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
# This Ansible include-playbook sets envionment variables which denote
3+
# essential paths for Fidimag.
4+
5+
- name: Add Fidimag to PYTHONPATH.
6+
lineinfile:
7+
dest: /etc/profile.d/fidimag.sh
8+
regexp: "^export PYTHONPATH="
9+
line: "export PYTHONPATH=\"{{ FIDIMAG_INSTALL_PATH }}/:$PYTHONPATH\""
10+
create: yes
11+
sudo: yes
12+
13+
- name: Add Fidimag library path to LD_LIBRARY_PATH.
14+
lineinfile:
15+
dest: /etc/profile.d/fidimag.sh
16+
regexp: "^export LD_LIBRARY_PATH="
17+
line: "export LD_LIBRARY_PATH=\"{{ FIDIMAG_INSTALL_PATH }}/local/lib:$LD_LIBRARY_PATH\""
18+
create: yes
19+
sudo: yes

0 commit comments

Comments
 (0)