main.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. - include: init.yml
  2. - include: sshd.yml
  3. - include: ulimits.yml
  4. - name: Setup sudo without password
  5. become: true
  6. ansible.builtin.template:
  7. src: sudo.conf.j2
  8. dest: /etc/sudoers.d/100-{{ ansible_user }}
  9. owner: root
  10. group: root
  11. mode: 0440
  12. when: ansible_distribution != 'Raspbian' and ansible_user != 'root'
  13. - name: Reset root password
  14. become: true
  15. shell: echo "root:$(pwgen 32 1)" | chpasswd
  16. - name: Reset {{ ansible_user }} password
  17. become: true
  18. shell: echo "{{ ansible_user }}:$(pwgen 32 1)" | chpasswd
  19. when: ansible_user != 'root'
  20. - name: Set timezone
  21. become: true
  22. shell: timedatectl set-timezone UTC
  23. - name: Setup journald storage
  24. become: true
  25. lineinfile:
  26. path: /etc/systemd/journald.conf
  27. regexp: '^#Storage='
  28. line: Storage=persistent
  29. # https://www.linode.com/docs/quick-answers/linux/how-to-use-journalctl/
  30. - name: Setup journald storage keep-free
  31. become: true
  32. lineinfile:
  33. path: /etc/systemd/journald.conf
  34. state: present
  35. regexp: '^#SystemKeepFree='
  36. line: SystemKeepFree=6%