Skip to content

laurnts/vmfordockercontainer

Repository files navigation

Ubuntu VM Setup Playbook

This Ansible playbook automates the setup of an Ubuntu VM with Docker, enhanced security settings, and useful tools. It's designed to be idempotent and can be rerun for updates.

First, Add your public key with setup.yml!

git clone https://github.com/laurnts/vmfordockercontainer.git
nano setup.yml

Features

  • Updates and upgrades system packages
  • Configures system settings (sysctl)
  • Sets up SSH with secure configurations
  • Installs and configures Docker
  • Installs Docker Compose and Python SDK for Docker
  • Sets up UFW (Uncomplicated Firewall) with Docker integration
  • Configures unattended upgrades
  • Installs ctop for Docker container monitoring
  • Generates SSH key for root user

Requirements

  • Ubuntu target system (tested on Ubuntu 20.04 LTS and newer)
  • Ansible 2.9 or newer on the control machine
  • SSH access to the target system with sudo privileges

Usage

  1. Clone this repository:

    git clone git@github.com:laurnts/vmfordockercontainer.git
    
  2. Review and adjust variables in setup.yml if needed, particularly:

    • project_user
    • ssh_public_key
    • security_* variables for SSH configuration
    • ctop_version
  3. Ensure you have the following files in the same directory:

    • setup.yml (the main playbook)
    • 20auto-upgrades.j2
    • 50unattended-upgrades.j2
  4. Run the playbook:

    sh install.sh
    

What This Playbook Does

  1. Updates and upgrades all system packages
  2. Configures sysctl settings for better performance
  3. Sets up SSH with custom security configurations
  4. Installs and configures Docker and Docker Compose
  5. Sets up UFW and integrates it with Docker
  6. Configures unattended upgrades for automatic system updates
  7. Installs ctop for Docker container monitoring
  8. Generates an SSH key for the root user

Example: Git Pull from Gitlab with Personal Access Token

https://gitlab.com/-/user_settings/personal_access_tokens
git clone https://<username>:<access_token>@gitlab.com/<username>/<repository>.git

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published