diff --git a/ansible/playbooks/add-new-service.yml b/ansible/playbooks/add-new-service.yml index f120637..90873e1 100644 --- a/ansible/playbooks/add-new-service.yml +++ b/ansible/playbooks/add-new-service.yml @@ -1,8 +1,15 @@ # TODO: Create venv and install ansible? That way not dependent on ansible # being installed on machine. -- name: Install and Restart Master IOC - import_playbook: ../plays/ioc/ioc-install-and-restart-master.yml +- name: Install Master IOC + vars: + service_dir_name: 000-master + import_playbook: ../plays/ioc/ioc-install.yml + +- name: Restart Master IOC + vars: + service_dir_name: 000-master + import_playbook: ../plays/ioc/ioc-restart.yml - name: Deploy and Restart Master Service import_playbook: ../plays/service/service-deploy-and-restart-master.yml diff --git a/ansible/plays/ioc/ioc-install-and-restart-master.yml b/ansible/plays/ioc/ioc-install-and-restart-master.yml deleted file mode 100644 index 10b0949..0000000 --- a/ansible/plays/ioc/ioc-install-and-restart-master.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: Install and Restart Master IOC - vars: - service_dir_name: 000-master - import_playbook: ioc-install-and-restart.yml \ No newline at end of file diff --git a/ansible/plays/ioc/ioc-install-and-restart.yml b/ansible/plays/ioc/ioc-install.yml similarity index 92% rename from ansible/plays/ioc/ioc-install-and-restart.yml rename to ansible/plays/ioc/ioc-install.yml index a9fc537..f63698c 100644 --- a/ansible/plays/ioc/ioc-install-and-restart.yml +++ b/ansible/plays/ioc/ioc-install.yml @@ -70,10 +70,4 @@ failed_when: > ioc_install_result.rc != 0 or "[error]" in ioc_install_result.stderr or - "Unable to write" in ioc_install_result.stderr - - - name: "[{{ service_dir_name }}] Restart IOC" - ansible.builtin.shell: - cmd: "ioc restart AGEBD-CPCL-{{ service_name_upper }}{{ env_suffix_upper }}" - chdir: "{{ ioc_base_dir }}" - changed_when: true \ No newline at end of file + "Unable to write" in ioc_install_result.stderr \ No newline at end of file diff --git a/ansible/plays/ioc/ioc-restart.yml b/ansible/plays/ioc/ioc-restart.yml new file mode 100644 index 0000000..fce9a1d --- /dev/null +++ b/ansible/plays/ioc/ioc-restart.yml @@ -0,0 +1,23 @@ +- name: Restart an IOC + # TODO: dev/prod + hosts: sls-lc + gather_facts: false + + vars: + workspace_dir: "/tmp/hla_framework_bd" + + tasks: + - name: Clone this repository + ansible.builtin.git: + repo: "git@gitea.psi.ch:sls/hla_framework_bd.git" + dest: "{{ workspace_dir }}" + version: main + accept_hostkey: true + version: "feature/add-service-{{ service_dir_name }}" + force: true + + - name: "[{{ service_dir_name }}] Restart IOC" + ansible.builtin.shell: + cmd: "ioc restart AGEBD-CPCL-{{ service_name_upper }}{{ env_suffix_upper }}" + chdir: "{{ ioc_base_dir }}" + changed_when: true \ No newline at end of file