Compare commits
13 Commits
1fbdcdd487
...
moonlight
| Author | SHA1 | Date | |
|---|---|---|---|
| 98573c0066 | |||
| d95f1f7e32 | |||
| 7da67aaed0 | |||
| 7ec59f8c52 | |||
| bebe6de7cd | |||
| 08af0f00b6 | |||
| 3864c0f35d | |||
| 3218722fcb | |||
| 1895f1561d | |||
| cee0c443a3 | |||
| bb945190f8 | |||
| 4f5a2e6333 | |||
| 833f9a25ef |
@@ -2,6 +2,9 @@
|
||||
- hosts: localhost
|
||||
|
||||
roles:
|
||||
- role: sudo
|
||||
when: ansible_user_id != "root"
|
||||
|
||||
- role: zsh
|
||||
- role: neovim
|
||||
- role: tmux
|
||||
@@ -16,6 +19,7 @@
|
||||
- role: htop
|
||||
- role: jp
|
||||
- role: jq
|
||||
- role: readline
|
||||
- role: tidy
|
||||
- role: tree
|
||||
- role: yq
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---
|
||||
- hosts: windows
|
||||
|
||||
vars:
|
||||
install_cad_apps: false
|
||||
|
||||
roles:
|
||||
- role: git
|
||||
- role: powershell
|
||||
@@ -23,4 +26,10 @@
|
||||
- role: autohotkey
|
||||
- role: firefox
|
||||
- role: obsidian
|
||||
- role: powertoys
|
||||
- role: windows-terminal
|
||||
|
||||
- role: autodesk-fusion360
|
||||
when: install_cad_apps
|
||||
- role: prusaslicer
|
||||
when: install_cad_apps
|
||||
|
||||
8
roles/autodesk-fusion360/tasks/main.yaml
Normal file
8
roles/autodesk-fusion360/tasks/main.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- assert:
|
||||
that: ansible_os_family == "Windows"
|
||||
|
||||
- name: install chocolatey package
|
||||
win_chocolatey:
|
||||
name: autodesk-fusion360
|
||||
state: latest
|
||||
6
roles/gdb/tasks/Debian.yaml
Normal file
6
roles/gdb/tasks/Debian.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: install apt package
|
||||
become: true
|
||||
apt:
|
||||
name: gdb
|
||||
state: latest
|
||||
11
roles/gdb/tasks/gdb-11.1-config.yaml
Normal file
11
roles/gdb/tasks/gdb-11.1-config.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
- set_fact:
|
||||
gdb_config_dir: '{{ansible_env.HOME}}/.config/gdb'
|
||||
|
||||
- name: create config directory
|
||||
file:
|
||||
path: '{{gdb_config_dir}}'
|
||||
state: directory
|
||||
|
||||
- set_fact:
|
||||
gdb_config_file: '{{gdb_config_dir}}/gdbinit'
|
||||
34
roles/gdb/tasks/main.yaml
Normal file
34
roles/gdb/tasks/main.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
- include_tasks: '{{ansible_os_family}}.yaml'
|
||||
|
||||
# gdb 11.1 introduced support for config files that respect the XDG base
|
||||
# directory spec, handle the boths paths dependant on the gdb version install.
|
||||
- name: get installed version
|
||||
command: gdb --version
|
||||
register: gdb_version_output
|
||||
changed_when: false
|
||||
|
||||
- set_fact:
|
||||
gdb_version: '{{gdb_version_output.stdout | regex_search("(\d+)\.(\d+)", "\1", "\2")}}'
|
||||
- set_fact:
|
||||
gdb_xdg_base_dir_check:
|
||||
gdb_version[0] | int > 11 or (
|
||||
gdb_version[0] | int == 11 and gdb_version[1] | int == 1
|
||||
)
|
||||
|
||||
- set_fact:
|
||||
gdb_config_file: '{{ansible_env.HOME}}/.gdbinit'
|
||||
gdb_state_dir: '{{ansible_env.HOME}}/.local/state/gdb'
|
||||
|
||||
- when: gdb_xdg_base_dir_check
|
||||
include_tasks: gdb-11.1-config.yaml
|
||||
|
||||
- name: create config file
|
||||
template:
|
||||
src: gdbinit
|
||||
dest: '{{gdb_config_file}}'
|
||||
|
||||
- name: create state directory
|
||||
file:
|
||||
path: '{{gdb_state_dir}}'
|
||||
state: directory
|
||||
3
roles/gdb/templates/gdbinit
Normal file
3
roles/gdb/templates/gdbinit
Normal file
@@ -0,0 +1,3 @@
|
||||
# Enable saving command history
|
||||
set history filename {{gdb_state_dir}}/history
|
||||
set history save on
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
- name: install apt package
|
||||
become: true
|
||||
apt:
|
||||
name: htop
|
||||
state: latest
|
||||
|
||||
5
roles/moonlight/tasks/Windows.yaml
Normal file
5
roles/moonlight/tasks/Windows.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: install chocolatey package
|
||||
win_chocolatey:
|
||||
name: moonlight-qt
|
||||
state: latest
|
||||
2
roles/moonlight/tasks/main.yaml
Normal file
2
roles/moonlight/tasks/main.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
- include_tasks: '{{ansible_os_family}}.yaml'
|
||||
@@ -4,4 +4,4 @@
|
||||
name: neovim
|
||||
state: latest
|
||||
|
||||
- include_tasks: unix.yaml
|
||||
- include_tasks: Unix.yaml
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
name: neovim
|
||||
state: latest
|
||||
|
||||
- include_tasks: unix.yaml
|
||||
- include_tasks: Unix.yaml
|
||||
|
||||
36
roles/neovim/tasks/Unix-plugins.yaml
Normal file
36
roles/neovim/tasks/Unix-plugins.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
- name: clone plugin repos
|
||||
git:
|
||||
repo: 'https://github.com/{{item.repo}}.git'
|
||||
dest: '{{plugin_dir}}/{{item.mode | default("start")}}/{{item.repo | regex_replace("^.*\/(.*)$", "\1")}}'
|
||||
version: '{{item.branch | default("HEAD")}}'
|
||||
with_items: '{{plugins}}'
|
||||
|
||||
- name: get list of managed plugin paths
|
||||
set_fact:
|
||||
managed_plugins: >-
|
||||
{{
|
||||
managed_plugins | default([]) + [
|
||||
plugin_dir + "/" +
|
||||
item.mode | default("start") + "/" +
|
||||
item.repo | regex_replace("^.*\/(.*)$", "\1")
|
||||
]
|
||||
}}
|
||||
with_items: '{{plugins}}'
|
||||
|
||||
- name: find all installed plugin directories
|
||||
find:
|
||||
paths:
|
||||
- '{{plugin_dir}}/start'
|
||||
- '{{plugin_dir}}/opt'
|
||||
file_type: directory
|
||||
register: found_plugins
|
||||
|
||||
- name: remove found plugins which are not in the managed list
|
||||
file:
|
||||
path: '{{item.path}}'
|
||||
state: absent
|
||||
with_items: '{{found_plugins.files}}'
|
||||
when: item.path not in managed_plugins
|
||||
loop_control:
|
||||
label: '{{item.path}}'
|
||||
28
roles/neovim/tasks/Unix.yaml
Normal file
28
roles/neovim/tasks/Unix.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- set_fact:
|
||||
vim_config_dir: '{{ansible_env.HOME}}/.config/nvim'
|
||||
|
||||
- name: clone config repo
|
||||
git:
|
||||
repo: git@code.infektor.net:config/vim.git
|
||||
dest: '{{vim_config_dir}}'
|
||||
version: master
|
||||
|
||||
# TODO: - name: set repo email
|
||||
|
||||
- name: install pip packages
|
||||
pip:
|
||||
name: '{{neovim_pip_packages}}'
|
||||
state: latest
|
||||
extra_args: --user
|
||||
|
||||
- name: check for config repo tasks.yaml
|
||||
stat:
|
||||
path: '{{vim_config_dir}}/tasks.yaml'
|
||||
register: config_repo_tasks
|
||||
|
||||
- when: config_repo_tasks.stat.exists
|
||||
include_tasks: '{{vim_config_dir}}/tasks.yaml'
|
||||
|
||||
- when: plugin_dir is defined and plugins is defined
|
||||
include_tasks: 'Unix-plugins.yaml'
|
||||
36
roles/neovim/tasks/Windows-plugins.yaml
Normal file
36
roles/neovim/tasks/Windows-plugins.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
- name: clone plugin repos
|
||||
win_git:
|
||||
repo: 'https://github.com/{{item.repo}}.git'
|
||||
dest: '{{plugin_dir}}/{{item.mode | default("start")}}/{{item.repo | regex_replace("^.*\/(.*)$", "\1")}}'
|
||||
branch: '{{item.branch | default("HEAD")}}'
|
||||
with_items: '{{plugins}}'
|
||||
|
||||
- name: get list of managed plugin paths
|
||||
set_fact:
|
||||
managed_plugins: >-
|
||||
{{
|
||||
managed_plugins | default([]) + [
|
||||
plugin_dir + "/" +
|
||||
item.mode | default("start") + "/" +
|
||||
item.repo | regex_replace("^.*\/(.*)$", "\1")
|
||||
]
|
||||
}}
|
||||
with_items: '{{plugins}}'
|
||||
|
||||
- name: find all start plugin directories
|
||||
win_find:
|
||||
paths:
|
||||
- '{{plugin_dir}}/start'
|
||||
- '{{plugin_dir}}/opt'
|
||||
file_type: directory
|
||||
register: found_plugins
|
||||
|
||||
- name: remove found plugins which are not in the managed list
|
||||
win_file:
|
||||
path: '{{item.path}}'
|
||||
state: absent
|
||||
with_items: '{{found_plugins.files}}'
|
||||
when: item.path not in managed_plugins
|
||||
loop_control:
|
||||
label: '{{item.path}}'
|
||||
@@ -1,22 +1,28 @@
|
||||
---
|
||||
- set_fact:
|
||||
nvim_config_dir: '{{ansible_env.LOCALAPPDATA}}/nvim'
|
||||
|
||||
- name: install chocolatey packages
|
||||
win_chocolatey:
|
||||
name: neovim
|
||||
state: latest
|
||||
|
||||
- set_fact:
|
||||
vim_config_dir: '{{ansible_env.LOCALAPPDATA}}\nvim'
|
||||
|
||||
- name: clone config repo
|
||||
win_git:
|
||||
repo: git@code.infektor.net:config/vim.git
|
||||
dest: '{{nvim_config_dir}}'
|
||||
version: master
|
||||
dest: '{{vim_config_dir}}'
|
||||
branch: master
|
||||
# clone: false
|
||||
update: true
|
||||
- win_owner:
|
||||
path: '{{nvim_config_dir}}'
|
||||
path: '{{vim_config_dir}}'
|
||||
user: Benie
|
||||
recurse: true
|
||||
|
||||
- assert:
|
||||
that: False
|
||||
|
||||
# - TODO: neovim set repo email
|
||||
# win_git_config:
|
||||
# - TODO: neovim install pip packages
|
||||
@@ -30,3 +36,27 @@
|
||||
dest: '{{ansible_env.ProgramData}}/Microsoft/Windows/Start Menu/Programs/nvim-qt.lnk'
|
||||
icon: '{{ansible_env.ChocolateyToolsLocation}}/neovim/nvim-win64/bin/nvim-qt.exe,0'
|
||||
directory: '{{ansible_env.USERPROFILE}}'
|
||||
|
||||
- name: check for config repo tasks.yaml
|
||||
win_stat:
|
||||
path: '{{vim_config_dir}}/tasks.yaml'
|
||||
register: config_repo_tasks
|
||||
|
||||
# TODO: this doesn't work for non localhost setups
|
||||
# probably need to copy the tasks.yaml and plugins.yaml to the controller in a
|
||||
# temporary directory then include them
|
||||
- when: config_repo_tasks.stat.exists
|
||||
fetch:
|
||||
src: '{{vim_config_dir}}/tasks.yaml'
|
||||
dest: vim_config_tasks.yaml
|
||||
flat: true
|
||||
|
||||
- when: config_repo_tasks.stat.exists
|
||||
include_tasks: vim_config_tasks.yaml
|
||||
|
||||
- when: ansible_os_family != "Windows" and
|
||||
plugin_dir is defined and plugins is defined
|
||||
include_tasks: 'Unix-plugins.yaml'
|
||||
- when: ansible_os_family == "Windows" and
|
||||
plugin_dir is defined and plugins is defined
|
||||
include_tasks: 'Windows-plugins.yaml'
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
- name: clone config repo
|
||||
git:
|
||||
repo: git@code.infektor.net:config/vim.git
|
||||
dest: ~/.config/nvim
|
||||
version: master
|
||||
|
||||
# TODO: - name: set repo email
|
||||
|
||||
- name: install pip packages
|
||||
pip:
|
||||
name: '{{neovim_pip_packages}}'
|
||||
state: latest
|
||||
extra_args: --user
|
||||
8
roles/powertoys/tasks/main.yaml
Normal file
8
roles/powertoys/tasks/main.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- assert:
|
||||
that: ansible_os_family == 'Windows'
|
||||
|
||||
- name: install chocolatey package
|
||||
win_chocolatey:
|
||||
name: powertoys
|
||||
state: present
|
||||
8
roles/prusaslicer/tasks/main.yaml
Normal file
8
roles/prusaslicer/tasks/main.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- assert:
|
||||
that: ansible_os_family == "Windows"
|
||||
|
||||
- name: install chocolatey package
|
||||
win_chocolatey:
|
||||
name: prusaslicer
|
||||
state: latest
|
||||
5
roles/readline/tasks/main.yaml
Normal file
5
roles/readline/tasks/main.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: create .inputrc config file
|
||||
template:
|
||||
src: inputrc
|
||||
dest: '{{ansible_env.HOME}}/.inputrc'
|
||||
11
roles/readline/templates/inputrc
Normal file
11
roles/readline/templates/inputrc
Normal file
@@ -0,0 +1,11 @@
|
||||
# Enable vi mode
|
||||
set editing-mode vi
|
||||
|
||||
# Insert mode mappings
|
||||
set keymap vi-insert
|
||||
"\C-[": vi-movement-mode
|
||||
|
||||
# Change cursor shape on vi mode change
|
||||
set show-mode-in-prompt on
|
||||
set vi-cmd-mode-string "\1\e[2 q\2"
|
||||
set vi-ins-mode-string "\1\e[6 q\2"
|
||||
12
roles/sudo/tasks/main.yaml
Normal file
12
roles/sudo/tasks/main.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- assert:
|
||||
that: ansible_user_id != "root"
|
||||
|
||||
- name: create /etc/sudoers.d/{user} config file
|
||||
become: true
|
||||
template:
|
||||
src: sudoers
|
||||
dest: '/etc/sudoers.d/{{ansible_user_id}}'
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0440'
|
||||
1
roles/sudo/templates/sudoers
Normal file
1
roles/sudo/templates/sudoers
Normal file
@@ -0,0 +1 @@
|
||||
{{ansible_user_id}} ALL=(ALL) NOPASSWD:ALL
|
||||
@@ -40,3 +40,21 @@
|
||||
with_items:
|
||||
- win_git.ps1
|
||||
- win_git.py
|
||||
|
||||
- name: read /etc/resolv.conf file contents
|
||||
set_fact:
|
||||
resolv_conf: '{{lookup("ansible.builtin.file", "/etc/resolv.conf")}}'
|
||||
|
||||
- name: get Windows host IP from /etc/resolv.conf
|
||||
set_fact:
|
||||
host_ip: '{{resolv_conf | regex_search("(\d+\.\d+\.\d+\.\d+)")}}'
|
||||
|
||||
- name: add $(hostname).local to /etc/hosts
|
||||
become: true
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: '^{{host_ip | replace(".", "\.")}}'
|
||||
line: '{{host_ip}} {{ansible_hostname}}.local'
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
dest: ~/.config/zsh/zsh-syntax-highlighting
|
||||
- repo: https://github.com/zsh-users/zsh-completions.git
|
||||
dest: ~/.config/zsh/zsh-completions
|
||||
loop_control:
|
||||
label: '{{item.repo | regex_search("https://github.com/(.*)\.git$", "\1")}}'
|
||||
|
||||
- name: create directories
|
||||
file:
|
||||
@@ -59,6 +61,8 @@
|
||||
dest: ~/.local/bin/cmake-uninstall
|
||||
- src: ~/.config/zsh/$
|
||||
dest: ~/.local/bin/$
|
||||
loop_control:
|
||||
label: '{{item.dest}}'
|
||||
|
||||
- name: get absolute path
|
||||
shell: command -v zsh
|
||||
|
||||
Reference in New Issue
Block a user