diff options
Diffstat (limited to 'roles')
-rw-r--r-- | roles/essential/handlers/atop.yml | 4 | ||||
-rw-r--r-- | roles/essential/handlers/main.yml | 1 | ||||
-rw-r--r-- | roles/essential/tasks/atop.yml | 38 | ||||
-rw-r--r-- | roles/essential/tasks/main.yml | 7 |
4 files changed, 47 insertions, 3 deletions
diff --git a/roles/essential/handlers/atop.yml b/roles/essential/handlers/atop.yml new file mode 100644 index 0000000..33ed20d --- /dev/null +++ b/roles/essential/handlers/atop.yml @@ -0,0 +1,4 @@ +- name: Restart atop + ansible.builtin.service: + name: atop + state: restarted diff --git a/roles/essential/handlers/main.yml b/roles/essential/handlers/main.yml new file mode 100644 index 0000000..2ea72d6 --- /dev/null +++ b/roles/essential/handlers/main.yml @@ -0,0 +1 @@ +- ansible.builtin.import_tasks: roles/essential/handlers/atop.yml diff --git a/roles/essential/tasks/atop.yml b/roles/essential/tasks/atop.yml new file mode 100644 index 0000000..ccc699c --- /dev/null +++ b/roles/essential/tasks/atop.yml @@ -0,0 +1,38 @@ +- name: Install atop + ansible.builtin.package: + name: + - atop + state: present + +- name: Setup per-minute atop snapshot + ansible.builtin.lineinfile: + dest: /etc/default/atop + state: present + regexp: '^#?LOGINTERVAL=' + line: 'LOGINTERVAL=60' + owner: root + group: root + mode: u+rw,g+r,o+r + notify: + - Restart atop + +- name: Setup logrotate to save 7 days of logs for atop + ansible.builtin.lineinfile: + dest: /etc/default/atop + state: present + regexp: '^#?LOGGENERATIONS=' + line: 'LOGGENERATIONS=7' + owner: root + group: root + mode: u+rw,g+r,o+r + notify: + - Restart atop + +- name: Enable atop systemd unit and logrotate timer + ansible.builtin.service: + name: '{{ item }}' + enabled: yes + state: started + loop: + - atop + - atop-rotate.timer diff --git a/roles/essential/tasks/main.yml b/roles/essential/tasks/main.yml index 87be2e5..fbcf875 100644 --- a/roles/essential/tasks/main.yml +++ b/roles/essential/tasks/main.yml @@ -1,3 +1,4 @@ -- ansible.builtin.include_tasks: roles/essential/tasks/packages.yml -- ansible.builtin.include_tasks: roles/essential/tasks/users.yml -- ansible.builtin.include_tasks: roles/essential/tasks/sudo.yml +- ansible.builtin.import_tasks: roles/essential/tasks/packages.yml +- ansible.builtin.import_tasks: roles/essential/tasks/users.yml +- ansible.builtin.import_tasks: roles/essential/tasks/sudo.yml +- ansible.builtin.import_tasks: roles/essential/tasks/atop.yml |