Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add role to install clatd #71

Merged
merged 5 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions host_vars/competitorsvcs.studentrobotics.org.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ add_hsts_header: true
certbot_certs:
- domains:
- "{{ canonical_hostname }}"

# Mythic have additionally routed this IP to the VM
PeterJCLaw marked this conversation as resolved.
Show resolved Hide resolved
clat_v6_addr: 2a00:1098:80:bc::2
1 change: 1 addition & 0 deletions playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
roles:
- competitor-services-nginx
- code-submitter
- clatd
- discord-bot

- name: Kit services
Expand Down
7 changes: 7 additions & 0 deletions roles/clatd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# [`clatd`](https://github.com/toreanderson/clatd)

A CLAT / SIIT-DC Edge Relay implementation for Linux.

Used to provide IPv4 outbound connectivity to an IPv6-only VM.
PeterJCLaw marked this conversation as resolved.
Show resolved Hide resolved
PeterJCLaw marked this conversation as resolved.
Show resolved Hide resolved

It's likely `clat-v6-addr` will need to be configured to assign the correct IP to the created `clat` interface. This may require an additional IPv6 address be routed to the VM.
4 changes: 4 additions & 0 deletions roles/clatd/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Restart clatd
service:
name: clatd
state: restarted
49 changes: 49 additions & 0 deletions roles/clatd/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
- name: Download
git:
repo: https://github.com/toreanderson/clatd
dest: "{{ install_dir }}"
force: true
version: 3ea303b5210bf701df30323933c86f9ffe4d3dd4
register: clatd_repo
notify: Restart clatd

- name: Get installed version (if installed)
slurp:
src: "{{ installed_version_file }}"
ignore_errors: true # Ignore if the file is missing, since it's about to be created
register: installed_version_slurp

- name: Resolve installed version
set_fact:
installed_version: "{{ installed_version_slurp.content | b64decode }}"
when: not installed_version_slurp.failed

- name: Install
community.general.make:
chdir: "{{ install_dir }}"
targets:
PeterJCLaw marked this conversation as resolved.
Show resolved Hide resolved
- installdeps # Install system dependencies
- install # Install clatd
when: installed_version is not defined or clatd_repo.after not in installed_version # noqa: no-handler - Use a handler to ensure execution order
notify: Restart clatd
register: install_clatd

- name: Update installed version
copy:
content: "{{ clatd_repo.after }}"
dest: "{{ installed_version_file }}"
mode: "0644"
when: install_clatd.changed # noqa: no-handler - Use a handler to ensure execution order

- name: Install configuration
template:
src: clatd.conf
dest: /etc/clatd.conf
mode: "0644"
notify: Restart clatd

- name: Enable service
service:
name: clatd
state: started
enabled: true
3 changes: 3 additions & 0 deletions roles/clatd/templates/clatd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% if clat_v6_addr is defined %}
clat-v6-addr={{ clat_v6_addr }}
{% endif %}
2 changes: 2 additions & 0 deletions roles/clatd/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
install_dir: /opt/clatd
installed_version_file: /opt/clatd.version
Loading