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

support acl as hujson #10

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# CHANGELOG

## Unreleased

### Breaking
[reff](https://github.com/juanfont/headscale/blob/a7874af3d0ba48913fa7e5fbffbb38b537bae7b3/CHANGELOG.md?plain=1#L74)
- YAML files are no longer supported for headscale policy. [#1792](https://github.com/juanfont/OBheadscale/pull/1792)
- HuJSON is now the only supported format for policy.

### Changed
- Changed `headscale_acl` for `headscale_acl_file`. A file is now needed.

### Removed
- Removed the capability of having ACL YAML formatted to be outputted to a file. ([0c79226](https://github.com/kazauwa/ansible-role-headscale/blob/1cbe9432ae53c3042a45506fd48f3dd203e24c97/tasks/configure.yml#L24))

## 2.0.0 (2024-03-18)

### Breaking
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ansible-galaxy install kazauwa.headscale
## Role Variables

- `headscale_version`
- Default: `0.22.3`
- Default: `0.23.0`
- Description: version of Headscale to install. List of avaliable versions can be found on [official releases page](https://github.com/juanfont/headscale/releases). Defaults to the latest avaliable.
- `headscale_arch`
- Default: `amd64`
Expand Down Expand Up @@ -52,9 +52,9 @@ ansible-galaxy install kazauwa.headscale
- `headscale_config_template`
- Default: `""`
- Description: path to Jinja2 formatted headscale config template. If present, will override `headscale_config`.
- `headscale_acl`
- Default: `{}`
- Description: yaml formatted ACL policies. **Make sure** that you've read the [docs](https://github.com/juanfont/headscale/tree/main/docs#policy-acls) on how to use this feature.
- `headscale_acl_file`
- Default: `""`
- Description: path to HuJSON formatted headscale acl file. **Make sure** that you've read the [docs](https://github.com/juanfont/headscale/blob/main/docs/ref/acls.md) on how to use this feature and the HuJSON syntax [acl-syntax](https://tailscale.com/kb/1337/acl-syntax).
- `headscale_users`
- Default: `[]`
- Description: list of users to create, e.g. to use with tagOwners.
Expand Down
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
headscale_version: '0.22.3'
headscale_version: '0.23.0'
headscale_os: 'linux'
headscale_arch: 'amd64'
headscale_user_name: 'headscale'
Expand All @@ -19,7 +19,7 @@ headscale_directories:

headscale_config: {}
headscale_config_template: ''
headscale_acl: {}
headscale_acl_file: ''
headscale_users: []
headscale_enable_routes: []
headscale_exit_nodes: []
5 changes: 3 additions & 2 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
notify: restart headscale

- name: Copy ACL policies file
when: headscale_acl_file
ansible.builtin.copy:
content: '{{ headscale_acl | to_yaml }}'
dest: '{{ headscale_config_dir }}/acl.yaml'
src: '{{ headscale_acl_file }}'
dest: '{{ headscale_config_dir }}/acl.hujson'
owner: '{{ headscale_user_uid }}'
group: '{{ headscale_user_gid }}'
mode: '0600'
Expand Down