forked from itential/itential.deployer
-
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.
Support installation of Itential artifacts using repository URL (ite…
…ntial#87) * Added functionality that allows the deployer to distribute bin/tar/whl files from a repository instead of from a file on the control node. * Added a check to ensure that only one of iap_bin_file, iap_tar_file, or platform_download_url are defined. * Added support for jfrog repository archive files. * fixed ansible lint * Removed reference to vault file * Added explanation to readme and implemented recommended changes
- Loading branch information
1 parent
1ecc55c
commit e88ff21
Showing
8 changed files
with
244 additions
and
85 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
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
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
44 changes: 44 additions & 0 deletions
44
roles/platform/tasks/download-platform-archive-from-repo.yml
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,44 @@ | ||
# Copyright (c) 2024, Itential, Inc | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
- name: Download the IAP file from URL | ||
ansible.builtin.get_url: | ||
url: "{{ iap_archive_download_url }}" | ||
dest: "{{ iap_install_dir }}/" | ||
mode: '0755' | ||
# Sets the appropriate header based on the repository type: | ||
# - For JFrog: Uses the "X-JFrog-Art-Api" header with the API key if "repository_api_key" is defined and "jfrog" is part of the download URL. | ||
# - For Nexus: Uses a default header ("Accept: application/octet-stream") since Nexus doesn't support API key authentication. | ||
headers: >- | ||
{%- if repository_api_key is defined and iap_archive_download_url is search("jfrog") -%} | ||
{"X-JFrog-Art-Api": "{{ repository_api_key }}", "Accept": "application/octet-stream"} | ||
{%- else -%} | ||
{"Accept": "application/octet-stream"} | ||
{%- endif -%} | ||
url_username: "{{ repository_username | default(omit) }}" | ||
url_password: "{{ repository_password | default(omit) }}" | ||
validate_certs: true | ||
register: download_result | ||
|
||
- name: Extract downloaded filename from result | ||
ansible.builtin.set_fact: | ||
downloaded_file: "{{ download_result.dest | basename }}" | ||
|
||
- name: Set iap_bin_file if the downloaded file is a bin file | ||
ansible.builtin.set_fact: | ||
iap_bin_file: "{{ downloaded_file }}" | ||
when: downloaded_file.endswith('.bin') | ||
|
||
- name: Set iap_tar_file if the downloaded file is a tar.gz file | ||
ansible.builtin.set_fact: | ||
iap_tar_file: "{{ downloaded_file }}" | ||
when: downloaded_file.endswith('.tar.gz') | ||
|
||
- name: Determine package name from the downloaded file | ||
ansible.builtin.set_fact: | ||
iap_package_name: >- | ||
{%- if downloaded_file.endswith('.bin') -%} | ||
{{ downloaded_file.split('.linux.x86_64.bin')[0] }} | ||
{%- elif downloaded_file.endswith('.tar.gz') -%} | ||
{{ downloaded_file.split('.linux.x86_64.tar.gz')[0] }} | ||
{%- endif -%} |
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
58 changes: 58 additions & 0 deletions
58
roles/platform/tasks/upload-platform-archive-from-local.yml
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,58 @@ | ||
# Copyright (c) 2024, Itential, Inc | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
- name: Upload the IAP bin file using rsync | ||
ansible.posix.synchronize: | ||
src: "{{ iap_bin_file }}" | ||
dest: "{{ iap_install_dir }}/{{ iap_bin_file }}" | ||
rsync_opts: | ||
- "--copy-links" | ||
when: | ||
- upload_using_rsync | ||
- iap_bin_file is defined | ||
|
||
- name: Upload the IAP tar file using rsync | ||
ansible.posix.synchronize: | ||
src: "{{ iap_tar_file }}" | ||
dest: "{{ iap_install_dir }}/{{ iap_tar_file }}" | ||
rsync_opts: | ||
- "--copy-links" | ||
when: | ||
- upload_using_rsync | ||
- iap_tar_file is defined | ||
|
||
- name: Upload the IAP bin file using copy | ||
ansible.builtin.copy: | ||
src: "{{ iap_bin_file }}" | ||
dest: "{{ iap_install_dir }}/{{ iap_bin_file }}" | ||
mode: "0775" | ||
force: false | ||
when: | ||
- not upload_using_rsync | ||
- iap_bin_file is defined | ||
|
||
- name: Upload the IAP tar file using copy | ||
ansible.builtin.copy: | ||
src: "{{ iap_tar_file }}" | ||
dest: "{{ iap_install_dir }}/{{ iap_tar_file }}" | ||
mode: "0775" | ||
force: false | ||
when: | ||
- not upload_using_rsync | ||
- iap_tar_file is defined | ||
|
||
- name: Change bin file ownership, group and permissions | ||
ansible.builtin.file: | ||
path: "{{ iap_install_dir }}/{{ iap_bin_file }}" | ||
owner: "{{ iap_user }}" | ||
group: "{{ iap_group }}" | ||
mode: "0755" | ||
when: iap_bin_file is defined | ||
|
||
- name: Change tar file ownership, group and permissions | ||
ansible.builtin.file: | ||
path: "{{ iap_install_dir }}/{{ iap_tar_file }}" | ||
owner: "{{ iap_user }}" | ||
group: "{{ iap_group }}" | ||
mode: "0755" | ||
when: iap_tar_file is defined |
Oops, something went wrong.