source: main/trunk/greenstone3/src/ansible-playbooks/intermuse-installation-playbook.yml@ 38657

Last change on this file since 38657 was 38657, checked in by davidb, 5 months ago

Some initial work on ansible scripting the InterMusE installation

File size: 4.0 KB
Line 
1# Ansible playbook to add in the intermuse site and interface
2# to a GS3 base installation
3
4# See greenstone3-svn-base-playbook.yml for details on how to run
5---
6
7- name: Setting up variables for InterMusE installation
8 hosts: localhost
9 connection: local
10
11 vars_files:
12 - vars/default-core.yml
13 ####
14 # Review and edit as needed the variables in the following file
15 ####
16 # - vars/default-intermuse.yml # Review and edit as needed
17
18 tasks:
19 - name: Setting Greenstone3 username
20 set_fact: gsdl3_user="{{ ansible_user | default(ansible_env.USER,true) | default('greenstone',true) }}"
21 - debug: msg="gsdl3_user = {{ gsdl3_user }}"
22
23
24- name: Installing InterMusE interface and site
25 hosts: localhost
26 connection: local
27 become_user: "{{ gsdl3_user }}"
28
29 vars_files:
30 - vars/default-core.yml
31
32 tasks:
33 - name: Downloading and unpacking self-contained command-line tools for InterMusE
34 ansible.builtin.shell:
35 chdir: "{{ gsdl3srchome }}/ext-cli"
36 cmd: "./get-selfcontained-{{ item }}.sh"
37 register: result
38 changed_when:
39 - '"Untarred" in result.stdout'
40 with_items:
41 - cmake
42 - mvn
43 - nodejs
44 - rclone
45
46 #- name: Debian/Ubuntu command-line tools
47 # include_tasks: intermuse-installation-debian-task.yml
48 # when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
49
50 #- name: CentOS/Red Hat command-line tools
51 # include_tasks: intermuse-installation-centos-task.yml
52 # when: ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat'
53
54 #- debug: msg="gsdl3_user = {{ gsdl3_user }}, USER={{ ansible_env.USER }}"
55 #- name: Subversion checkout of Greenstone3
56 # ansible.builtin.subversion:
57 # repo: https://svn.greenstone.org/main/trunk/greenstone3
58 # checkout: yes
59 # update: no
60 # dest: "{{ gsdl3srchome }}"
61
62
63 # The next two steps are equivalent to sourcing SETUP.bash
64 # For more details, see:
65 # https://stackoverflow.com/questions/60209185/ansible-environment-variables-from-env-file
66 #
67 - name: Source Greenstone3's SETUP.bash
68 ansible.builtin.shell:
69 executable: /bin/bash
70 chdir: "{{ gsdl3srchome }}"
71 # RHEL8.5 introduces a weirdly environemnt variable BASH_FUNC_which%% set to a multi-line JSON value
72 # => use 'sed' to delete this form 'env' output
73 cmd: . ./SETUP.bash 1>/dev/null 2>&1 && env | sed '/^BASH_FUNC_which%%=() {.*$/,/^}$/d'
74 register: env_file_result
75
76 #- debug: var=env_file_result.stdout_lines
77
78 - name: Parse Greenstone3 environment variables
79 set_fact:
80 env_vars: "{{ ('{' + env_file_result.stdout_lines | map('regex_replace', '([^=]*)=(.*)', '\"\\1\": \"\\2\"') | join(',') + '}') | from_json }}"
81
82 #- debug: var=env_vars
83
84 # !!!!
85 # For each extension .... run get it, and casecade make
86 # !!!!
87
88 # iiif-servlet structured-image jena-fuseki
89
90 - name: Svn checking out extensions for InterMusE
91 ansible.builtin.shell:
92 chdir: "{{ gsdl3srchome }}/ext"
93 cmd: "./get-extension.sh {{ item }}"
94 register: result
95 #changed_when:
96 # - '"Untarred" in result.stdout'
97 with_items:
98 - iiif-servlet
99 - jena-fuseki
100 - structured-image
101
102 #- name: Generate build.properties for Greenstone3
103 # ansible.builtin.command:
104 # chdir: "{{ gsdl3srchome }}"
105 # cmd: ant
106 # environment: "{{ env_vars }}"
107
108 #- name: Prepare Greenstone3
109 # ansible.builtin.command:
110 # chdir: "{{ gsdl3srchome }}"
111 # stdin: "y"
112 # stdin_add_newline: true
113 # cmd: ant prepare
114 # environment: "{{ env_vars }}"
115
116 #- name: Compile and Install Greenstone3 (command)
117 # ansible.builtin.command:
118 # chdir: "{{ gsdl3srchome }}"
119 # cmd: ant install
120 # environment: "{{ env_vars }}"
121
122# - name: Compile and Install Greenstone3 (shell, piped to /dev/tty)
123# ansible.builtin.shell:
124# chdir: "{{ gsdl3srchome }}"
125# cmd: ant install | tee /dev/tty
126# environment: "{{ env_vars }}"
127
128
Note: See TracBrowser for help on using the repository browser.