add pre-install playbook

This commit is contained in:
Domenik Bildhauer
2024-12-31 18:39:16 +01:00
parent f7bc90d138
commit b3fd049375

54
linux/pre-install.yml Normal file
View File

@@ -0,0 +1,54 @@
---
- name: Install Essential Packages
hosts: all
become: yes
tasks:
- name: Install essential packages
apt:
name:
- vim
- git
- curl
- htop
- iftop
- dnsutils
- net-tools
- sudo
- wget
- unzip
- zip
- lsb-release
- gnupg
- gnupg2
- sysstat
- screen
- tmux
state: present
update_cache: yes
- name: Configure Bash history with timestamps
hosts: all
become: yes
tasks:
- name: Add HISTTIMEFORMAT to .bashrc
lineinfile:
path: ~/.bashrc
regexp: '^export HISTTIMEFORMAT='
line: 'export HISTTIMEFORMAT="%F %T "'
state: present
- name: Source .bashrc to apply changes
shell: source ~/.bashrc
args:
executable: /bin/bash
- name: Display Bash history
shell: history
args:
executable: /bin/bash
register: history_output
- name: Print Bash history
debug:
msg: "{{ history_output.stdout }}"