commit 1f5fd017def67e623e4241e9f868aa1e8a57905c Author: KKlochko Date: Tue May 16 09:52:47 2023 +0300 Added a basic template for the debian11 VM. diff --git a/README.org b/README.org new file mode 100644 index 0000000..cccbeac --- /dev/null +++ b/README.org @@ -0,0 +1,29 @@ +* debian11-template +It's a simple configuration for debian11 using Vagrant and Ansible. + +* Using +⚠ W️ARNING ⚠️ +Setup virt-manager, QEMU and libvirt for using configuration. + +I'm using nix-shell for running vagrant and ansible. +You can just install them to your host or install nix for using nix-shell. + +Open a shell in the repository folder. +Run to open the VM: +#+BEGIN_SRC shell + nix-shell + vagrant up + vagrant ssh +#+END_SRC + +To close: +#+BEGIN_SRC shell + logout + vagrant halt +#+END_SRC + +To remove VM: +#+BEGIN_SRC shell + vagrant destroy +#+END_SRC + diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..780462c --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,20 @@ +Vagrant.configure("2") do |config| + config.vm.provider :libvirt do |libvirt| + libvirt.driver = "kvm" + end + + config.vm.define "main" do |subconfig| + subconfig.vm.box = "generic/debian11" + subconfig.vm.hostname = "debian11-ansible-vm" + + subconfig.vm.provider :libvirt do |domain| + domain.memory = 4096 + domain.cpus = 1 + end + + subconfig.vm.provision "ansible" do |ansible| + ansible.verbose = "v" + ansible.playbook = "main_playbook.yaml" + end + end +end diff --git a/main_playbook.yaml b/main_playbook.yaml new file mode 100644 index 0000000..4fab96e --- /dev/null +++ b/main_playbook.yaml @@ -0,0 +1,22 @@ +--- +- hosts: all + become: yes + tasks: + - name: Update apt cache + apt: + update_cache: yes + + - name: Upgrade all packages + apt: + upgrade: dist + autoremove: yes + autoclean: yes + - name: install neofetch + apt: + name: + - neofetch + - name: install docker + apt: + name: + - docker + - docker-compose diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..76ff063 --- /dev/null +++ b/shell.nix @@ -0,0 +1,12 @@ +{ pkgs ? import { } }: +pkgs.mkShell { + name = "VagrantShell"; + buildInputs = with pkgs; [ + vagrant + ansible + ]; + + shellHook = '' + echo "Welcome to vagrant shell"; + ''; +}