diff --git a/README.md b/README.md index fb02c0cc..87b764ee 100644 --- a/README.md +++ b/README.md @@ -235,9 +235,9 @@ If you need to view the unredacted value, see [`insecurely_log_authkey`](#insecu ### tailscale_up_timeout -**Default**: `120s` +**Default**: `120` -Defines the timeout duration for the `tailscale up` command. +Defines the timeout duration for the `tailscale up` command in seconds. > --timeout duration > diff --git a/defaults/main.yml b/defaults/main.yml index 18d65869..7ef71b08 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -9,8 +9,8 @@ tailscale_authkey: "" tailscale_args: "" # Apply provided tags to node tailscale_tags: [] -# Set timeout for 'tailscale up' command -tailscale_up_timeout: "120s" +# Set timeout for 'tailscale up' command in seconds +tailscale_up_timeout: "120" # Used for OAuth authentication # Register as an ephemeral node (recommended) diff --git a/tasks/install.yml b/tasks/install.yml index 033cadf5..de6635d2 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -113,7 +113,7 @@ - name: Install | Build the final tailscale_args ansible.builtin.set_fact: - tailscale_args_string: "{{ tailscale_args }} {{ tailscale_tags_string | trim }} --timeout={{ tailscale_up_timeout | trim }}" + tailscale_args_string: "{{ tailscale_args }} {{ tailscale_tags_string | trim }} --timeout={{ tailscale_up_timeout | trim }}s" - name: Install | Final `tailscale up` arguments string ansible.builtin.debug: @@ -142,7 +142,7 @@ - not tailscale_up_skip - state_file is changed or not tailscale_is_online notify: Confirm Tailscale is Connected - async: 60 + async: "{{ (tailscale_up_timeout | trim | int) + 10 }}" poll: 5 - name: Install | Report non-sensitive stdout from "tailscale up" # noqa: no-handler diff --git a/tasks/main.yml b/tasks/main.yml index 64b8f5ef..c58d487b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,6 +27,15 @@ - state != "absent" - not tailscale_up_skip +- name: Tailscale timeout verification + ansible.builtin.fail: + msg: "`tailscale_up_timeout` variable should be parseable as an integer." + when: + - tailscale_up_timeout != 0 + - (tailscale_up_timeout | type_debug == "bool") or not (tailscale_up_timeout | int) + - state != "absent" + - not tailscale_up_skip + - name: Use tailscale_tags instead of tailscale_args for tags ansible.builtin.debug: msg: You must use `tailscale_tags` instead of `tailscale_args` to assign tags.