You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note that API keys will expire in 90 days. Set up a monthly event to
22
24
rotate your Tailscale API key.
23
25
24
-
### `policy-file`
26
+
####`policy-file`
25
27
26
28
**Optional** The path to your policy file in the repository. If not set this
27
29
defaults to `policy.hujson` in the root of your repository.
28
30
29
-
### `action`
31
+
####`action`
30
32
31
33
**Required** One of `test` or `apply`. If you set `test`, the action will run
32
34
ACL tests and not update the ACLs in Tailscale. If you set `apply`, the action
33
35
will run ACL tests and then update the ACLs in Tailscale. This enables you to
34
36
use pull requests to make changes with CI stopping you from pushing a bad change
35
37
out to production.
36
38
37
-
## Getting Started
39
+
###Getting Started
38
40
39
41
Set up a new GitHub repository that will contain your tailnet policy file. Open the [Access Controls page of the admin console](https://login.tailscale.com/admin/acls) and copy your policy file to
40
42
a file in that repo called `policy.hujson`.
@@ -49,9 +51,9 @@ name: Sync Tailscale ACLs
49
51
50
52
on:
51
53
push:
52
-
branches: ["main"]
54
+
branches: ["main"]
53
55
pull_request:
54
-
branches: ["main"]
56
+
branches: ["main"]
55
57
56
58
jobs:
57
59
acls:
@@ -87,6 +89,21 @@ jobs:
87
89
action: test
88
90
```
89
91
92
+
## Gitlab CI
93
+
94
+
You can include the YAML file contained in this repository:
This will generate two jobs. The first one (`validate tailscale acls`) tests the validity of the ACLs policy file (by default `policy.hujson`, but can be overridden by the env variable `TAILSCALE_POLICY_FILE`). It does it for every push. The next one (`push tailscale policy`) pushes the policies upstream.
102
+
103
+
You can check this example project for future information: [tailscale-gitops-gitlab-example](https://gitlab.com/rdb-is/devops/tailscale-gitops-gitlab-example)
104
+
105
+
## Generate the required API keys
106
+
90
107
Generate a new API key [here](https://login.tailscale.com/admin/settings/keys).
91
108
92
109
Set a monthly calendar reminder to renew this key because Tailscale does not
@@ -95,8 +112,8 @@ that feature is implemented).
95
112
96
113
Then open the secrets settings for your repo and add two secrets:
97
114
98
-
*`TS_API_KEY`: Your Tailscale API key from the earlier step
99
-
* `TS_TAILNET`: Your tailnet's name (it's next to the logo on the upper
115
+
-`TS_API_KEY`: Your Tailscale API key from the earlier step
116
+
-`TS_TAILNET`: Your tailnet's name (it's next to the logo on the upper
0 commit comments