first commit

This commit is contained in:
2024-10-05 10:06:52 +02:00
commit 0784cad8af
57 changed files with 965 additions and 0 deletions

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: terminal_pkgs
ansible.builtin.package:
name: "{{ terminal_pkgs }}"
- name: "Install casks : {{ context }}"
tags:
- install
when: terminal_casks
community.general.homebrew_cask:
name: "{{ terminal_casks }}"
state: installed

View File

@@ -0,0 +1,35 @@
---
- 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
- name: Install node and set version
tags:
- config
register: nodeinstall
ansible.builtin.shell: source {{ home }}/.nvm/nvm.sh && nvm install 22
changed_when: "'is already installed' not in nodeinstall.stderr"
args:
executable: /bin/bash
- name: Configure neovim
tags:
- config
ansible.builtin.git:
repo: https://github.com/morten-olsen/nvim
dest: "{{ home }}/.config/nvim"
accept_newhostkey: true
clone: true
update: true