-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add tc_redirect_tap role (#10)
- Loading branch information
1 parent
dac3663
commit db86ce1
Showing
6 changed files
with
119 additions
and
0 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,27 @@ | ||
# tc_redirect_tap | ||
|
||
Ansible role to install and configure [tc-redirect-tap](https://github.com/awslabs/tc-redirect-tap). | ||
|
||
## Requirements | ||
|
||
None. | ||
|
||
## Dependencies | ||
|
||
None. | ||
|
||
## Role Variables | ||
|
||
Refer to [defaults/main.yml](defaults/main.yml) for a list of variables along with documentation. | ||
|
||
## Example Playbook | ||
|
||
```yaml | ||
- hosts: all | ||
roles: | ||
- role: hostinger.core.tc_redirect_tap | ||
``` | ||
## License | ||
See [LICENSE](../../LICENSE) |
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,10 @@ | ||
--- | ||
tc_redirect_tap_version: 0.0.1 | ||
tc_redirect_tap_url: | | ||
https://github.com/hostinger/tc-redirect-tap/releases/download/v{{ tc_redirect_tap_version }}/tc-redirect-tap-{{ tc_redirect_tap_arch }} | ||
tc_redirect_tap_owner: root | ||
tc_redirect_tap_group: root | ||
tc_redirect_tap_arch: amd64 | ||
tc_redirect_tap_dir: /opt/tc-redirect-tap | ||
tc_redirect_tap_install_dir: "{{ tc_redirect_tap_dir }}/{{ tc_redirect_tap_version }}" | ||
tc_redirect_tap_bin_dir: "{{ tc_redirect_tap_dir }}/bin" |
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,20 @@ | ||
--- | ||
galaxy_info: | ||
role_name: tc_redirect_tap | ||
author: hostinger | ||
description: Ansible role for installing tc-redirect-tap CNI plugin | ||
license: license (MIT) | ||
min_ansible_version: "2.10" | ||
platforms: | ||
- name: Fedora | ||
versions: | ||
- all | ||
- name: Debian | ||
versions: | ||
- all | ||
- name: Ubuntu | ||
versions: | ||
- all | ||
galaxy_tags: | ||
- cni-plugins | ||
- tc-redirect-tap |
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,7 @@ | ||
--- | ||
- name: Converge | ||
hosts: | ||
- all | ||
|
||
roles: | ||
- tc_redirect_tap |
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,19 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
driver: | ||
name: docker | ||
platforms: | ||
- name: default | ||
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
cgroupns_mode: host | ||
pre_build_image: true | ||
privileged: true | ||
platform: amd64 | ||
provisioner: | ||
name: ansible | ||
playbooks: | ||
converge: ${MOLECULE_PLAYBOOK:-converge.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,36 @@ | ||
--- | ||
- name: Fail when unsupported architecture | ||
ansible.builtin.fail: | ||
msg: "Unsupported architecture" | ||
when: | ||
- tc_redirect_tap_arch not in ['amd64', 'arm64'] | ||
|
||
- name: Create directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
mode: 0755 | ||
state: directory | ||
owner: "{{ tc_redirect_tap_owner }}" | ||
group: "{{ tc_redirect_tap_group }}" | ||
with_items: | ||
- "{{ tc_redirect_tap_dir }}" | ||
- "{{ tc_redirect_tap_install_dir }}" | ||
- "{{ tc_redirect_tap_bin_dir }}" | ||
|
||
- name: Download binary | ||
ansible.builtin.get_url: | ||
url: "{{ tc_redirect_tap_url }}" | ||
dest: "{{ tc_redirect_tap_install_dir }}/tc-redirect-tap" | ||
mode: 0755 | ||
owner: "{{ tc_redirect_tap_owner }}" | ||
group: "{{ tc_redirect_tap_group }}" | ||
timeout: 30 | ||
|
||
- name: Create symlink to binaries | ||
ansible.builtin.file: | ||
src: "{{ tc_redirect_tap_install_dir }}/tc-redirect-tap" | ||
dest: "{{ tc_redirect_tap_bin_dir }}/tc-redirect-tap" | ||
mode: 0755 | ||
owner: "{{ tc_redirect_tap_owner }}" | ||
group: "{{ tc_redirect_tap_group }}" | ||
state: link |