diff --git a/ansible/group_vars/all b/ansible/group_vars/all index 3229f94..17800a0 100644 --- a/ansible/group_vars/all +++ b/ansible/group_vars/all @@ -1,4 +1,5 @@ apt_packages: + - adwaita-icon-theme - aspell-de - atom - bitlbee diff --git a/ansible/requirements.yml b/ansible/requirements.yml index 566f69d..9e0be24 100644 --- a/ansible/requirements.yml +++ b/ansible/requirements.yml @@ -1 +1,2 @@ - src: angstwad.docker_ubuntu + version: v2.2 diff --git a/ansible/tasks/base.yml b/ansible/tasks/base.yml index daf0ed2..31cc073 100644 --- a/ansible/tasks/base.yml +++ b/ansible/tasks/base.yml @@ -11,7 +11,7 @@ apt_repository: repo={{ item }} with_items: "{{ apt_ppas }}" - name: Install missing packages - apt: name={{ item }} + apt: name={{ item }} install_recommends=yes update_cache=yes with_items: "{{ apt_packages }}" - name: Set default shell for {{ vm_user }} user user: name={{ vm_user }} shell=/usr/bin/fish groups=docker append=yes @@ -19,8 +19,6 @@ - gem: name=homesick state=present user_install=no - stat: path=/dev/vdb register: code_disk -- stat: path=/home/bascht/.emacs.d/init.el - register: emacs_conf - name: Mount Code Volume mount: name=/home/bascht/Code src='/dev/vdb' fstype=ext4 state=mounted when: code_disk.stat.isblk is defined and code_disk.stat.isblk diff --git a/ansible/tasks/tools.yml b/ansible/tasks/tools.yml index f31c650..7fe3bbf 100644 --- a/ansible/tasks/tools.yml +++ b/ansible/tasks/tools.yml @@ -10,3 +10,9 @@ when: omf.stat.isdir is not defined become: yes become_user: "{{ vm_user }}" +- name: "Provide IP for Tmux + Shell to pick up" + ignore_errors: yes + copy: + dest: /var/run/vm_ip + mode: "0744" + content: "{{ ansible_eth0.ipv4.address|default(omit) }}" diff --git a/packer/metadata.json b/packer/metadata.json new file mode 100644 index 0000000..856e028 --- /dev/null +++ b/packer/metadata.json @@ -0,0 +1,12 @@ +{ + "name": "bascht/vm", + "description": "My local dev environment", + "short_description": "Don't use it. Unless you are shure what you do. Even then: Don't use it.", + "versions": [{ + "version": "0.7.1", + "providers": [{ + "name": "libvirt", + "url": "../packer_qemu_libvirt.box" + }] + }] +} diff --git a/packer/scripts/ansible.sh b/packer/scripts/ansible.sh index db7c765..c4d488c 100755 --- a/packer/scripts/ansible.sh +++ b/packer/scripts/ansible.sh @@ -1,3 +1,3 @@ #!/bin/bash -apt-get install -y ansible +apt install -y ansible ansible-galaxy install -r /tmp/requirements.yml diff --git a/packer/scripts/cleanup.sh b/packer/scripts/cleanup.sh index bb25f60..8515028 100755 --- a/packer/scripts/cleanup.sh +++ b/packer/scripts/cleanup.sh @@ -32,9 +32,9 @@ echo "cleaning up dhcp leases" rm /var/lib/dhcp/* # Clean up Apts Rubbish bin -apt-get -y autoremove --purge -apt-get -y clean -apt-get -y autoclean +apt -y autoremove --purge +apt -y clean +apt -y autoclean # Clean up logs + journals find /var/log -maxdepth 1 -type f -exec cp /dev/null {} \; diff --git a/packer/template.json b/packer/template.json index 4dbd5ef..9fc418d 100644 --- a/packer/template.json +++ b/packer/template.json @@ -1,15 +1,10 @@ { "variables": { - "atlas_username": "{{env `ATLAS_USERNAME`}}", - "atlas_name": "{{env `ATLAS_NAME`}}", "username": "bascht", "password": "bascht", - "build_version": "0.5.0.{{env `ATLAS_BUILD_ID`}}" - }, - "push": { - "name": "{{user `atlas_username`}}/{{user `atlas_name`}}", - "vcs": true, - "base_dir": "packer" + "build_version": "0.7.1", + "ubuntu_iso": "http://de.releases.ubuntu.com/16.04/ubuntu-16.04.2-server-amd64.iso", + "ubuntu_checksum": "f529548fa7468f2d8413b8427d8e383b830df5f6" }, "provisioners": [ { @@ -54,14 +49,14 @@ "builders": [ { "type": "qemu", - "iso_url": "http://de.releases.ubuntu.com/16.04.1/ubuntu-16.04.1-server-amd64.iso", - "iso_checksum": "de5ee8665048f009577763efbf4a6f0558833e59", + "iso_url": "{{ user `ubuntu_iso`}}", + "iso_checksum": "{{user `ubuntu_checksum`}}", "iso_checksum_type": "sha1", "ssh_wait_timeout": "30s", "shutdown_command": "sudo shutdown -P now", "disk_size": 20000, "format": "qcow2", - "headless": false, + "headless": true, "accelerator": "kvm", "http_directory": "packer/http", "http_port_min": 10082, @@ -98,23 +93,18 @@ "console-setup/ask_detect=false ", "keyboard-configuration/layoutcode=de ", "vga=788 noprompt quiet --" + ], + "qemuargs": [ + [ "-m", "2048M" ] ] } ], "post-processors": [ [{ "type": "vagrant", - "keep_input_artifact": false - }, - { - "type": "atlas", - "artifact": "{{user `atlas_username`}}/{{user `atlas_name`}}", - "artifact_type": "vagrant.box", - "metadata": { - "provider": "libvirt", - "version": "{{user `build_version`}}" - } - } + "keep_input_artifact": true, + "compression_level": 9 + } ] ] }