Skip to content

Instantly share code, notes, and snippets.

@samdoran
Created October 30, 2020 17:11
Show Gist options
  • Save samdoran/fd1b56ce8bee34c50cb890f0325e56ec to your computer and use it in GitHub Desktop.
Save samdoran/fd1b56ce8bee34c50cb890f0325e56ec to your computer and use it in GitHub Desktop.
systemd mask tests
tasks:
- name: Install chrony
dnf:
name: chrony
state: present
- name: Start, enable, and unmask
systemd:
name: chronyd
state: started
enabled: yes
masked: no
- name: Mask
systemd:
name: chronyd
masked: yes
- name: Mask again (should not change)
systemd:
name: chronyd
masked: yes
- name: Unmask
systemd:
name: chronyd
masked: no
- name: Unmask again (should not change)
systemd:
name: chronyd
masked: no
- name: Masked + Started
systemd:
name: chronyd
masked: yes
state: started
- name: Stop chronyd
systemd:
name: chronyd
state: stopped
- name: EXPECTED FAILURE (Masked + Started when service is stopped)
systemd:
name: chronyd
masked: yes
state: started
ignore_errors: yes
- name: EXPECTED FAILURE (Masked + Enabled)
systemd:
name: chronyd
masked: yes
enabled: yes
ignore_errors: yes
- name: EXPECTED FAILURE (Masked + Restarted)
systemd:
name: chronyd
masked: yes
state: restarted
ignore_errors: yes
- name: EXPECTED FAILURE (Masked + Reloaded)
systemd:
name: chronyd
masked: yes
state: reloaded
ignore_errors: yes
- name: EXPECTED FAILURE (Enable when currently masked)
systemd:
name: chronyd
enabled: yes
ignore_errors: yes
- name: disable when masked
systemd:
name: chronyd
enabled: no
- name: start (might fail?)
systemd:
name: chronyd
state: started
ignore_errors: yes
- name: disable and mask
systemd:
name: chronyd
enabled: no
masked: yes
ignore_errors: yes
- name: stop disable and mask
systemd:
name: chronyd
enabled: no
masked: yes
state: stopped
ignore_errors: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment