This commit is contained in:
2024-10-07 15:04:35 +02:00
parent 0784cad8af
commit c552125b12
25 changed files with 210 additions and 33 deletions

View File

@@ -0,0 +1 @@
{"dependencies":[["racc",["~> 1.4"]],["nokogiri",["~> 1.6"]],["diffy",[">= 0"]],["rexml",[">= 0"]],["xml-simple",[">= 0"]],["mime-types-data",["~> 3.2015"]],["mime-types",[">= 0"]],["formatador",[">= 0.2","< 2.0"]],["excon",["~> 0.71"]],["builder",[">= 0"]],["fog-core",["~> 2"]],["json",[">= 0"]],["ruby-libvirt",[">= 0.7.0"]],["fog-xml",["~> 0.1.1"]],["multi_json",["~> 1.10"]],["fog-json",[">= 0"]],["fog-libvirt",[">= 0.6.0"]],["vagrant-libvirt",["= 0.12.2"]],["vagrant-qemu",["= 0.3.6"]]],"checksum":"d29c877f7d936a4ed482393f2146efe63cd2dcecac3c1ae41fbb8ca2d854a211","vagrant_version":"2.4.1"}

View File

@@ -0,0 +1 @@
/Users/alice/Projects/private/system

View File

@@ -0,0 +1,12 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end

View File

@@ -1,9 +1,8 @@
FROM debian:bookworm
FROM fedora
WORKDIR /app
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /app
RUN pip3 install -r requirements.txt
RUN yum update -y && yum install -y \
ansible
COPY requirements.yml /app
RUN ansible-galaxy collection install -r requirements.yml
COPY . /app
RUN ansible-playbook /app/playbooks/image.yml

9
Vagrantfile vendored Normal file
View File

@@ -0,0 +1,9 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox"
config.vm.box = "archlinux/archlinux"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbooks/setup.yml"
end
end

View File

@@ -1,3 +1,8 @@
images:
hosts:
docker-dev:
contexts:
- privat
desktops:
hosts:
zn-macbook:

5
playbooks/image.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- name: Setup host
hosts: localhost
roles:
- role: terminal

View File

@@ -1,5 +1,5 @@
---
_desktop_casks:
desktop_casks:
- 1password
- 1password-cli
- kitty

View File

@@ -0,0 +1,26 @@
---
- name: "Copy templates : {{ context }}"
tags:
- config
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path | regex_replace('\\.j2$', '') }}"
mode: "{{ item.mode }}"
with_community.general.filetree:
- ../templates/{{ context }}
loop_control:
label: "{{ item.path }}"
when: item.state == 'file'
- name: "Copy config : {{ context }}"
tags:
- config
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"
mode: "{{ item.mode }}"
with_community.general.filetree:
- ../files/{{ context }}
loop_control:
label: "{{ item.path }}"
when: item.state == 'file'

View File

@@ -0,0 +1,33 @@
---
- name: "Unload vars : {{ context }}"
ansible.builtin.include_vars: ../vars/empty.yml
tags:
- install
- name: "Load vars : {{ context }}"
ansible.builtin.include_vars: "{{ item }}"
tags:
- install
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- default.yml
paths: ../vars/{{ context }}
skip: true
- name: "Install dependencies : {{ context }}"
tags:
- install
when: desktop_pkgs
ansible.builtin.package:
name: "{{ dev_pkgs }}"
- name: "Install casks : {{ context }}"
tags:
- install
when: dev_casks
community.general.homebrew_cask:
name: "{{ dev_casks }}"
state: installed

View File

@@ -0,0 +1,16 @@
---
- name: Install context dependencies
ansible.builtin.include_tasks: install.yml
loop: "{{ contexts }}"
loop_control:
loop_var: context
tags:
- config
- name: Configure contexts
ansible.builtin.include_tasks: config.yml
loop: "{{ contexts }}"
loop_control:
loop_var: context
tags:
- config

View File

@@ -0,0 +1,4 @@
---
dev_pkgs:
- rustup
- python3

View File

@@ -0,0 +1,4 @@
---
dev_pkgs: []
dev_casks: []
dev_flatpaks: []

View File

@@ -2,7 +2,7 @@
tags: always
ansible.builtin.set_fact:
username: alice
home: /Users/alice
home: "{{ ansible_env.HOME }}"
use_become: true
mac_os: "{{ ansible_distribution == 'MacOSX' }}"
contexts: "{{ ['default'] + (contexts | default([])) }}"

View File

@@ -1,11 +1,6 @@
- name: Install core dependencies
tags: always
ansible.builtin.package:
name:
- zsh
- name: Create group
when: not mac_os
become: true
tags: always
ansible.builtin.group:
name: "{{ username }}"
@@ -13,10 +8,10 @@
- name: Create user
when: not mac_os
become: true
tags: always
ansible.builtin.user:
name: "{{ username }}"
update_password: "on_create"
create_home: yes
shell: /usr/bin/zsh
group: "{{ username }}"

View File

@@ -0,0 +1,2 @@
style = "compact"
keymap_mode = "vim-normal"

View File

@@ -4,7 +4,7 @@ Include ~/.ssh/config.d/*
Host *
Controlmaster auto
Controlpath ${TMPDIR}/ssh-%r@%h:%p
Controlpath /tmp/ssh-%r@%h:%p
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
ForwardAgent yes

View File

@@ -2,3 +2,4 @@
dependencies:
- role: info
- role: system
# - elliotweiser.osx-command-line-tools

View File

@@ -1,4 +1,16 @@
---
- name: Copy config {{ context }}
tags:
- config
ansible.builtin.file:
path: "{{ home }}/{{ item.path }}"
state: directory
with_community.general.filetree:
- ../files/{{ context }}
loop_control:
label: "{{ item.path }}"
when: item.state == 'directory'
- name: "Copy templates : {{ context }}"
tags:
- config

View File

@@ -1,4 +1,19 @@
---
- name: Install core dependencies
tags:
- install
ansible.builtin.package:
name:
- zsh
- name: Set shell
become: true
tags:
- config
ansible.builtin.user:
name: "{{ username }}"
shell: /usr/bin/zsh
- name: Install context dependencies
ansible.builtin.include_tasks: install.yml
loop: "{{ contexts }}"
@@ -7,13 +22,16 @@
tags:
- config
- name: Configure contexts
ansible.builtin.include_tasks: config.yml
loop: "{{ contexts }}"
loop_control:
loop_var: context
- name: Clone nvm
tags:
- config
- install
ansible.builtin.git:
accept_newhostkey: true
clone: true
force: true
recursive: false
repo: https://github.com/nvm-sh/nvm
dest: "{{ home }}/.nvm"
- name: Install node and set version
tags:
@@ -24,12 +42,16 @@
args:
executable: /bin/bash
- name: Configure neovim
- name: Setup nvim
tags:
- config
- nvim
include_tasks: "nvim.yml"
- name: Configure contexts
ansible.builtin.include_tasks: config.yml
loop: "{{ contexts }}"
loop_control:
loop_var: context
tags:
- config
ansible.builtin.git:
repo: https://github.com/morten-olsen/nvim
dest: "{{ home }}/.config/nvim"
accept_newhostkey: true
clone: true
update: true

View File

@@ -0,0 +1,22 @@
---
- name: Configure neovim
tags:
- config
- nvim
ansible.builtin.git:
repo: https://github.com/morten-olsen/nvim
dest: "{{ home }}/.config/nvim"
accept_newhostkey: true
clone: true
update: true
force: true
- name: Prepare neovim
tags:
- config
- nvim
register: nviminstall
changed_when: "nviminstall.stdout != ''"
ansible.builtin.shell: nvim --headless +q
args:
executable: /bin/bash

View File

@@ -1,6 +1,6 @@
---
terminal_pkgs:
- atuin
#- atuin
- bat
- eza
- direnv
@@ -10,7 +10,7 @@ terminal_pkgs:
- ripgrep
- neovim
- gh
- starship
#- starship
- tmux
- zoxide
- git

View File

@@ -0,0 +1,4 @@
- name: Update neovim lazy
ansible.builtin.run: 'nvim --headless "+Lazy! sync" +qa'
args:
executable: /bin/bash

View File

@@ -1,6 +1,6 @@
---
- name: Setup host
hosts: all
hosts: desktops
roles:
- role: terminal
- role: desktop

4
requirements.yml Normal file
View File

@@ -0,0 +1,4 @@
---
roles:
- name: elliotweiser.osx-command-line-tools
- name: andrewrothstein.starship