Skip to content

Commit 9f9acd1

Browse files
committed
Split main role file in the Fidimag role into smaller role files for modularity.
1 parent ab7b264 commit 9f9acd1

File tree

5 files changed

+88
-74
lines changed

5 files changed

+88
-74
lines changed
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: 4 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,7 @@
11
---
22
# This Ansible role installs Fidimag on the virtual machine.
33

4-
# Clone fidimag from the repository.
5-
- name: Ensure that Git and openssh-client are installed.
6-
apt:
7-
pkg: "{{ item }}"
8-
state: latest
9-
update_cache: yes
10-
cache_valid_time: 86400
11-
with_items:
12-
- git
13-
- openssh-client
14-
sudo: yes
15-
16-
- name: Clone the Fidimag source.
17-
git:
18-
repo: "{{ FIDIMAG_REPO_URL }}"
19-
dest: "{{ FIDIMAG_INSTALL_PATH }}"
20-
version: "{{ FIDIMAG_VERSION }}"
21-
sudo: yes
22-
23-
# Install dependencies.
24-
- name: Install dependencies in Ubuntu packages.
25-
apt:
26-
pkg: "{{ item }}"
27-
state: latest
28-
update_cache: yes
29-
cache_valid_time: 86400
30-
with_items:
31-
- gcc
32-
- ipython
33-
- mayavi2
34-
- python-dev
35-
- python-matplotlib
36-
- python-numpy
37-
- python-pytest
38-
- python-pyvtk
39-
- python-scipy
40-
sudo: yes
41-
42-
- name: Install dependencies with Pip.
43-
pip:
44-
name: cython
45-
extra_args: --upgrade
46-
sudo: yes
47-
48-
# Install local dependencies.
49-
- name: Install FFTW and SUNDIALS from the Fidimag installation script.
50-
command: bash install.sh
51-
args:
52-
chdir: "{{ FIDIMAG_INSTALL_PATH }}/bin"
53-
sudo: yes
54-
55-
# Build fidimag. Makefile module?
56-
- name: Build Fidimag.
57-
command: make
58-
args:
59-
chdir: "{{ FIDIMAG_INSTALL_PATH }}"
60-
sudo: yes
61-
62-
# Organise paths.
63-
- name: Add fidimag to PYTHONPATH.
64-
lineinfile:
65-
dest: /etc/profile.d/fidimag.sh
66-
regexp: "^export PYTHONPATH="
67-
line: "export PYTHONPATH=\"{{ FIDIMAG_INSTALL_PATH }}/:$PYTHONPATH\""
68-
create: yes
69-
sudo: yes
70-
71-
- name: Add fidimag library path to LD_LIBRARY_PATH.
72-
lineinfile:
73-
dest: /etc/profile.d/fidimag.sh
74-
regexp: "^export LD_LIBRARY_PATH="
75-
line: "export LD_LIBRARY_PATH=\"{{ FIDIMAG_INSTALL_PATH }}/local/lib:$LD_LIBRARY_PATH\""
76-
create: yes
77-
sudo: yes
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)