Changeset 38570 for main


Ignore:
Timestamp:
2024-01-19T11:30:46+13:00 (4 months ago)
Author:
davidb
Message:

Changes after a fresh round of testing. Some work also done on looking to make the playbook work as a different user (e.g. 'greenstone') to the one the user is logged in as (e.g. 'ubuntu'), but beginning to look like this idea doesn't really work out when running playbook as localhost connection

Location:
main/trunk/greenstone3/src/ansible-playbooks
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/ansible-playbooks/_local_config.bash

    r38534 r38570  
    1 if [ $# != 1 ] ; then
     1
     2if [ $# -gt 1 ] || [ "x$1" == "x-help" ] || [ "x$1" == "x--help" ] ; then
    23    echo "" >&2
    34    echo "Usage: $0 localhost-username" >&2
     
    910fi
    1011
    11 localhost_username=$1
     12localhost_username=${1:-greenstone}
     13
     14echo ""
     15echo "####"
     16echo "# Away to run the playbook with {{ remote_user }}:"
     17echo "#    $localhost_username"
     18##echo "# Setting the username to install Greenstone3 as to:"
     19##echo "#    $localhost_username"
     20echo "####"
     21echo ""
     22
     23if [ ! -d "/home/$localhost_username" ] ; then
     24   
     25    echo "! Warning: Failed to detect /home/$localhost_username as a home directory" >&2
     26    echo "! " >&2
     27    echo "! Note: You can control the username used by providing it as a command-line argument" >&2
     28    echo "!   when the ansible playbook is run." >&2
     29    echo "! " >&2
     30    echo "! Or alternatively: consider using 'sudo adduser' (or similar) to create an account" >&2
     31    echo "!   for the missing user" >&2
     32    echo "" >&2
     33fi
     34
     35echo ""
     36echo "Continuing in 5 seconds ..."
     37echo "[press <enter> to proceed immediately, or 'q' to quit]"
     38read -t 5  continue_answer
     39
     40if [ $? == 0 ] ; then
     41    # keyboard input given
     42   
     43    if [ "x$continue_answer" == "xq" ] ; then
     44    exit 1
     45    fi
     46fi
     47
     48
     49
     50
  • main/trunk/greenstone3/src/ansible-playbooks/greenstone3-svn-base-playbook.yml

    r38538 r38570  
    3131    - debug: msg="gsdl3srchome = {{ hostvars['localhost']['gsdl3srchome'] }}"
    3232   
    33     - name: Setting gsdl3port
    34       set_fact: gsdl3port="{{ gsdl3port }}"
    35     - debug: msg="gsdl3port = {{ hostvars['localhost']['gsdl3port'] }}"
    36 
    37     - name: Setting gsdl3ports
    38       set_fact: gsdl3ports="{{ gsdl3ports }}"
    39     - debug: msg="gsdl3ports = {{ hostvars['localhost']['gsdl3ports'] }}"
     33#    - name: Setting gsdl3port
     34#      set_fact: gsdl3port="{{ gsdl3port }}"
     35#    - debug: msg="gsdl3port = {{ hostvars['localhost']['gsdl3port'] }}"
     36
     37#    - name: Setting gsdl3_buildproperties_ports
     38#      set_fact: gsdl3_buildproperties_ports="{{ gsdl3_buildproperties_ports }}"
     39#    - debug: msg="gsdl3_buildproperties_ports = {{ hostvars['localhost']['gsdl3_buildproperties_ports'] }}"
     40
     41    - name: Setting Greenstone3 username
     42      set_fact: gsdl3_user="{{ ansible_user | default(ansible_env.USER,true) | default('greenstone',true) }}"
     43    - debug: msg="gsdl3_user = {{ hostvars['localhost']['gsdl3_user'] }}"
    4044
    4145
     
    5862
    5963        # As well as using 'unzip', the greenstone3 compile sequence currently uses
    60     # 'zip' in a handful of places, such as:
    61     #     <gsdl3srchome>/gli/makejar.sh
     64        # 'zip' in a handful of places, such as:
     65        #     <gsdl3srchome>/gli/makejar.sh
    6266        'zip', 'unzip',
    6367
     
    7680  hosts:      localhost
    7781  connection: local
     82  become_user: "{{ gsdl3_user }}"
    7883  vars_files:
    7984    - vars/default-core.yml
    8085   
    8186  tasks:
     87  - debug: msg="gsdl3_user = {{ gsdl3_user }}, USER={{ ansible_env.USER }}"
    8288  - name: Subversion checkout of Greenstone3
    8389    ansible.builtin.subversion:
     
    147153#      path: "{{ gsdl3srchome }}/build.properties"
    148154#      regexp: '^localhost.port.http='
    149 #      line: localhost.port.http={{ gsdl3port }}
     155#      line: localhost.port.http={{ gsdl3_buildproperties_port }}
    150156
    151157  - name: Setting ports in build.properties
     
    153159      path:   "{{ gsdl3srchome }}/build.properties"
    154160      regexp: '^{{ item }}='
    155       line:   "{{ item }}={{ hostvars['localhost']['gsdl3ports'][item] }}"
     161      #line:   "{{ item }}={{ hostvars['localhost']['gsdl3_buildproperties_ports'][item] }}"
     162      line:   "{{ item }}={{ gsdl3_buildproperties_ports[item] }}"     
    156163    with_items:
    157164      - "localhost.port.http"
  • main/trunk/greenstone3/src/ansible-playbooks/vars/default-core.yml

    r38566 r38570  
    22# gsdl3srchome: /home/{{ ansible_user }}/greenstone3-svn
    33# gsdl3srchome: /mnt/<mydisk>/greenstone3-svn
    4 gsdl3srchome: /mnt/intermuse/greenstone3-ansible-svn
     4#gsdl3srchome: /mnt/intermuse/greenstone3-ansible-svn
     5gsdl3srchome: /mnt/intermuse/greenstone3-ansible3-svn
    56
    67digital_librarian_info: {
     
    2930
    3031gsdl3_buildproperties_ports: {
    31   "localhost.port.http":  "{{ gsdl3servlet_internal.explicit_port }}",
     32  "localhost.port.http":  "{{ gsdl3servlet_internal.port }}",
    3233
    3334  #"tomcat.shutdown.port": 8305,
     
    6162}
    6263
     64####
    6365# Using Apache2 as a reverse-proxy server?
     66####
    6467apache2_as_revproxy: true
    6568
Note: See TracChangeset for help on using the changeset viewer.