- security_ssh_permit_root_login: "no" — ansible ходит под major с become, root по SSH не нужен - security_autoupdate_enabled: true — unattended-upgrades ставит только патчи из security-репозиториев, автоперезагрузка выключена
64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
---
|
|
- name: "Configure base system parameters"
|
|
hosts: all
|
|
|
|
vars:
|
|
apt_packages:
|
|
- acl
|
|
- curl
|
|
- fuse
|
|
- git
|
|
- htop
|
|
- jq
|
|
- make
|
|
- python3-croniter
|
|
- python3-pip
|
|
- python3-requests
|
|
- sqlite3
|
|
- tree
|
|
|
|
tasks:
|
|
- name: "Install additional apt packages"
|
|
ansible.builtin.apt:
|
|
name: "{{ apt_packages }}"
|
|
update_cache: true
|
|
|
|
- name: "Configure security settings"
|
|
ansible.builtin.import_role:
|
|
name: geerlingguy.security
|
|
vars:
|
|
# Root по SSH не нужен: ansible ходит под непривилегированным major с
|
|
# become. Заодно defense-in-depth — если PasswordAuthentication когда-то
|
|
# вернётся в "yes", root не откроется по паролю.
|
|
security_ssh_permit_root_login: "no"
|
|
# unattended-upgrades: шаблон роли ограничен security-репозиториями,
|
|
# автоматическая перезагрузка выключена дефолтом роли.
|
|
security_autoupdate_enabled: true
|
|
security_fail2ban_enabled: true
|
|
|
|
- name: "Copy keep files script"
|
|
ansible.builtin.copy:
|
|
src: "files/keep-files.py"
|
|
dest: "{{ bin_prefix }}/keep-files.py"
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: 'Create directory for applications'
|
|
ansible.builtin.file:
|
|
path: '{{ application_dir }}'
|
|
state: 'directory'
|
|
mode: '0755'
|
|
tags:
|
|
- mount-storage
|
|
|
|
- name: 'Mount external storages'
|
|
ansible.posix.mount:
|
|
path: '{{ application_dir }}'
|
|
src: 'UUID=3942bffd-8328-4536-8e88-07926fb17d17'
|
|
fstype: ext4
|
|
state: mounted
|
|
when: mount_external_storage | default(false) | bool
|
|
tags:
|
|
- mount-storage
|