-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Diesel-Net/development
Major overhaul
- Loading branch information
Showing
6 changed files
with
24 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# ansible-role-common | ||
Diesel-Net common predefined and dynamic variables. | ||
# ansible-role-application | ||
Common application deployment tasks and dynamic variables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
localtime_file: '{{ lookup("env", "LOCALTIME_FILE") if lookup("env", "LOCALTIME_FILE") else "/etc/localtime" }}' | ||
ssl_cert_file: '{{ lookup("env", "SSL_CERT_FILE") if lookup("env", "SSL_CERT_FILE") else "/etc/ssl/certs/ca-certificates.crt" }}' | ||
|
||
home_dir: '{{ ansible_env.HOME }}' | ||
app_dir: '{{ home_dir }}/.diesel/{{ repository }}/{{ version }}' | ||
app_dir: '{{ home_dir }}/applications/{{ repository }}/{{ version }}' | ||
config_dir: '{{ app_dir }}/config' | ||
data_dir: '{{ app_dir }}/data' | ||
docker_dir: '{{ app_dir }}/docker' | ||
|
||
version: '{{ version_fallback if not ("production" if git_tag else git_branch) else ("production" if git_tag else git_branch) }}' | ||
# note: `version` and `repository` can easily be overwritten at the playbook/cli level if needed. | ||
# e.g. --extra_vars "version=production" | ||
|
||
# attempts to use the name of the inventory file (not full path) without the .yaml suffix | ||
# https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html | ||
version: '{{ version_fallback if inventory_file | basename | split(".") | first == "hosts" else inventory_file | basename | split(".") | first }}' | ||
|
||
# attempts to use env var $DRONE_REPO_NAME, if set. | ||
# https://docs.drone.io/pipeline/environment/reference/drone-repo-name/ | ||
repository: '{{ repository_fallback if not git_repository else git_repository }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# intentionally left blank |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
# these are in the vars/ folder to maintain higher variable precedence | ||
|
||
git_owner: '{{ lookup("env", "DRONE_REPO_NAMESPACE") }}' | ||
git_repository: '{{ lookup("env", "DRONE_REPO_NAME") }}' | ||
git_tag: '{{ lookup("env", "DRONE_TAG") }}' | ||
git_branch: '{{ lookup("env", "DRONE_BRANCH") }}' | ||
git_version: '{{ git_tag if git_tag else git_branch }}' | ||
|
||
# use the inventory directory name as fallback | ||
# https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html | ||
version_fallback: '{{ inventory_dir | basename }}' | ||
|
||
# go up some dirs and use the top-level directory name as a fallback | ||
# https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html | ||
repository_fallback: '{{ (playbook_dir | dirname | basename) if (playbook_dir | basename == ".ansible") else (playbook_dir | basename) }}' |