Skip to content

Commit

Permalink
feat: cover status checks for expired auth keys (#280)
Browse files Browse the repository at this point in the history
* feat: cover status checks for expired auth keys

* chore: add to state-absent converge

* chore: reformat multi-conditional when statement
  • Loading branch information
artis3n authored Jan 1, 2023
1 parent 1c4c54a commit 4f32273
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions molecule/args/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
ansible.builtin.assert:
that:
- "'Logged out.' not in tailscale_status.stdout"
- "'not logged in' not in tailscale_status.stdout"
1 change: 1 addition & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
ansible.builtin.assert:
that:
- "'Logged out.' not in tailscale_status.stdout"
- "'not logged in' not in tailscale_status.stdout"
1 change: 1 addition & 0 deletions molecule/idempotent-up/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
ansible.builtin.assert:
that:
- "'Logged out.' not in tailscale_status.stdout"
- "'not logged in' not in tailscale_status.stdout"
1 change: 1 addition & 0 deletions molecule/skip-authentication/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
failed_when:
- tailscale_status.rc != 0
- "'Logged out.' not in tailscale_status.stdout"
- "'not logged in' not in tailscale_status.stdout"

- name: Assertions
ansible.builtin.assert:
Expand Down
1 change: 1 addition & 0 deletions molecule/state-absent/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ansible.builtin.assert:
that:
- "'Logged out.' not in tailscale_status.stdout"
- "'not logged in' not in tailscale_status.stdout"

- name: Uninstall Tailscale
ansible.builtin.include_role:
Expand Down
1 change: 1 addition & 0 deletions molecule/state-present/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
ansible.builtin.assert:
that:
- "'Logged out.' not in tailscale_status.stdout"
- "'not logged in' not in tailscale_status.stdout"
1 change: 1 addition & 0 deletions molecule/vars-priority/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
ansible.builtin.assert:
that:
- "'Logged out.' not in tailscale_status.stdout"
- "'not logged in' not in tailscale_status.stdout"
4 changes: 3 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
failed_when:
- tailscale_status.rc != 0
- "'Logged out.' not in tailscale_status.stdout"
- "'not logged in' not in tailscale_status.stdout"

- name: Install | Tailscale Status
ansible.builtin.debug:
Expand Down Expand Up @@ -81,7 +82,8 @@
ignore_errors: true
when: >
not tailscale_up_skip | bool
and ('Logged out.' in tailscale_status.stdout
and (('Logged out.' in tailscale_status.stdout
and 'not logged in' in tailscale_status.stdout)
or state_checksum != existing_state_checksum)
notify: Confirm Tailscale is Connected
async: 60
Expand Down
2 changes: 1 addition & 1 deletion tasks/uninstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Hack to get correct changed/ok status
ansible.builtin.shell: tailscale status; tailscale logout
register: tailscale_logout
changed_when: "'Logged out.' not in tailscale_logout.stdout"
changed_when: "'Logged out.' not in tailscale_status.stdout and 'not logged in' not in tailscale_status.stdout"
when:
# [Errno 2] No such file or directory: 'tailscale'
- tailscale_status.rc != 2
Expand Down

0 comments on commit 4f32273

Please sign in to comment.