Add initial version
This commit is contained in:
1 parent
3fea4d0cf3
commit
b152e01328
6 files changed
+194
No files matched your search
@@ -0,0 +1,8 @@
|
||||
---
|
||||
bec_user: bec
|
||||
bec_path: /opt/bec_deployment
|
||||
|
||||
bec_version: main
|
||||
ophyd_devices_version: main
|
||||
bec_widgets_version: main
|
||||
bec_plugins: {}
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: (Re-)start BEC server
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
source {{ bec_venv_path }}/bin/activate
|
||||
bec-server start
|
||||
chdir: "{{ bec_path }}"
|
||||
when: not ansible_check_mode
|
||||
@@ -0,0 +1,8 @@
|
||||
galaxy_info:
|
||||
author: BEC developers
|
||||
description: Installation and configuration of BEC
|
||||
company: Paul Scherrer Institute
|
||||
license: MIT
|
||||
min_ansible_version: 2.9
|
||||
galaxy_tags: []
|
||||
dependencies: []
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
---
|
||||
- name: Install and configure redis
|
||||
include_role:
|
||||
name: geerlingguy.redis
|
||||
vars:
|
||||
redis_bind_interface: 0.0.0.0
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Install required rpm packages
|
||||
ansible.builtin.dnf:
|
||||
name:
|
||||
- python3.11
|
||||
- git
|
||||
- tmux
|
||||
state: present
|
||||
|
||||
- name: Download epics_contexts.yml
|
||||
ansible.builtin.uri:
|
||||
url: https://git.psi.ch/gfa_rpms/gfa-global-profile/-/raw/master/src/etc/epics_contexts.yml
|
||||
dest: /etc
|
||||
|
||||
- name: Download gfa_12_epics.sh
|
||||
ansible.builtin.uri:
|
||||
url: https://git.psi.ch/gfa_rpms/gfa-global-profile/-/raw/master/src/etc/profile.d/gfa_12_epics.sh
|
||||
dest: /etc/profile.d
|
||||
|
||||
- name: Create a folder for BEC deployment
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.file:
|
||||
path: "{{ bec_path }}"
|
||||
state: directory
|
||||
|
||||
- name: Clone BEC repository
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.git:
|
||||
repo: https://gitlab.psi.ch/bec/bec.git
|
||||
dest: "{{ bec_path }}/bec"
|
||||
version: "{{ bec_version }}"
|
||||
force: true
|
||||
|
||||
- name: Clone Ophyd Devices repository
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.git:
|
||||
repo: https://gitlab.psi.ch/bec/ophyd_devices.git
|
||||
dest: "{{ bec_path }}/ophyd_devices"
|
||||
version: "{{ ophyd_devices_version }}"
|
||||
force: true
|
||||
|
||||
- name: Clone BEC Widgets repository
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.git:
|
||||
repo: https://gitlab.psi.ch/bec/bec_widgets.git
|
||||
dest: "{{ bec_path }}/bec_widgets"
|
||||
version: "{{ bec_widgets_version }}"
|
||||
force: true
|
||||
|
||||
- name: Clone BEC plugins
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.git:
|
||||
repo: https://oauth2:{{ lookup('env', 'BEC_PLUGIN_TOKEN') }}@gitlab.psi.ch/bec/{{ item.key }}.git
|
||||
dest: "{{ bec_path }}/{{ item.key }}"
|
||||
version: "{{ item.value or 'main' }}"
|
||||
force: true
|
||||
loop: "{{ bec_plugins | dict2items }}"
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Clear token from git remote url in BEC plugins
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.command:
|
||||
cmd: git remote set-url origin https://gitlab.psi.ch/bec/{{ item.key }}.git
|
||||
chdir: "{{ bec_path }}/{{ item.key }}"
|
||||
loop: "{{ bec_plugins | dict2items }}"
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Check if venv exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ bec_venv_path }}"
|
||||
register: bec_venv_path_stat
|
||||
|
||||
- name: Stop bec_server
|
||||
when: bec_venv_path_stat.stat.exists and bec_venv_path_stat.stat.isdir
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
source {{ bec_venv_path }}/bin/activate
|
||||
bec-server stop
|
||||
|
||||
- name: Delete old venv (if it exists)
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.file:
|
||||
path: "{{ bec_venv_path }}"
|
||||
state: absent
|
||||
diff: false
|
||||
|
||||
- name: Install bec_lib
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.pip:
|
||||
name: "{{ bec_path }}/bec/bec_lib"
|
||||
editable: true
|
||||
virtualenv_command: python3.11 -m venv
|
||||
virtualenv: "{{ bec_venv_path }}"
|
||||
notify:
|
||||
- (Re-)start BEC server
|
||||
|
||||
- name: Install ophyd_devices
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.pip:
|
||||
name: "{{ bec_path }}/ophyd_devices"
|
||||
editable: true
|
||||
virtualenv_command: python3.11 -m venv
|
||||
virtualenv: "{{ bec_venv_path }}"
|
||||
notify:
|
||||
- (Re-)start BEC server
|
||||
|
||||
- name: Install bec_widgets
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.pip:
|
||||
name: "{{ bec_path }}/bec_widgets[pyside6]"
|
||||
editable: true
|
||||
virtualenv_command: python3.11 -m venv
|
||||
virtualenv: "{{ bec_venv_path }}"
|
||||
|
||||
- name: Install bec_server
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.pip:
|
||||
name: "{{ bec_path }}/bec/bec_server"
|
||||
editable: true
|
||||
virtualenv_command: python3.11 -m venv
|
||||
virtualenv: "{{ bec_venv_path }}"
|
||||
notify:
|
||||
- (Re-)start BEC server
|
||||
|
||||
- name: Install BEC plugins
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.pip:
|
||||
name: "{{ bec_path }}/{{ item.key }}"
|
||||
editable: true
|
||||
virtualenv_command: python3.11 -m venv
|
||||
virtualenv: "{{ bec_venv_path }}"
|
||||
loop: "{{ bec_plugins | dict2items }}"
|
||||
notify:
|
||||
- (Re-)start BEC server
|
||||
|
||||
- name: Copy BEC service config
|
||||
become_user: "{{ bec_user }}"
|
||||
ansible.builtin.template:
|
||||
src: bec_config.yaml.j2
|
||||
dest: "{{ bec_path }}/bec_config.yaml"
|
||||
notify:
|
||||
- (Re-)start BEC server
|
||||
@@ -0,0 +1,17 @@
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
mongodb:
|
||||
host: localhost
|
||||
port: 27017
|
||||
scibec:
|
||||
host: http://localhost
|
||||
port: 3030
|
||||
beamline: MyBeamline
|
||||
env_file: {{ bec_path }}
|
||||
service_config:
|
||||
file_writer:
|
||||
plugin: default_NeXus_format
|
||||
base_path: ./
|
||||
scilog:
|
||||
env_file: ./
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
bec_venv_path: "{{ bec_path }}/bec_venv"
|
||||
Reference in new issue
Block a user