jokerwrld999.bootstrap
Ansible Role: Bootstrap
Description
This role performs basic setup tasks for your servers.
Features
System Setup
- Update the system and set up repositories.
User Configuration
- Set up the Root User
- Tags: lxc
- Set up a Custom User
- Set up the Root User
Install Software
- Install Development Packages
- Tags: lxc
- Install Tweaks
- Install Docker
- Tags: docker
- Install Utilities
- Install Development Packages
System Tweaks
- Set the Hostname
- Manage Log Retention
- Install Microcode
- Set up OpenSSH
- Install Qemu Guest Agent
Usage
Requirements
This role needs some collections to be installed from Ansible Galaxy. Here is a sample requirements.yml
file:
---
collections:
- name: community.general
- name: kewlfft.aur
roles:
- name: jokerwrld999.bootstrap
Install Requirements
ansible-galaxy install -r requirements.yml
Role Variables
Here are the available variables and their default values:
Pre-Configuration
set_hostname
: Boolean, defaults tofalse
. Set totrue
to change the hostname.custom_hostname
: String, a template for the hostname using${{ custom_user }}
.Example:
{{ custom_user }}-server
SSH
ssh_port
: Integer, defaults to22
. Set your desired SSH port.
User Configuration
setup_user
: Boolean, defaults tofalse
. Set totrue
to create a custom user with ZSH shell, p10k customizations, and generated SSH keys ofed25519
type.custom_user
: String, defaults to the value in theCUSTOM_USER
environment variable. If not set, it defaults to"jokerwrld"
. This is the username for the custom user account.Example to create the environment variable:
export CUSTOM_USER=username
.temp_dir
: String, defaults to"tmp"
. This is a temporary directory used for some tasks.
User's Password (Optional - Security Consideration)
Encrypt Password
python3 -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'
root_passwd
: String, empty by default. Set your root password here.custom_user_passwd
: String, empty by default. Set your custom user's password.
It’s a good idea to use Ansible Vault or other secure ways to manage credentials.
Example Variables File
---
# Pre-Configuration
# Custom Hostname
set_hostname: false
custom_hostname: "{{ custom_user }}-server"
# SSH
ssh_port: 22
# User Configuration
setup_user: false
custom_user: "{{ lookup('env', 'CUSTOM_USER') | default('jokerwrld', true) }}" # >>> ubuntu | ec2-user | custom_user
temp_dir: "tmp"
# Encrypt Password
# python3 -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'
root_passwd: "$6$aBitRBNIk5O7.rRs$.r7jWebBbVsx6GL7/8EixidRnFxtvSPEcXMkCLa.zKXS8ETQjpay54Htc9Q4sLJfs1Cyvjj4VVGpe5yc1zXLe/" # root
custom_user_passwd: "$6$8ReSwQWsQjmGVfva$2/.pJ9aeIIXxAPhhpDuOhZ7161EKvAx2uFFdGpMC9tpMGEBO4m5MbGYR9nJloPrf68GSb7eSsN6Ef0FMKxkbQ1" # sudo
Example Playbook
- name: Pre-configuring servers
hosts: all
become: true
vars_files:
- main.yml
vars:
set_hostname: true
custom_hostname: "{{ custom_user }}-server"
setup_user: true
custom_user: myuser
ssh_port: 2234
tasks:
- name: Pre-configuring servers
block:
- name: Include bootstrap role
ansible.builtin.include_role:
name: jokerwrld999.bootstrap
tags: lxc, docker
rescue:
- name: Pre-Configuration | Rescue
ansible.builtin.set_fact:
task_failed: true
Dependencies
None.
License
MIT / BSD
Author Information
This role was created in 2024 by Joker Wrld.