forked from marvel-nccr/quantum-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook-build.yml
189 lines (161 loc) · 5.49 KB
/
playbook-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
- name: Install ansible prerequisites
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: set up the VM
hosts: "{{ build_hosts | default('vagrant-ssh') }}"
vars:
libxc_version: "4.3.4"
libxc_prefix: "/usr/local/libxc-{{ libxc_version }}"
roles:
- name: add user {{ vm_user }} with key
role: marvel-nccr.add_user
tags: [add_user]
vars:
add_user_name: "{{ vm_user }}"
add_user_password: "{{ vm_password }}"
add_user_groups:
- "{{ vm_user }}"
- sudo
add_user_passwordless_sudo: true
- role: marvel-nccr.simulationbase
tags: [simulationbase]
vars:
simulationbase_vm_user: "{{ vm_user }}"
simulationbase_hostname: "{{ vm_hostname }}"
simulationbase_codes_folder: "{{ vm_codes_folder }}"
simulationbase_tmz: Europe/Zurich
- role: marvel-nccr.ubuntu_desktop
tags: [ubuntu_desktop]
vars:
ubuntu_desktop_browser: "{{ vm_browser }}"
ubuntu_desktop_vm_user: "{{ vm_user }}"
when: not vm_headless
- role: marvel-nccr.quantum_mobile_customizations
tags: [qm_customizations]
vars:
qm_customizations_browser: "{{ vm_browser }}"
qm_customizations_vm_user: "{{ vm_user }}"
qm_customizations_vm_password: "{{ vm_password }}"
qm_customizations_vm_name: "{{ vm_name }}"
qm_customizations_vm_version: "{{ vm_version }}"
qm_customizations_vm_author: "{{ vm_author }}"
qm_customizations_headless: "{{ vm_headless }}"
qm_customizations_examples_folder: "{{ vm_examples_folder }}"
qm_customizations_examples_readme: "{{ vm_examples_folder_reamde }}"
qm_customizations_data_folder: "{{ vm_data_folder }}"
qm_customizations_readme_file: "{{ vm_readme_file }}"
qm_customizations_homepage: "https://quantum-mobile.readthedocs.io"
qm_customizations_urls:
Abinit: https://www.abinit.org
Siesta: https://gitlab.com/siesta-project/siesta
Wannier90: http://www.wannier.org
- role: marvel-nccr.editors
tags: [editors]
vars:
editors_vm_user: "{{ vm_user }}"
- role: marvel-nccr.slurm
tags: [slurm]
- role: marvel-nccr.wannier90
tags: [wannier90]
- role: marvel-nccr.wannier_tools
tags: [wannier_tools]
- role: marvel-nccr.libxc # this is used by abinit and siesta
tags: [abinit, siesta]
vars:
libxc_build_cpus: "{{ vm_cpus }}"
- role: marvel-nccr.siesta
tags: [siesta]
vars:
siesta_build_cpus: "{{ vm_cpus }}"
siesta_libxc_root: "{{ libxc_prefix }}"
siesta_repo: "gitlab.com/garalb/siesta"
siesta_version: "school--MaX-1.3.0-1"
- role: marvel-nccr.conda-codes
tags: [conda]
- role: marvel-nccr.abinit
tags: [abinit]
vars:
abinit_build_cpus: "{{ vm_cpus }}"
abinit_libxc_path: "{{ libxc_prefix }}"
- role: geerlingguy.nodejs # this is used by jupyterlab and aiidalab
tags: [aiida, nodejs]
become: true
become_user: "{{ root_user }}"
vars:
nodejs_version: 12.x
nodejs_install_npm_user: "{{ root_user }}"
- role: marvel-nccr.aiida
tags: [aiida]
become: true
become_user: "{{ vm_user }}"
vars:
aiida_source_folder: "{{ vm_codes_folder }}"
aiida_data_folder: "{{ vm_data_folder }}/aiida"
aiida_computer_cpus: "{{ vm_cpus }}"
aiida_computer_scheduler: "{{ vm_scheduler }}"
aiida_examples_folder: "{{ vm_examples_folder }}"
aiida_venv: "{{ aiida_venv_base }}/siesta_school"
aiida_jupyter_venv: "{{ aiida_venv_base }}/jupyter"
aiida_venv_constraints: "{{ vm_data_folder }}/aiida/constraints.txt"
post_tasks:
- name: Check package version integrity in virtualenv
command: "{{ aiida_venv }}/bin/pip check --no-color"
become: true
become_user: "{{ vm_user }}"
changed_when: false
tags: [aiida, aiidalab, pipcheck]
# pymatgen can fail when the numpy it was compiled against is downgraded/upgraded
# (e.g. due to a package pinning numpy)
- name: test pymatgen import
command: "{{ aiida_venv }}/bin/python -c 'import pymatgen'"
become: true
become_user: "{{ vm_user }}"
changed_when: false
tags: [aiida, aiidalab, pymatgen]
# the following tasks should only be run after the machine is fully provisioned
# since these tasks break idempotence
- name: apt-get clean # noqa 303
tags: [never, cleanup]
become: true
command: apt-get clean
- name: wipe apt lists
tags: [never, cleanup]
become: true
command: "rm -rf /var/lib/apt/lists/*" # noqa 302
- name: wipe user cache
tags: [never, cleanup]
become: true
become_user: "{{ vm_user }}"
file:
state: absent
path: "~/.cache"
- name: wipe root user cache
tags: [never, cleanup]
become: true
file:
state: absent
path: "~/.cache"