diff --git a/.gitignore b/.gitignore index 69bc0b1..3b5294a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ INSTALL*.txt RELEASENOTES.txt doc/_build other_stuff/*/*.png + +# roles & dependencies +roles/marvel-nccr* diff --git a/CHANGELOG.md b/CHANGELOG.md index ba9528d..c179670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## Quantum Mobile v18.06.0 + +### Software updates +* aiida-core v0.12.0 +* aiida-quantumespresso v2.0.1 + +### Improvements + +- Add /scratch directory +- Using shared folders no longer requires sudo + +### Build process + +- Separate roles into independent repositories +- Roles are installed via ansible-galaxy +- Continuous integration tests for individual roles + ## Quantum Mobile v18.04.0 ### Software updates diff --git a/README.md b/README.md index 85d4dca..4ae0746 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Quantum Mobile +## What is Quantum Mobile + *Quantum Mobile* is a Virtual Machine for computational materials science. It comes with a collection of software packages for quantum @@ -16,26 +18,37 @@ all of which are set up and ready to be used through the [AiiDA](http://www.aiida.net) python framework for automated workflows and provenance tracking. +You can run Quantum Mobile on your Windows, MacOS or Linux computer using the +[VirtualBox](http://virtualbox.org/) software. +You can also install Quantum Mobile on virtual machines using cloud services +like Amazon Web Services or OpenStack. + +![Demo](https://image.ibb.co/n50SdT/quantum_mobile.gif "A brief impression of the Quantum Mobile interface.") + ## Download the VM -Please see [releases](https://github.com/marvel-nccr/quantum-mobile/releases) for the latest VM image and installation instructions. +Please see [releases](https://github.com/marvel-nccr/quantum-mobile/releases) +for the latest VM image and installation instructions. -For issues encountered during installation of the VM, see the [FAQ](https://github.com/marvel-nccr/quantum-mobile/wiki/Frequently-Asked-Questions). +For issues encountered during installation of the VM, see the +[FAQ](https://github.com/marvel-nccr/quantum-mobile/wiki/Frequently-Asked-Questions). ## Build it from scratch You would like to add/remove some components of the VM and produce your own modified VM image? -This git repository contains all the vagrant and ansible scripts -required to set up the VM from scratch (note: [plan >1h](other_stuff/timings.txt) for this). +This git repository contains all the vagrant and ansible scripts required to +set up the VM from scratch (note: [plan >1h](other_stuff/timings.txt) for +this). ### Prerequisites - [vagrant](https://www.vagrantup.com/downloads.html) >= 2.0.1 - [virtualbox](https://www.virtualbox.org/wiki/Downloads) - [python](https://www.python.org/) -- Host OS: Building VM tested only on Unix systems so far (MacOS, Ubuntu). Might work under Windows with a few modifications. +- Host OS: Building VM tested only on Unix systems so far (MacOS, Ubuntu). + Might work under Windows with a few modifications. ### Create Virtual Machine @@ -43,10 +56,13 @@ required to set up the VM from scratch (note: [plan >1h](other_stuff/timings.txt git checkout git@github.com:marvel-nccr/quantum-mobile.git cd quantum-mobile pip install -r requirements.txt +ansible-galaxy install -r requirements.yml vagrant plugin install vagrant-vbguest # optional, improves interface vagrant up # build vm from scratch (takes some tens of minutes) ``` +Note: Due to a bug in the vbguest vagrant plugin, there are some additional steps #60 + ### Create image ``` # optional: reduce size of VM diff --git a/Vagrantfile b/Vagrantfile index f22c253..91c8973 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -45,6 +45,7 @@ Vagrant.configure(2) do |config| #config.vbguest.no_remote = true config.vm.box = "bento/ubuntu-16.04" + #config.vm.box = "bento/ubuntu-18.04" #config.vm.box_version = "== 201801.02.0" #config.vm.box = "ubuntu/xenial64" config.vm.boot_timeout = 60 @@ -55,42 +56,20 @@ Vagrant.configure(2) do |config| # Shared folder # Unfortunately, VirtualBox only allows to share absolute paths, which cannot - # work across all host OS. Until this changes, let's add the shared folder + # work across all host OS. # https://www.virtualbox.org/ticket/15305 #config.vm.synced_folder ".", gconfig['vm_shared_folder'], owner: gconfig['vm_user'] # Disable the default shared folder of vagrant config.vm.synced_folder ".", "/vagrant", disabled: true - # provisioner: python needed for ansible provisioner - config.vm.provision "bootstrap", type: "shell" do |s| - s.inline = "apt-get update && apt-get install -y python2.7 python3" - end - - # provisioner: add custom user for ansible provisioner - user = gconfig['vm_user'] - password = gconfig['vm_password'] - commands = <<-EOF -if [ ! -d /home/#{user} ] ; then - useradd -m -s /bin/bash --groups sudo,adm #{user} && \ - cp -pr /home/vagrant/.ssh /home/#{user}/ && \ - chown -R #{user}:#{user} /home/#{user} \ -# echo #{user}:#{password} | chpasswd -fi -EOF - config.vm.provision "adduser", type: "shell" do |s| - s.inline = commands - end - # provisioner: set up VM via ansible. To (re-)run this step: # vagrant provision --provision-with ansible config.vm.provision "ansible" do |ansible| ansible.verbose = "v" - ansible.inventory_path = './hosts' ansible.playbook = "playbook.yml" ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python2.7", - ansible_user: user } ansible.raw_arguments = Shellwords.shellsplit(ENV['ANSIBLE_ARGS']) if ENV['ANSIBLE_ARGS'] end diff --git a/ansible.cfg b/ansible.cfg index bc69cc6..7b13dfa 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -2,8 +2,17 @@ [defaults] log_path = ./ansible.log inventory = ./hosts +roles_path = ./roles + +# workaround for https://github.com/ansible/ansible/issues/14426 +timeout = 30 # Use the YAML callback plugin. stdout_callback = yaml # Use the stdout_callback when running ad-hoc commands. bin_ansible_callbacks = True + +# when changing user via su, this opens a login shell +# (i.e. executes .profile) +# See https://askubuntu.com/a/376386/715125 +ansible_su_flags = "- " diff --git a/globalconfig.yml b/globalconfig.yml index cae9171..9f1e65c 100644 --- a/globalconfig.yml +++ b/globalconfig.yml @@ -1,12 +1,12 @@ --- # Caution: This file is read by vagrant, ansible and bash -vm_version: "18.04.0" +vm_version: "18.06.0" vm_name: "Quantum Mobile" vm_description: "A Virtual Machine for Computational Materials Science" vm_url: "https://github.com/marvel-nccr/marvel-virtualmachine" vm_author: "MARVEL NCCR and MaX CoE" vm_author_url: "http://nccr-marvel.ch" -vm_release_notes_file: "{{ ansible_env.HOME }}/Desktop/RELEASENOTES.txt" +vm_release_notes_file: "${HOME}/Desktop/RELEASENOTES.txt" # VM configuration vm_hostname: "qmobile" @@ -16,7 +16,7 @@ vm_memory: 1024 vm_cpus: 2 vm_vram: 128 vm_shared_folder: "/shared" -vm_codes_folder: "{{ ansible_env.HOME }}/codes" -vm_examples_folder: "{{ ansible_env.HOME }}/examples" +vm_codes_folder: "${HOME}/codes" +vm_examples_folder: "${HOME}/examples" vm_headless: False vm_browser: chromium # 'chromium' or 'firefox' diff --git a/host_vars/aws_aiida.yml b/host_vars/aws_aiida.yml new file mode 100644 index 0000000..80016e2 --- /dev/null +++ b/host_vars/aws_aiida.yml @@ -0,0 +1,5 @@ +ansible_ssh_common_args: -i ./keys/aiida_tutorial_aiidaaccount -o StrictHostKeyChecking=no + +ansible_become_user: root +ansible_become_method: su +ansible_become_pass: "{{ lookup('file', './keys/aws_root_pass') }}" diff --git a/host_vars/aws_ubuntu.yml b/host_vars/aws_ubuntu.yml new file mode 100644 index 0000000..8a08c4e --- /dev/null +++ b/host_vars/aws_ubuntu.yml @@ -0,0 +1 @@ +ansible_ssh_common_args: -i ./keys/aiida-tutorial.pem -o StrictHostKeyChecking=no diff --git a/hosts b/hosts new file mode 100644 index 0000000..351d7c0 --- /dev/null +++ b/hosts @@ -0,0 +1,4 @@ +[vms:vars] +ansible_ssh_common_args= -F vagrant-ssh +[vms] +default ansible_user=vagrant diff --git a/keys/.gitignore b/keys/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/keys/.gitignore @@ -0,0 +1 @@ +* diff --git a/playbook.yml b/playbook.yml index 5b15558..7e211e9 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,9 +1,13 @@ -- name: set up the VM - hosts: vms - vars: - - release_notes: True - - run_tests: True - - clean: False +--- +- name: Install ansible prerequisites + hosts: default + gather_facts: no + roles: + - marvel-nccr.ansible-prerequisites + +- name: Add vm user + hosts: default + gather_facts: no pre_tasks: - name: import global variables tags: always @@ -15,56 +19,96 @@ - name: testing ansible environment debug: msg: Connecting to host '{{ inventory_hostname }}' as user '{{ ansible_user }}' + roles: + - name: add user {{ vm_user }} with key + role: marvel-nccr.add-user + vars: + add_user_name: "{{ vm_user }}" + add_user_password: "{{ vm_password }}" + add_user_sudo: True + +# Note: it is important to pass variables to roles within a 'vars' group +# If they are passed on the same indentation level as the role, the variable is +# set correctly inside the role, but following roles will read the *default* +# value of the variable (as defined inside the role). +- name: set up the VM + hosts: default + become: True + become_user: "{{ vm_user }}" + pre_tasks: + - name: import global variables + tags: always + include_vars: + file: globalconfig.yml + vars: + - release_notes: True + - run_tests: False + - clean: False + - root_user: root + - cloud_platform: virtualbox roles: - - role: common - tags: common - common_hostname: "{{ vm_hostname }}" - common_vm_user: "{{ vm_user }}" - common_vm_password: "{{ vm_password }}" - common_headless: "{{ vm_headless }}" - common_browser: "{{ vm_browser }}" - - role: customizations + - role: marvel-nccr.simulationbase + tags: simulationbase + vars: + simulationbase_vm_user: "{{ vm_user }}" + simulationbase_vm_user_public_key: "{{ lookup('file', './keys/aiida_tutorial_aiidaaccount.pub') }}" + simulationbase_hostname: "{{ vm_hostname }}" + simulationbase_codes_folder: "{{ vm_codes_folder }}" + - 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: customizations - customizations_vm_user: "{{ vm_user }}" - customizations_vm_password: "{{ vm_password }}" - customizations_vm_name: "{{ vm_name }}" - customizations_vm_version: "{{ vm_version }}" - customizations_vm_shared_folder: "{{ vm_shared_folder }}" - customizations_vm_author: "{{ vm_author }}" - customizations_headless: "{{ vm_headless }}" - customizations_codes_folder: "{{ vm_codes_folder }}" - customizations_examples_folder: "{{ vm_examples_folder }}" - customizations_browser: "{{ vm_browser }}" - - role: editors + vars: + 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_codes_folder: "{{ vm_codes_folder }}" + qm_customizations_examples_folder: "{{ vm_examples_folder }}" + - role: marvel-nccr.editors tags: editors - - role: scheduler - tags: scheduler - scheduler_hostname: "{{ vm_hostname }}" - scheduler_cpus: "{{ vm_cpus }}" - - role: simulationtools - tags: simulationtools - - role: quantum_espresso + - role: marvel-nccr.torque + tags: torque + vars: + torque_hostname: "{{ vm_hostname }}" + torque_cpus: "{{ vm_cpus }}" + - role: marvel-nccr.quantum-espresso tags: quantum_espresso - quantum_espresso_code_folder: "{{ vm_codes_folder }}" - - role: yambo + vars: + quantum_espresso_code_folder: "{{ vm_codes_folder }}" + - role: marvel-nccr.yambo tags: yambo - yambo_code_folder: "{{ vm_codes_folder }}" - - role: fleur + vars: + yambo_code_folder: "{{ vm_codes_folder }}" + - role: marvel-nccr.fleur tags: fleur - fleur_code_folder: "{{ vm_codes_folder }}" - - role: siesta + vars: + fleur_code_folder: "{{ vm_codes_folder }}" + - role: marvel-nccr.siesta tags: siesta - siesta_code_folder: "{{ vm_codes_folder }}" - - role: cp2k + vars: + siesta_code_folder: "{{ vm_codes_folder }}" + - role: marvel-nccr.cp2k tags: cp2k - cp2k_code_folder: "{{ vm_codes_folder }}" - - role: wannier90 + vars: + cp2k_code_folder: "{{ vm_codes_folder }}" + - role: marvel-nccr.wannier90 tags: wannier90 - wannier90_code_folder: "{{ vm_codes_folder }}" - - role: aiida - tags: aiida - aiida_code_folder: "{{ vm_codes_folder }}" - aiida_localhost_cpus: "{{ vm_cpus }}" - aiida_examples_folder: "{{ vm_examples_folder }}" - - role: jupyter - tags: jupyter + vars: + wannier90_code_folder: "{{ vm_codes_folder }}" + - role: marvel-nccr.aiida + tags: aiida + vars: + aiida_code_folder: "{{ vm_codes_folder }}" + aiida_localhost_cpus: "{{ vm_cpus }}" + aiida_examples_folder: "{{ vm_examples_folder }}" + - role: marvel-nccr.aiidalab + tags: aiidalab + vars: + aiidalab_headless: "{{ vm_headless }}" diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..1bd650a --- /dev/null +++ b/requirements.yml @@ -0,0 +1,37 @@ +--- +- src: marvel-nccr.quantum-espresso + version: master +- src: marvel-nccr.fleur + version: master +- src: marvel-nccr.cp2k + version: master +- src: marvel-nccr.wannier90 + version: master +- src: marvel-nccr.siesta + version: master +- src: marvel-nccr.yambo + version: master +- src: marvel-nccr.editors + version: master +- src: marvel-nccr.simulationbase + version: master +- src: marvel-nccr.ubuntu-desktop + version: master +# Needed to modify this role for become_user +# See https://github.com/marvel-nccr/quantum-mobile/issues/67 +#- src: gantsign.default-web-browser +# version: 3.1.0 +- src: marvel-nccr.quantum-mobile-customizations + version: master +- src: marvel-nccr.add-user + version: master +- src: marvel-nccr.torque + version: master +- src: marvel-nccr.aiida + version: master +- src: marvel-nccr.current-user + version: master +- src: marvel-nccr.ansible-prerequisites + version: master +- src: marvel-nccr.aiidalab + version: master diff --git a/roles/aiida/defaults/main.yml b/roles/aiida/defaults/main.yml deleted file mode 100644 index 0a33ded..0000000 --- a/roles/aiida/defaults/main.yml +++ /dev/null @@ -1,51 +0,0 @@ -aiida_version: "0.11.4" -aiida_extras: - - rest - - docs - - atomic_tools - - testing - - notebook -aiida_run_folder: "{{ ansible_env.HOME }}/.aiida_run" -aiida_code_folder: "{{ ansible_env.HOME }}" -aiida_examples_folder: "{{ ansible_env.HOME }}" -aiida_localhost_name: localhost -aiida_localhost_cpus: 2 -aiida_postgres_pw: "ne9N_LDK-*JSS" -aiida_postgres_db: aiidadb -aiida_postgres_user: aiida -aiida_venv: "{{ ansible_env.HOME }}/.virtualenvs/aiida" - -# plugins -aiida_plugin_versions: - aiida_quantumespresso: "2.0.0" - aiida_fleur: "0.6.0" - aiida_siesta: "0.11.5" - aiida_cp2k: "0.9.0" - aiida_yambo: "0.2.5" - aiida_wannier90: "1.0.0" - -aiida_plugins: "{{ aiida_plugin_versions.keys() }}" - -# pseudos -aiida_pseudopotentials: -- name: sssp-pbe-efficiency - file: SSSP_efficiency_pseudos.aiida - url: http://archive.materialscloud.org/file/2018.0001/v1 - home_page: http://materialscloud.org/sssp/ - description: >- - Standard Solid State Pseudopotentials (efficiency) - for the PBE functional -- name: sssp-pbe-accuracy - file: SSSP_accuracy_pseudos.aiida - url: http://archive.materialscloud.org/file/2018.0001/v1 - home_page: http://materialscloud.org/sssp/ - description: >- - Standard Solid State Pseudopotentials (accuracy) - for the PBE functional -- name: sg15-oncv-1.1 - file: sg15_oncv_upf_2015-10-07.tar.gz - url: http://www.quantum-simulation.org/potentials/sg15_oncv - folder: sg15-oncv-1.1 - home_page: http://www.quantum-simulation.org/potentials/sg15_oncv/ - description: >- - SG15 Optimized Norm-Conserving Vanderbilt (ONCV) pseudopotentials diff --git a/roles/aiida/files/oncv-select-pps.sh b/roles/aiida/files/oncv-select-pps.sh deleted file mode 100644 index 4def754..0000000 --- a/roles/aiida/files/oncv-select-pps.sh +++ /dev/null @@ -1,11 +0,0 @@ -# Selec v1.1 PPs, where they exist -# naming scheme: Br_ONCV_PBE-1.0.upf - -re="(\w+)_ONCV_PBE-(...).upf" -for fname in *-1.0.upf; do - [[ $fname =~ $re ]] && element=${BASH_REMATCH[1]} - fname_new="${element}_ONCV_PBE-1.1.upf" - if [ -e $fname_new ]; then - rm $fname - fi -done diff --git a/roles/aiida/tasks/aiida-core.yml b/roles/aiida/tasks/aiida-core.yml deleted file mode 100644 index be99891..0000000 --- a/roles/aiida/tasks/aiida-core.yml +++ /dev/null @@ -1,134 +0,0 @@ -- name: Install DB and more - become: true - apt: - name: "{{ item }}" - state: present - with_items: - # Compilation - - postgresql-9.5 - - postgresql-contrib - - python-psycopg2 - - libpq-dev - # Needed for the ASE visualizer - - python-gtk2 - # For AiiDA - - libffi-dev - - libssl-dev - - graphviz - -- name: Setup postgres db - become: True - become_user: postgres - postgresql_db: - name: "{{ aiida_postgres_db }}" - -- name: Setup postgres user - become: True - become_user: postgres - postgresql_user: - db: "{{ aiida_postgres_db }}" - name: "{{ aiida_postgres_user }}" - password: "{{ aiida_postgres_pw }}" - -# Note: this installs also a number of plugins. However at the moment, -# for the case of the quantum espresso plugin, we later force a specific -# version (for the others, e.g. aiida-ase etc., not yet - note that the -# dependency int he meta package is >= for these plugins). -- name: Install the aiida meta package - pip: - name: "aiida=={{ aiida_version }}" - virtualenv: "{{ aiida_venv }}" - register: pip_install - -# this is necessary, since the meta package installs plugins -- name: run reentry scan - shell: "{{ aiida_venv }}/bin/reentry scan -r aiida" - when: pip_install.changed - -- name: Install extras of aiida-core - pip: - name: "aiida-core[{{ item }}]=={{ aiida_version }}" - virtualenv: "{{ aiida_venv }}" - with_items: "{{ aiida_extras }}" - -- name: Additional pip dependencies - pip: - name: "{{ item }}" - virtualenv: "{{ aiida_venv }}" - with_items: - - seekpath - -## PyGTK cannot be installed with pip... we need to use -## a workaround, see https://stackoverflow.com/questions/12830662/ -- name: workaround to install pygtk 2 inside the virtualenv [making dir] - file: - path: "{{ aiida_venv }}/lib/python2.7/dist-packages/" - state: "directory" - mode: 0755 - -- name: workaround to install pygtk 2 inside the virtualenv [creating symlinks] - file: - src: "/usr/lib/python2.7/dist-packages/{{ item }}" - dest: "{{ aiida_venv }}/lib/python2.7/dist-packages/{{ item }}" - state: link - with_items: - - glib - - gobject - - gtk-2.0 - - pygtk.pth - - pygtk.py - - cairo - -# get anyway the GIT code, it is often useful; checkout the same version -- name: Get the AiiDA code from GIT - git: - repo: 'https://github.com/aiidateam/aiida_core.git' - dest: "{{ ansible_env.HOME }}/codes/aiida_core" - version: "v{{ aiida_version }}" - -- name: "Activate TAB completion in virtualenv" - lineinfile: - path: "{{ aiida_venv }}/bin/activate" - line: 'eval "$(verdi completioncommand)"' - -- name: "Check if AiiDA has already been configured" - stat: path="{{ ansible_env.HOME }}/.aiida/config.json" - register: aiida_config_file - -- name: "Configure AiiDA" - # Need to use the full path because it's in a virtualenv - shell: | - {{ aiida_venv }}/bin/verdi setup default --non-interactive \ - --email aiida@localhost \ - --backend django \ - --db_host localhost --db_port 5432 \ - --db_name {{ aiida_postgres_db }} \ - --db_user {{ aiida_postgres_user }} --db_pass '{{ aiida_postgres_pw }}' \ - --repo {{ ansible_env.HOME }}/.aiida/repository-aiida/ - when: aiida_config_file.stat.exists == False - -# TODO: change this 'when' condition: this might create problems -# if there's an error between the previous task and this one -- name: "Set the default AiiDA profile" - shell: | - {{ aiida_venv }}/bin/verdi profile setdefault verdi default - {{ aiida_venv }}/bin/verdi profile setdefault daemon default - when: aiida_config_file.stat.exists == False - -- import_role: - name: release_notes - vars: - section: "AiiDA" - option: "version" - value: "{{ aiida_version }}" - when: release_notes is defined and release_notes - -- import_role: - name: release_notes - vars: - section: "AiiDA" - option: "usage" - value: >- - AiiDA is installed in a virtual environment. - Type 'workon aiida' to get access to the 'verdi' commands. - when: release_notes is defined and release_notes diff --git a/roles/aiida/tasks/aiida-cp2k.yml b/roles/aiida/tasks/aiida-cp2k.yml deleted file mode 100644 index 057a42c..0000000 --- a/roles/aiida/tasks/aiida-cp2k.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- name: "install aiida-cp2k-{{ aiida_cp2k_version }} from PyPI" - pip: - name: aiida-cp2k - version: "{{ aiida_cp2k_version }}" - virtualenv: "{{ aiida_venv }}" - register: pip_install - -- name: run reentry scan - shell: "{{ aiida_venv }}/bin/reentry scan -r aiida" - when: pip_install.changed - -- name: set up cp2k codes for localhost - include_tasks: code-setup.yml code={{ item }} - with_items: "{{cp2k_executables}}" - vars: - - aiida_code_name: "cp2k-{{cp2k_version}}" - - aiida_code_template: cp2k.code - - aiida_computer_name: "{{ aiida_localhost_name }}" - when: cp2k_executables is defined - -- import_role: - name: release_notes - vars: - section: AiiDA - option: aiida-cp2k - value: >- - aiida-cp2k {{ aiida_cp2k_version }} is installed. - when: release_notes is defined and release_notes diff --git a/roles/aiida/tasks/aiida-daemon.yml b/roles/aiida/tasks/aiida-daemon.yml deleted file mode 100644 index 2eb36c8..0000000 --- a/roles/aiida/tasks/aiida-daemon.yml +++ /dev/null @@ -1,20 +0,0 @@ -#- name: Check AiiDA daemon status -# shell: "{{ aiida_venv }}/bin/verdi daemon status" -# register: aiida_daemon_status -# changed_when: False - -- name: Add AiiDA Daemon as system service - become: True - template: - src: aiida-daemon.service - dest: /etc/systemd/system - owner: root - group: root - mode: 0644 - -- name: Start AiiDA Daemon system service - become: True - systemd: - name: aiida-daemon - daemon-reload: yes - state: restarted diff --git a/roles/aiida/tasks/aiida-examples.yml b/roles/aiida/tasks/aiida-examples.yml deleted file mode 100644 index 869ad57..0000000 --- a/roles/aiida/tasks/aiida-examples.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: get AiiDA MaX examples - git: - repo: https://github.com/aiidateam/aiida-max-examples.git - dest: "{{ aiida_examples_folder }}/aiida-max-examples" - version: master - -- name: get AiiDA demos - git: - repo: https://github.com/aiidateam/aiida_demos.git - dest: "{{ aiida_examples_folder }}/aiida-demos" - version: master diff --git a/roles/aiida/tasks/aiida-fleur.yml b/roles/aiida/tasks/aiida-fleur.yml deleted file mode 100644 index 81b9627..0000000 --- a/roles/aiida/tasks/aiida-fleur.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -# latest version not available on PYPI -#- name: "install aiida-fleur-{{ aiida_fleur_version }} from PyPI" -# pip: -# name: aiida-fleur -# version: "{{ aiida_fleur_version }}" -# virtualenv: "{{ aiida_venv }}" -# register: pip_install -# -- name: Get aiida-fleur from github - get_url: - url: "https://github.com/broeder-j/aiida-fleur/archive/{{ aiida_fleur_version }}.tar.gz" - dest: "{{ aiida_code_folder }}/aiida-fleur-{{ aiida_fleur_version }}.tar.gz" - mode: "u+r" - register: aiida_fleur_download - -- name: Unpack aiida-fleur source - unarchive: - src: "{{ aiida_fleur_download.dest }}" - dest: "{{ aiida_code_folder }}" - remote_src: True - -- name: Install aiida-fleur - pip: - name: "aiida-fleur-{{ aiida_fleur_version }}/" - virtualenv: "{{ aiida_venv }}" - chdir: "{{ aiida_code_folder}}" - register: pip_install - - -- name: run reentry scan - shell: "{{ aiida_venv }}/bin/reentry scan -r aiida" - when: pip_install.changed - -- name: set up fleur codes for localhost - include_tasks: code-setup.yml code={{ item }} - with_items: "{{fleur_executables}}" - vars: - - aiida_code_name: "fleur-{{fleur_version}}-{{code}}" - - aiida_code_template: fleur.code - - aiida_computer_name: "{{ aiida_localhost_name }}" - when: fleur_executables is defined - -- import_role: - name: release_notes - vars: - section: AiiDA - option: aiida-fleur - value: >- - aiida-fleur {{ aiida_fleur_version }} is installed. - when: release_notes is defined and release_notes diff --git a/roles/aiida/tasks/aiida-pps-oncv.yml b/roles/aiida/tasks/aiida-pps-oncv.yml deleted file mode 100644 index 5db5424..0000000 --- a/roles/aiida/tasks/aiida-pps-oncv.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -# extract and prepare oncv -- name: "Create {{ pp.folder }}/" - file: - path: "{{ aiida_code_folder }}/{{ pp.folder }}" - state: directory - -- name: "Unpack {{ pp.file }}" - unarchive: - src: "{{ aiida_pp_download.dest }}" - dest: "{{ aiida_code_folder }}/{{ pp.folder }}" - remote_src: True - -- name: Copy script to select pseudos - copy: - src: oncv-select-pps.sh - dest: "{{ aiida_code_folder }}/{{ pp.folder }}" - -- name: run script to select pseudos - shell: bash oncv-select-pps.sh - args: - chdir: "{{ aiida_code_folder }}/{{ pp.folder }}" - -- name: Add upf family - shell: "{{ aiida_venv }}/bin/verdi data upf uploadfamily {{aiida_code_folder}}/{{ pp.folder }} {{ pp.name }} '{{ pp.description }}'" diff --git a/roles/aiida/tasks/aiida-pps-sssp.yml b/roles/aiida/tasks/aiida-pps-sssp.yml deleted file mode 100644 index 12ab78b..0000000 --- a/roles/aiida/tasks/aiida-pps-sssp.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- name: Import {{ pp.file }} - shell: "{{ aiida_venv }}/bin/verdi import {{aiida_code_folder}}/{{ pp.file }}" - diff --git a/roles/aiida/tasks/aiida-pps.yml b/roles/aiida/tasks/aiida-pps.yml deleted file mode 100644 index 1ed03e0..0000000 --- a/roles/aiida/tasks/aiida-pps.yml +++ /dev/null @@ -1,27 +0,0 @@ -# add pseudopotential family -- name: Download "{{ pp.file }}" - get_url: - url: "{{ pp.url }}/{{ pp.file }}" - dest: "{{ aiida_code_folder }}/{{ pp.file }}" - mode: "u+r" - tags: aiida_pps - register: aiida_pp_download - -- import_tasks: aiida-pps-sssp.yml - tags: aiida_pps - when: "'sssp' in pp.name and aiida_pp_download.changed" - -- import_tasks: aiida-pps-oncv.yml - tags: aiida_pps - when: "'oncv' in pp.name and aiida_pp_download.changed" - -- import_role: - name: release_notes - vars: - section: "AiiDA" - option: "{{ pp.name }}" - value: >- - pseudopotential family {{ pp.name }}: {{ pp.description }} - homepage: {{ pp.home_page }} - tags: aiida_pps - when: release_notes is defined and release_notes diff --git a/roles/aiida/tasks/aiida-quantumespresso.yml b/roles/aiida/tasks/aiida-quantumespresso.yml deleted file mode 100644 index d5a97f9..0000000 --- a/roles/aiida/tasks/aiida-quantumespresso.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- name: "install aiida-quantumespresso-{{ aiida_quantumespresso_version }} from PyPI" - pip: - name: aiida-quantumespresso - version: "{{ aiida_quantumespresso_version }}" - virtualenv: "{{ aiida_venv }}" - register: pip_install - -- name: run reentry scan - shell: "{{ aiida_venv }}/bin/reentry scan -r aiida" - when: pip_install.changed - -- name: set up QE codes for localhost - include_tasks: code-setup.yml code={{ item }} - with_items: "{{quantum_espresso_executables}}" - vars: - - aiida_code_name: "qe-{{code}}-{{quantum_espresso_version}}" - - aiida_code_template: qe.code - - aiida_computer_name: "{{ aiida_localhost_name }}" - when: quantum_espresso_executables is defined - -- import_role: - name: release_notes - vars: - section: "AiiDA" - option: "aiida-quantumespresso" - value: >- - aiida-quantumespresso {{ aiida_quantumespresso_version }} is installed. - when: release_notes is defined and release_notes diff --git a/roles/aiida/tasks/aiida-siesta.yml b/roles/aiida/tasks/aiida-siesta.yml deleted file mode 100644 index 9528fdb..0000000 --- a/roles/aiida/tasks/aiida-siesta.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- name: "install aiida-siesta-{{ aiida_siesta_version }} from PyPI" - pip: - name: aiida-siesta - version: "{{ aiida_siesta_version }}" - virtualenv: "{{ aiida_venv }}" - register: pip_install - -- name: run reentry scan - shell: "{{ aiida_venv }}/bin/reentry scan -r aiida" - when: pip_install.changed - -- name: set up siesta codes for localhost - include_tasks: code-setup.yml code={{ item }} - with_items: "{{siesta_executables}}" - vars: - - aiida_code_name: "siesta-{{siesta_version}}" - - aiida_code_template: siesta.code - - aiida_computer_name: "{{ aiida_localhost_name }}" - when: siesta_executables is defined - -- import_role: - name: release_notes - vars: - section: AiiDA - option: aiida-siesta - value: >- - aiida-siesta {{ aiida_siesta_version }} is installed. - when: release_notes is defined and release_notes diff --git a/roles/aiida/tasks/aiida-wannier90.yml b/roles/aiida/tasks/aiida-wannier90.yml deleted file mode 100644 index a96d302..0000000 --- a/roles/aiida/tasks/aiida-wannier90.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: "install aiida-wannier90-{{ aiida_wannier90_version }} from PyPI" - pip: - name: aiida-wannier90 - version: "{{ aiida_wannier90_version }}" - virtualenv: "{{ aiida_venv }}" - register: pip_install - -- name: run reentry scan - shell: "{{ aiida_venv }}/bin/reentry scan -r aiida" - when: pip_install.changed - -- name: set up Wannier90 codes for localhost - include_tasks: code-setup.yml code={{ item.execname }} - with_items: "{{ wannier90_executables }}" - vars: - - aiida_code_name: "wannier90-{{wannier90_version}}" - - aiida_code_template: wannier90.code - - aiida_computer_name: "{{ aiida_localhost_name }}" - # Only Wannier90.x has a plugin for AiiDA so far - when: wannier90_executables is defined and items.execname == "wannier90.x" - -- import_role: - name: release_notes - vars: - section: AiiDA - option: aiida-wannier90 - value: >- - aiida-wannier90 {{ aiida_wannier90_version }} is installed. - when: release_notes is defined and release_notes diff --git a/roles/aiida/tasks/aiida-yambo.yml b/roles/aiida/tasks/aiida-yambo.yml deleted file mode 100644 index e4cfc35..0000000 --- a/roles/aiida/tasks/aiida-yambo.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: "install aiida-yambo-{{ aiida_yambo_version }} from PyPI" - pip: - name: aiida-yambo - version: "{{ aiida_yambo_version }}" - virtualenv: "{{ aiida_venv }}" - register: pip_install - -- name: run reentry scan - shell: "{{ aiida_venv }}/bin/reentry scan -r aiida" - when: pip_install.changed - -# Do not use the yambo_executables directly because not all of them -# have an AiiDA plugin -- name: set up Yambo codes for localhost - include_tasks: code-setup.yml code={{ item }} - with_items: - - yambo - - p2y - vars: - - aiida_code_name: "{{code}}-{{yambo_version}}" - - aiida_code_template: yambo.code - - aiida_computer_name: "{{ aiida_localhost_name }}" - when: yambo_executables is defined - -- import_role: - name: release_notes - vars: - section: AiiDA - option: aiida-yambo - value: >- - aiida-yambo {{ aiida_yambo_version }} is installed. - when: release_notes is defined and release_notes diff --git a/roles/aiida/tasks/code-setup.yml b/roles/aiida/tasks/code-setup.yml deleted file mode 100644 index 59239dd..0000000 --- a/roles/aiida/tasks/code-setup.yml +++ /dev/null @@ -1,16 +0,0 @@ -- name: "Check if {{ aiida_code_name }} is already present" - shell: "{{ aiida_venv }}/bin/verdi code show {{ aiida_code_name }}@{{ aiida_computer_name }}" - ignore_errors: True - register: aiida_check_code - changed_when: False - -- name: "Copy {{ aiida_code_template }} to setup the AiiDA code" - template: - src: "{{ aiida_code_template }}" - dest: "{{ ansible_env.HOME }}/.local/share/marvelnccr/" - mode: 0755 - when: aiida_check_code.rc != 0 - -- name: "Set up the {{ aiida_code_name }} code for AiiDA" - shell: "cat {{ ansible_env.HOME }}/.local/share/marvelnccr/{{ aiida_code_template }} | {{ aiida_venv }}/bin/verdi code setup" - when: aiida_check_code.rc != 0 diff --git a/roles/aiida/tasks/computer-setup.yml b/roles/aiida/tasks/computer-setup.yml deleted file mode 100644 index a660965..0000000 --- a/roles/aiida/tasks/computer-setup.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: check if the AiiDA computer is already present - shell: "{{ aiida_venv }}/bin/verdi computer show {{ aiida_computer_name }}" - ignore_errors: True - register: aiida_check_computer - changed_when: False - -- name: Copy the script to setup the {{ aiida_computer_name }} AiiDA computer - template: - src: "{{ aiida_computer_name }}.computer" - dest: "{{ ansible_env.HOME }}/.local/share/marvelnccr/" - mode: 0755 - when: aiida_check_computer.rc != 0 - -- name: "Setup {{ aiida_computer_setup }} computer for AiiDA" - shell: "cat {{ ansible_env.HOME }}/.local/share/marvelnccr/{{ aiida_computer_name }}.computer | {{ aiida_venv }}/bin/verdi computer setup" - when: aiida_check_computer.rc != 0 - -- name: "Configure localhost" - shell: "{{ aiida_venv }}/bin/verdi computer configure {{ aiida_computer_name }}" - when: (aiida_check_computer.rc != 0) and (aiida_computer_name == aiida_localhost_name) diff --git a/roles/aiida/tasks/computers-setup.yml b/roles/aiida/tasks/computers-setup.yml deleted file mode 100644 index 54e252d..0000000 --- a/roles/aiida/tasks/computers-setup.yml +++ /dev/null @@ -1,15 +0,0 @@ -- name: set up aiida computers - include_tasks: computer-setup.yml aiida_computer_name={{ item }} - with_items: - - "{{ aiida_localhost_name }}" - -- import_role: - name: release_notes - vars: - section: "AiiDA" - option: "computers" - value: >- - localhost has already been set up and configured. - List all available computers with 'verdi computer list -a' - when: release_notes is defined and release_notes - diff --git a/roles/aiida/tasks/main.yml b/roles/aiida/tasks/main.yml deleted file mode 100644 index f6143b1..0000000 --- a/roles/aiida/tasks/main.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- import_tasks: aiida-core.yml - tags: aiida,aiida_core -- import_tasks: aiida-daemon.yml - tags: aiida_daemon,aiida_core - -- import_tasks: computers-setup.yml - -# codes need to come after computers -- import_tasks: aiida-quantumespresso.yml - tags: aiida_quantumespresso - vars: - aiida_quantumespresso_version: "{{ aiida_plugin_versions.aiida_quantumespresso }}" - when: "'aiida_quantumespresso' in aiida_plugins" -- import_tasks: aiida-yambo.yml - tags: aiida_yambo - vars: - aiida_yambo_version: "{{ aiida_plugin_versions.aiida_yambo }}" - when: "'aiida_yambo' in aiida_plugins" -- import_tasks: aiida-fleur.yml - tags: aiida_fleur - vars: - aiida_fleur_version: "{{ aiida_plugin_versions.aiida_fleur }}" - when: "'aiida_fleur' in aiida_plugins" -- import_tasks: aiida-siesta.yml - tags: aiida_siesta - vars: - aiida_siesta_version: "{{ aiida_plugin_versions.aiida_siesta }}" - when: "'aiida_siesta' in aiida_plugins" -- import_tasks: aiida-cp2k.yml - tags: aiida_cp2k - vars: - aiida_cp2k_version: "{{ aiida_plugin_versions.aiida_cp2k }}" - when: "'aiida_cp2k' in aiida_plugins" -- import_tasks: aiida-wannier90.yml - tags: aiida_wannier90 - vars: - aiida_wannier90_version: "{{ aiida_plugin_versions.aiida_wannier90 }}" - when: "'aiida_wannier90' in aiida_plugins" - -- include_tasks: aiida-pps.yml - vars: - pp: "{{ item }}" - with_items: "{{ aiida_pseudopotentials }}" - tags: aiida_pps - -- import_tasks: aiida-examples.yml - tags: aiida_examples diff --git a/roles/aiida/templates/aiida-daemon.service b/roles/aiida/templates/aiida-daemon.service deleted file mode 100644 index da1dde5..0000000 --- a/roles/aiida/templates/aiida-daemon.service +++ /dev/null @@ -1,24 +0,0 @@ -[Unit] -Description=AiiDA daemon service -After=network.target - -[Service] -Type=forking -ExecStart={{ aiida_venv }}/bin/verdi daemon start -PIDFile={{ ansible_env.HOME }}/.aiida/daemon/log/celery.pid -# 2s delay to prevent read error on PID file -ExecStartPost=/bin/sleep 2 - -ExecStop={{ aiida_venv }}/bin/verdi daemon stop -ExecReload={{ aiida_venv }}/bin/verdi daemon restart - -User={{ ansible_user }} -Group={{ ansible_user }} -Restart=on-failure -RestartSec=60 # Restart daemon after 1 min if crashes -StandardOutput=syslog -StandardError=syslog -SyslogIdentifier=aiida-daemon - -[Install] -WantedBy=multi-user.target diff --git a/roles/aiida/templates/cp2k.code b/roles/aiida/templates/cp2k.code deleted file mode 100755 index 3ed0ea6..0000000 --- a/roles/aiida/templates/cp2k.code +++ /dev/null @@ -1,8 +0,0 @@ -{{ aiida_code_name }} -cp2k v{{ cp2k_version }} from source forge -False -cp2k -{{ aiida_computer_name }} -{{ cp2k_topdir }}/exe/{{ code }} - - diff --git a/roles/aiida/templates/fleur.code b/roles/aiida/templates/fleur.code deleted file mode 100755 index 85af7a3..0000000 --- a/roles/aiida/templates/fleur.code +++ /dev/null @@ -1,8 +0,0 @@ -{{ aiida_code_name }} -fleur v{{ fleur_version }} {{ fleur_release }} -False -fleur.{{ code }} -{{ aiida_computer_name }} -{{ fleur_topdir }}/build/{{ code }} -ulimit -s unlimited - diff --git a/roles/aiida/templates/localhost.computer b/roles/aiida/templates/localhost.computer deleted file mode 100755 index 0f88b6a..0000000 --- a/roles/aiida/templates/localhost.computer +++ /dev/null @@ -1,12 +0,0 @@ -localhost -localhost - -True -local -torque -#!/bin/bash -{{aiida_run_folder}} -mpirun -np {tot_num_mpiprocs} -{{ aiida_localhost_cpus }} - - diff --git a/roles/aiida/templates/qe.code b/roles/aiida/templates/qe.code deleted file mode 100755 index 920f63e..0000000 --- a/roles/aiida/templates/qe.code +++ /dev/null @@ -1,8 +0,0 @@ -{{ aiida_code_name }} -{{ code }}.x from Quantum ESPRESSO {{ quantum_espresso_version }} -False -quantumespresso.{{ code }} -{{ aiida_computer_name }} -{{ quantum_espresso_topdir }}/bin/{{ code }}.x - - diff --git a/roles/aiida/templates/siesta.code b/roles/aiida/templates/siesta.code deleted file mode 100755 index 076e3b4..0000000 --- a/roles/aiida/templates/siesta.code +++ /dev/null @@ -1,8 +0,0 @@ -{{ aiida_code_name }} -siesta v{{ siesta_version }} -False -siesta.{{ code }} -{{ aiida_computer_name }} -{{ siesta_topdir }}/Obj/{{ code }} - - diff --git a/roles/aiida/templates/wannier90.code b/roles/aiida/templates/wannier90.code deleted file mode 100755 index 2c8cd67..0000000 --- a/roles/aiida/templates/wannier90.code +++ /dev/null @@ -1,8 +0,0 @@ -{{ aiida_code_name }} -Wannier90 v{{ wannier90_version }} -False -wannier90.wannier90 -{{ aiida_computer_name }} -{{ wannier90_topdir }}/{{ code }} - - diff --git a/roles/aiida/templates/yambo.code b/roles/aiida/templates/yambo.code deleted file mode 100755 index ab9fe94..0000000 --- a/roles/aiida/templates/yambo.code +++ /dev/null @@ -1,8 +0,0 @@ -{{ aiida_code_name }} -{{ code }} from YAMBO {{ yambo_version }} compiled -False -yambo.yambo -{{ aiida_computer_name }} -{{ yambo_topdir }}/bin/{{ code }} - - diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml deleted file mode 100644 index 26f5139..0000000 --- a/roles/common/defaults/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Note: don't use characters that are special for regexps here! -common_bashrc_string: "## Add commands before this line if you want them to run also non-interactively" -common_hostname: localhost -common_vm_user: ubuntu -#common_vm_password: # Need to define this variable! -common_headless: False -common_browser: firefox diff --git a/roles/common/handlers/main.yml b/roles/common/handlers/main.yml deleted file mode 100644 index 2e0adcd..0000000 --- a/roles/common/handlers/main.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: apt clean - become: True - listen: - - apt clean - apt: - autoclean: True - -- name: remove ~/.cache - listen: - - apt clean - - clean cache - file: - state: absent - path: "{{ ansible_env.HOME }}/.cache" - -- name: apt autoremove - become: True - listen: - - apt clean - apt: - autoremove: True diff --git a/roles/common/tasks/bashrc_refpoint.yml b/roles/common/tasks/bashrc_refpoint.yml deleted file mode 100644 index 3c141d9..0000000 --- a/roles/common/tasks/bashrc_refpoint.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: "Put a line in ~/.bashrc that acts as a reference point to add lines also when bash is run non-interactively (e.g. via ssh)" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "{{ common_bashrc_string }}" - insertbefore: "^# If not running interactively.*$" diff --git a/roles/common/tasks/hostname.yml b/roles/common/tasks/hostname.yml deleted file mode 100644 index a7dcae9..0000000 --- a/roles/common/tasks/hostname.yml +++ /dev/null @@ -1,36 +0,0 @@ -- name: "get the machine hostname" - become: true - shell: "hostname" - register: cur_hostname_command - changed_when: False - - # This updates both the current hostname and /etc/hostname -- name: "update machine hostname, if necessary" - become: true - shell: "hostnamectl set-hostname {{ common_hostname }}" - when: cur_hostname_command.stdout != common_hostname - -- name: "remove any lines with 127.0.1.1" - become: true - lineinfile: - path: "/etc/hosts" - regexp: '^127\.0\.1\.1' - state: absent - owner: root - group: root - mode: 0644 - -- name: "set 127.0.1.1 to localhost (if it's set to the hostname, pbs server complains)" - become: true - lineinfile: - path: "/etc/hosts" - regexp: '^127\.0\.1\.1' - line: "127.0.1.1 localhost" - -- name: "set hostname for dynamic ip address in /etc/hosts (needed for PBS Torque)" - become: true - lineinfile: - path: "/etc/hosts" - # lines ending with hostname - regexp: "{{ common_hostname }}$" - line: "{{ ansible_default_ipv4.address }} {{ common_hostname }}" diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml deleted file mode 100644 index 5706a0c..0000000 --- a/roles/common/tasks/main.yml +++ /dev/null @@ -1,17 +0,0 @@ -- import_tasks: password.yml - tags: common_password -- import_tasks: bashrc_refpoint.yml - tags: common_bashrc -- import_tasks: swap.yml - tags: common_swap -- import_tasks: packages.yml - tags: common_packages -- import_tasks: ubuntu_desktop.yml - tags: common_desktop - when: not common_headless -- import_tasks: hostname.yml - tags: common_hostname -- import_tasks: timezone.yml - tags: common_timezone -- import_tasks: stacksize.yml - tags: common_stacksize diff --git a/roles/common/tasks/packages.yml b/roles/common/tasks/packages.yml deleted file mode 100644 index 8b131bc..0000000 --- a/roles/common/tasks/packages.yml +++ /dev/null @@ -1,52 +0,0 @@ -- name: Update repositories cache & upgrade packages - become: true - apt: - update_cache: yes - upgrade: yes - cache_valid_time: 86400 #One day - -- name: Install apt & pip - become: true - apt: - name: "{{item}}" - state: latest - with_items: - - aptitude - - python-pip - - python-dev - notify: apt clean - -- name: upgrade pip - become: true - pip: - name: pip - extra_args: --upgrade - notify: clean cache - -- name: add packages (pip) - become: true - pip: - name: "{{item}}" - with_items: - - virtualenv - - virtualenvwrapper - -- name: "Run virtualenvwrapper once to create folders" - shell: "bash /usr/local/bin/virtualenvwrapper.sh" - args: - creates: "{{ ansible_env.HOME }}/.virtualenvs/initialize" - -# This fixes https://github.com/marvel-nccr/marvel-virtualmachine/issues/21 -- name: "Fix virtualenvwrapper python executable" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- name: "Activate the virtualenvwrapper for the user" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "source /usr/local/bin/virtualenvwrapper.sh" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" diff --git a/roles/common/tasks/password.yml b/roles/common/tasks/password.yml deleted file mode 100644 index c6b7e6e..0000000 --- a/roles/common/tasks/password.yml +++ /dev/null @@ -1,8 +0,0 @@ - # On MacOS this requires the passlib python module -- name: Changing password for {{ common_vm_user }} - become: True - user: - name: "{{ common_vm_user }}" - # string filter is workaround for ansible vault issue - # https://github.com/ansible/ansible/pull/35406 - password: "{{ common_vm_password | string | password_hash('sha512') }}" diff --git a/roles/common/tasks/stacksize.yml b/roles/common/tasks/stacksize.yml deleted file mode 100644 index fa00862..0000000 --- a/roles/common/tasks/stacksize.yml +++ /dev/null @@ -1,7 +0,0 @@ -# this is needed by many codes... -- name: set stack size to unlimited - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: ulimit -s unlimited - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" diff --git a/roles/common/tasks/swap.yml b/roles/common/tasks/swap.yml deleted file mode 100644 index 954dde7..0000000 --- a/roles/common/tasks/swap.yml +++ /dev/null @@ -1,25 +0,0 @@ -- name: "Check if swapfile exists" - stat: path=/swapfile - register: swapfile_stat - -- name: "Create swapfile" - become: true - command: "dd if=/dev/zero of=/swapfile bs=1M count=1024" - when: swapfile_stat.stat.exists == False - -- name: "Make the swapfile a valid swap" - become: true - command: "mkswap /swapfile" - when: swapfile_stat.stat.exists == False - -- name: "Use the swapfile" - become: true - command: "swapon /swapfile" - when: swapfile_stat.stat.exists == False - -- name: "Put a line in fstab to ensure swap is used at boot time" - become: true - lineinfile: - path: "/etc/fstab" - line: "/swapfile swap swap defaults 0 0" - when: swapfile_stat.stat.exists == False diff --git a/roles/common/tasks/timezone.yml b/roles/common/tasks/timezone.yml deleted file mode 100644 index 29d65af..0000000 --- a/roles/common/tasks/timezone.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: set timezone to Europe/Zurich - become: true - timezone: - name: Europe/Zurich diff --git a/roles/common/tasks/ubuntu_desktop.yml b/roles/common/tasks/ubuntu_desktop.yml deleted file mode 100644 index 0c3becc..0000000 --- a/roles/common/tasks/ubuntu_desktop.yml +++ /dev/null @@ -1,31 +0,0 @@ -- name: Install ubuntu-desktop (apt) - become: true - apt: - name: "{{item}}" - state: latest - with_items: - - ubuntu-desktop - #- lxde - #- lxde-common - notify: apt clean - -- name: Start lightdm service to get a graphical login - become: true - service: - name: lightdm - state: started - -- name: install chromium-browser - become: true - apt: - name: "chromium-browser" - state: latest - notify: apt clean - when: common_browser == 'chromium' - -- name: - import_role: - name: gantsign.default-web-browser - vars: - default_web_browser: chromium-browser - when: common_browser == 'chromium' diff --git a/roles/cp2k/defaults/main.yml b/roles/cp2k/defaults/main.yml deleted file mode 100644 index 6a0ce16..0000000 --- a/roles/cp2k/defaults/main.yml +++ /dev/null @@ -1,20 +0,0 @@ -cp2k_version: "5.1" -#cp2k_apt_version: "4.1-1" -cp2k_executables: - - cp2k.ssmp - -cp2k_src: cp2k-{{ cp2k_version }} -cp2k_src_archive: "{{ cp2k_src }}.tar.bz2" -cp2k_code_folder: "{{ ansible_env.HOME }}" -cp2k_url: "https://sourceforge.net/projects/cp2k/files/{{ cp2k_src_archive }}/download" -cp2k_topdir: "{{ cp2k_code_folder }}/{{cp2k_src}}" -#cp2k_make_arch: Linux-x86-64-gfortran -#cp2k_make_versions: -# - sopt -# - popt -#cp2k_make_cpus: 2 - -# binary download -cp2k_binary: cp2k-{{ cp2k_version }}-Linux-x86_64.ssmp -cp2k_binary_url: "https://sourceforge.net/projects/cp2k/files/precompiled/{{ cp2k_binary }}" -cp2k_svn_url: "https://sourceforge.net/p/cp2k/code/HEAD/tree/branches/cp2k-5_1-branch/cp2k" diff --git a/roles/cp2k/tasks/download_binary.yml b/roles/cp2k/tasks/download_binary.yml deleted file mode 100644 index 3b3cdff..0000000 --- a/roles/cp2k/tasks/download_binary.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -- name: make cp2k topdir - file: - dest: "{{ cp2k_topdir }}/exe" - state: directory - -- name: download cp2k binary - get_url: - url: "{{ cp2k_binary_url }}" - dest: "{{ cp2k_topdir }}/exe/{{ cp2k_binary }}" - mode: "u+x" - -- name: symlink binary - file: - src: "{{ cp2k_topdir }}/exe/{{ cp2k_binary }}" - dest: "{{ cp2k_topdir }}/exe/cp2k.ssmp" - state: link - - - #- name: download cp2k data files - # get_url: - # url: "{{ cp2k_svn_url }}/data/{{ item }}?format=raw" - # dest: "{{ cp2k_topdir }}" - # # for some reason, the first item used to time out - # # with the default timeout of 10s - # timeout: 30 - # with_items: - # - BASIS_MOLOPT - # - POTENTIAL - # - ALL_BASIS_SETS - # - ALL_POTENTIALS - -- name: download cp2k source - get_url: - url: "{{ cp2k_url }}" - dest: "{{ cp2k_code_folder }}" - # for some reason, the first item used to time out - # with the default timeout of 10s - timeout: 30 - -- name: Extract cp2k data directory - shell: | - tar xf {{ cp2k_src_archive }} {{ cp2k_src }}/data - args: - chdir: "{{ cp2k_code_folder }}" - - -- name: download copyright notice - get_url: - url: "{{ cp2k_svn_url }}/{{ item }}?format=raw" - dest: "{{ cp2k_topdir }}" - with_items: - - COPYRIGHT - -- name: "Put a line in ~/.bashrc to add cp2k to the path" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export PATH=${PATH}:{{ cp2k_topdir }}/exe" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- name: "Put a line in ~/.bashrc for cp2k data directory" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export CP2K_DATA_DIR={{ cp2k_topdir }}/data" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- import_role: - name: release_notes - vars: - section: "cp2k" - option: "usage" - value: >- - cp2k binary was downloaded from source forge. - simply run 'cp2k.ssmp' - when: release_notes is defined and release_notes - diff --git a/roles/cp2k/tasks/install_via_apt.yml b/roles/cp2k/tasks/install_via_apt.yml deleted file mode 100644 index 9d2b5cf..0000000 --- a/roles/cp2k/tasks/install_via_apt.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -# this worked only until it tried rebuilding the package in the ppa -# broken now... -- name: add repo with backport containing recent cp2k version - become: True - apt_repository: - repo: 'ppa:leopold-talirz/xenial-science-backports' - state: present - codename: xenial - update_cache: True - -- name: install cp2k {{ cp2k_version }} - become: True - apt: - name: cp2k={{ cp2k_version }} - state: installed - -- import_role: - name: release_notes - vars: - section: "cp2k" - option: "usage" - value: >- - cp2k was built via apt. - simply run cp2k.popt - when: release_notes is defined and release_notes - diff --git a/roles/cp2k/tasks/install_via_make.yml b/roles/cp2k/tasks/install_via_make.yml deleted file mode 100644 index 585576d..0000000 --- a/roles/cp2k/tasks/install_via_make.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -#quite a few dependencies) -# Will only download once -- name: Get cp2k source - get_url: - url: "{{ cp2k_url }}" - dest: "{{ cp2k_code_folder }}/{{ cp2k_src_archive }}" - register: cp2k_download - -- name: Extract cp2k source - unarchive: - src: "{{ cp2k_download.dest }}" - dest: "{{ cp2k_code_folder }}" - remote_src: yes - -- name: Make cp2k executables - shell: "make -j{{ cp2k_make_cpus }} ARCH={{ cp2k_make_arch }} VERSION={{ item }}" - args: - chdir: "{{ cp2k_topdir }}/makefiles" - creates: "{{ cp2k_topdir }}/exe/{{ cp2k_make_arch }}/cp2k.{{ item }}" - with_items: "{{ cp2k_make_versions }}" - register: cp2k_make - -- import_tasks: tests.yml - when: cp2k_make.changed and run_tests is defined and run_tests - -- name: "Put a line in ~/.bashrc to add cp2k to the path" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export PATH=${PATH}:{{ cp2k_topdir }}/bin" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- import_role: - name: release_notes - vars: - section: "cp2k" - option: "usage" - value: >- - cp2k was built in {{ cp2k_topdir }}. - simply run cp2k.popt - when: release_notes is defined and release_notes diff --git a/roles/cp2k/tasks/main.yml b/roles/cp2k/tasks/main.yml deleted file mode 100644 index f12c3cf..0000000 --- a/roles/cp2k/tasks/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -#- import_tasks: install_via_apt.yml -#- import_tasks: install_via_make.yml -- import_tasks: download_binary.yml - -- import_role: - name: release_notes - vars: - section: "cp2k" - option: "version" - value: "{{ cp2k_version }}" - when: release_notes is defined and release_notes diff --git a/roles/customizations/defaults/main.yml b/roles/customizations/defaults/main.yml deleted file mode 100644 index bd4e203..0000000 --- a/roles/customizations/defaults/main.yml +++ /dev/null @@ -1,13 +0,0 @@ -customizations_headless: False -customizations_vm_user: ubuntu -#customizations_vm_password: ubuntu # Need to specify this! -customizations_browser: firefox - -customizations_vm_name: "Quantum Mobile" -customizations_vm_version: "" -customizations_vm_shared_folder: "/shared" -customizations_vm_author: "MARVEL NCCR and MaX CoE" - -customizations_codes_folder: "{{ ansible_env.HOME }}" -customizations_examples_folder: "{{ ansible_env.HOME }}" -customizations_examples_readme: "{{ customizations_examples_folder }}/README.txt" diff --git a/roles/customizations/files/quantum-mobile-bg.png b/roles/customizations/files/quantum-mobile-bg.png deleted file mode 100644 index 5cb79f5..0000000 Binary files a/roles/customizations/files/quantum-mobile-bg.png and /dev/null differ diff --git a/roles/customizations/files/quantum-mobile-v2.png b/roles/customizations/files/quantum-mobile-v2.png deleted file mode 100644 index c8d8b71..0000000 Binary files a/roles/customizations/files/quantum-mobile-v2.png and /dev/null differ diff --git a/roles/customizations/handlers/main.yml b/roles/customizations/handlers/main.yml deleted file mode 100644 index 20b519d..0000000 --- a/roles/customizations/handlers/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: restart lightdm - become: true - service: - name: lightdm - state: restarted diff --git a/roles/customizations/tasks/autologin.yml b/roles/customizations/tasks/autologin.yml deleted file mode 100644 index 9f3775c..0000000 --- a/roles/customizations/tasks/autologin.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: enable autologin - become: true - ini_file: - path: /etc/lightdm/lightdm.conf.d/12-autologin.conf - section: "Seat:*" - option: "autologin-user" - value: "{{ customizations_vm_user }}" - -- name: disable autologin timeout - become: true - ini_file: - path: /etc/lightdm/lightdm.conf.d/12-autologin.conf - section: "Seat:*" - option: "autologin-user-timeout" - value: "0" diff --git a/roles/customizations/tasks/chromium_keyring.yml b/roles/customizations/tasks/chromium_keyring.yml deleted file mode 100644 index dc2631e..0000000 --- a/roles/customizations/tasks/chromium_keyring.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: don't use keyring in chromium - become: True - lineinfile: - path: /etc/chromium-browser/default - line: CHROMIUM_FLAGS="--password-store=basic" - regexp: "^CHROMIUM_FLAGS=" diff --git a/roles/customizations/tasks/disable_autolock.yml b/roles/customizations/tasks/disable_autolock.yml deleted file mode 100644 index 1288290..0000000 --- a/roles/customizations/tasks/disable_autolock.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: disable autolock after idle - dconf: - key: "{{ item }}" - value: "false" - state: present - with_items: - - /org/gnome/desktop/screensaver/idle-activation-enabled - - /org/gnome/desktop/screensaver/lock-enabled diff --git a/roles/customizations/tasks/disable_guestuser.yml b/roles/customizations/tasks/disable_guestuser.yml deleted file mode 100644 index d3695cb..0000000 --- a/roles/customizations/tasks/disable_guestuser.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: disable guest account - become: true - ini_file: - path: /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf - section: "Seat:*" - option: "allow-guest" - value: "false" - notify: restart lightdm - register: disable_guest_account - -- name: hide vagrant user on login screen - become: true - ini_file: - path: /var/lib/AccountsService/users/vagrant - section: "User" - option: "SystemAccount" - value: "true" - notify: restart lightdm diff --git a/roles/customizations/tasks/folders.yml b/roles/customizations/tasks/folders.yml deleted file mode 100644 index d2c56bb..0000000 --- a/roles/customizations/tasks/folders.yml +++ /dev/null @@ -1,41 +0,0 @@ -- name: Create folder for codes - file: - path: "{{ customizations_codes_folder }}" - state: directory - -- name: clean archives of codes - shell: rm -f *.tar *.tar.gz *.zip *.bz2 *.aiida - ignore_errors: True - args: - chdir: "{{ customizations_codes_folder }}" - when: clean is defined and clean - -- name: Create folder for examples - file: - path: "{{ customizations_examples_folder }}" - state: directory - -- name: clean compiled python files - shell: find . -name "*.pyc" | xargs rm -f - ignore_errors: True - args: - chdir: "{{ customizations_examples_folder }}" - when: clean is defined and clean - -- name: Add readme for examples - ini_file: - path: "{{ customizations_examples_readme }}" - section: "General" - option: "info" - value: >- - This folder contains examples of how to use the various codes that are - available in the VM. - You find this folder both in the user home directory and (symlinked) on - the Desktop. - create: true - -- name: symlink examples to desktop - file: - src: "{{ customizations_examples_folder }}" - dest: "{{ ansible_env.HOME }}/Desktop/examples" - state: link diff --git a/roles/customizations/tasks/global_bashrc.yml b/roles/customizations/tasks/global_bashrc.yml deleted file mode 100644 index f2f0869..0000000 --- a/roles/customizations/tasks/global_bashrc.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: set the Message Of The Day (MOTD) - become: true - template: - src: motd - dest: "/etc/motd" - mode: 0644 - -- name: "Print motd always" - # Note that this is added at the end of the file, so - # with the default bashrc by Ubuntu, it's run only interactively - # moreover, login shells already print it by default - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "shopt -q login_shell || cat /etc/motd # Print only in non-login shells" diff --git a/roles/customizations/tasks/launcher.yml b/roles/customizations/tasks/launcher.yml deleted file mode 100644 index b2b6864..0000000 --- a/roles/customizations/tasks/launcher.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- - # see https://askubuntu.com/questions/846704/changing-gsettings-for-another-user-from-an-ansible-script-started-by-vagrant/967632 -- name: set icons/applications (with Firefox) - dconf: - key: /com/canonical/unity/launcher/favorites - value: "{{ launcher_favorites_firefox }}" - state: present - notify: restart lightdm - when: customizations_browser is 'chromium' - -- name: set icons/applications (with Chromium) - dconf: - key: /com/canonical/unity/launcher/favorites - value: "{{ launcher_favorites_chromium }}" - state: present - notify: restart lightdm - when: customizations_browser is 'chromium' diff --git a/roles/customizations/tasks/main.yml b/roles/customizations/tasks/main.yml deleted file mode 100644 index 7107460..0000000 --- a/roles/customizations/tasks/main.yml +++ /dev/null @@ -1,26 +0,0 @@ -- import_tasks: release_notes.yml - tags: customizations_release_notes - when: release_notes is defined and release_notes -- import_tasks: shared_folder.yml - tags: customizations_shared_folder -- import_tasks: global_bashrc.yml - tags: customizations_global_bashrc -- import_tasks: folders.yml - tags: customizations_folders - -- name: lightdm-related - block: - - import_tasks: disable_guestuser.yml - tags: customizations_disable_guestuser - - import_tasks: wallpaper.yml - tags: customizations_wallpaper - - import_tasks: launcher.yml - tags: customizations_launcher - - import_tasks: disable_autolock.yml - tags: customizations_disable_autolock - - import_tasks: autologin.yml - tags: customizations_autologin - - import_tasks: chromium_keyring.yml - tags: customizations_chromium_keyring - - meta: flush_handlers - when: not customizations_headless diff --git a/roles/customizations/tasks/release_notes.yml b/roles/customizations/tasks/release_notes.yml deleted file mode 100644 index 63deb1d..0000000 --- a/roles/customizations/tasks/release_notes.yml +++ /dev/null @@ -1,26 +0,0 @@ -- import_role: - name: release_notes - vars: - section: "{{ customizations_vm_name }}" - option: "version" - value: "{{ customizations_vm_version }}" - -- name: store Ubuntu version number - command: lsb_release -sd - changed_when: false - register: lsb_release - -- import_role: - name: release_notes - vars: - section: "{{ customizations_vm_name }}" - option: "Operating System" - value: "{{ lsb_release.stdout }}" - -- import_role: - name: release_notes - vars: - section: "{{ customizations_vm_name }}" - option: "Login credentials" - value: "{{ customizations_vm_user }} / {{ customizations_vm_password }}" - diff --git a/roles/customizations/tasks/shared_folder.yml b/roles/customizations/tasks/shared_folder.yml deleted file mode 100644 index 104f02c..0000000 --- a/roles/customizations/tasks/shared_folder.yml +++ /dev/null @@ -1,20 +0,0 @@ -- name: create mountpoint for shared folder - become: True - file: - path: "{{ customizations_vm_shared_folder }}" - owner: "{{ customizations_vm_user }}" - group: "{{ customizations_vm_user }}" - state: directory - -- import_role: - name: release_notes - vars: - section: "{{ customizations_vm_name }}" - option: "shared folder" - value: >- - Sharing a folder "/my/folder" with the VM: add folder in VirtualBox - Settings => Shared Folders as "vbox-folder", then mount it via - 'sudo mount -t vboxsf -o uid=1000,gid=1000 vbox-folder /shared' - create: true - when: release_notes is defined and release_notes - diff --git a/roles/customizations/tasks/wallpaper.yml b/roles/customizations/tasks/wallpaper.yml deleted file mode 100644 index 4d4bb34..0000000 --- a/roles/customizations/tasks/wallpaper.yml +++ /dev/null @@ -1,67 +0,0 @@ -- name: Create folder for generic MARVEL data - file: - path: "{{ ansible_env.HOME }}/.local/share/marvelnccr" - state: directory - -- name: Copy the background image - copy: - src: quantum-mobile-bg.png - dest: "{{ ansible_env.HOME }}/.local/share/marvelnccr/quantum-mobile-bg.png" - mode: 0755 - -- name: Create folder for generic MARVEL data in global machine - become: true - file: - path: "/usr/share/marvelnccr" - state: directory - mode: 0755 - -- name: Copy the background image - become: true - copy: - src: quantum-mobile-bg.png - dest: "/usr/share/marvelnccr/quantum-mobile-bg.png" - mode: 0755 - -- name: set lightdm (login page) not to draw the user background - become: true - ini_file: - path: /usr/share/glib-2.0/schemas/10_unity-settings-daemon.gschema.override - section: "com.canonical.unity-greeter" - option: "draw-user-backgrounds" - value: "false" - notify: restart lightdm - register: lightdm_draw_user_backgrounds - -- name: set lightdm (login page) background - become: true - ini_file: - path: /usr/share/glib-2.0/schemas/10_unity-settings-daemon.gschema.override - section: "com.canonical.unity-greeter" - option: "background" - value: "'/usr/share/marvelnccr/quantum-mobile-bg.png'" - notify: restart lightdm - register: lightdm_background - -- name: recreate schemas to apply modifications - become: true - command: glib-compile-schemas /usr/share/glib-2.0/schemas - when: (lightdm_background.changed) or (lightdm_draw_user_backgrounds.changed) - -- name: add packages (pip) - become: true - pip: - name: "{{item}}" - with_items: - # Needed to set the wallpaper (maybe?) - - psutil - -# To work around error: -# Cannot autolaunch D-Bus without X11 $DISPLAY -- name: set the background image - shell: "DISPLAY=:0.0 dbus-launch --exit-with-session gsettings set org.gnome.desktop.background picture-uri file://{{ ansible_env.HOME }}/.local/share/marvelnccr/quantum-mobile-bg.png" - args: - executable: /bin/bash - notify: restart lightdm - - diff --git a/roles/customizations/templates/motd b/roles/customizations/templates/motd deleted file mode 100755 index f8f533b..0000000 --- a/roles/customizations/templates/motd +++ /dev/null @@ -1,8 +0,0 @@ -########################################################################## -# Welcome to {{ customizations_vm_name }} version {{ customizations_vm_version }} -# distributed by the {{ customizations_vm_author }} -# -# Instructions: -# - See RELEASENOTES.txt on the Desktop for installed packages -# - type 'workon aiida' to enable the AiiDA 'verdi' commands -########################################################################## diff --git a/roles/customizations/vars/.gitignore b/roles/customizations/vars/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/roles/customizations/vars/main.yml b/roles/customizations/vars/main.yml deleted file mode 100644 index 898b9cc..0000000 --- a/roles/customizations/vars/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -launcher_favorites_firefox: "['application://ubiquity.desktop', 'application://org.gnome.Nautilus.desktop', 'application://firefox.desktop', 'application://gnome-terminal.desktop', 'application://gedit.desktop', 'application://libreoffice-writer.desktop', 'application://libreoffice-calc.desktop', 'unity://running-apps', 'unity://expo-icon']" - -launcher_favorites_chromium: "['application://ubiquity.desktop', 'application://org.gnome.Nautilus.desktop', 'application://chromium-browser.desktop', 'application://gnome-terminal.desktop', 'application://gedit.desktop', 'application://libreoffice-writer.desktop', 'application://libreoffice-calc.desktop', 'unity://running-apps', 'unity://expo-icon']" diff --git a/roles/editors/files/.gitignore b/roles/editors/files/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/roles/editors/files/.vimrc b/roles/editors/files/.vimrc deleted file mode 100644 index f2e143d..0000000 --- a/roles/editors/files/.vimrc +++ /dev/null @@ -1,9 +0,0 @@ -set tabstop=8 " tab character appears as 8 spaces -set softtabstop=0 -set expandtab " tab key inserts spaces instead of tab character -set shiftwidth=4 " by how many spaces to indent code -set smarttab " pressing tab jumps to current indentation level -set backspace=indent,eol,start " Let backspace delete over line breaks -filetype plugin on -syntax enable -filetype indent on diff --git a/roles/editors/tasks/main.yml b/roles/editors/tasks/main.yml deleted file mode 100644 index 6b11be7..0000000 --- a/roles/editors/tasks/main.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: Install some common editors - become: true - apt: - name: "{{item}}" - state: present - with_items: - - emacs24 - - vim - - nano - -- name: install basic .vimrc - copy: - src: .vimrc - dest: "{{ ansible_env.HOME }}" diff --git a/roles/editors/vars/.gitignore b/roles/editors/vars/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/roles/fleur/defaults/main.yml b/roles/fleur/defaults/main.yml deleted file mode 100644 index 50e8357..0000000 --- a/roles/fleur/defaults/main.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -fleur_version: "0.27" -fleur_release: "MaXR2.1" -fleur_src: fleur{{ fleur_release }} -fleur_code_folder: "{{ ansible_env.HOME }}" -fleur_url: "http://www.flapw.de/pm/uploads/FLEUR/{{fleur_src}}.tgz" -fleur_topdir: "{{ fleur_code_folder }}/fleur" -fleur_executables: - - fleur - - inpgen diff --git a/roles/fleur/tasks/main.yml b/roles/fleur/tasks/main.yml deleted file mode 100644 index febde1f..0000000 --- a/roles/fleur/tasks/main.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -- name: Install fleur dependencies - become: true - apt: - name: "{{ item }}" - state: latest - with_items: - - build-essential - - gfortran - - gfortran-6 - - g++-6 - - gcc-6 - - binutils-gold - - git - - cmake - - libxml2-dev - - liblapack-dev - - libblas-dev - - doxygen - -- name: Get fleur source - unarchive: - src: "{{ fleur_url }}" - dest: "{{ fleur_code_folder }}" - remote_src: yes - - # note: this does not throw an error, even if configure fails... -- name: Configure fleur - shell: FC=gfortran-6 ./configure.sh AUTO - args: - chdir: "{{ fleur_topdir }}" - creates: "{{ fleur_topdir }}/build/Makefile" - -- name: Make fleur executables - shell: "make" - args: - chdir: "{{ fleur_topdir }}/build" - creates: "{{ fleur_topdir }}/build/fleur" - register: fleur_make - -- import_tasks: tests.yml - when: fleur_make.changed and run_tests is defined and run_tests - -- name: "Put a line in ~/.bashrc to add fleur to the path" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export PATH=${PATH}:{{ fleur_topdir }}/build" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- import_role: - name: release_notes - vars: - section: "fleur" - option: "version" - value: "{{ fleur_version }} {{ fleur_release }}" - when: release_notes is defined and release_notes - -- import_role: - name: release_notes - vars: - section: "fleur" - option: "usage" - value: >- - fleur is compiled and installed in {{ fleur_topdir }}. - The folder with executables is added to the path, so simply run 'fleur' - when: release_notes is defined and release_notes diff --git a/roles/fleur/tasks/tests.yml b/roles/fleur/tasks/tests.yml deleted file mode 100644 index 48969bd..0000000 --- a/roles/fleur/tasks/tests.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: run fleur tests - shell: "ctest" - args: - chdir: "{{ fleur_topdir }}/build" - - # fails (return code != 0), if "Test Failed." is found -- name: check fleur test results - command: grep -vFxq "Test Failed." "{{ fleur_topdir }}/build/Testing/Temporary/LastTest.log" diff --git a/roles/gantsign.default-web-browser/.travis.yml b/roles/gantsign.default-web-browser/.travis.yml index 586d374..eedabe3 100644 --- a/roles/gantsign.default-web-browser/.travis.yml +++ b/roles/gantsign.default-web-browser/.travis.yml @@ -4,8 +4,8 @@ python: '2.7' # Spin off separate builds for each of the following versions of Ansible env: - - ANSIBLE_VERSION=2.2.0 - - ANSIBLE_VERSION=2.3.0 + - ANSIBLE_VERSION=2.3.2 + - ANSIBLE_VERSION=2.4.4 # Require the standard build environment sudo: required @@ -23,17 +23,18 @@ cache: before_install: - sudo apt-get -qq update - - sudo apt-get install -o Dpkg::Options::='--force-confold' --force-yes -y docker-engine + - sudo apt-get install -o Dpkg::Options::='--force-confold' --force-yes -y docker-ce install: # Install Ansible - pip install "ansible~=$ANSIBLE_VERSION" # Install Python API for Docker (required by Molecule Docker driver) - - pip install docker + # Limit version as workaround for: https://github.com/ansible/ansible/issues/35612 + - pip install 'docker<3.0' # Install Molecule - - pip install 'molecule==1.24' + - pip install 'molecule==2.12.1' # Check Ansible version - ansible --version diff --git a/roles/gantsign.default-web-browser/.yamllint b/roles/gantsign.default-web-browser/.yamllint new file mode 100644 index 0000000..3a2255e --- /dev/null +++ b/roles/gantsign.default-web-browser/.yamllint @@ -0,0 +1,13 @@ +extends: default + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable + # NOTE(retr0h): Templates no longer fail this lint rule. + # Uncomment if running old Molecule templates. + # truthy: disable diff --git a/roles/gantsign.default-web-browser/README.md b/roles/gantsign.default-web-browser/README.md index 301fd66..f4e85f3 100644 --- a/roles/gantsign.default-web-browser/README.md +++ b/roles/gantsign.default-web-browser/README.md @@ -12,14 +12,11 @@ Requirements * Ansible - * Minimum 2.2 + * Minimum 2.3 * Ubuntu - * Trusty (14.04) - * Wily (15.10) * Xenial (16.04) - * Note: other Ubuntu versions are likely to work but have not been tested. * Supported desktop diff --git a/roles/gantsign.default-web-browser/meta/.galaxy_install_info b/roles/gantsign.default-web-browser/meta/.galaxy_install_info index ccb6376..8def241 100644 --- a/roles/gantsign.default-web-browser/meta/.galaxy_install_info +++ b/roles/gantsign.default-web-browser/meta/.galaxy_install_info @@ -1 +1 @@ -{install_date: 'Fri Apr 6 11:46:24 2018', version: 3.0.0} +{install_date: 'Thu Jun 7 11:36:35 2018', version: 3.1.0} diff --git a/roles/gantsign.default-web-browser/meta/main.yml b/roles/gantsign.default-web-browser/meta/main.yml index e57da06..aab05bb 100644 --- a/roles/gantsign.default-web-browser/meta/main.yml +++ b/roles/gantsign.default-web-browser/meta/main.yml @@ -3,12 +3,10 @@ galaxy_info: description: Role for setting the default web browser for Ubuntu Unity and Xfce4. company: GantSign Ltd. license: MIT - min_ansible_version: 2.2 + min_ansible_version: 2.3 platforms: - name: Ubuntu versions: - - trusty - - wily - xenial galaxy_tags: - ubuntu diff --git a/roles/gantsign.default-web-browser/molecule.yml b/roles/gantsign.default-web-browser/molecule.yml deleted file mode 100644 index 1bef831..0000000 --- a/roles/gantsign.default-web-browser/molecule.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -ansible: - playbook: tests/test.yml - -dependency: - name: galaxy - -driver: - name: docker - -docker: - containers: - - name: ansible-role-default-web-browser-01 - image: ubuntu - image_version: '16.04' - -verifier: - name: testinfra diff --git a/roles/gantsign.default-web-browser/molecule/default/Dockerfile.j2 b/roles/gantsign.default-web-browser/molecule/default/Dockerfile.j2 new file mode 100644 index 0000000..9f689d9 --- /dev/null +++ b/roles/gantsign.default-web-browser/molecule/default/Dockerfile.j2 @@ -0,0 +1,13 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi diff --git a/roles/gantsign.default-web-browser/molecule/default/INSTALL.rst b/roles/gantsign.default-web-browser/molecule/default/INSTALL.rst new file mode 100644 index 0000000..e26493b --- /dev/null +++ b/roles/gantsign.default-web-browser/molecule/default/INSTALL.rst @@ -0,0 +1,16 @@ +******* +Install +******* + +Requirements +============ + +* Docker Engine +* docker-py + +Install +======= + +.. code-block:: bash + + $ sudo pip install docker-py diff --git a/roles/gantsign.default-web-browser/molecule/default/create.yml b/roles/gantsign.default-web-browser/molecule/default/create.yml new file mode 100644 index 0000000..45d222e --- /dev/null +++ b/roles/gantsign.default-web-browser/molecule/default/create.yml @@ -0,0 +1,76 @@ +--- +- name: Create + hosts: localhost + connection: local + gather_facts: false + no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + tasks: + - name: Log into a Docker registry + docker_login: + username: "{{ item.registry.credentials.username }}" + password: "{{ item.registry.credentials.password }}" + email: "{{ item.registry.credentials.email | default(omit) }}" + registry: "{{ item.registry.url }}" + with_items: "{{ molecule_yml.platforms }}" + when: + - item.registry is defined + - item.registry.credentials is defined + - item.registry.credentials.username is defined + + - name: Create Dockerfiles from image names + template: + src: "{{ molecule_scenario_directory }}/Dockerfile.j2" + dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}" + with_items: "{{ molecule_yml.platforms }}" + register: platforms + + - name: Discover local Docker images + docker_image_facts: + name: "molecule_local/{{ item.item.name }}" + with_items: "{{ platforms.results }}" + register: docker_images + + - name: Build an Ansible compatible image + docker_image: + path: "{{ molecule_ephemeral_directory }}" + name: "molecule_local/{{ item.item.image }}" + dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}" + force: "{{ item.item.force | default(true) }}" + with_items: "{{ platforms.results }}" + when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0 + + - name: Create docker network(s) + docker_network: + name: "{{ item }}" + state: present + with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks }}" + + - name: Create molecule instance(s) + docker_container: + name: "{{ item.name }}" + hostname: "{{ item.name }}" + image: "molecule_local/{{ item.image }}" + state: started + recreate: false + log_driver: json-file + command: "{{ item.command | default('bash -c \"while true; do sleep 10000; done\"') }}" + privileged: "{{ item.privileged | default(omit) }}" + volumes: "{{ item.volumes | default(omit) }}" + capabilities: "{{ item.capabilities | default(omit) }}" + exposed_ports: "{{ item.exposed_ports | default(omit) }}" + published_ports: "{{ item.published_ports | default(omit) }}" + ulimits: "{{ item.ulimits | default(omit) }}" + networks: "{{ item.networks | default(omit) }}" + dns_servers: "{{ item.dns_servers | default(omit) }}" + register: server + with_items: "{{ molecule_yml.platforms }}" + async: 7200 + poll: 0 + + - name: Wait for instance(s) creation to complete + async_status: + jid: "{{ item.ansible_job_id }}" + register: docker_jobs + until: docker_jobs.finished + retries: 300 + with_items: "{{ server.results }}" diff --git a/roles/gantsign.default-web-browser/molecule/default/destroy.yml b/roles/gantsign.default-web-browser/molecule/default/destroy.yml new file mode 100644 index 0000000..7ba7d28 --- /dev/null +++ b/roles/gantsign.default-web-browser/molecule/default/destroy.yml @@ -0,0 +1,30 @@ +--- +- name: Destroy + hosts: localhost + connection: local + gather_facts: false + no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + tasks: + - name: Destroy molecule instance(s) + docker_container: + name: "{{ item.name }}" + state: absent + force_kill: "{{ item.force_kill | default(true) }}" + register: server + with_items: "{{ molecule_yml.platforms }}" + async: 7200 + poll: 0 + + - name: Wait for instance(s) deletion to complete + async_status: + jid: "{{ item.ansible_job_id }}" + register: docker_jobs + until: docker_jobs.finished + retries: 300 + with_items: "{{ server.results }}" + + - name: Delete docker network(s) + docker_network: + name: "{{ item }}" + state: absent + with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks }}" diff --git a/roles/gantsign.default-web-browser/molecule/default/molecule.yml b/roles/gantsign.default-web-browser/molecule/default/molecule.yml new file mode 100644 index 0000000..94ffc68 --- /dev/null +++ b/roles/gantsign.default-web-browser/molecule/default/molecule.yml @@ -0,0 +1,26 @@ +--- +dependency: + name: galaxy + +driver: + name: docker + +lint: + name: yamllint + +platforms: + - name: ansible-role-default-web-browser-01 + image: ubuntu:16.04 + +provisioner: + name: ansible + lint: + name: ansible-lint + +scenario: + name: default + +verifier: + name: testinfra + lint: + name: flake8 diff --git a/roles/gantsign.default-web-browser/tests/test.yml b/roles/gantsign.default-web-browser/molecule/default/playbook.yml similarity index 70% rename from roles/gantsign.default-web-browser/tests/test.yml rename to roles/gantsign.default-web-browser/molecule/default/playbook.yml index 739f25b..98a8202 100644 --- a/roles/gantsign.default-web-browser/tests/test.yml +++ b/roles/gantsign.default-web-browser/molecule/default/playbook.yml @@ -1,12 +1,12 @@ --- -- hosts: all - remote_user: root +- name: Converge + hosts: all pre_tasks: - name: create applications directory become: yes file: - path: "{{ default_web_browser_applications_dir }}" + path: '{{ default_web_browser_applications_dir }}' state: directory owner: root group: root @@ -16,7 +16,7 @@ become: yes copy: content: 'Exec=/usr/bin/google-chrome-stable %U' - dest: "{{ default_web_browser_applications_dir }}/google-chrome.desktop" + dest: '{{ default_web_browser_applications_dir }}/google-chrome.desktop' owner: root group: root mode: 'u=rwx,go=rx' diff --git a/roles/gantsign.default-web-browser/molecule/default/prepare.yml b/roles/gantsign.default-web-browser/molecule/default/prepare.yml new file mode 100644 index 0000000..5358b3b --- /dev/null +++ b/roles/gantsign.default-web-browser/molecule/default/prepare.yml @@ -0,0 +1,5 @@ +--- +- name: Prepare + hosts: all + gather_facts: false + tasks: [] diff --git a/roles/gantsign.default-web-browser/tests/test_gnome.py b/roles/gantsign.default-web-browser/molecule/default/tests/test_gnome.py similarity index 81% rename from roles/gantsign.default-web-browser/tests/test_gnome.py rename to roles/gantsign.default-web-browser/molecule/default/tests/test_gnome.py index 283bd3d..03df3fc 100644 --- a/roles/gantsign.default-web-browser/tests/test_gnome.py +++ b/roles/gantsign.default-web-browser/molecule/default/tests/test_gnome.py @@ -1,8 +1,10 @@ import pytest +import os -from testinfra.utils.ansible_runner import AnsibleRunner +import testinfra.utils.ansible_runner -testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_mimeapps_file_permissions(File): diff --git a/roles/gantsign.default-web-browser/tests/test_xfce4.py b/roles/gantsign.default-web-browser/molecule/default/tests/test_xfce4.py similarity index 87% rename from roles/gantsign.default-web-browser/tests/test_xfce4.py rename to roles/gantsign.default-web-browser/molecule/default/tests/test_xfce4.py index 26e25b2..2dd4aec 100644 --- a/roles/gantsign.default-web-browser/tests/test_xfce4.py +++ b/roles/gantsign.default-web-browser/molecule/default/tests/test_xfce4.py @@ -1,8 +1,10 @@ import pytest +import os -from testinfra.utils.ansible_runner import AnsibleRunner +import testinfra.utils.ansible_runner -testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_helpers_file_permissions(File): diff --git a/roles/gantsign.default-web-browser/tests/test_xsession.py b/roles/gantsign.default-web-browser/molecule/default/tests/test_xsession.py similarity index 79% rename from roles/gantsign.default-web-browser/tests/test_xsession.py rename to roles/gantsign.default-web-browser/molecule/default/tests/test_xsession.py index e6db993..9e9e8e0 100644 --- a/roles/gantsign.default-web-browser/tests/test_xsession.py +++ b/roles/gantsign.default-web-browser/molecule/default/tests/test_xsession.py @@ -1,8 +1,10 @@ import pytest +import os -from testinfra.utils.ansible_runner import AnsibleRunner +import testinfra.utils.ansible_runner -testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_xsession_file_permissions(File): diff --git a/roles/gantsign.default-web-browser/tasks/gnome.yml b/roles/gantsign.default-web-browser/tasks/gnome.yml index 3cbd9b5..0a08165 100644 --- a/roles/gantsign.default-web-browser/tasks/gnome.yml +++ b/roles/gantsign.default-web-browser/tasks/gnome.yml @@ -1,8 +1,9 @@ --- - name: create XDG applications directory become: yes + become_user: "{{ root_user }}" file: - path: "{{ default_web_browser_custom_config_dir }}" + path: '{{ default_web_browser_custom_config_dir }}' state: directory owner: root group: root @@ -10,6 +11,7 @@ - name: write mimeapps.list config become: yes + become_user: "{{ root_user }}" template: src: mimeapps.list.j2 dest: '{{ default_web_browser_custom_config_dir }}/mimeapps.list' diff --git a/roles/gantsign.default-web-browser/tasks/xfce4.yml b/roles/gantsign.default-web-browser/tasks/xfce4.yml index e83e980..242b511 100644 --- a/roles/gantsign.default-web-browser/tasks/xfce4.yml +++ b/roles/gantsign.default-web-browser/tasks/xfce4.yml @@ -1,8 +1,9 @@ --- - name: create custom Xfce4 config directory become: yes + become_user: "{{ root_user }}" file: - path: "{{ default_web_browser_custom_xfce4_dir }}" + path: '{{ default_web_browser_custom_xfce4_dir }}' state: directory owner: root group: root @@ -10,6 +11,7 @@ - name: write helpers.rc become: yes + become_user: "{{ root_user }}" template: src: helpers.rc.j2 dest: '{{ default_web_browser_custom_xfce4_dir }}/helpers.rc' @@ -19,7 +21,7 @@ - name: create tmp directory file: - path: "{{ remote_tmp }}" + path: '~/.ansible/tmp' state: directory mode: 'u=rwx,go=' @@ -46,18 +48,18 @@ - name: set xfce4 type lineinfile: - dest: "{{ item }}" + dest: '{{ item }}' regexp: '^Type=' line: Type=X-XFCE-Helper state: present with_items: - - "{{ default_web_browser_tmp_desktop_file_part1 }}" - - "{{ default_web_browser_tmp_desktop_file_part2 }}" + - '{{ default_web_browser_tmp_desktop_file_part1 }}' + - '{{ default_web_browser_tmp_desktop_file_part2 }}' changed_when: no - name: set xfce4 category lineinfile: - dest: "{{ default_web_browser_tmp_desktop_file_part1 }}" + dest: '{{ default_web_browser_tmp_desktop_file_part1 }}' regexp: '^X-XFCE-Category=' line: X-XFCE-Category=WebBrowser state: present @@ -78,7 +80,7 @@ - name: set xfce4 commands lineinfile: - dest: "{{ default_web_browser_tmp_desktop_file_part1 }}" + dest: '{{ default_web_browser_tmp_desktop_file_part1 }}' regexp: '^X-XFCE-Commands=' line: 'X-XFCE-Commands={{ browser_command.stdout }}' state: present @@ -86,7 +88,7 @@ - name: set xfce4 commands with param lineinfile: - dest: "{{ default_web_browser_tmp_desktop_file_part1 }}" + dest: '{{ default_web_browser_tmp_desktop_file_part1 }}' regexp: '^X-XFCE-CommandsWithParameter=' line: 'X-XFCE-CommandsWithParameter={{ browser_command_with_param.stdout }}' state: present @@ -102,8 +104,9 @@ - name: create custom Xfce4 helpers directory become: yes + become_user: "{{ root_user }}" file: - path: "{{ default_web_browser_custom_xfce4_helpers_dir }}" + path: '{{ default_web_browser_custom_xfce4_helpers_dir }}' state: directory owner: root group: root @@ -111,10 +114,11 @@ - name: copy browser desktop file become: yes + become_user: "{{ root_user }}" copy: - src: "{{ default_web_browser_tmp_desktop_file }}" + src: '{{ default_web_browser_tmp_desktop_file }}' remote_src: yes - dest: "{{ default_web_browser_custom_xfce4_helpers_dir }}/{{ default_web_browser }}.desktop" + dest: '{{ default_web_browser_custom_xfce4_helpers_dir }}/{{ default_web_browser }}.desktop' owner: root group: root mode: 'u=rw,go=r' diff --git a/roles/gantsign.default-web-browser/tasks/xsession.yml b/roles/gantsign.default-web-browser/tasks/xsession.yml index 1652933..2d3615a 100644 --- a/roles/gantsign.default-web-browser/tasks/xsession.yml +++ b/roles/gantsign.default-web-browser/tasks/xsession.yml @@ -1,8 +1,9 @@ --- - name: create Xsession.d directory become: yes + become_user: "{{ root_user }}" file: - path: "{{ default_web_browser_xsession_d_dir }}" + path: '{{ default_web_browser_xsession_d_dir }}' state: directory owner: root group: root @@ -10,6 +11,7 @@ - name: write Xsession config become: yes + become_user: "{{ root_user }}" template: src: x-session.j2 dest: '{{ default_web_browser_xsession_d_dir }}/80-ansible-default-web-browser' diff --git a/roles/gantsign.default-web-browser/templates/helpers.rc.j2 b/roles/gantsign.default-web-browser/templates/helpers.rc.j2 index 97ae54e..43ea77f 100644 --- a/roles/gantsign.default-web-browser/templates/helpers.rc.j2 +++ b/roles/gantsign.default-web-browser/templates/helpers.rc.j2 @@ -1,3 +1,3 @@ -# {{ ansible_managed }} +{{ ansible_managed | comment }} WebBrowser={{ default_web_browser }} diff --git a/roles/gantsign.default-web-browser/templates/mimeapps.list.j2 b/roles/gantsign.default-web-browser/templates/mimeapps.list.j2 index 3a8002f..442d314 100644 --- a/roles/gantsign.default-web-browser/templates/mimeapps.list.j2 +++ b/roles/gantsign.default-web-browser/templates/mimeapps.list.j2 @@ -1,4 +1,4 @@ -# {{ ansible_managed }} +{{ ansible_managed | comment }} [Default Applications] text/html={{ default_web_browser }}.desktop diff --git a/roles/gantsign.default-web-browser/templates/x-session.j2 b/roles/gantsign.default-web-browser/templates/x-session.j2 index edd500e..5944e51 100644 --- a/roles/gantsign.default-web-browser/templates/x-session.j2 +++ b/roles/gantsign.default-web-browser/templates/x-session.j2 @@ -1,4 +1,4 @@ -# {{ ansible_managed }} +{{ ansible_managed | comment }} XDG_CONFIG_DIRS={{ default_web_browser_custom_config_dir }}:"$XDG_CONFIG_DIRS" export XDG_CONFIG_DIRS diff --git a/roles/gantsign.default-web-browser/vars/main.yml b/roles/gantsign.default-web-browser/vars/main.yml index f43e200..30e09eb 100644 --- a/roles/gantsign.default-web-browser/vars/main.yml +++ b/roles/gantsign.default-web-browser/vars/main.yml @@ -12,19 +12,19 @@ default_web_browser_custom_config_dir: /etc/xdg/ansible-default-web-browser default_web_browser_xsession_d_dir: /etc/X11/Xsession.d # The directory where custom Xfce4 config is stored -default_web_browser_custom_xfce4_dir: "{{ default_web_browser_custom_config_dir }}/xfce4" +default_web_browser_custom_xfce4_dir: '{{ default_web_browser_custom_config_dir }}/xfce4' # The directory where custom Xfce4 helpers stored -default_web_browser_custom_xfce4_helpers_dir: "{{ default_web_browser_custom_xfce4_dir }}/helpers" +default_web_browser_custom_xfce4_helpers_dir: '{{ default_web_browser_custom_xfce4_dir }}/helpers' # The the browser desktop file -default_web_browser_desktop_file: "{{ default_web_browser_applications_dir }}/{{ default_web_browser }}.desktop" +default_web_browser_desktop_file: '{{ default_web_browser_applications_dir }}/{{ default_web_browser }}.desktop' # Temporary desktop file part 1 -default_web_browser_tmp_desktop_file_part1: "{{ remote_tmp }}/{{ default_web_browser }}.part1" +default_web_browser_tmp_desktop_file_part1: '{{ remote_tmp }}/{{ default_web_browser }}.part1' # Temporary desktop file part 2 -default_web_browser_tmp_desktop_file_part2: "{{ remote_tmp }}/{{ default_web_browser }}.part2" +default_web_browser_tmp_desktop_file_part2: '{{ remote_tmp }}/{{ default_web_browser }}.part2' # Temporary desktop file -default_web_browser_tmp_desktop_file: "{{ remote_tmp }}/{{ default_web_browser }}.desktop" +default_web_browser_tmp_desktop_file: '{{ remote_tmp }}/{{ default_web_browser }}.desktop' diff --git a/roles/jupyter/README.md b/roles/jupyter/README.md deleted file mode 100644 index 110c211..0000000 --- a/roles/jupyter/README.md +++ /dev/null @@ -1,13 +0,0 @@ -aiida jupyter notebooks ------------------------- - -Usage example: -``` -workon aiida -verdi daemon start -cd jupyter_apps -cd mc-aiida -jupyter notebook -``` -Then open `aiida_status.ipynb`, enable Appmode, and off you go! - diff --git a/roles/jupyter/defaults/main.yml b/roles/jupyter/defaults/main.yml deleted file mode 100644 index 7af3a77..0000000 --- a/roles/jupyter/defaults/main.yml +++ /dev/null @@ -1,14 +0,0 @@ -# note: this folder is currently hardcoded in many apps -# Would have to make this a variable -jupyter_base_folder: "/project" -jupyter_apps_folder: "{{ jupyter_base_folder}}/apps" -jupyter_apps_symlink: "{{ ansible_env.HOME }}/jupyter_apps" -jupyter_apps: -- name: home - repo: materialscloud-org/mc-home -- name: aiida - repo: ltalirz/mc-aiida -- name: cscs - repo: materialscloud-org/mc-cscs - #- name: epfl - # repo: materialscloud-org/mc-epfl diff --git a/roles/jupyter/files/ipython_config.py b/roles/jupyter/files/ipython_config.py deleted file mode 100644 index 5b1c3d2..0000000 --- a/roles/jupyter/files/ipython_config.py +++ /dev/null @@ -1,4 +0,0 @@ -c = get_config() -c.InteractiveShellApp.extensions = [ - 'aiida.common.ipython.ipython_magics' -] diff --git a/roles/jupyter/files/mc-jupyter-singleuser b/roles/jupyter/files/mc-jupyter-singleuser deleted file mode 100644 index 7380b30..0000000 --- a/roles/jupyter/files/mc-jupyter-singleuser +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 - -from jupyterhub import singleuser - -# https://github.com/jupyterhub/jupyterhub/blob/master/scripts/jupyterhub-singleuser -# https://github.com/jupyterhub/jupyterhub/blob/master/jupyterhub/singleuser.py - -matcloud_page_template = """ -{% extends "templates/page.html" %} -{% block header_buttons %} -{{super()}} - - - Control Panel - - - - - Materials Cloud - - -{% endblock %} -{% block logo %} -Jupyter Notebook -{% endblock logo %} -""" - -if __name__ == '__main__': - singleuser.page_template = matcloud_page_template - singleuser.main() diff --git a/roles/jupyter/tasks/apps.yml b/roles/jupyter/tasks/apps.yml deleted file mode 100644 index dd7704b..0000000 --- a/roles/jupyter/tasks/apps.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: install default apps - git: - repo: 'https://github.com/{{ item.repo }}' - dest: "{{ jupyter_apps_folder }}/{{ item.name }}" - force: True - with_items: "{{ jupyter_apps }}" diff --git a/roles/jupyter/tasks/main.yml b/roles/jupyter/tasks/main.yml deleted file mode 100644 index b069587..0000000 --- a/roles/jupyter/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- import_tasks: prerequisites.yml - tags: jupyter_prerequisites -- import_tasks: setup.yml - tags: jupyter_setup -- import_tasks: apps.yml - tags: jupyter_apps diff --git a/roles/jupyter/tasks/prerequisites.yml b/roles/jupyter/tasks/prerequisites.yml deleted file mode 100644 index 4c8b81e..0000000 --- a/roles/jupyter/tasks/prerequisites.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -## below: stuff needed for jupyterhub -#- name: Install pip for python3 -# become: True -# apt: -# name: python3-pip -# state: latest -# -#- name: upgrade pip for python3 -# become: True -# pip: -# name: pip -# executable: pip3 -# state: latest -# -## note: python2 does not have jupyterhub 0.8.0 -#- name: Install jupyter prerequisites (python3) -# become: True -# pip: -# name: "{{ item }}" -# executable: pip3 -# with_items: -# - jupyterhub==0.8.0 -# - notebook==5.1.0 -# - appmode==0.2.0 - -#- name: activate ipython kernels -# become: True -# shell: | -# python3 -m ipykernel install - -- name: Install jupyter prerequisites (python2) - pip: - name: "{{ item }}" - virtualenv: "{{ aiida_venv }}" - with_items: - - widgetsnbextension==3.0.8 - - pythreejs==0.4.1 - - nglview==1.0 - - bqplot==0.10.1 - - ipympl==0.1.0 - - fileupload==0.1.5 - - appmode==0.2.0 - - markdown - -- name: activate ipython kernel - become: True - shell: "{{ aiida_venv }}/bin/python -m ipykernel install" - -- name: install jupyter extensions - shell: "{{ aiida_venv }}/bin/jupyter nbextension install --sys-prefix --py {{item}}" - with_items: - - fileupload - -- name: enable jupyter notebook extensions - shell: "{{ aiida_venv }}/bin/jupyter nbextension enable --sys-prefix --py {{item}}" - with_items: - - widgetsnbextension - - pythreejs - - nglview - - bqplot - - ipympl - - fileupload - - appmode - -- name: enable jupyter server extensions - shell: "{{ aiida_venv }}/bin/jupyter serverextension enable --sys-prefix --py {{item}}" - with_items: - - appmode diff --git a/roles/jupyter/tasks/setup.yml b/roles/jupyter/tasks/setup.yml deleted file mode 100644 index 827e7f3..0000000 --- a/roles/jupyter/tasks/setup.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -- name: create ipython config folder - file: - path: "{{ ansible_env.HOME }}/.ipython/profile_default" - state: directory - -- name: setup AiiDA jupyter extension - copy: - src: ipython_config.py - dest: "{{ ansible_env.HOME }}/.ipython/profile_default" - -- name: create jupyter folders - become: True - file: - path: "{{ item }}" - state: directory - owner: "{{ ansible_user }}" - with_items: - - "{{ jupyter_base_folder }}" - - "{{ jupyter_apps_folder }}" - -- name: touch __init__.py for import - become: True - file: - path: "{{ jupyter_apps_folder }}/__init__.py" - state: touch - -- name: add launcher script - template: - src: start.sh - dest: "{{ jupyter_apps_folder }}" - mode: 0753 - -- name: update PYTHONPATH - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: 'export PYTHONPATH=$PYTHONPATH:{{ jupyter_base_folder }}' - -- name: create jupyter apps symlink - file: - src: "{{ jupyter_apps_folder }}" - dest: "{{ jupyter_apps_symlink }}" - state: link - -- name: create desktop shortcut - template: - src: apps.desktop - dest: "{{ ansible_env.HOME }}/Desktop" - mode: 0753 - -# below: stuff needed for jupyterhub -#- name: copy singleuser script -# copy: -# src: mc-jupyter-singleuser -# dest: "{{ aiida_venv }}/bin" -# mode: u+x - -#- name: start jupyter notebook server -# shell: | -# {{ aiida_venv }}/bin/mc-jupyterhub-singleuser \ -# --ip=0.0.0.0 \ -# --port=8888 \ -# --notebook-dir="{{ jupyter_apps_folder }}" \ -# --NotebookApp.iopub_data_rate_limit=1000000000 \ -# --NotebookApp.default_url="/apps/home/start.ipynb" diff --git a/roles/jupyter/templates/apps.desktop b/roles/jupyter/templates/apps.desktop deleted file mode 100644 index 45d68e7..0000000 --- a/roles/jupyter/templates/apps.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Jupyter Apps -Comment=Launch AiiDA Jupyter Apps -Exec={{ jupyter_apps_folder }}/start.sh -Icon=utilities-terminal -Type=Application diff --git a/roles/jupyter/templates/start.sh b/roles/jupyter/templates/start.sh deleted file mode 100644 index cbabd59..0000000 --- a/roles/jupyter/templates/start.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -source "{{ aiida_venv }}/bin/activate" -export PYTHONPATH=$PYTHONPATH:{{ jupyter_base_folder }} - -if jupyter notebook list | grep -q 'localhost'; then - url=`jupyter notebook list | grep -m1 localhost | awk '{print $1}'` - xdg-open $url -else - jupyter notebook --notebook-dir="{{ jupyter_base_folder }}" \ - --NotebookApp.default_url="/apps/apps/home/start.ipynb" -fi diff --git a/roles/quantum_espresso/defaults/main.yml b/roles/quantum_espresso/defaults/main.yml deleted file mode 100644 index 278548d..0000000 --- a/roles/quantum_espresso/defaults/main.yml +++ /dev/null @@ -1,16 +0,0 @@ -quantum_espresso_version: "6.2.1" -quantum_espresso_git_tag: "fda42b8045f604ef8cc8400dac1b2a06cb3f6e91" -quantum_espresso_src_archive: "qe-{{ quantum_espresso_version }}.tar.gz" -quantum_espresso_code_folder: "{{ ansible_env.HOME }}" -#quantum_espresso_url: "http://www.qe-forge.org/gf/download/frsrelease/240/1075/{{quantum_espresso_src_archive }}" -#quantum_espresso_url: "https://github.com/QEF/q-e/archive/{{ quantum_espresso_src_archive }}" -quantum_espresso_url: "https://gitlab.com/QEF/q-e/repository/qe-{{ quantum_espresso_version }}/archive.tar.gz" - -quantum_espresso_src: "q-e-qe-{{ quantum_espresso_version }}-{{ quantum_espresso_git_tag }}" -quantum_espresso_topdir: "{{ quantum_espresso_code_folder }}/{{quantum_espresso_src}}" -quantum_espresso_executables: - - pw - - cp - - pp - - ph - - neb diff --git a/roles/quantum_espresso/tasks/main.yml b/roles/quantum_espresso/tasks/main.yml deleted file mode 100644 index 59e55e8..0000000 --- a/roles/quantum_espresso/tasks/main.yml +++ /dev/null @@ -1,69 +0,0 @@ -# Will only download once -- name: Get Quantum ESPRESSO source - get_url: - url: "{{ quantum_espresso_url }}" - dest: "{{ quantum_espresso_code_folder }}/{{ quantum_espresso_src_archive }}" - register: quantum_espresso_download - -- name: Extract QE source - unarchive: - src: "{{ quantum_espresso_download.dest }}" - dest: "{{ quantum_espresso_code_folder }}" - remote_src: yes - -# --fpe-summary=none removes all floating-point exceptions -# see https://github.com/marvel-nccr/quantum-mobile/issues/52 -- name: Configure QE - shell: "FFLAGS='-O3 -g -ffpe-summary=none' ./configure --enable-parallel" - args: - creates: "{{ quantum_espresso_topdir }}/make.inc" - chdir: "{{ quantum_espresso_topdir }}" - -# this is needed because aiida isn't yet able to parse -# the new XML format -- name: "Force to use old XML format" - lineinfile: - path: "{{ quantum_espresso_topdir }}/make.inc" - insertafter: "DFLAGS = -D__FFTW3 -D__MPI" - line: "DFLAGS += -D__OLDXML" - - -- name: Make QE executables - shell: "make {{ item }}" - args: - creates: "{{ quantum_espresso_topdir }}/bin/{{ item }}.x" - chdir: "{{ quantum_espresso_topdir }}" - with_items: "{{ quantum_espresso_executables }}" - register: quantum_espresso_make - -- import_tasks: tests.yml - when: quantum_espresso_make.changed and run_tests is defined and run_tests - -- name: "Put a line in ~/.bashrc to add QE to the path" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export PATH=${PATH}:{{ quantum_espresso_topdir }}/bin" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- import_role: - name: release_notes - vars: - section: "Quantum ESPRESSO" - option: "version" - value: "{{ quantum_espresso_version }}" - when: release_notes is defined and release_notes - -- import_role: - name: release_notes - vars: - section: "Quantum ESPRESSO" - option: "usage" - value: >- - Quantum ESPRESSO is installed in {{ quantum_espresso_topdir }}. - 'pw.x', 'cp.x', ... have been added to the PATH - when: release_notes is defined and release_notes - -- name: Clean object files - shell: "rm {{ quantum_espresso_topdir }}/*/src/*.o" - when: clean is defined and clean diff --git a/roles/quantum_espresso/tasks/tests.yml b/roles/quantum_espresso/tasks/tests.yml deleted file mode 100644 index 4bf8fcd..0000000 --- a/roles/quantum_espresso/tasks/tests.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# QE 6.2.1: test-suite fails to create temporary directory -# Should be fixed in next release. See https://gitlab.com/QEF/q-e/issues/15 -- name: make temporary directory - file: - path: /tmp/save - state: directory - -- name: run QE test suite - shell: "make test-suite" - args: - creates: "{{ quantum_espresso_topdir }}/bin/.x" - chdir: "{{ quantum_espresso_topdir }}" diff --git a/roles/release_notes/defaults/main.yml b/roles/release_notes/defaults/main.yml index 6d019b7..1d82c8f 100644 --- a/roles/release_notes/defaults/main.yml +++ b/roles/release_notes/defaults/main.yml @@ -2,6 +2,6 @@ # Other roles will check the `release_notes` variable # to see whether they should include release notes -release_notes_locally: True -release_notes_vm: "{{ ansible_env.HOME }}/Desktop/RELEASENOTES.txt" +release_notes_locally: False +release_notes_vm: "${HOME}/Desktop/RELEASENOTES.txt" release_notes_localhost: "{{ playbook_dir }}/RELEASENOTES.txt" diff --git a/roles/scheduler/defaults/main.yml b/roles/scheduler/defaults/main.yml deleted file mode 100644 index 6cb2eb5..0000000 --- a/roles/scheduler/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -scheduler_hostname: localhost -scheduler_cpus: 2 diff --git a/roles/scheduler/files/.gitignore b/roles/scheduler/files/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/roles/scheduler/files/torque b/roles/scheduler/files/torque deleted file mode 100644 index 1cb1e36..0000000 --- a/roles/scheduler/files/torque +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/bash -# Written by G. Pizzi in Nov 2017 adapting the openssh if-up script -# See also -# https://github.com/marvel-nccr/marvel-virtualmachine/issues/20 -# -# Reload the torque-scheduler service if a new interface goes up, -# when needed (if the network takes some time to go up, the scheduler -# might not find the IP yet and die) - -set -e - -# Don't bother to restart when lo is configured. -if [ "$IFACE" = lo ]; then - exit 0 -fi - -# Only run from ifup. -if [ "$MODE" != start ]; then - exit 0 -fi - -# We only cares about inet and inet6 (there are other states like META etc.) -if [ "$ADDRFAM" != inet ] && [ "$ADDRFAM" != inet6 ]; then - exit 0 -fi - -THE_IP=`ip -4 address show "$IFACE" | grep inet | awk '{print $2;}' | cut -f1 -d/` -THE_HOSTNAME=`hostname` - -if [ "$THE_IP" == "" ] -then - echo "No IP found for interface $IFACE, not continuing with the if-up script for torque" - exit 0 -fi - -echo "if-up script for torque - setting /etc/hosts for $THE_IP $THE_HOSTNAME" - -#REWRITE /etc/hosts as torque wants -cat > /etc/hosts </dev/null 2>&1 || true -invoke-rc.d torque-server stop >/dev/null 2>&1 || true - -echo restarting torque-scheduler at `date` -invoke-rc.d torque-scheduler restart >/dev/null 2>&1 || true -echo continuing after restarting torque-scheduler at `date` - - -# We also want to restart the server (and, to be sure, the mom) -# so that it knows that the scheduler is up again -sleep $REQUIRED_SLEEP && invoke-rc.d torque-mom start >/dev/null 2>&1 || true -echo right before torque-server restart at `date` -sleep $REQUIRED_SLEEP && invoke-rc.d torque-server start >/dev/null 2>&1 || true - -exit 0 diff --git a/roles/scheduler/tasks/main.yml b/roles/scheduler/tasks/main.yml deleted file mode 100644 index 95c2c13..0000000 --- a/roles/scheduler/tasks/main.yml +++ /dev/null @@ -1,139 +0,0 @@ -- name: Install torque packages - apt: pkg={{ item }} state=present - become: true - with_items: - - torque-scheduler - - torque-server - - torque-mom - - torque-client - -- name: "get the torque hostname" - become: true - shell: "cat /etc/torque/server_name" - register: hostnamecontent_command - changed_when: False - -- name: "set the torque hostname (1)" - become: true - shell: "echo '{{ scheduler_hostname }}' > /etc/torque/server_name" - when: hostnamecontent_command.stdout != scheduler_hostname - -- name: "set the torque hostname (2)" - become: true - lineinfile: - path: "/var/spool/torque/mom_priv/config" - line: "$pbsserver {{ scheduler_hostname }}" - create: true - register: torque_hostname_2 - -- name: "set the torque hostname (3)" - become: true - lineinfile: - path: "/var/spool/torque/server_priv/nodes" - line: "{{ scheduler_hostname }} np={{ scheduler_cpus }}" - create: true - register: torque_hostname_3 - -# Note: we need to restart because the services are already started -# when installed, and we change the hostname only afterwards -## For some reason, using the ansible 'service' module -## sometime doesn't properly restart the server, and the following -## task "checking..." then fails... I try to restart 'manually' -#- name: (Re)start the torque services -# become: true -# service: -# name: "{{ item }}" -# state: restarted -# with_items: -# - torque-server -# - torque-mom -# - torque-scheduler -- name: Restart the torque server - become: true - shell: /etc/init.d/torque-server restart - when: hostnamecontent_command.stdout != scheduler_hostname or torque_hostname_2.changed or torque_hostname_3.changed - -- name: waiting 5 seconds for torque to start... - shell: sleep 5 - when: hostnamecontent_command.stdout != scheduler_hostname or torque_hostname_2.changed or torque_hostname_3.changed - changed_when: False - -- name: "Checking if torque is already configured" - become: true - shell: qmgr -c "print server" - register: qmgr_check_command - changed_when: False - -- name: executing torque configuration - shell: "{{ item }}" - become: true - with_items: - - qmgr -c "create queue batch queue_type=execution" - - qmgr -c "set server query_other_jobs = True" - - qmgr -c "set queue batch resources_max.ncpus={{ scheduler_cpus }}" - - qmgr -c "set server default_queue=batch" - # Torque queue set - - qmgr -c "set queue batch enabled=True" - - qmgr -c "set queue batch started=True" - # Torque queue started - - qmgr -c "set queue batch resources_default.nodes=1" - - qmgr -c "set queue batch resources_default.walltime=3600" - - qmgr -c "set queue batch max_running=2" - # Torque queue parameters set - - qmgr -c "set server scheduling=True" - # Torque scheduling started - - qmgr -c "unset server acl_hosts" - - qmgr -c "set server acl_hosts={{ scheduler_hostname }}" - # Torque server ACL hosts set - register: qmgr_command_result - failed_when: "'Unauthorized' in qmgr_command_result.stderr" - when: - "'batch' not in qmgr_check_command.stdout" - -- name: Restart the torque server - become: true - service: - name: "{{ item }}" - state: restarted - with_items: - - torque-server - - torque-mom - - torque-scheduler - when: - "'batch' not in qmgr_check_command.stdout" - -# I need to setup a couple of things for the next reboots, as "workarounds" -# for weird torque/PBS behaviours - -# First: I put a script that both restarts the torque-scheduler when it's down -# (typically: crashed) and the server is up -- name: Copy the torque script for if-up (when the interface goes up) - become: true - copy: - src: torque - dest: "/etc/network/if-up.d" - mode: 0755 - -# Second: I fix a problem in the default script provided by Ubuntu that does -# not put the right dependency of the torque-scheduler service on the network -# (it is started before the DHCP address is assigned - the torque-server is ok, -# instead) -- name: Fix the dependency of the torque-scheduler init script - become: true - lineinfile: - path: "/etc/init.d/torque-scheduler" - regexp: '^# Required-Start:' - line: "# Required-Start: $all $remote_fs $local_fs $named $network $time" - owner: root - group: root - mode: 0755 - -- import_role: - name: release_notes - vars: - section: "Job Scheduler" - option: "torque" - value: "Use 'qsub' to submit jobs and 'qstat' to get the status." - when: release_notes is defined and release_notes - - diff --git a/roles/siesta/defaults/main.yml b/roles/siesta/defaults/main.yml deleted file mode 100644 index 3e22ef2..0000000 --- a/roles/siesta/defaults/main.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -siesta_version: "4.0.1" -siesta_minor_version: "4.0" -siesta_src: siesta-{{ siesta_version }} -siesta_src_archive: "{{ siesta_src }}.tar.gz" -siesta_code_folder: "{{ ansible_env.HOME }}" -siesta_url: "https://launchpad.net/siesta/{{ siesta_minor_version }}/{{ siesta_version }}/+download/{{ siesta_src_archive }}" -siesta_topdir: "{{ siesta_code_folder }}/siesta-{{ siesta_version }}" -siesta_executables: - - siesta - -siesta_tests: -- h2o diff --git a/roles/siesta/tasks/main.yml b/roles/siesta/tasks/main.yml deleted file mode 100644 index c9c4019..0000000 --- a/roles/siesta/tasks/main.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -# see https://pelios.csx.cam.ac.uk/~mc321/siesta.html -- name: Install siesta dependencies - become: true - apt: - name: "{{ item }}" - state: latest - with_items: - - openmpi-common - - openmpi-bin - - libopenmpi-dev - - libblacs-mpi-dev - - libnetcdf-dev - - netcdf-bin - - libnetcdff-dev - - libscalapack-mpi-dev - - libblas-dev - - liblapack-dev - -- name: Get siesta source - get_url: - url: "{{ siesta_url }}" - dest: "{{ siesta_code_folder }}/{{ siesta_src_archive }}" - register: siesta_download - -- name: Extract siesta source - unarchive: - src: "{{ siesta_download.dest }}" - dest: "{{ siesta_code_folder }}" - remote_src: True - -- name: create Makefile - shell: ../Src/obj_setup.sh - args: - chdir: "{{ siesta_topdir }}/Obj" - creates: "{{ siesta_topdir }}/Obj/Makefile" - -- name: copy arch.make - template: - src: arch.make.deb_or_ubuntu - dest: "{{ siesta_topdir }}/Obj/arch.make" - -- name: Make siesta executables - shell: "make" - args: - chdir: "{{ siesta_topdir }}/Obj" - creates: "{{ siesta_topdir }}/Obj/siesta" - register: siesta_make - -- import_tasks: tests.yml - when: siesta_make.changed and run_tests is defined and run_tests - -- name: "Put a line in ~/.bashrc to add siesta to the path" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export PATH=${PATH}:{{ siesta_topdir }}/Obj" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- import_role: - name: release_notes - vars: - section: "siesta" - option: "version" - value: "{{ siesta_version }}" - when: release_notes is defined and release_notes - -- import_role: - name: release_notes - vars: - section: "siesta" - option: "usage" - value: >- - siesta is compiled and installed in {{ siesta_topdir }}. - simply run 'siesta' - when: release_notes is defined and release_notes diff --git a/roles/siesta/tasks/tests.yml b/roles/siesta/tasks/tests.yml deleted file mode 100644 index 764c49e..0000000 --- a/roles/siesta/tasks/tests.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- - # running all tests would take of the order of 1h - # there is currently a bug that results in the test failing - # https://bugs.launchpad.net/siesta/+bug/1725813 -- name: run siesta tests - shell: "make tests={{ item }} check" - args: - chdir: "{{ siesta_topdir }}/Obj/Tests" - with_items: "{{ siesta_tests }}" - - # # fails (return code != 0), if "Test Failed." is found - #- name: check siesta test results - # command: grep -vFxq "Test Failed." "{{ siesta_topdir }}/build/Testing/Temporary/LastTest.log" diff --git a/roles/siesta/templates/arch.make.deb_or_ubuntu b/roles/siesta/templates/arch.make.deb_or_ubuntu deleted file mode 100644 index c06708c..0000000 --- a/roles/siesta/templates/arch.make.deb_or_ubuntu +++ /dev/null @@ -1,69 +0,0 @@ -# -# Copyright (C) 1996-2016 The SIESTA group -# This file is distributed under the terms of the -# GNU General Public License: see COPYING in the top directory -# or http://www.gnu.org/copyleft/gpl.txt. -# See Docs/Contributors.txt for a list of contributors. -# -# For Ubuntu, with the libraries set up as described by Mark Calleja in -# http://pelios.csx.cam.ac.uk/~mc321/siesta.html -.SUFFIXES: -.SUFFIXES: .f .F .o .a .f90 .F90 - -SIESTA_ARCH=x86_64-unknown-linux-gnu--Gfortran - -FPP= -FPP_OUTPUT= -FC=mpif90 -RANLIB=echo - -SYS=nag - -SP_KIND=4 -DP_KIND=8 -KINDS=$(SP_KIND) $(DP_KIND) - -# Add any other sensible compilation flags here -FFLAGS=-g -O2 - -FPPFLAGS= -DMPI -DFC_HAVE_FLUSH -DFC_HAVE_ABORT -DCDF -DGRID_DP -DPHI_GRID_SP -LDFLAGS= - -ARFLAGS_EXTRA= - -FCFLAGS_fixed_f= -FCFLAGS_free_f90= -FPPFLAGS_fixed_F= -FPPFLAGS_free_F90= - -INCFLAGS=-I/usr/include -I. -I/usr/lib/openmpi/include -BLAS_LIBS=-lblas -LAPACK_LIBS=/usr/lib/lapack/liblapack.a -BLACS_LIBS=-lblacsF77init-openmpi -lblacsCinit-openmpi -lblacs-openmpi -SCALAPACK_LIBS=-lscalapack-openmpi - -COMP_LIBS=dc_lapack.a - -NETCDF_LIBS=-lnetcdff -lnetcdf -NETCDF_INTERFACE=libnetcdf_f90.a - -LIBS= $(NETCDF_LIBS) -lpthread $(SCALAPACK_LIBS) $(BLACS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) - -#SIESTA needs an F90 interface to MPI -#This will give you SIESTA's own implementation -#If your compiler vendor offers an alternative, you may change -#to it here. -MPI_INTERFACE=libmpi_f90.a -MPI_INCLUDE=. - -#Dependency rules are created by autoconf according to whether -#discrete preprocessing is necessary or not. -.F.o: - $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $< -.F90.o: - $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $< -.f.o: - $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f) $< -.f90.o: - $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90) $< - diff --git a/roles/simulationtools/tasks/libraries.yml b/roles/simulationtools/tasks/libraries.yml deleted file mode 100644 index b9f5594..0000000 --- a/roles/simulationtools/tasks/libraries.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- name: add toolchain repository for recent compiler versions - become: True - apt_repository: - repo: ppa:ubuntu-toolchain-r/test - state: present - -- name: Install libraries - become: true - apt: - name: "{{ item }}" - state: latest - update_cache: True - with_items: - # Compilation - - linux-headers-{{ ansible_kernel }} - - build-essential - - python-passlib - - gfortran - - openmpi-common - - openmpi-bin - - libopenmpi-dev - - libfftw3-dev - - libfftw3-bin - - libfftw3-mpi-dev - - liblapack-dev - - libblas-dev - - m4 - -- import_role: - name: release_notes - vars: - section: "MPI libraries" - option: "openmpi" - value: "Run using 'mpirun '" - when: release_notes is defined and release_notes - diff --git a/roles/simulationtools/tasks/main.yml b/roles/simulationtools/tasks/main.yml deleted file mode 100644 index 5229af8..0000000 --- a/roles/simulationtools/tasks/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -- import_tasks: libraries.yml -- import_tasks: plotting.yml diff --git a/roles/simulationtools/tasks/plotting.yml b/roles/simulationtools/tasks/plotting.yml deleted file mode 100644 index 4c1aaf5..0000000 --- a/roles/simulationtools/tasks/plotting.yml +++ /dev/null @@ -1,22 +0,0 @@ -- name: Install plotting tools, etc. - become: true - apt: - name: "{{ item }}" - state: present - with_items: - # For plotting - - grace - - gnuplot - - python-tk - - xcrysden - # note: jmol+java = 110MB - - jmol - - default-jre - -- import_role: - name: release_notes - vars: - section: "Plotting Tools" - option: "available tools" - value: "xmgrace, gnuplot, xcrysden, jmol" - when: release_notes is defined and release_notes diff --git a/roles/wannier90/defaults/main.yml b/roles/wannier90/defaults/main.yml deleted file mode 100644 index cd23a01..0000000 --- a/roles/wannier90/defaults/main.yml +++ /dev/null @@ -1,15 +0,0 @@ -wannier90_version: "2.1" -wannier90_src_archive: "wannier90-{{ wannier90_version }}.tar.gz" -wannier90_url: "https://github.com/wannier-developers/wannier90/archive/v2.1.tar.gz" - -wannier90_code_folder: "{{ ansible_env.HOME }}" -wannier90_src: "wannier90-{{ wannier90_version }}" -wannier90_topdir: "{{ wannier90_code_folder }}/{{wannier90_src}}" - -wannier90_executables: - - target: wannier - execname: wannier90.x - - target: post - execname: postw90.x - - target: w90chk2chk - execname: w90chk2chk.x diff --git a/roles/wannier90/files/make.inc b/roles/wannier90/files/make.inc deleted file mode 100644 index 3055467..0000000 --- a/roles/wannier90/files/make.inc +++ /dev/null @@ -1,21 +0,0 @@ -F90 = gfortran - -#Add next two lines for parallel postw90. Choose the correct name of the mpi f90 wrapper -COMMS = mpi -MPIF90 = mpif90.openmpi - -FCOPTS = -O3 -ffpe-summary=none -LDOPTS = - -#======================= -# System LAPACK and BLAS -# e.g. use -# sudo apt-get install libblas-dev liblapack-dev -# on Ubuntu -#======================= -LIBS = -llapack -lblas - - - - - diff --git a/roles/wannier90/tasks/main.yml b/roles/wannier90/tasks/main.yml deleted file mode 100644 index 41d9b1d..0000000 --- a/roles/wannier90/tasks/main.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Will only download once -- name: Get Wannier90 source - get_url: - url: "{{ wannier90_url }}" - dest: "{{ wannier90_code_folder }}/{{ wannier90_src_archive }}" - register: wannier90_download - -- name: Extract Wannier90 source - unarchive: - src: "{{ wannier90_download.dest }}" - dest: "{{ wannier90_code_folder }}" - remote_src: yes - -- name: Configure Wannier90 - copy: - src: "make.inc" - dest: "{{ wannier90_topdir }}" - -- name: Make Wannier90 executables - shell: "make {{ item.target }}" - args: - creates: "{{ wannier90_topdir }}/{{ item.execname }}" - chdir: "{{ wannier90_topdir }}" - with_items: "{{ wannier90_executables }}" - register: wannier90_make - -- name: Clean object files - shell: "rm -f {{ wannier90_topdir }}/src/obj/* {{ wannier90_topdir }}/src/objp/*" - when: clean is defined and clean - -- name: Wannier90 tests - import_tasks: tests.yml - when: wannier90_make.changed and run_tests is defined and run_tests - -- name: "Put a line in ~/.bashrc to add W90 to the path" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export PATH=${PATH}:{{ wannier90_topdir }}" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- import_role: - name: release_notes - vars: - section: "Wannier90" - option: "version" - value: "{{ wannier90_version }}" - when: release_notes is defined and release_notes - -- import_role: - name: release_notes - vars: - section: "Wannier90" - option: "usage" - value: >- - Wannier90 is installed in {{ wannier90_topdir }}. - 'wannier90.x', 'postw90/x', ... have been added to the PATH - when: release_notes is defined and release_notes diff --git a/roles/wannier90/tasks/tests.yml b/roles/wannier90/tasks/tests.yml deleted file mode 100644 index 91f13bc..0000000 --- a/roles/wannier90/tasks/tests.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: run Wannier90 default tests - shell: "make run-tests" - args: - chdir: "{{ wannier90_topdir }}/test-suite" - register: wannier90_tests - -- name: run Wannier90 default tests - shell: "make clean" - args: - chdir: "{{ wannier90_topdir }}/test-suite" - when: wannier90_tests diff --git a/roles/yambo/defaults/main.yml b/roles/yambo/defaults/main.yml deleted file mode 100644 index 08d620c..0000000 --- a/roles/yambo/defaults/main.yml +++ /dev/null @@ -1,10 +0,0 @@ -yambo_version: "4.2.1" -yambo_src: yambo-{{ yambo_version }} -yambo_src_archive: "{{ yambo_src }}.tar.gz" -yambo_code_folder: "{{ ansible_env.HOME }}" -yambo_url: "https://github.com/yambo-code/yambo/archive/{{ yambo_version }}.tar.gz" -yambo_topdir: "{{ yambo_code_folder }}/{{yambo_src}}" -yambo_executables: - - yambo - - p2y - - ypp diff --git a/roles/yambo/tasks/main.yml b/roles/yambo/tasks/main.yml deleted file mode 100644 index 215c5c5..0000000 --- a/roles/yambo/tasks/main.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Will only download once -- name: Get Yambo - get_url: - url: "{{ yambo_url }}" - dest: "{{ yambo_code_folder }}/{{ yambo_src_archive }}" - register: yambo_download - -- name: Extract yambo source - unarchive: - src: "{{ yambo_download.dest }}" - dest: "{{ yambo_code_folder }}" - remote_src: True - -# Note: use ./configure --with-p2y-version=qexsd for QE 6.2 or higher with new xml schema -# See https://github.com/marvel-nccr/marvel-virtualmachine/issues/34 -- name: Configure Yambo - shell: ./configure - args: - chdir: "{{ yambo_topdir }}" - creates: "{{ yambo_topdir }}/Makefile" - -- name: Make Yambo executables - shell: "make {{ item }}" - args: - chdir: "{{ yambo_topdir }}" - creates: "{{ yambo_topdir }}/bin/{{ item }}" - with_items: "{{ yambo_executables }}" - -- name: "Put a line in ~/.bashrc to add Yambo to the path" - lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export PATH=${PATH}:{{ yambo_topdir }}/bin" - # Do this also non-interactively - insertbefore: "{{ common_bashrc_string }}" - -- import_role: - name: release_notes - vars: - section: "Yambo" - option: "version" - value: "{{ yambo_version }}" - when: release_notes is defined and release_notes - -- import_role: - name: release_notes - vars: - section: "Yambo" - option: "usage" - value: >- - Yambo is compiled and installed in {{ yambo_topdir }}. - Simply run 'yambo'. - when: release_notes is defined and release_notes diff --git a/setup_ansible.sh b/setup_ansible.sh index 3160411..f798978 100755 --- a/setup_ansible.sh +++ b/setup_ansible.sh @@ -7,7 +7,7 @@ eval $(parse_yaml globalconfig.yml) # set up ssh config for ansible vagrant ssh-config > vagrant-ssh -sed -i"" "s/User vagrant/User ${vm_user}/g" vagrant-ssh +#sed -i"" "s/User vagrant/User ${vm_user}/g" vagrant-ssh echo "### SSH config written to 'vagrant-ssh'" echo "### Use e.g.: ssh -F vagrant-ssh default'" @@ -16,5 +16,5 @@ cat > hosts <