├── testserver ├── Distribution_Files │ └── Cache │ │ ├── cache.key │ │ └── PUT_CACHE_DISTRIBUTION_HERE.tar.gz ├── ansible.cfg ├── dbserver.yml ├── webserver.yml ├── roles │ └── hs_server_common │ │ ├── handlers │ │ └── main.yml │ │ ├── vars │ │ ├── os-RedHat.yml │ │ └── healthshare2015.yml │ │ ├── tasks │ │ ├── main.yml │ │ ├── setup-RedHat.yml │ │ └── configure-healthshare2015.yml │ │ └── templates │ │ └── parameters_hs20152_rh64.isc └── inventory_test ├── README.md └── LICENSE.md /testserver/Distribution_Files/Cache/cache.key: -------------------------------------------------------------------------------- 1 | PUT YOUR CACHE KEY HERE -------------------------------------------------------------------------------- /testserver/Distribution_Files/Cache/PUT_CACHE_DISTRIBUTION_HERE.tar.gz: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testserver/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | host_key_checking = False 3 | hostfile = inventory_test 4 | -------------------------------------------------------------------------------- /testserver/dbserver.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: dbservers 3 | sudo: yes 4 | roles: 5 | - hs_server_common 6 | -------------------------------------------------------------------------------- /testserver/webserver.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: webservers 3 | sudo: yes 4 | roles: 5 | - hs_server_common 6 | - webserver 7 | -------------------------------------------------------------------------------- /testserver/roles/hs_server_common/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart Cache 3 | command: ccontrol stop "{{ ISC_PACKAGE_INSTANCENAME }}" restart quietly 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ansible-deploy-cache 2 | Example using ansible to deploy and configure Caché 3 | 4 | For details on this example please search for ansible on the InterSystems Developer Community Portal 5 | 6 | https://community.intersystems.com 7 | 8 | -------------------------------------------------------------------------------- /testserver/roles/hs_server_common/vars/os-RedHat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # operating System setup - this will be application specific. 4 | 5 | os_swappiness: 5 6 | os_dirty_background_ratio: 5 7 | os_dirty_ratio: 10 8 | 9 | # minimal security for demo - this must be changed for live environments 10 | 11 | os_disable_selinux: true 12 | os_disable_iptables: true 13 | 14 | -------------------------------------------------------------------------------- /testserver/inventory_test: -------------------------------------------------------------------------------- 1 | # Web servers 2 | 3 | web1 ansible_ssh_host=web_server_hostname 4 | 5 | # Drivers 6 | 7 | gen1 ansible_ssh_host=gen_server_hostname1 8 | gen2 ansible_ssh_host=gen_server_hostname2 9 | gen3 ansible_ssh_host=gen_server_hostname3 10 | 11 | db ansible_ssh_host=192.168.33.61 12 | 13 | [webservers] 14 | web1 15 | 16 | [generators] 17 | gen1 18 | gen2 19 | gen3 20 | 21 | [dbservers] 22 | db 23 | 24 | 25 | [datacenter:children] 26 | webservers 27 | generators 28 | dbservers 29 | 30 | [datacenter:vars] 31 | ansible_ssh_user=vagrant 32 | ansible_ssh_pass=vagrant 33 | 34 | -------------------------------------------------------------------------------- /testserver/roles/hs_server_common/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ## NOTE: These Examples can be used as a template for HealthShare, Ensemble or Caché deployment 4 | ## 5 | 6 | # include Caché defaults 7 | - include_vars: healthshare2015.yml 8 | 9 | # Setup/install tasks. 10 | 11 | # Configure OS Basics - Note the "when:" clause 12 | 13 | - include_vars: os-RedHat.yml 14 | when: ansible_os_family == 'RedHat' 15 | 16 | - include: setup-RedHat.yml 17 | when: ansible_os_family == 'RedHat' 18 | 19 | 20 | #### Install and Configure healthshare 21 | 22 | - include: configure-healthshare2015.yml 23 | 24 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Murray Oldfield 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /testserver/roles/hs_server_common/tasks/setup-RedHat.yml: -------------------------------------------------------------------------------- 1 | ### Red Hat Caché specific OS config 2 | 3 | # Set /etc/sysctl.conf 4 | 5 | - sysctl: name=vm.swappiness value="{{ os_swappiness }}" state=present 6 | - sysctl: name=vm.dirty_background_ratio value="{{ os_dirty_background_ratio }}" state=present 7 | - sysctl: name=vm.dirty_ratio value="{{ os_dirty_ratio }}" state=present 8 | 9 | 10 | # This is an example only of using calculations 11 | 12 | - debug: msg="Memory in MB {{ ansible_memtotal_mb }}" 13 | - debug: msg="Memory in GB {{ ansible_memtotal_mb/1024 }}" 14 | - debug: msg="Memory in bytes {{ ansible_memtotal_mb * 1024 *1024 }}" 15 | - debug: msg="Number of Huge Pages {{ (((hs_percent_shared_memory/100) * ansible_memtotal_mb)/2)|round|int }}" 16 | 17 | 18 | # Huge pages are 2MB on RH Intel 19 | # Huge pages must be greater than total shared memory (routine + global buffers + GMHEAP + Other) 20 | 21 | - sysctl: name=vm.nr_hugepages value="{{ (((hs_percent_shared_memory/100) * ansible_memtotal_mb)/2)|round|int }}" state=present reload=yes 22 | 23 | 24 | # shmmax can be as big as we want - there is no penalty, make same size as memory 25 | 26 | - sysctl: name=kernel.shmmax value="{{ ansible_memtotal_mb * 1024 *1024 }}" state=present reload=yes 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /testserver/roles/hs_server_common/vars/healthshare2015.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### REVIEW ALL THE FILE PATHS TO ENSURE COMPATABILITY WITH YOUR SYSTEMS 3 | 4 | # HS/cache default install file temp directory on target 5 | common_install_base_path: /ztemp/hsinstall 6 | 7 | # Path to distribution fies on local server 8 | # YOU WILL HAVE TO CHANGE THIS FOR YOUR SET UP 9 | common_path_to_distribution_files: Distribution_Files 10 | common_path_to_distribution_files_Cache: "{{ common_path_to_distribution_files }}/Cache" 11 | 12 | 13 | # HS default groups 14 | hs_cache_group: cachegrp 15 | hs_cachemgr_group: cachemgr 16 | 17 | # HS default users 18 | hs_cache_usr: cacheusr 19 | hs_cache_usr_sys: cachesys 20 | 21 | # HS default install temp file upack directory 22 | hs_install_unpack_path: unpack 23 | 24 | 25 | # HealthShare/Cache install files. 26 | # - - - - - - - - - - - - - - 27 | # NOTE: The scripts in this example work with Caché, HealthShare AP or Ensemble 28 | # Caché distribution file and cache.key must exist on the controller server in: 29 | # {{ common_path_to_distribution_files_Cache }} 30 | # Change the distribution file to match the the file you will use. 31 | 32 | # cache-2015.2.2.805.0-lnxrhx64.tar.gz 33 | hs_distribution_file: cache-2015.2.2.805.0-lnxrhx64 34 | 35 | # Other examples: 36 | # HSAP-2015.2.1.705.0-hscore14.01-b7952-lnxrhx64.tar.gz 37 | # Different distribution. Comment previous variable and uncomment this one. 38 | # hs_distribution_file: HSAP-2015.2.1.705.0-hscore14.01-b7952-lnxrhx64 39 | 40 | 41 | # Separate apache configuration file for Caché CSP and application configuration 42 | hs_ztrak_conf_location: /etc/httpd/conf.d/ztrak.conf 43 | 44 | # Destination file paths 45 | hs_parameterfile_location_hs2015: "{{ common_install_base_path }}/unpack/package/installFromParametersFile" 46 | hs_parameterfile_name_rh64: parameters_hs20152_rh64.isc 47 | 48 | ISC_PACKAGE_INSTANCENAME: H2015 49 | ISC_PACKAGE_INSTALLDIR: /test/hs2015 50 | ISC_PACKAGE_UNICODE: Y 51 | ISC_PACKAGE_INITIAL_SECURITY: Normal 52 | ISC_PACKAGE_MGRUSER: "{{ hs_cache_usr_sys }}" 53 | ISC_PACKAGE_MGRGROUP: "{{ hs_cachemgr_group }}" 54 | ISC_PACKAGE_USER_PASSWORD: SYS 55 | ISC_PACKAGE_CACHEUSER: "{{ hs_cache_usr }}" 56 | ISC_PACKAGE_CACHEGROUP: "{{ hs_cache_group }}" 57 | ISC_PACKAGE_SUPERSERVER_PORT: 1972 58 | ISC_PACKAGE_WEBSERVER_PORT: 57772 59 | ISC_PACKAGE_JDBCGATEWAY_PORT: 62972 60 | ISC_PACKAGE_SMP_CSP_PASSWORD: SYS 61 | ISC_CSP_GATEWAY_DIR: /opt/cspgateway 62 | 63 | 64 | # Set defaults for cache.cpf file 65 | 66 | hs_percent_shared_memory: 75 # Percentage (0-100) of total RAM to dedicate to huge pages 67 | 68 | # Default values - These will be application specific - These will be used in Part 2 ofthe blog post 69 | hs_tc_routine_buffers: 512 70 | hs_locksize: 64000000 71 | hs_gmheap: 256000 72 | 73 | # Global buffers is memory allocated for huge pages - all hs/Cache shared memory 74 | 75 | # Approx how much memory for hs shared memory - Global and routine buffers gmheap, etc 76 | # Ballpark - can hard code global buffers etc. 77 | 78 | ## Leave a buffer for other structures and rounding errors. 79 | 80 | hs_shared_memory_available_for_hs: "{{ (((hs_percent_shared_memory/100) * ansible_memtotal_mb) * (hs_percent_shared_memory_hs/100) )|round|int }}" 81 | -------------------------------------------------------------------------------- /testserver/roles/hs_server_common/templates/parameters_hs20152_rh64.isc: -------------------------------------------------------------------------------- 1 | 2 | dist.source_dir: {{ common_install_base_path }}/{{ hs_install_unpack_path }} 3 | legacy_dist.source_dir: {{ common_install_base_path }}/{{ hs_install_unpack_path }} 4 | product_info.version: 2015.2.0.664.0 5 | product_info.name: HealthShare 6 | product_info.displayed_name: HealthShare 7 | platform_selection.platform: lnxrhx64 8 | platform_selection.platform_family: lnxrhx64 9 | platform_selection.endianness: little 10 | platform_selection.os: Linux 11 | posix_tools.user_add: /usr/sbin/useradd 12 | posix_tools.group_add: /usr/sbin/groupadd 13 | posix_tools.grep: grep 14 | posix_tools.id: id 15 | posix_tools.ps_opt: -ef 16 | posix_tools.gzip: gzip 17 | posix_tools.shared_ext: so 18 | posix_tools.symbolic_copy: cp -Rfp 19 | posix_tools.tr: tr 20 | posix_tools.shared_ext1: so 21 | posix_tools.permission: 755 22 | posix_tools.dir_permission: 775 23 | server_location.target_dir: {{ ISC_PACKAGE_INSTALLDIR }} 24 | server_location.is_server_install: Y 25 | server_location.is_nonroot_install: N 26 | server_location.instance_name: H2015 27 | server_location.is_new_install: Y 28 | server_location.registry_dir: /usr/local/etc/cachesys 29 | server_location.convert_ensemble_registry: 30 | server_location.ccontrol: {{ common_install_base_path }}/{{ hs_install_unpack_path }}/dist/lnxrhx64/bin/shared/ccontrol 31 | install_mode.setup_type: Custom 32 | unicode_selection.binary_type: unicode 33 | unicode_selection.install_unicode: Y 34 | security_settings.cache_user: {{ hs_cache_usr }} 35 | security_settings.cache_group: {{ hs_cache_usr }} 36 | security_settings.manager_user: {{ hs_cache_usr_sys }} 37 | security_settings.manager_group: {{ hs_cachemgr_group }} 38 | security_settings.dbencrypted: 0 39 | security_settings.dbenckeyfile: 40 | security_settings.dbenckeyuser: 41 | security_settings.personal_database: 42 | security_settings.initial_level: Normal 43 | security_settings.already_secured: N 44 | security_settings.password: {{ ISC_PACKAGE_SMP_CSP_PASSWORD }} 45 | security_settings.csppassword: {{ ISC_PACKAGE_SMP_CSP_PASSWORD }} 46 | security_settings.dbenckeypassword: {{ ISC_PACKAGE_SMP_CSP_PASSWORD }} 47 | installer.manifest: 48 | installer.manifest_parameters: SourceDir={{ common_install_base_path }}/{{ hs_install_unpack_path }},ISCUpgrade=0, 49 | manager_source_code.available: Y 50 | port_selection.superserver_port: {{ ISC_PACKAGE_SUPERSERVER_PORT }} 51 | port_selection.webserver_port: {{ ISC_PACKAGE_WEBSERVER_PORT }} 52 | port_selection.jdbcgateway_port: {{ ISC_PACKAGE_JDBCGATEWAY_PORT }} 53 | csp_gateway.configure: Y 54 | csp_gateway.web_server_type: Apache 55 | csp_gateway.apache_version: 2.4 56 | csp_gateway.apache_user: apache 57 | csp_gateway.apache_conf_file: {{ hs_ztrak_conf_location }} 58 | csp_gateway.apache_pid_file: 59 | csp_gateway.apache_use32bit: N 60 | csp_gateway.sunone_server: 61 | csp_gateway.directory: /opt/cspgateway 62 | csp_gateway.selinuxaware: N 63 | license_key.enter_key: 64 | license_key.license_file: 65 | agent.user_account: iscagent 66 | agent.user_group: iscagent 67 | agent.install: N 68 | client_location.target_dir: {{ ISC_PACKAGE_INSTALLDIR }} 69 | client_location.is_client_install: N 70 | samples.install: Y 71 | japanese_docs.install: N 72 | docbook.install: Y 73 | postinstall: upgrade 74 | install: odbc 75 | install: samples 76 | install: dev_kit 77 | install: ensemble_databases 78 | install: hsdocumentation 79 | install: fop 80 | install: renderserver 81 | install: printserver 82 | install: excelexporter 83 | install: addenda 84 | install: install_confirmation 85 | install: copyright 86 | install: database_server 87 | postinstall: database_server 88 | install: mprl 89 | install: hscore 90 | install: shutdown_server 91 | install: install_confirmation 92 | -------------------------------------------------------------------------------- /testserver/roles/hs_server_common/tasks/configure-healthshare2015.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: msg="Start of HealthShare/Caché install" 4 | 5 | # Create users and groups 6 | - name: Create default cache group 7 | group: name={{ hs_cache_group }} state=present 8 | 9 | - name: Create default cache manager group 10 | group: name={{ hs_cachemgr_group }} state=present 11 | 12 | - name: Create default cache user 13 | user: name={{ hs_cache_usr }} comment="cacheusr" group={{ hs_cache_group }} 14 | 15 | - name: Create default cache system users 16 | user: name={{ hs_cache_usr_sys }} comment="cache system usr" group={{ hs_cachemgr_group }} 17 | 18 | 19 | # Copy distribution Files 20 | 21 | - name: Create full Caché install temp directory 22 | file: path={{ common_install_base_path }}/{{ hs_install_unpack_path }} 23 | mode=0777 24 | state=directory 25 | 26 | 27 | # Check whether file has been untar'ed already 28 | 29 | - name: Check tar file (gunzipped already) does not exist 30 | stat: path={{ common_install_base_path }}/{{ hs_distribution_file }}.tar 31 | register: hs_tar_file 32 | 33 | 34 | - name: Copy Caché/hs install file 35 | copy: src={{ common_path_to_distribution_files_Cache }}/{{ hs_distribution_file }}.tar.gz 36 | dest={{ common_install_base_path }}/{{ hs_distribution_file }}.tar.gz 37 | when: not hs_tar_file.stat.exists 38 | 39 | 40 | # uncompress and untar 41 | 42 | - name: un zip Caché folder 43 | command: gunzip {{ common_install_base_path }}/{{ hs_distribution_file }}.tar.gz 44 | args: 45 | chdir: "{{ common_install_base_path }}" 46 | creates: "{{ hs_distribution_file }}.tar" 47 | 48 | 49 | - name: un tar Caché install 50 | command: tar -xvf {{ common_install_base_path }}/{{ hs_distribution_file }}.tar 51 | args: 52 | chdir: "{{ common_install_base_path }}/{{ hs_install_unpack_path }}" 53 | creates: "{{ common_install_base_path }}/{{ hs_install_unpack_path }}/cinstall" 54 | 55 | 56 | # ### Alternative 57 | #- name: Unarchive install file 58 | # unarchive: 59 | # src={{ common_install_base_path }}/{{ hs_distribution_file }}.tar.gz 60 | # dest={{ common_install_base_path }}/{{ hs_install_unpack_path }}.tar.gz 61 | # copy=yes 62 | # mode=0777 63 | # creates="{{ common_install_base_path }}/{{ hs_install_unpack_path }}/cinstall" 64 | 65 | 66 | # Install Caché 67 | 68 | - name: Create hs install directory 69 | file: path={{ ISC_PACKAGE_INSTALLDIR }} state=directory 70 | 71 | 72 | # File for Web server Caché CSP directives 73 | 74 | - name: touch ztrak.conf. 75 | command: touch "{{ hs_ztrak_conf_location }}" 76 | args: 77 | creates: "{{ hs_ztrak_conf_location }}" 78 | 79 | 80 | # Process install file - Note this uses the included Jinja2 filters 81 | 82 | - name: Process parameters file 83 | template: 84 | src="{{ hs_parameterfile_name_rh64 }}" 85 | dest="{{ common_install_base_path }}" 86 | 87 | 88 | #### Example unattended install using parameters file to show how ansible templates files can be used. 89 | # (see ./roles/hs_server_common/templates/parameters_hs20152_rh64.isc). 90 | # A parameters file is useful when you want to install and configure Caché and use CSPGateway with a web server other than the Caché internal Apache version. 91 | # Note: yes is a unix command outputs an affirmative response, or a user-defined string of text continuously until killed 92 | # Its shown here because installing with a parameters file requires a user response to go ahead. 93 | 94 | #- name: Unattended install of hs/Cache from parameters file 95 | # shell: yes '' | {{ hs_parameterfile_location_hs2015 }} {{ common_install_base_path }}/{{ hs_parameterfile_name_rh64 }} 96 | # when: ansible_os_family == 'RedHat' 97 | # args: 98 | # creates: "{{ ISC_PACKAGE_INSTALLDIR }}/cinstall.log" 99 | 100 | 101 | - name: unattended install of hs/Cache using cinstall_silent 102 | shell: > 103 | ISC_PACKAGE_INSTANCENAME="{{ ISC_PACKAGE_INSTANCENAME }}" 104 | ISC_PACKAGE_INSTALLDIR="{{ ISC_PACKAGE_INSTALLDIR }}" 105 | ISC_PACKAGE_UNICODE="{{ ISC_PACKAGE_UNICODE }}" 106 | ISC_PACKAGE_INITIAL_SECURITY="{{ ISC_PACKAGE_INITIAL_SECURITY }}" 107 | ISC_PACKAGE_MGRUSER="{{ ISC_PACKAGE_MGRUSER }}" 108 | ISC_PACKAGE_MGRGROUP="{{ ISC_PACKAGE_MGRGROUP }}" 109 | ISC_PACKAGE_USER_PASSWORD="{{ ISC_PACKAGE_USER_PASSWORD }}" 110 | ISC_PACKAGE_CACHEUSER="{{ ISC_PACKAGE_CACHEUSER }}" 111 | ISC_PACKAGE_CACHEGROUP="{{ ISC_PACKAGE_CACHEGROUP }}" ./cinstall_silent 112 | chdir="{{ common_install_base_path }}/{{ hs_install_unpack_path }}" 113 | args: 114 | creates: "{{ ISC_PACKAGE_INSTALLDIR }}/cinstall.log" 115 | 116 | 117 | # Copy key now. Note healthshare not started until after tasks finished 118 | 119 | - name: copy hs key 120 | copy: src="{{ common_path_to_distribution_files_Cache }}/cache.key" dest="{{ ISC_PACKAGE_INSTALLDIR }}/mgr" 121 | notify: restart Cache 122 | 123 | 124 | - name: Set default hs instance 125 | command: "ccontrol default {{ ISC_PACKAGE_INSTANCENAME }}" 126 | 127 | 128 | - name: restart apache to initialize CSP.ini file 129 | service: 130 | name: httpd 131 | state: restarted 132 | 133 | 134 | 135 | 136 | --------------------------------------------------------------------------------