main.yml 1.0 KB

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