From dacef969e93ea369ed22ead9999093c69cb251fd Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Tue, 11 Apr 2023 20:19:58 +0000 Subject: [PATCH] fixing variable usage and deploying to headless machine --- Makefile | 5 ++-- inventory | 6 +++- roles/base/tasks/main.yml | 9 ++++++ roles/development/defaults/main.yml | 4 +++ roles/development/tasks/main.yml | 44 ++++++++++++++++++++++------- site.yml | 20 +++++++++++-- 6 files changed, 73 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index c491233..c165b33 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,14 @@ L := "$(shell hostname -s)" C := -c local K := -K P := site.yml +V := -vvv all: deploy check: - ansible-playbook -i $I -l $L $C $K --syntax-check $P + ansible-playbook -i $I -l $L $C $K --syntax-check $V $P deploy: - ansible-playbook -i $I -l $L $C $K $P + ansible-playbook -i $I -l $L $C $K $V $P .PHONY: all check deploy diff --git a/inventory b/inventory index 69ee32e..e7285ed 100644 --- a/inventory +++ b/inventory @@ -2,4 +2,8 @@ petrichor [worklaptop] -kisom-x1 \ No newline at end of file +kisom-x1 + +[build] +orion + diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index b96212e..964ac56 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -25,3 +25,12 @@ - tree - unzip - zsh + +- name: set up tools specifically for headless systems + when: headless + become: true + ansible.builtin.apt: name={{ item }} state=present + with_items: + - emacs-nox + - vim-nox + diff --git a/roles/development/defaults/main.yml b/roles/development/defaults/main.yml index d0bbfd8..e34f93c 100644 --- a/roles/development/defaults/main.yml +++ b/roles/development/defaults/main.yml @@ -1,2 +1,6 @@ go_version: 1.20.3 bazelisk_version: 1.16.0 +dev_embedded: False +dev_full: False +dev_rust: False +dev_virt: False diff --git a/roles/development/tasks/main.yml b/roles/development/tasks/main.yml index 44c9aa6..82b4f19 100644 --- a/roles/development/tasks/main.yml +++ b/roles/development/tasks/main.yml @@ -9,7 +9,6 @@ - cloc - cmake - devscripts - - erlang - gcc - golang-google-genproto-dev - golang-goprotobuf-dev @@ -28,6 +27,20 @@ - zlib1g - zlib1g-dev +- name: install dev tools with guis + when: not headless + become: true + ansible.builtin.apt: name={{ item }} state=present + with_items: + - erlang + +- name: install headless dev tools + when: headless + become: true + ansible.builtin.apt: name={{ item }} state=present + with_items: + - erlang-nox + ## golang - name: install godeb become: true @@ -108,15 +121,21 @@ - qemu-system-arm - qemu-system - qemu-system-x86 - - qemu-system-gui - qemu-user-static - sbuild-qemu - seabios - u-boot-qemu - - virt-manager - virt-top notify: "restart docker service" +- name: install container and virtualisation GUIs + when: (dev_virt or dev_full) and not headless + become: true + ansible.builtin.apt: name={{ item }} state=present + with_items: + - qemu-system-gui + - virt-manager + - name: Ensure kvm group exists when: dev_virt or dev_full become: true @@ -158,10 +177,15 @@ - gcc-avr - libstdc++-arm-none-eabi-newlib - picocom + +- name: install embedded dev guis + when: (dev_virt or dev_full) and not headless + become: true + ansible.builtin.apt: name={{ item }} state=present + with_items: - pulseview - sigrok - ## documentation stuff - name: install documentation tooling become: true @@ -176,7 +200,7 @@ ## vscode - name: add VS Code repo key - when: dev_full + when: dev_full and not headless become: true ansible.builtin.apt_key: url: https://packages.microsoft.com/keys/microsoft.asc @@ -184,7 +208,7 @@ validate_certs: yes - name: add VS Code repo - when: dev_full + when: dev_full and not headless become: true ansible.builtin.apt_repository: repo: deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main @@ -192,20 +216,20 @@ validate_certs: yes - name: install VS Code - when: dev_full + when: dev_full and not headless become: true ansible.builtin.apt: name=code state=present ## rust - name: check if cargo is installed - when: dev_full + when: dev_rust or dev_full shell: command -v cargo register: cargo_exists ignore_errors: yes - name: Download Installer - when: dev_full and cargo_exists is failed + when: (dev_rust or dev_full) and (cargo_exists is failed) get_url: url: https://sh.rustup.rs dest: /tmp/sh.rustup.rs @@ -213,7 +237,7 @@ force: 'yes' - name: install rust/cargo - when: dev_full and cargo_exists is failed + when: (dev_rust or dev_full) and (cargo_exists is failed) shell: /tmp/sh.rustup.rs -y diff --git a/site.yml b/site.yml index 6b334df..48b8142 100644 --- a/site.yml +++ b/site.yml @@ -9,7 +9,8 @@ - heavy vars: laptop_user: kyle - dev_full: true + headless: False + dev_full: True - hosts: worklaptop roles: @@ -21,4 +22,19 @@ - heavy vars: laptop_user: k.isom - dev_virt: true + headless: False + dev_virt: True + +- hosts: build + roles: + - base + - dotfiles + - development + - server + - tailscale + vars: + laptop_user: kyle + headless: True + dev_virt: True + dev_embedded: True + dev_rust: True