Skip to content

Instantly share code, notes, and snippets.

@csmr
Last active March 15, 2024 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csmr/fc7da6c6e72c8fa314a8b2efd3d9c36d to your computer and use it in GitHub Desktop.
Save csmr/fc7da6c6e72c8fa314a8b2efd3d9c36d to your computer and use it in GitHub Desktop.
Minimal Debian 12 Ansible playbook boilerplate YAML
---
# pseudocode - caveat emptor
# The base directories relative to which user specific configuration etc files should be stored
# default: $XDG_CONFIG_HOME | ~/.config/
default_xdg_config_home: "{{ ansible_user_dir }}/.config"
default_xdg_data_home: "{{ ansible_user_dir }}/.local/share"
default_xdg_cache_home: "{{ ansible_user_dir }}/.cache"
xdg_config_home: "{{ ansible_env.XDG_CONFIG_HOME | default(default_xdg_config_home) }}"
# playbook targets all machines (hosts: all).
# become directive allows the tasks to run with elevated privileges.
# first task updates the package lists to ensure package information is current.
# second task installs a set of essential developer tools using the apt module.
# optional loop demonstrates how to install additional tools like Python development libraries or Node.js.
- hosts: all
become: true
tasks:
# note: this includes an upgrade, may not be desired
- name: Update and upgrade all packages
become: true
ansible.builtin.apt:
upgrade: true
update_cache: true
- name: Install basic developer tools
apt:
name:
- git
- curl
- neovim
- build-essential
state: present
- name: Install additional developer tools (optional)
apt:
name: "{{ item }}"
state: present
loop:
- python3-pip
- python3-dev
- nodejs
- npm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment