0
0

Updated playbook

This commit is contained in:
Opnxng 2024-10-29 18:05:22 +08:00 committed by Opnxng
parent 48d031035e
commit 5c56b99173
17 changed files with 58 additions and 46 deletions

View File

@ -1,3 +1,4 @@
- name: Set hostname
command: "hostnamectl set-hostname {{ inventory_hostname }}"
when: inventory_hostname in groups["oracle"]
when:
- inventory_hostname != 'localhost'

View File

@ -10,7 +10,7 @@
- name: Restart SSH service
systemd:
name: sshd
name: ssh
enabled: true
state: restarted

View File

@ -5,7 +5,7 @@ PermitRootLogin no
PasswordAuthentication no
AddressFamily inet
ChallengeResponseAuthentication no
AllowUsers {{ user }}
AllowUsers {{ ansible_user }}
KbdInteractiveAuthentication no
UsePAM yes
X11Forwarding no

View File

@ -1,4 +1,4 @@
- name: Set timezone to Asia/Singapore
- name: Set timezone
community.general.timezone:
name: "{{ TZ }}"
become: true

View File

@ -0,0 +1,6 @@
---
- name: touch .hushlogin
file:
path: "/home/{{ user }}/.hushlogin"
state: touch

View File

@ -5,47 +5,52 @@
vars_files:
- vars/secrets.yaml
become: true
tasks:
# ----------------------------------------------------------------------------------------------------
- name: Install packages
apt:
name:
- iputils-ping
- cron
- fzf
- git
- curl
- zip
- unzip
- trash-cli
state: latest
install_recommends: false
update_cache: true
autoclean: true
autoremove: true
# ----------------------------------------------------------------------------------------------------
pre_tasks:
# - name: Install packages
# apt:
# name:
# - iputils-ping
# - cron
# - fzf
# - git
# - curl
# - zip
# - unzip
# - trash-cli
# state: latest
# install_recommends: false
# update_cache: true
# autoclean: true
# autoremove: true
- name: Touch .hushlogin
file:
path: "/home/{{ user }}/.hushlogin"
state: touch
# ----------------------------------------------------------------------------------------------------
roles:
# - grub-opnxng
# - disable-root
# - timezone
# - chrony
# - hostname
# - systemd-resolved
# - sources-list
# - ssh
- ufw-opnxng
# - fail2ban
# - unattended-upgrades
# - nfs-opnxng
# - docker
# - set-vm-overcommit-memory
- name: Include roles
include_role:
name: "{{ item }}"
loop:
- disable-root
- timezone
- chrony
- vps-sources-list
- vps-ufw
- ssh
- fail2ban
- unattended-upgrades
- nfs-opnxng
- docker
- touch-hushlogin
- set-vm-overcommit-memory
#- docker-buildx
- name: Include roles
include_role:
name: "{{ item }}"
loop:
- oracle-systemd-resolved
- oracle-grub-opnxng
- hostname
when:
- inventory_hostname in groups["oracle"]