Skip to content

Commit

Permalink
feat: add ability to toggle 'no_log' property on tailscale up task
Browse files Browse the repository at this point in the history
  • Loading branch information
artis3n committed Dec 26, 2021
1 parent ea67c4e commit 2fb6822
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ Helpful when packaging up a Tailscale installation into a build process such as

## Optional

### insecurely_log_authkey

**Default**: `false`

If set to `true`, the "Bring Tailscale Up" command will not mask any failing output message.
The authkey is not logged in successful task completions.
Since the authkey is printed to the console if the task fails, [no_log](https://docs.ansible.com/ansible/latest/reference_appendices/logging.html#protecting-sensitive-data-with-no-log) is enabled by default on the task.

If you are encountering an error bringing Tailscale up and want the "Bring Tailscale Up" task to log details on the error, set this variable to `true`.

### force

**Default**: `false`
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ force: false
# Whether to use the stable or unstable upstream Tailscale build.
# Strongly recommend to leave on 'stable' unless you know what you're doing
release_stability: stable
# Whether to log your Tailscale authkey in the event of some error with the "Bring Tailscale Up" command.
# Since this value is sensitive, log output is disabled by default.
# You can easily toggle this value by setting this variable to "true".
insecurely_log_authkey: false
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
# The command module cannot use | ; &
# So we are ok not quoting the variables
command: tailscale up --authkey={{ tailscale_auth_key }} {{ tailscale_args | default() }}
# Since the auth key is included in this task, we do not want to log output
no_log: true
# Since the auth key is included in this task's output, we do not want to log output
no_log: "{{ not (insecurely_log_authkey | bool) }}"
register: tailscale_start
when: >
force | bool or
Expand Down

0 comments on commit 2fb6822

Please sign in to comment.