mirror of
https://codeberg.org/ProgramSnail/config.git
synced 2026-01-09 21:25:06 +00:00
Compare commits
No commits in common. "94111b0a4b52d80863875a43bb61f02483a9a69e" and "19b706da4cf51a1c4e3d0bc0792aac8311adf098" have entirely different histories.
94111b0a4b
...
19b706da4c
14 changed files with 12 additions and 143 deletions
15
defaults.yml
15
defaults.yml
|
|
@ -1,15 +0,0 @@
|
||||||
# containers during host setup
|
|
||||||
container_names:
|
|
||||||
- dev
|
|
||||||
- txt
|
|
||||||
- haskell
|
|
||||||
|
|
||||||
# containers tool groups
|
|
||||||
container_tools:
|
|
||||||
dev:
|
|
||||||
- cpp
|
|
||||||
- js
|
|
||||||
txt:
|
|
||||||
- txt
|
|
||||||
haskell:
|
|
||||||
- haskell
|
|
||||||
|
|
@ -1,30 +1 @@
|
||||||
- name: Configure distrobox dev container
|
|
||||||
hosts: localhost
|
|
||||||
connection: local
|
|
||||||
vars:
|
|
||||||
vars_prompt:
|
|
||||||
- name: tools_in
|
|
||||||
prompt: "Specify comma separated list of required tool packages (cpp, js, haskell, txt, lang)"
|
|
||||||
roles:
|
|
||||||
# link and copy dotfiles
|
|
||||||
- role: dotfiles
|
|
||||||
vars:
|
|
||||||
configue:
|
|
||||||
- bash
|
|
||||||
- cli
|
|
||||||
- git
|
|
||||||
- ssh
|
|
||||||
- scripts
|
|
||||||
|
|
||||||
# install apps
|
|
||||||
- role: installs
|
|
||||||
vars:
|
|
||||||
apps:
|
|
||||||
- cli
|
|
||||||
|
|
||||||
# install and setup dev tools
|
|
||||||
- role: dev
|
|
||||||
vars:
|
|
||||||
tools: "{{ tools_in.split(',') }}"
|
|
||||||
|
|
||||||
# TODO: repositories
|
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1 @@
|
||||||
- name: Create distrobox containers on host
|
|
||||||
hosts: localhost
|
|
||||||
connection: local
|
|
||||||
vars:
|
|
||||||
tasks:
|
|
||||||
- name: Create containers
|
|
||||||
include_role:
|
|
||||||
name: dev_host
|
|
||||||
vars:
|
|
||||||
container_name: '{{ item }}'
|
|
||||||
loop: '{{ container_names }}'
|
|
||||||
|
|
||||||
- name: Setup containers
|
|
||||||
hosts: containers
|
|
||||||
roles:
|
|
||||||
# link and copy dotfiles
|
|
||||||
- role: dotfiles
|
|
||||||
vars:
|
|
||||||
configue:
|
|
||||||
- bash
|
|
||||||
- cli
|
|
||||||
- git
|
|
||||||
- ssh
|
|
||||||
- scripts
|
|
||||||
|
|
||||||
# install apps
|
|
||||||
- role: installs
|
|
||||||
vars:
|
|
||||||
apps:
|
|
||||||
- cli
|
|
||||||
|
|
||||||
# install and setup dev tools
|
|
||||||
- role: dev
|
|
||||||
vars:
|
|
||||||
tools: "{{ container_tools['{{item}}'] }}"
|
|
||||||
|
|
||||||
# TODO: repositories
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
- ansible.builtin.import_tasks: build.yml
|
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: cpp.yml
|
|
||||||
when: "'cpp' in tools"
|
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: js.yml
|
|
||||||
when: "'js' in tools"
|
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: haskell.yml
|
|
||||||
when: "'haskell' in tools"
|
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: txt.yml
|
|
||||||
when: "'txt' in tools"
|
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: lang.yml
|
|
||||||
when: "'lang' in tools"
|
|
||||||
|
|
||||||
# TODO: ocaml, truffle, ...
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
container_name: dev
|
|
||||||
container_image: quay.io/fedora/fedora-toolbox
|
|
||||||
container_image_tag: latest
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
# os based on https://github.com/sandorex/config/blob/master/playbooks/container-dev.yml
|
|
||||||
|
|
||||||
- name: Check if container already exists
|
|
||||||
containers.podman.podman_container_info:
|
|
||||||
name: '{{ container_name }}'
|
|
||||||
register: container_info
|
|
||||||
|
|
||||||
- name: Create container using distrobox
|
|
||||||
ansible.builtin.command:
|
|
||||||
# requires distrobox version 1.7
|
|
||||||
# add python3 to allow ansible to work
|
|
||||||
# add ansible to run local roles without host (?)
|
|
||||||
cmd: >-
|
|
||||||
distrobox create --yes --no-entry --pull
|
|
||||||
--image '{{ container_image }}:{{ container_image_tag }}'
|
|
||||||
--name '{{ container_name }}'
|
|
||||||
--hostname '{{ ansible_hostname }}'
|
|
||||||
--additional-packages 'python3 ansible'
|
|
||||||
when: container_info.containers | length == 0
|
|
||||||
|
|
||||||
- name: Start the container
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: 'distrobox enter --name {{ container_name }} -- sh -c ''exit'''
|
|
||||||
# start if not running or if not defined
|
|
||||||
when: not (container_info.containers[0].State.Running | default(false))
|
|
||||||
|
|
||||||
- name: Add container to host
|
|
||||||
changed_when: no
|
|
||||||
ansible.builtin.add_host:
|
|
||||||
name: '{{ container_name }}' # ??
|
|
||||||
groups: containers
|
|
||||||
ansible_connection: distrobox
|
|
||||||
ansible_host: '{{ container_name }}'
|
|
||||||
ansible_user: '{{ ansible_user_id }}'
|
|
||||||
fedora_version: '{{ container_image_tag }}' # ??
|
|
||||||
|
|
||||||
# container setup is done outside (?)
|
|
||||||
|
|
@ -5,16 +5,12 @@
|
||||||
- bash
|
- bash
|
||||||
- fish
|
- fish
|
||||||
- trash-cli
|
- trash-cli
|
||||||
|
|
||||||
# dev utils
|
|
||||||
- just
|
- just
|
||||||
- jsonnet
|
- jsonnet
|
||||||
- shellcheck
|
|
||||||
|
|
||||||
# edit utils
|
# edit utils
|
||||||
- helix
|
- helix
|
||||||
- micro
|
- micro
|
||||||
- nano
|
|
||||||
- tmux
|
- tmux
|
||||||
- tmate
|
- tmate
|
||||||
- ripgrep
|
- ripgrep
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,18 @@
|
||||||
|
- ansible.builtin.import_tasks: build.yml
|
||||||
|
when: "'build' in apps"
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: cli.yml
|
- ansible.builtin.import_tasks: cli.yml
|
||||||
when: "'cli' in apps"
|
when: "'cli' in apps"
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: cpp.yml
|
||||||
|
when: "'cpp' in apps"
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: lang.yml
|
||||||
|
when: "'lang' in apps"
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: javascript.yml
|
||||||
|
when: "'javascript' in apps"
|
||||||
|
|
||||||
- ansible.builtin.import_tasks: gui.yml
|
- ansible.builtin.import_tasks: gui.yml
|
||||||
when: "'gui' in apps"
|
when: "'gui' in apps"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue