Skip to content
Snippets Groups Projects
Commit edb7aeda authored by Corné Lukken's avatar Corné Lukken
Browse files

L2SS-983: Templates tasks for ansible deploy

parent d5729b6d
No related branches found
No related tags found
1 merge request!469L2SS-983: Deployment through environments and ansible
......@@ -2,20 +2,22 @@
- name: StationControl Early Deployment
hosts: all
vars:
default_install_path: ~/git/tango
base_station_config: "LOFAR_ConfigDb.json"
install_path: ~/git/tango
databaseds_port: 10000
tasks:
- name: Register make installation status
command: which make
changed_when: false
failed_when: make_installed.rc not in [0,1]
register: make_installed
- name: Register git installation status
command: which git
changed_when: false
failed_when: git_installed.rc not in [0,1]
register: git_installed
- name: Check make installed
include_tasks:
file: tasks/check_binary_install.yml
vars:
program: make
- name: Check git installed
include_tasks:
file: tasks/check_binary_install.yml
vars:
program: git
- name: Register tango directory status
shell: cd {{ default_install_path }}
shell: cd {{ install_path }}
args:
chdir: ~
changed_when: false
......@@ -31,19 +33,13 @@
fi
exit 0
args:
chdir: "{{ default_install_path }}"
chdir: "{{ install_path }}"
changed_when: false
failed_when: pending_changes.rc not in [0,1]
register: pending_changes
# Several issues with this variable being unset in ansible 2.2
# where encountered, keep debug in case needed
- debug: var=pending_changes
- name: Check make installation status
fail:
msg: "Make does not appear to be installed!"
when: make_installed.rc not in [0]
- name: Check git installation status
fail:
msg: "Git does not appear to be installed!"
when: git_installed.rc not in [0]
- name: Check tango directory status
fail:
msg: "Tango directory appears to be missing!"
......@@ -56,66 +52,62 @@
changed_when: false
shell: "make stop"
args:
chdir: "{{ default_install_path }}/docker-compose"
chdir: "{{ install_path }}/docker-compose"
# - name: Git Fetch All
# changed_when: false
# shell: "git fetch --all"
# args:
# chdir: "{{ default_install_path }}"
# chdir: "{{ install_path }}"
- name: Update Sources
changed_when: false
shell: "git checkout {{ station_version }}"
args:
chdir: "{{ default_install_path }}"
chdir: "{{ install_path }}"
- name: Pull Images
changed_when: false
shell: "make pull"
args:
chdir: "{{ default_install_path }}/docker-compose"
chdir: "{{ install_path }}/docker-compose"
- name: Build Images
changed_when: false
shell: "make build"
args:
chdir: "{{ default_install_path }}/docker-compose"
chdir: "{{ install_path }}/docker-compose"
- name: Start Database
changed_when: false
shell: "make minimal"
args:
chdir: "{{ default_install_path }}/docker-compose"
chdir: "{{ install_path }}/docker-compose"
- name: Wait for databaseds
ansible.builtin.wait_for:
port: 10000
port: "{{ databaseds_port }}"
delay: 10
- name: Update Base Database Config
changed_when: false
shell: "./sbin/load_ConfigDb.sh CDB/LOFAR_ConfigDb.json"
args:
chdir: "{{ default_install_path }}"
- name: Get Base Database Config
changed_when: false
shell: "./sbin/load_ConfigDb.sh CDB/LOFAR_ConfigDb.json 2>&1"
register: base_dsconfig_result
args:
chdir: "{{ default_install_path }}"
include_tasks:
file: tasks/update_database_config.yml
vars:
database_config: "{{ base_station_config }}"
base_path: "{{ install_path }}"
- name: Verify Base Database Config
when: '"No changes needed" in base_dsconfig_result.stdout'
debug: msg="Base database changes stored"
include_tasks:
file: tasks/verify_database_config.yml
vars:
database_config: "{{ base_station_config }}"
base_path: "{{ install_path }}"
- name: Update Station Database Config
changed_when: false
shell: "./sbin/load_ConfigDb.sh CDB/stations/{{ station_config }}"
args:
chdir: "{{ default_install_path }}"
- name: Get Station Database Config
changed_when: false
shell: "./sbin/load_ConfigDb.sh CDB/stations/{{ station_config }} 2>&1"
register: station_dsconfig_result
args:
chdir: "{{ default_install_path }}"
include_tasks:
file: tasks/update_database_config.yml
vars:
database_config: "stations/{{ station_config }}"
base_path: "{{ install_path }}"
- name: Verify Station Database Config
when: '"No changes needed" in station_dsconfig_result.stdout'
debug: msg="Station database changes stored"
include_tasks:
file: tasks/verify_database_config.yml
vars:
database_config: "stations/{{ station_config }}"
base_path: "{{ install_path }}"
- name: Start Station
changed_when: false
shell: "make start"
args:
chdir: "{{ default_install_path }}/docker-compose"
chdir: "{{ install_path }}/docker-compose"
- name: Register installation status
command: which {{ program }}
changed_when: false
failed_when: installed.rc not in [0,1]
register: installed
- name: Check installation status
fail:
msg: "{{ program }} does not appear to be installed!"
when: installed.rc not in [0]
\ No newline at end of file
- name: Update Database Config
changed_when: false
shell: "./sbin/load_ConfigDb.sh CDB/{{ database_config }}"
args:
chdir: "{{ base_path }}"
\ No newline at end of file
- name: Get Database Config
changed_when: false
shell: "./sbin/load_ConfigDb.sh CDB/{{ database_config }} 2>&1"
register: dsconfig_result
args:
chdir: "{{ base_path }}"
- name: Verify Database Config
when: '"No changes needed" in dsconfig_result.stdout'
debug: msg="Database changes stored"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment