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 - name: Set hostname
command: "hostnamectl set-hostname {{ inventory_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 - name: Restart SSH service
systemd: systemd:
name: sshd name: ssh
enabled: true enabled: true
state: restarted state: restarted

View File

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

View File

@ -1,4 +1,4 @@
- name: Set timezone to Asia/Singapore - name: Set timezone
community.general.timezone: community.general.timezone:
name: "{{ TZ }}" name: "{{ TZ }}"
become: true 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_files:
- vars/secrets.yaml - vars/secrets.yaml
become: true 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: Include roles
# - name: Install packages include_role:
# apt: name: "{{ item }}"
# name: loop:
# - iputils-ping - disable-root
# - cron - timezone
# - fzf - chrony
# - git - vps-sources-list
# - curl - vps-ufw
# - zip - ssh
# - unzip - fail2ban
# - trash-cli - unattended-upgrades
# state: latest - nfs-opnxng
# install_recommends: false - docker
# update_cache: true - touch-hushlogin
# autoclean: true - set-vm-overcommit-memory
# autoremove: true #- docker-buildx
- name: Touch .hushlogin - name: Include roles
file: include_role:
path: "/home/{{ user }}/.hushlogin" name: "{{ item }}"
state: touch loop:
- oracle-systemd-resolved
# ---------------------------------------------------------------------------------------------------- - oracle-grub-opnxng
- hostname
roles: when:
# - grub-opnxng - inventory_hostname in groups["oracle"]
# - disable-root
# - timezone
# - chrony
# - hostname
# - systemd-resolved
# - sources-list
# - ssh
- ufw-opnxng
# - fail2ban
# - unattended-upgrades
# - nfs-opnxng
# - docker
# - set-vm-overcommit-memory
# - docker-buildx