Skip to content

Add option to add netdata to unattended upgrades for debian #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ netdata_agent_web_enabled: true
netdata_agent_web_port: 19999
netdata_agent_web_bind_to:
netdata_agent_web_allow_from:

## Netdata package repository
# Enable automatic updates
netdata_enable_unattended_upgrades: false
```

## Dependencies
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ netdata_distro_check_bypass: false
# Distro check failstate end_role|end_play|end_host
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/meta_module.html#parameter-free_form
netdata_distro_check_fail_state: end_role

## Netdata package repository
# Enable automatic updates
netdata_enable_unattended_upgrades: false
18 changes: 18 additions & 0 deletions tasks/repo-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,23 @@
state: absent
enabled: true

- name: "Disable unattended-upgrades for Netdata"
when: not netdata_enable_unattended_upgrades
ansible.builtin.file:
path: "/etc/apt/apt.conf.d/50unattended-upgrades-netdata"
state: absent

- name: "Enable unattended-upgrades for Netdata"
when: netdata_enable_unattended_upgrades
ansible.builtin.copy:
dest: "/etc/apt/apt.conf.d/50unattended-upgrades-netdata"
content: |
Unattended-Upgrade::Origins-Pattern {
"origin=Netdata,codename=${distro_codename},label=Netdata";
};
owner: root
group: root
mode: "0644"

- name: "Flush handlers"
ansible.builtin.meta: flush_handlers
5 changes: 5 additions & 0 deletions tasks/repo-RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,10 @@
state: absent
key: https://repo.netdata.cloud/netdatabot.gpg.key

- name: "Fail if netdata_enable_unattended_upgrades is used on RedHat"
ansible.builtin.fail:
msg: "netdata_enable_unattended_upgrades is not supported on RedHat-based systems yet."
when: netdata_enable_unattended_upgrades

- name: "Flush handlers"
ansible.builtin.meta: flush_handlers