1 | # Ansible playbook to add in the willow site and interface
|
---|
2 | # to a GS3 base installation, along with its supporting
|
---|
3 | # dependencies
|
---|
4 |
|
---|
5 | # See greenstone3-svn-base-playbook.yml for details on how to run
|
---|
6 | ---
|
---|
7 |
|
---|
8 | - name: Setting up variables for The Willow installation
|
---|
9 | hosts: localhost
|
---|
10 | connection: local
|
---|
11 |
|
---|
12 | vars_files:
|
---|
13 | - vars/default-core.yml
|
---|
14 | ####
|
---|
15 | # Review and edit as needed the variables in the following file
|
---|
16 | ####
|
---|
17 | # - vars/default-thewillow.yml # Review and edit as needed
|
---|
18 |
|
---|
19 | tasks:
|
---|
20 | - name: Setting Greenstone3 username
|
---|
21 | set_fact: gsdl3_user="{{ ansible_user | default(ansible_env.USER,true) | default('greenstone',true) }}"
|
---|
22 | - debug: msg="gsdl3_user = {{ gsdl3_user }}"
|
---|
23 |
|
---|
24 |
|
---|
25 | - name: Installing The Willow interface and site, and supporting dependencies
|
---|
26 | hosts: localhost
|
---|
27 | connection: local
|
---|
28 | become_user: "{{ gsdl3_user }}"
|
---|
29 |
|
---|
30 | vars_files:
|
---|
31 | - vars/default-core.yml
|
---|
32 |
|
---|
33 | tasks:
|
---|
34 | - name: Downloading and unpacking self-contained command-line tools for The Willow
|
---|
35 | ansible.builtin.shell:
|
---|
36 | chdir: "{{ gsdl3srchome }}/ext-cli"
|
---|
37 | cmd: "./get-selfcontained-{{ item }}.sh"
|
---|
38 | register: result
|
---|
39 | changed_when:
|
---|
40 | - '"Untarred" in result.stdout'
|
---|
41 | with_items:
|
---|
42 | - rclone
|
---|
43 |
|
---|
44 | #- name: Debian/Ubuntu command-line tools
|
---|
45 | # include_tasks: thewillow-installation-debian-task.yml
|
---|
46 | # when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
|
---|
47 |
|
---|
48 | #- name: CentOS/Red Hat command-line tools
|
---|
49 | # include_tasks: thewillow-installation-centos-task.yml
|
---|
50 | # when: ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat'
|
---|
51 |
|
---|
52 | #- debug: msg="gsdl3_user = {{ gsdl3_user }}, USER={{ ansible_env.USER }}"
|
---|
53 | #- name: Subversion checkout of Greenstone3
|
---|
54 | # ansible.builtin.subversion:
|
---|
55 | # repo: https://svn.greenstone.org/main/trunk/greenstone3
|
---|
56 | # checkout: yes
|
---|
57 | # update: no
|
---|
58 | # dest: "{{ gsdl3srchome }}"
|
---|
59 |
|
---|
60 |
|
---|
61 | # The next two steps are equivalent to sourcing SETUP.bash
|
---|
62 | # For more details, see:
|
---|
63 | # https://stackoverflow.com/questions/60209185/ansible-environment-variables-from-env-file
|
---|
64 | #
|
---|
65 | - name: Source Greenstone3's SETUP.bash
|
---|
66 | ansible.builtin.shell:
|
---|
67 | executable: /bin/bash
|
---|
68 | chdir: "{{ gsdl3srchome }}"
|
---|
69 | # RHEL8.5 introduces a weirdly environemnt variable BASH_FUNC_which%% set to a multi-line JSON value
|
---|
70 | # => use 'sed' to delete this form 'env' output
|
---|
71 | cmd: . ./SETUP.bash 1>/dev/null 2>&1 && env | sed '/^BASH_FUNC_which%%=() {.*$/,/^}$/d'
|
---|
72 | register: env_file_result
|
---|
73 |
|
---|
74 | #- debug: var=env_file_result.stdout_lines
|
---|
75 |
|
---|
76 | - name: Parse Greenstone3 environment variables
|
---|
77 | set_fact:
|
---|
78 | env_vars: "{{ ('{' + env_file_result.stdout_lines | map('regex_replace', '([^=]*)=(.*)', '\"\\1\": \"\\2\"') | join(',') + '}') | from_json }}"
|
---|
79 |
|
---|
80 | #- debug: var=env_vars
|
---|
81 |
|
---|
82 | # !!!!
|
---|
83 | # For each extension .... get it, and run cascade make (or equivalent)
|
---|
84 | # !!!!
|
---|
85 |
|
---|
86 | # structured-image
|
---|
87 |
|
---|
88 | - name: Svn checking out extensions for The Willow
|
---|
89 | ansible.builtin.shell:
|
---|
90 | chdir: "{{ gsdl3srchome }}/ext"
|
---|
91 | cmd: "./get-extension.sh {{ item }}"
|
---|
92 | register: result
|
---|
93 | changed_when:
|
---|
94 | - '"A " | string in result.stdout'
|
---|
95 | with_items:
|
---|
96 | - structured-image
|
---|
97 |
|
---|
98 | - name: Compiling and Installing the structured-image extension
|
---|
99 | ansible.builtin.shell:
|
---|
100 | chdir: "{{ gsdl3srchome }}/ext/structured-image"
|
---|
101 | cmd: |
|
---|
102 | ./PREPARE-PYTHON3.sh
|
---|
103 | cd packages
|
---|
104 | ./COMPILE-AND-INSTALL.sh
|
---|
105 | cd ..
|
---|
106 | #
|
---|
107 | # cd src
|
---|
108 | # ./PREPARE.sh
|
---|
109 | # ./COMPILE.sh
|
---|
110 | # # Generated Warnings are OK
|
---|
111 | # ./INSTALL.sh
|
---|
112 | environment: "{{ env_vars }}"
|
---|
113 |
|
---|
114 |
|
---|
115 | # - name: Compiling and Installing the structured-image extension
|
---|
116 | # ansible.builtin.command:
|
---|
117 | # chdir: "{{ gsdl3srchome }}/ext/structured-image"
|
---|
118 | # cmd: ./CASCADE-COMPILE-AND-INSTALL.sh
|
---|
119 | # environment: "{{ env_vars }}"
|
---|
120 |
|
---|
121 |
|
---|
122 | - name: Svn checkout of The Willow iterface and site
|
---|
123 | ansible.builtin.command:
|
---|
124 | chdir: "{{ gsdl3srchome }}/web"
|
---|
125 | cmd: ./get-installation.sh thewillow
|
---|
126 | register: result
|
---|
127 | changed_when:
|
---|
128 | - '"A " | string in result.stdout'
|
---|
129 | environment: "{{ env_vars }}"
|
---|
130 |
|
---|
131 | - debug: msg="Additional steps needed: (1) update resources/web/servlet.xml.in to interface=thewillow site=thewillow; (2) add in service key for Google Vision API <collect>/etc/google-sa-credentials-key.json"
|
---|
132 |
|
---|
133 |
|
---|
134 |
|
---|