Installation

Extract files

On a server the client must be deployed i.e. in /opt/deployment-client/

Use git clone if you feel familiar with git. Otherwise download the archive and extract it.

The files should be owned by root:root because the main script will be executed as root and it wants to chown the extracted files to your application user.

The result in your target directory is:

.
├── bin
│   ├── create_config.sh
│   ├── getfile.sh
│   ├── getfile.sh.cfg
│   ├── getfile.sh.cfg.dist
│   └── preinstall_cleanup.sh
├── deploy_app.sh
├── docs
│   └── ...
├── profiles
│   └── example
│       ├── config.sh.dist
│       ├── replace.txt
│       ├── tasks_config.sh
│       ├── tasks_postinstall.sh
│       └── tasks_preinstall.sh
└── readme.md

Create directory for logfiles

Then create a folder for log data. As root:

mkdir -p /var/log/imldeployment-client/

Automation

This is an example for Ansible.

Execute the deploy_app.sh [PROFILENAME] as root.

Snippet of a playbook:

# ---------- install deployment profile
- name: Deployment profile
  hosts: web
  become: yes
  become_user: root
  vars:
    deploy_profile_name: my_ci_project_id

  roles:
    - iml.deployment_profile

  tags:
    - rollout

Snippet of the Ansible role iml.deployment_profile:

# run deploy script
- name: '{{ deploy_profile_name }} - run deployment client'
  shell: | 
    {{ CONST.imldeployment.clientdir }}/deploy_app.sh {{ deploy_profile_name }}
  register: out_install
  ignore_errors: yes

- debug: var=out_install.stdout.split("\n")
  when: out_install.rc > 0
  
- name: 'check returncode of deployment' 
  fail: msg="ERROR - occured. See output in the debug task above."
  when: out_install.rc > 0