From f2f505cfc8d65c8c612c3a4b9aa6d0185f62f1bd Mon Sep 17 00:00:00 2001 From: Frank Villaro-Dixon Date: Fri, 4 Oct 2024 20:37:55 +0200 Subject: [PATCH] add more shit Signed-off-by: Frank Villaro-Dixon --- defaults/main.yml | 6 +++++- handlers/main.yml | 4 ++++ tasks/journald.yml | 23 +++++++++++++++++++++++ tasks/main.yml | 3 +++ tasks/ntp.yml | 1 + tasks/pkgs.yml | 13 +++++++++++++ tasks/setup_backup.yml | 4 ++++ 7 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 tasks/journald.yml create mode 100644 tasks/pkgs.yml create mode 100644 tasks/setup_backup.yml diff --git a/defaults/main.yml b/defaults/main.yml index 6fede56..44269bb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,4 +8,8 @@ ssh_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDDEEf2vpLMXa2o9tA3xeoPWMZ0Dk1MjIV9AOPyKT4Gi8jSovEnN+Hu1FQhODLkRx+CGkD5dV9rirbL6yD4BC9vNXoO2FeQpgRPAl1WkMpmg+AvVmroOUlsiNYCQL/F/yIAGwXiIo4mWTcsYDNngnlFkmqWzjaUG1VltmVOJtN+YVYvMj5ak/NYnFQIF7UsUZ/TRmQ9pvej2Yw001crhqe7SUfCYinJL/ynBmT/pXnd2hKJR5JSQl9uqBpsOFhPBUuShKjOMH+zc/6aM/MNEPNBnstvykztht6t4u8umu7LujcfWotwccz8rBhDSU6sIii0hbzxIeNWcM2pvNp/YtqmpEXpDJ8Yz8ffQY92lreR6picfvkqkoR+RA2uhMGP0VzajWCLPYQAHFmWOZIba6PpvJ5bkTSM+IA8U5dtBJ7l9D4vCKhUeybZUHTKL3hwxpaumu75giszKtZ15SA76QhZ5fLz+AuG2LdQwgnEgcdgLmrXXGi3/SOhvj5O9JGkrt5dIJHNo1sADulqhCLXjurlE2I55j2SloLmpduVKTUSD+OC0iTqIwzn8Sk6VVgSYfrUoZs7ySmFKG4SH+2iAcatj3z6r45y6eGqGaLdkeSFRlA6PJPuI85p6Fc44NxOEFae5wXV/G9nWHsnfZYv8cr73gaIo4duUg7fqmdjJ8BeDw== /home/frank/.ssh/id_rsa.auth -ansible_cfg_repo: infra/ansible-common \ No newline at end of file +ansible_cfg_repo: infra/ansible-common + +journal_volatile: true + +setup_ntp: true \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml index 855f67b..63b2f06 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,6 +3,10 @@ name: systemd-timesyncd state: restarted +- name: restart systemd-journald + systemd: + name: systemd-journald + state: restarted - name: restart sshd systemd: diff --git a/tasks/journald.yml b/tasks/journald.yml new file mode 100644 index 0000000..502edca --- /dev/null +++ b/tasks/journald.yml @@ -0,0 +1,23 @@ +# Make the systemd journal volatile (i.e. don't store it to disk) + +# only do that on raspberry Pis + + +- name: Set systemd journal to volatile + ini_file: + path: /etc/systemd/journald.conf + section: Journal + option: Storage + value: volatile + notify: restart systemd-journald + when: ansible_architecture == 'armv7l' and vars.journal_volatile + + +- name: Set systemd journal max usage + ini_file: + path: /etc/systemd/journald.conf + section: Journal + option: RuntimeMaxUse + value: 100M + notify: restart systemd-journald + when: ansible_architecture == 'armv7l' and vars.journal_volatile \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index aa4828c..cc4d1c8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,7 @@ +- import_tasks: journald.yml - import_tasks: ntp.yml - import_tasks: ssh.yml - import_tasks: remove_alarm.yml - import_tasks: motd.yml +- import_tasks: setup_backup.yml +- import_tasks: pkgs.yml diff --git a/tasks/ntp.yml b/tasks/ntp.yml index 093b10f..8bd7500 100644 --- a/tasks/ntp.yml +++ b/tasks/ntp.yml @@ -5,4 +5,5 @@ option: NTP value: "{{ vars.ntp_servers | join(' ') }}" notify: restart systemd-timesyncd + when: vars.setup_ntp is true diff --git a/tasks/pkgs.yml b/tasks/pkgs.yml new file mode 100644 index 0000000..abfbf85 --- /dev/null +++ b/tasks/pkgs.yml @@ -0,0 +1,13 @@ +- name: Install some necessary pkgs + ansible.builtin.package: + name: "{{ item }}" + state: present + with_items: + - vim + - tcpdump + - curl + - wget + - iftop + - iotop + - dfc + - htop diff --git a/tasks/setup_backup.yml b/tasks/setup_backup.yml new file mode 100644 index 0000000..413032c --- /dev/null +++ b/tasks/setup_backup.yml @@ -0,0 +1,4 @@ +- name: Install rsync for backuping + ansible.builtin.package: + name: rsync + state: present