-
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 #10 from O1ahmad/ahmad/add_binary_download_feat
feat: add functionality for automatically downloading and extracting binaries with systemd setups
- Loading branch information
Showing
13 changed files
with
100 additions
and
38 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file contains ignores rule violations for ansible-lint | ||
.ansible-lint schema[ansible-lint-config] | ||
meta/main.yml schema[meta] | ||
tasks/common/download-binary.yml jinja[spacing] | ||
tasks/systemd/setup.yml var-naming[no-role-prefix] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
- name: Ensure destination directory exists | ||
ansible.builtin.file: | ||
path: "{{ destination_directory }}" | ||
state: directory | ||
mode: "0755" | ||
|
||
- name: Download the binary file | ||
ansible.builtin.get_url: | ||
url: "{{ binary_url }}" | ||
dest: /tmp/{{ binary_file_name }} | ||
mode: "0755" | ||
vars: | ||
binary_file_name: "{{ binary_url | basename }}" | ||
|
||
- name: Unarchive the file if it's a tar archive | ||
ansible.builtin.unarchive: | ||
src: /tmp/{{ binary_file_name }} | ||
dest: "{{ destination_directory }}" | ||
remote_src: true | ||
when: binary_file_name.endswith('.tar') or binary_file_name.endswith('.tar.gz') or binary_file_name.endswith('.tgz') | ||
|
||
- name: Unzip the file if it's a zip archive | ||
unzip: | ||
src: /tmp/{{ binary_file_name }} | ||
dest: "{{ destination_directory }}" | ||
when: binary_file_name.endswith('.zip') | ||
|
||
- name: Move the file if it's not an archive | ||
Check warning on line 29 in tasks/common/download-binary.yml
|
||
ansible.builtin.command: > | ||
mv /tmp/{{ binary_file_name }} {{ destination_directory }}/{{ binary_file_name_override|default(binary_file_name) }} | ||
when: > | ||
not (binary_file_name.endswith('.tar') or | ||
binary_file_name.endswith('.tar.gz') or | ||
binary_file_name.endswith('.tgz') or | ||
binary_file_name.endswith('.zip') | ||
register: mv_output | ||
changed_when: mv_output.rc != 0 | ||
|
||
- name: Ensure the file has executable permissions | ||
ansible.builtin.file: | ||
path: "{{ destination_directory }}/{{ binary_file_name_override | default(binary_file_name) }}" | ||
mode: "0755" | ||
when: > | ||
not (binary_file_name.endswith('.tar') or | ||
binary_file_name.endswith('.tar.gz') or | ||
binary_file_name.endswith('.tgz') or | ||
binary_file_name.endswith('.zip') |
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,12 +1,12 @@ | ||
--- | ||
- name: Determine service ingress port list for iptables config | ||
ansible.builtin.set_fact: | ||
ingressList: "{{ ingressList + [item.value.ingressPort | string] }}" | ||
ingress_list: "{{ ingress_list + [item.value.ingressPort | string] }}" | ||
with_dict: "{{ ports }}" | ||
|
||
- name: Allow service ingress ports in iptables setup | ||
ansible.builtin.iptables: | ||
chain: INPUT | ||
protocol: tcp | ||
destination_ports: "{{ ingressList }}" | ||
destination_ports: "{{ ingress_list }}" | ||
jump: ACCEPT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
--- | ||
- name: Manage storage/data setup | ||
ansible.builtin.include_tasks: "common/storage-setup.yml" | ||
ansible.builtin.include_tasks: common/storage-setup.yml | ||
|
||
- name: Setup service infrastructure topology | ||
ansible.builtin.include_tasks: "{{ setupMode }}/setup.yml" | ||
ansible.builtin.include_tasks: "{{ setup_mode }}/setup.yml" | ||
|
||
- name: Manage networking and IP tables setup | ||
when: setup_iptables|bool | ||
ansible.builtin.include_tasks: "common/network-setup.yml" | ||
ansible.builtin.include_tasks: common/network-setup.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