diff --git a/defaults/main.yaml b/defaults/main.yaml index 8fac196..631866f 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -6,6 +6,7 @@ bec_deployments_path: /opt/bec_deployments deployment_name: production file_writer_base_path: ./ log_writer_base_path: ./ +client_data_base_path: ./ bec_version: main ophyd_devices_version: main bec_widgets_version: main diff --git a/tasks/main.yaml b/tasks/main.yaml index 783c124..dc7cb85 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -1,14 +1,14 @@ --- - name: Install redis ansible.builtin.dnf: - name: '@redis:6' + name: "@redis:6" state: present - name: Copy redis config ansible.builtin.template: src: redis.conf.j2 dest: /etc/redis.conf - mode: '0644' + mode: "0644" notify: - Enable and (re-)start redis @@ -143,11 +143,25 @@ notify: - (Re-)start BEC server +- name: Create BEC deployment config directory + become_user: "{{ bec_user }}" + ansible.builtin.file: + path: "{{ bec_path }}/bec/deployment_configs" + state: directory + - name: Copy BEC service config become_user: "{{ bec_user }}" ansible.builtin.template: - src: bec_config.yaml.j2 - dest: "{{ bec_path }}/bec_config.yaml" + src: bec_config_server.yaml.j2 + dest: "{{ bec_path }}/bec/deployment_configs/server.yaml" + notify: + - (Re-)start BEC server + +- name: Copy BEC client config + become_user: "{{ bec_user }}" + ansible.builtin.template: + src: bec_config_client.yaml.j2 + dest: "{{ bec_path }}/bec/deployment_configs/client.yaml" notify: - (Re-)start BEC server @@ -193,7 +207,7 @@ ansible.builtin.template: src: bec.j2 dest: /usr/local/bin/bec - mode: '0755' + mode: "0755" - name: Install vscode become: true diff --git a/templates/bec_config.yaml.j2 b/templates/bec_config.yaml.j2 deleted file mode 100644 index f55014b..0000000 --- a/templates/bec_config.yaml.j2 +++ /dev/null @@ -1,19 +0,0 @@ -redis: - host: {{ ansible_fqdn }} - 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: {{ file_writer_base_path }} - log_writer: - base_path: {{ log_writer_base_path }} - scilog: - env_file: ./ diff --git a/templates/bec_config_client.yaml.j2 b/templates/bec_config_client.yaml.j2 new file mode 100644 index 0000000..c3983ed --- /dev/null +++ b/templates/bec_config_client.yaml.j2 @@ -0,0 +1,11 @@ +redis: + host: {{ ansible_fqdn }} + port: 6379 +log_writer: + base_path: {{ client_data_base_path }}/logs +user_scripts: + base_path: {{ client_data_base_path }}/scripts +user_macros: + base_path: {{ client_data_base_path }}/macros +widgets_settings: + base_path: {{ client_data_base_path }}/widgets \ No newline at end of file diff --git a/templates/bec_config_server.yaml.j2 b/templates/bec_config_server.yaml.j2 new file mode 100644 index 0000000..33c81e9 --- /dev/null +++ b/templates/bec_config_server.yaml.j2 @@ -0,0 +1,11 @@ +redis: + host: {{ ansible_fqdn }} + port: 6379 +file_writer: + base_path: {{ file_writer_base_path }} +log_writer: + base_path: {{ log_writer_base_path }} +scilog: + env_file: ./ +acl: + acl_file: ./.bec_acl.env