47 lines
2.2 KiB
Markdown
47 lines
2.2 KiB
Markdown
# Deploy files from a git repository
|
|
|
|
This role will localy clone any number of git repositories with any number of branches, then create an archive for each repositories/branches combinations.
|
|
|
|
Those archives will then be extracted to the remote server in the correct directory.
|
|
|
|
To make this work, you need to define an object with all the necessary variables, like this:
|
|
```
|
|
git_generic_deploy_files_list:
|
|
- repository_url: 'https://scmlab.talas.com/VirtualTryOn/talasTryOn_API_Booth.git'
|
|
branch: 'opticworld'
|
|
deploy_directory: '/var/www/opticworld.vto.talas.io/'
|
|
- repository_url: 'https://scmlab.talas.com/VirtualTryOn/talasTryOn_API_Booth.git'
|
|
branch: 'master'
|
|
deploy_directory: '/dev/shm/test/'
|
|
```
|
|
|
|
# Mandatory variable
|
|
| Variable | Description | Example |
|
|
|-----------------------------------|-------------|---------|
|
|
| repository_url | repo url | `https://scmlab.talas.com/VirtualTryOn/talasTryOn_API_Booth.git`
|
|
| branch | branch to clone | `master`
|
|
| deploy_directory | path to unpack archive | `/var/www/freescout`
|
|
|
|
# Optional variable
|
|
| Variable for git_generic_deploy_files_list | Description | Default value |
|
|
|-----------------------------------|-------------|---------------|
|
|
| deploy_directory_owner | Owner of deploy_directory path | none, same as user executing |
|
|
| deploy_directory_group | group owning of deploy_directory path | none, same as user executing |
|
|
| deploy_directory_mode | perms of deploy_directory path | |
|
|
| owner | owner of files inside the repo, same for all files | same as user executing |
|
|
| group | group owning files inside the repo, same for all files | same as user executing |
|
|
| mode | perms for files inside the repo | perserve those from repo |
|
|
|
|
The git_generic_deploy_copy variable is very simple and use the same parameters of module copy (https://docs.ansible.com/ansible/latest/modules/copy_module.html).
|
|
|
|
Example:
|
|
```
|
|
git_generic_deploy_copy:
|
|
- dest: "/var/www/prerequisites.talas.net/veza_prerequisites/configuration.php"
|
|
content: |
|
|
<?php
|
|
define('ACJS_URL', 'https://c1.talas.biz/43ACJS17007');
|
|
define('ACJS_USER', '{{ local_ACJS_USER }}');
|
|
define('ACJS_PASSWORD', '{{ local_ACJS_PASSWORD }}');
|
|
define('ACJS_SITE', 'm');
|
|
```
|