Skip to content

Instantly share code, notes, and snippets.

@ekbfh
Created March 3, 2020 15:09
Show Gist options
  • Save ekbfh/e4a5ab8f057cd0065d31eb14b59d3ca6 to your computer and use it in GitHub Desktop.
Save ekbfh/e4a5ab8f057cd0065d31eb14b59d3ca6 to your computer and use it in GitHub Desktop.
- name: "Disable timers for unattended upgrade"
raw: "systemctl disable --now {{ item }}"
loop:
- 'apt-daily.timer'
- 'apt-daily-upgrade.timer'
changed_when: false
when: ansible_connection != 'docker'
- name: "Reload systemctl daemon to apply the new changes"
raw: "systemctl daemon-reload"
changed_when: false
when: ansible_connection != 'docker'
- name: "Wait for any possibly running unattended upgrade to finish"
raw: "systemd-run --property=\"After=apt-daily.service apt-daily-upgrade.service\" --wait /bin/true"
changed_when: false
when: ansible_connection != 'docker'
- name: "Purge unattended upgrades"
raw: apt-get -y purge unattended-upgrades
changed_when: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment