Update repo structure as part of nixification

This commit is contained in:
Gene Liverman 2023-09-14 00:01:31 -04:00
parent 49e67c64fb
commit cc0efcfdde
56 changed files with 181 additions and 154 deletions

View file

@ -0,0 +1,13 @@
# Ansible Bootstrapping
Temporary docs for Ansible as I work things out.
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export PATH="$HOME/.local/bin:$PATH"
python3 -m pip install --user ansible ansible-lint
ansible-galaxy collection install jonellis.sudoers
ansible-galaxy install gantsign.oh-my-zsh
ansible-galaxy install jack1142.apt_signing_key
ansible-playbook -i ansible/ansible_hosts.yaml --ask-become-pass ansible/carbonbean.yaml --verbose
```

View file

@ -0,0 +1,20 @@
---
all:
hosts:
bigboy-wsl:
ansible_connection: local
blue-rock:
ansible_connection: local
children:
servers:
vars:
ansible_connection: ssh
hosts:
cloud2.technicalissues.us:
ansible_user: gene
mail.alt.technicalissues.us:
ansible_user: gliverma
mini-watcher.local:
ansible_user: gene
tart.local:
ansible_user: pi

View file

@ -0,0 +1,142 @@
---
- name: Install packages
hosts: bigboy-wsl
vars:
ansible_python_interpreter: '/usr/bin/python3'
tasks:
- name: Install Microsoft keys and repo
become: true
ansible.builtin.apt:
state: present
force: true
deb: https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
- name: Base packages from apt
become: true
ansible.builtin.apt:
update_cache: true
state: latest
pkg:
- bat
- bundler
- cmake
- dconf-editor
- dos2unix
- exa
- gh
- git
- git-lfs
- gnupg
- htop
- httpie
- hub
- hugo
- iftop
- jq
- libssl-dev
- neofetch
- pass
- pcsc-tools
- pcscd
- powershell
- rake
- ruby
- ruby-dev
- scdaemon
- snapd
- tilix
- traceroute
- tree
- vim
- xclip
- zsh
- name: Install git-credential-manager deb package
become: true
ansible.builtin.apt:
state: present
deb: https://github.com/GitCredentialManager/git-credential-manager/releases/download/v2.0.696/gcmcore-linux_amd64.2.0.696.deb
- name: Install delta via deb package on GitHub
become: true
ansible.builtin.apt:
state: present
deb: https://github.com/dandavison/delta/releases/download/0.13.0/git-delta_0.13.0_amd64.deb
- name: Base packages from Snapcraft
become: true
community.general.snap:
name:
- cctv-viewer # only available here
- name: hiera-eyaml gem
community.general.gem:
name: hiera-eyaml
state: latest
- name: vmfloaty gem
community.general.gem:
name: vmfloaty
state: latest
- name: Python packages via pip
ansible.builtin.pip:
state: latest
name:
- ansible
- ansible-lint
- flake8
- pywinrm
- name: ensure fonts directory
file:
path: "{{ lookup('env', 'HOME') }}/.fonts"
state: directory
- name: Hack exists
shell: "ls {{ lookup('env', 'HOME') }}/.fonts/Hack*Nerd*Font*Complete*"
register: hack_exists
ignore_errors: true
- name: Download Hack
when: hack_exists is failed
ansible.builtin.unarchive:
src: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Hack.zip
dest: "{{ lookup('env', 'HOME') }}/.fonts/"
remote_src: true
- name: Setup Oh My ZSH
include_role:
name: gantsign.oh-my-zsh
vars:
oh_my_zsh_theme: steeef
oh_my_zsh_plugins:
- git
users:
- username: "{{ lookup('env', 'USER') }}"
# - name: Symlink .zshrc
# ansible.builtin.file:
# src: "{{ lookup('env', 'HOME') }}/repos/dots/link/nix/zshrc"
# dest: "{{ lookup('env', 'HOME') }}/.zshrc"
# state: link
# - name: Set shell to zsh and add to groups
# become: true
# ansible.builtin.user:
# name: "{{ lookup('env', 'USER') }}"
# shell: /usr/bin/zsh
# append: true
# groups:
# - dialout
- name: Add passwordless sudo entries
become: true
community.general.sudoers:
name: "{{ lookup('env', 'USER') }}-no-password"
user: "{{ lookup('env', 'USER') }}"
nopassword: true
commands:
- /usr/bin/systemctl restart pcscd
- /usr/bin/pkill -9 gpg-agent

View file

@ -0,0 +1,127 @@
---
- name: Install packages
hosts: blue-rock
vars:
ansible_python_interpreter: '/usr/local/bin/python3'
tasks:
- name: Install packages from Homebrew
community.general.homebrew:
state: latest
name:
- adr-tools
# - cdktf
- chart-testing
- coreutils
- dog
- dust
- gh
- gotop
- helm
- hub
- jq
- k9s
- kubectl
- kubectx
- mas
- neovim
- npm
- python
- subversion
- tree
- wget
- yq
# - name: Install casks from Homebrew
# community.general.homebrew:
# state: present
# name:
# - homebrew/cask/1password
# - homebrew/cask/cakebrew
# - homebrew/cask/elgato-stream-deck
# - homebrew/cask/firefox
# - homebrew/cask/google-drive
# - homebrew/cask/iterm2
# - homebrew/cask/keepingyouawake
# - homebrew/cask/logseq
# - homebrew/cask/meld
# - homebrew/cask/obs
# - homebrew/cask/signal
# - homebrew/cask/slack
# - homebrew/cask/thunderbird
# - homebrew/cask/visual-studio-code
# - homebrew/cask/vivaldi
# - homebrew/cask/whatsapp
# - homebrew/cask/zoom
# - homebrew/cask-fonts/font-hack-nerd-font
# - homebrew/cask-fonts/font-inconsolata-g-for-powerline
# - homebrew/cask-fonts/font-source-code-pro-for-powerline
# - puppetlabs/puppet/pdk
# - name: Install apps from App Store
# community.general.mas:
# state: present
# id:
# - 1569813296 # 1Password for Safari
# - 417375580 # BetterSnapTool
# - 1532419400 # MeetingBar for Meet, Zoom & Co
# - 1451685025 # WireGuard
- name: Install packages with pip
ansible.builtin.pip:
name:
- ansible
- ansible-lint
# - powerline-status # repalced with airline
# - psutil
- name: Download Hack Nerd Font
ansible.builtin.unarchive:
src: https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Hack.zip
dest: "{{ lookup('env', 'HOME') }}/Library/Fonts/"
remote_src: true
# Vim setup
- name: Symlink .vimrc
ansible.builtin.file:
src: "{{ lookup('env', 'HOME') }}/repos/dots/link/nix/vimrc"
dest: "{{ lookup('env', 'HOME') }}/.vimrc"
state: link
force: true
# - name: Symlink .vimrc_os_specific
# ansible.builtin.file:
# src: "{{ lookup('env', 'HOME') }}/repos/dots/link/mac/vimrc_os_specific"
# dest: "{{ lookup('env', 'HOME') }}/.vimrc_os_specific"
# state: link
# force: true
- name: Install Vundle
ansible.builtin.git:
repo: 'https://github.com/VundleVim/Vundle.vim'
dest: "{{ lookup('env', 'HOME') }}/.vim/bundle/Vundle.vim"
- name: Install Vundle Plugins
shell: "echo -ne '\n' | vim +PluginInstall! +qall"
# ZSH setup
- name: Clone my oh-my-zsh plugins
ansible.builtin.git:
repo: 'https://github.com/genebean/my-oh-zsh-plugins'
dest: "{{ lookup('env', 'HOME') }}/repos/customized-oh-my-zsh/plugins"
- name: Clone zsh-autosuggestions
ansible.builtin.git:
repo: 'https://github.com/zsh-users/zsh-autosuggestions'
dest: "{{ lookup('env', 'HOME') }}/repos/customized-oh-my-zsh/plugins/zsh-autosuggestions"
- name: Clone my oh-my-zsh themes
ansible.builtin.git:
repo: 'https://github.com/genebean/my-oh-zsh-themes'
dest: "{{ lookup('env', 'HOME') }}/repos/customized-oh-my-zsh/themes"
- name: Symlink .zshrc
ansible.builtin.file:
src: "{{ lookup('env', 'HOME') }}/repos/dots/link/nix/zshrc"
dest: "{{ lookup('env', 'HOME') }}/.zshrc"
state: link
force: true

View file

@ -0,0 +1,362 @@
---
- name: Install packages
hosts: carbonbean
vars:
ansible_python_interpreter: '/usr/bin/python3'
tasks:
- name: Add 1Password apt signing key
ansible.builtin.include_role:
name: jack1142.apt_signing_key
vars:
url: https://downloads.1password.com/linux/keys/1password.asc
key_name: 1password
dearmor: true
- name: Add 1Password repository
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64 signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/amd64 stable main
state: present
filename: 1password
update_cache: false
- name: Add Google Cloud apt key
become: true
ansible.builtin.apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
keyring: /usr/share/keyrings/cloud.google.gpg
state: present
- name: Add Google apt repo
become: true
ansible.builtin.apt_repository:
repo: deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main
state: present
filename: google-cloud-sdk
update_cache: false
- name: Add Okta ASA client apt signing key
ansible.builtin.include_role:
name: jack1142.apt_signing_key
vars:
url: https://dist.scaleft.com/pki/scaleft_deb_key.asc
key_name: scaleft
dearmor: true
- name: Add scaleft / Okta ASA repository
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64 signed-by=/usr/share/keyrings/scaleft-archive-keyring.gpg] http://pkg.scaleft.com/deb linux main
state: present
filename: scaleft
update_cache: false
- name: Add HashiCorp apt key
become: true
ansible.builtin.apt_key:
url: https://apt.releases.hashicorp.com/gpg
state: present
- name: Add HashiCorp Jammy repository
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://apt.releases.hashicorp.com jammy main
state: present
filename: hashicorp
update_cache: false
- name: Add Tailscale apt signing key
ansible.builtin.include_role:
name: jack1142.apt_signing_key
vars:
url: https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg
key_name: tailscale
- name: Add Tailscale Jammy repository
become: true
ansible.builtin.apt_repository:
repo: deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/ubuntu jammy main
state: present
filename: tailscale
update_cache: false
- name: Add VirtualBox oracle_vbox apt key
become: true
ansible.builtin.apt_key:
url: https://www.virtualbox.org/download/oracle_vbox.asc
state: present
- name: Add VirtualBox oracle_vbox_2016 apt key
become: true
ansible.builtin.apt_key:
url: https://www.virtualbox.org/download/oracle_vbox_2016.asc
state: present
- name: Add VirtualBox Jammy repository
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian jammy contrib
state: present
filename: virtualbox
update_cache: false
- name: Install Microsoft keys and repo
become: true
ansible.builtin.apt:
state: present
force: true
deb: https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
- name: Install puppet-tools repo via Focal (20.04) deb package
become: true
ansible.builtin.apt:
state: present
deb: http://apt.puppet.com/puppet-tools-release-focal.deb
- name: Base packages from apt
become: true
ansible.builtin.apt:
update_cache: true
state: latest
pkg:
- 1password
- bat
- boinc-manager
- boinctui
- bundler
- cmake
- code # provided by Pop OS repos
- dconf-editor
- dos2unix
- exa
- gh
- git
- git-lfs
- gnupg
- google-cloud-cli
- google-cloud-cli-gke-gcloud-auth-plugin
- gthumb
- htop
- httpie
- hub
- hugo
- iftop
- jq
- libssl-dev
- neofetch
- packer
- pass
- pcsc-tools
- pcscd
- pdk
- powershell
- puppet-bolt
- rake
- ruby
- ruby-dev
- scdaemon
- scaleft-client-tools
- scaleft-url-handler
- slack-desktop # provided by Pop OS repos
- snapd
- tailscale
- terraform
- tilix
- traceroute
- tree
- vagrant
- vim
- virtualbox-6.1
- vivaldi-stable
- xclip
- yubikey-manager
- zsh
- name: Install git-credential-manager deb package
become: true
ansible.builtin.apt:
state: present
deb: https://github.com/GitCredentialManager/git-credential-manager/releases/download/v2.0.696/gcmcore-linux_amd64.2.0.696.deb
- name: Install Profile Switcher for Firefox deb package
become: true
ansible.builtin.apt:
state: present
deb: https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.deb
- name: Install pe-client-tools via Focal (20.04) deb package
become: true
ansible.builtin.apt:
state: present
deb: https://pm.puppetlabs.com/pe-client-tools/2021.6.0/21.6.0/repos/deb/focal/PC1/pe-client-tools_21.6.0-1focal_amd64.deb
- name: Install TeamViewer via deb
become: true
ansible.builtin.apt:
state: present
deb: https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
- name: Install Webex via deb package
become: true
ansible.builtin.apt:
state: present
deb: https://binaries.webex.com/WebexDesktop-Ubuntu-Official-Package/Webex.deb
- name: Install Zoom via deb package
become: true
ansible.builtin.apt:
state: present
deb: https://zoom.us/client/latest/zoom_amd64.deb
- name: Install delta via deb package on GitHub
become: true
ansible.builtin.apt:
state: present
deb: https://github.com/dandavison/delta/releases/download/0.13.0/git-delta_0.13.0_amd64.deb
- name: Base packages from Flathub
community.general.flatpak:
method: user
name:
- app.resp.RESP
- com.belmoussaoui.Obfuscate
- com.borgbase.Vorta
- com.discordapp.Discord
- com.emqx.MQTTX
- com.feaneron.Boatswain
- flathub org.ferdium.Ferdium
- com.github.bleakgrey.tootle
- com.github.gijsgoudzwaard.image-optimizer
- com.github.joseexposito.touche
- com.github.tchx84.Flatseal
- com.mattjakeman.ExtensionManager
- com.nextcloud.desktopclient.nextcloud
- com.obsproject.Studio
- com.obsproject.Studio.Plugin.Gstreamer
- com.rafaelmardojai.SharePreview
- im.riot.Riot
- info.mumble.Mumble
- io.github.janbar.noson
- io.github.mimbrero.WhatsAppDesktop
- net.cozic.joplin_desktop
- org.ferdium.Ferdium
- org.fritzing.Fritzing
- org.gnome.meld
- org.mozilla.Thunderbird
- org.onlyoffice.desktopeditors
- org.remmina.Remmina
- org.signal.Signal
- name: Base packages from Snapcraft
become: true
community.general.snap:
name:
- cctv-viewer # only available here
- name: Snaps requiring classic mode
become: true
community.general.snap:
classic: true
name:
- gitkraken # official version
- name: Cider from Snapcraft
become: true
community.general.snap:
name: cider # official
channel: latest/edge
- name: hiera-eyaml gem
community.general.gem:
name: hiera-eyaml
state: latest
- name: vmfloaty gem
community.general.gem:
name: vmfloaty
state: latest
- name: Python packages via pip
ansible.builtin.pip:
state: latest
name:
- ansible
- ansible-lint
- flake8
- name: Install packages from Homebrew
community.general.homebrew:
state: latest
name:
- adr-tools
- cdktf
- chart-testing
- dog
- dust
- glow
- gotop
- helm
- k9s
- kubectx
- stern
- yq
- name: ensure fonts directory
file:
path: "{{ lookup('env', 'HOME') }}/.fonts"
state: directory
- name: Hack exists
shell: "ls {{ lookup('env', 'HOME') }}/.fonts/Hack*Nerd*Font*Complete*"
register: hack_exists
ignore_errors: true
- name: Download Hack
when: hack_exists is failed
ansible.builtin.unarchive:
src: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Hack.zip
dest: "{{ lookup('env', 'HOME') }}/.fonts/"
remote_src: true
- name: Symlink .zshrc
ansible.builtin.file:
src: "{{ lookup('env', 'HOME') }}/repos/dots/link/nix/zshrc"
dest: "{{ lookup('env', 'HOME') }}/.zshrc"
state: link
- name: Set shell to zsh and add to groups
become: true
ansible.builtin.user:
name: "{{ lookup('env', 'USER') }}"
shell: /usr/bin/zsh
append: true
groups:
- dialout
- name: Add passwordless sudo entries
become: true
community.general.sudoers:
name: "{{ lookup('env', 'USER') }}-no-password"
user: "{{ lookup('env', 'USER') }}"
nopassword: true
commands:
- /usr/bin/systemctl restart pcscd
- /usr/bin/pkill -9 gpg-agent
- name: Disable britty so ESPHome flashing works
become: true
ansible.builtin.shell:
cmd: |
for f in /usr/lib/udev/rules.d/*brltty*.rules; do
if [ ! -L "/etc/udev/rules.d/$(basename "$f")" ]; then
ln -s /dev/null "/etc/udev/rules.d/$(basename "$f")"
udevadm control --reload-rules
fi
done
- name: Disable brltty service
become: true
ansible.builtin.service:
name: brltty.service
enabled: false
state: stopped

View file

@ -0,0 +1,24 @@
---
- name: Install and configure zsh
hosts: servers
vars:
ansible_python_interpreter: '/usr/bin/python3'
tasks:
- name: Install zsh using default package manager
become: true
ansible.builtin.package:
state: present
name:
- git
- zsh
- name: Setup Oh My ZSH
include_role:
name: gantsign.oh-my-zsh
vars:
oh_my_zsh_theme: steeef
oh_my_zsh_plugins:
- git
users:
- username: "{{ ansible_user }}"

5
legacy/.bundle/config Normal file
View file

@ -0,0 +1,5 @@
---
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_JOBS: "3"
BUNDLE_PATH: "vendor/bundle"
BUNDLE_RETRY: "3"

8
legacy/.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10

View file

@ -0,0 +1,15 @@
name: Ansible Lint
on:
pull_request:
jobs:
ansbile_linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ansible-lint
uses: ansible-community/ansible-lint-action@main
with:
path: 'ansible/'

20
legacy/.github/workflows/ruby.yml vendored Normal file
View file

@ -0,0 +1,20 @@
name: Ruby
on:
pull_request:
jobs:
ruby_testing:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: ['2.6', '2.7', '3.0', '3.1']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake tests

1
legacy/.puppet-lint.rc Normal file
View file

@ -0,0 +1 @@
--no-class_inherits_from_params_class-check

3
legacy/.rspec Normal file
View file

@ -0,0 +1,3 @@
--format documentation
--color
--tty

9
legacy/.rubocop.yml Normal file
View file

@ -0,0 +1,9 @@
AllCops:
Exclude:
- 'vendor/**/*'
- 'spec/fixtures/**/*'
TargetRubyVersion: 2.5
NewCops: enable
Style/CommentedKeyword:
Enabled: false

52
legacy/DevelopmentPlan.md Normal file
View file

@ -0,0 +1,52 @@
# dots
My dot files and a tool to deploy them to various OS's
## The Plan
* files in [link/](link) get symlinked to `~/.{filename}`
* files in [copy/](copy) get copied to `~/.{filename}`
* this process should default to not clobbering existing files
* [bin/dots.rb](bin/dots.rb) is what users will interact with
* it should bootstrap based on the OS it is being run on
* it should run Puppet and associated tools such as r10k via bundler
* it should not utilize Git submodules; it should instead use [vcsrepo](https://forge.puppet.com/puppetlabs/vcsrepo)
* the destination of each repo may well need to be added to the parent's `.gitignore`
* it should configure [iTerm2](https://www.iterm2.com/) on Mac
* it should configure [Atom](https://atom.io/) on all platforms
* it should offer a choice to skip steps related to GUI programs
* it should permit host-specific settings / options
* this will likely be done via entries in a hiera node file
* create a Docker image with all tools preinstaleld and set to mount the current user's home directory as a volume.
* use [gosu](https://github.com/tianon/gosu) so ownership is correct.
* this may not work on Windows...
### Packages to install on Mac's
#### Vundle & Vim
Install via Puppet:
1. link `vimrc`
2. vcsrepo: https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
3. exec `vim +PluginInstall +qall`
#### Powerline
```bash
brew install coreutils python socat tmux
pip install psutil powerline-status
git clone https://github.com/powerline/fonts.git ~/repos/powerline-fonts
cd ~/repos/powerline-fonts
./install.sh
```
##### Thoughts on installing with Puppet:
* [x] install packages using a provider for homebrew
* [x] install packages using the pip provider
* [x] use vcsrepo to clone the fonts
* [x] create a refresh-only exec that runs the install script
* [x] add a notify to the vcsrepo resource that triggers the exec
* this will also take care of bringing in new fonts or updates

45
legacy/Gemfile Normal file
View file

@ -0,0 +1,45 @@
# frozen_string_literal: true
# vim:ft=ruby
source 'https://rubygems.org'
# rubocop:disable Style/ConditionalAssignment
if ENV.key?('PUPPET_VERSION')
puppetversion = ENV['PUPPET_VERSION'].to_s
else
puppetversion = ['>= 7', '< 8']
end
# rubocop:enable Style/ConditionalAssignment
group :production do
gem 'os', '~> 1.1'
gem 'puppet', puppetversion
gem 'r10k', '~> 3.15'
gem 'rugged', '~> 1.5'
gem 'xmlrpc', '~> 0.3.0' if RUBY_VERSION >= '2.3'
end
group :development, :unit_tests do
gem 'json', '>= 2.0.2'
gem 'metadata-json-lint', '~> 3.0'
gem 'puppetlabs_spec_helper', '~> 5.0'
gem 'rspec-puppet', '~> 2.12'
gem 'rubocop', '~> 1.44'
gem 'tty-command', '~> 0.6'
gem 'tty-file', '~> 0.9'
gem 'tty-prompt', '~> 0.21'
gem 'yamllint', '~> 0.0.9'
# puppet-lint and plugins
gem 'puppet-lint', '~> 2.5'
gem 'puppet-lint-absolute_classname-check', '~> 3.1'
gem 'puppet-lint-absolute_template_path', '~> 1.0'
gem 'puppet-lint-empty_string-check', '~> 1.0'
gem 'puppet-lint-leading_zero-check', '~> 1.0'
gem 'puppet-lint-resource_reference_syntax', '~> 1.2'
gem 'puppet-lint-spaceship_operator_without_tag-check', '~> 0.1'
gem 'puppet-lint-trailing_newline-check', '~> 1.1'
gem 'puppet-lint-undef_in_function-check', '~> 0.2'
gem 'puppet-lint-unquoted_string-check', '~> 2.2'
gem 'puppet-lint-variable_contains_upcase', '~> 1.3'
end

250
legacy/Gemfile.lock Normal file
View file

@ -0,0 +1,250 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
colored2 (3.1.2)
concurrent-ruby (1.1.10)
cri (2.15.11)
deep_merge (1.2.2)
diff-lcs (1.5.0)
erubi (1.12.0)
facter (4.2.14)
hocon (~> 1.3)
thor (>= 1.0.1, < 2.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fast_gettext (2.2.0)
forwardable (1.3.3)
gettext (3.4.3)
erubi
locale (>= 2.0.5)
prime
text (>= 1.3.0)
gettext-setup (1.1.0)
fast_gettext (~> 2.1)
gettext (~> 3.4)
locale
hiera (3.11.0)
hocon (1.3.1)
json (2.6.3)
json-schema (3.0.0)
addressable (>= 2.8)
jwt (2.2.3)
locale (2.1.3)
log4r (1.1.10)
metadata-json-lint (3.0.2)
json-schema (>= 2.8, < 4.0)
spdx-licenses (~> 1.0)
minitar (0.9)
mocha (1.16.1)
multi_json (1.15.0)
multipart-post (2.2.3)
os (1.1.4)
parallel (1.22.1)
parser (3.2.0.0)
ast (~> 2.4.1)
pastel (0.8.0)
tty-color (~> 0.5)
pathspec (1.1.3)
prime (0.1.2)
forwardable
singleton
public_suffix (4.0.7)
puppet (7.22.0)
concurrent-ruby (~> 1.0, < 1.2.0)
deep_merge (~> 1.0)
facter (> 2.0.1, < 5)
fast_gettext (>= 1.1, < 3)
hiera (>= 3.2.1, < 4)
locale (~> 2.1)
multi_json (~> 1.10)
puppet-resource_api (~> 1.5)
scanf (~> 1.0)
semantic_puppet (~> 1.0)
puppet (7.22.0-universal-darwin)
CFPropertyList (~> 2.2)
concurrent-ruby (~> 1.0, < 1.2.0)
deep_merge (~> 1.0)
facter (> 2.0.1, < 5)
fast_gettext (>= 1.1, < 3)
hiera (>= 3.2.1, < 4)
locale (~> 2.1)
multi_json (~> 1.10)
puppet-resource_api (~> 1.5)
scanf (~> 1.0)
semantic_puppet (~> 1.0)
puppet-lint (2.5.2)
puppet-lint-absolute_classname-check (3.1.0)
puppet-lint (>= 1.0, < 4)
puppet-lint-absolute_template_path (1.0.1)
puppet-lint (>= 1.1, < 3.0)
puppet-lint-empty_string-check (1.0.0)
puppet-lint (>= 1.0, < 3.0)
puppet-lint-leading_zero-check (1.0.0)
puppet-lint (>= 1.0, < 3.0)
puppet-lint-resource_reference_syntax (1.2.0)
puppet-lint (>= 1.0, < 4)
puppet-lint-spaceship_operator_without_tag-check (0.1.1)
puppet-lint (>= 1.0, < 3.0)
puppet-lint-trailing_newline-check (1.1.0)
puppet-lint (>= 1.0, < 3.0)
puppet-lint-undef_in_function-check (0.2.1)
puppet-lint (>= 1.0, < 3.0)
puppet-lint-unquoted_string-check (2.2.0)
puppet-lint (>= 2.1, < 4)
puppet-lint-variable_contains_upcase (1.3.0)
puppet-lint (>= 1.0, < 4)
puppet-resource_api (1.8.14)
hocon (>= 1.0)
puppet-syntax (3.2.1)
puppet (>= 5)
rake
puppet_forge (3.2.0)
faraday (~> 1.3)
faraday_middleware (~> 1.0)
minitar
semantic_puppet (~> 1.0)
puppetlabs_spec_helper (5.0.3)
mocha (~> 1.0)
pathspec (>= 0.2, < 2.0.0)
puppet-lint (>= 2.5.2, < 4.0.0)
puppet-syntax (~> 3.0)
rspec-github (~> 2.0)
rspec-puppet (~> 2.0)
r10k (3.15.4)
colored2 (= 3.1.2)
cri (>= 2.15.10)
fast_gettext (>= 1.1.0, < 3.0.0)
gettext (>= 3.0.2, < 4.0.0)
gettext-setup (>= 0.24, < 2.0.0)
jwt (~> 2.2.3)
log4r (= 1.1.10)
minitar (~> 0.9)
multi_json (~> 1.10)
puppet_forge (>= 2.3.0, < 4.0.0)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.6.2)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-github (2.4.0)
rspec-core (~> 3.0)
rspec-mocks (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-puppet (2.12.0)
rspec
rspec-support (3.12.0)
rubocop (1.44.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
rugged (1.5.1)
scanf (1.0.0)
semantic_puppet (1.0.4)
singleton (0.1.1)
spdx-licenses (1.3.0)
text (1.3.1)
thor (1.2.1)
trollop (2.9.10)
tty-color (0.6.0)
tty-command (0.10.1)
pastel (~> 0.8)
tty-cursor (0.7.1)
tty-file (0.10.0)
diff-lcs (~> 1.3)
pastel (~> 0.8)
tty-prompt (~> 0.22)
tty-prompt (0.23.1)
pastel (~> 0.8)
tty-reader (~> 0.8)
tty-reader (0.9.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.8)
wisper (~> 2.0)
tty-screen (0.8.1)
unicode-display_width (2.4.2)
webrick (1.7.0)
wisper (2.0.1)
xmlrpc (0.3.2)
webrick
yamllint (0.0.9)
trollop (~> 2)
PLATFORMS
x86_64-darwin-19
x86_64-linux
DEPENDENCIES
json (>= 2.0.2)
metadata-json-lint (~> 3.0)
os (~> 1.1)
puppet (>= 7, < 8)
puppet-lint (~> 2.5)
puppet-lint-absolute_classname-check (~> 3.1)
puppet-lint-absolute_template_path (~> 1.0)
puppet-lint-empty_string-check (~> 1.0)
puppet-lint-leading_zero-check (~> 1.0)
puppet-lint-resource_reference_syntax (~> 1.2)
puppet-lint-spaceship_operator_without_tag-check (~> 0.1)
puppet-lint-trailing_newline-check (~> 1.1)
puppet-lint-undef_in_function-check (~> 0.2)
puppet-lint-unquoted_string-check (~> 2.2)
puppet-lint-variable_contains_upcase (~> 1.3)
puppetlabs_spec_helper (~> 5.0)
r10k (~> 3.15)
rspec-puppet (~> 2.12)
rubocop (~> 1.44)
rugged (~> 1.5)
tty-command (~> 0.6)
tty-file (~> 0.9)
tty-prompt (~> 0.21)
xmlrpc (~> 0.3.0)
yamllint (~> 0.0.9)
BUNDLED WITH
2.3.5

159
legacy/README.md Normal file
View file

@ -0,0 +1,159 @@
# dots
[![Ansible Lint](https://github.com/genebean/dots/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ansible-lint.yml)
[![Ruby](https://github.com/genebean/dots/actions/workflows/ruby.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ruby.yml)
> **NOTICE:** this repo is undergoing a transformation. Historically it has been centered around using Puppet and r10k as ruby gems. I love Puppet for managing servers, but running it unprivledged as a gem has proven more than a little challenging in this specific use case. As a result, I am transitioning to using Ansible for the adhoc work that is needed here. Also, the `dots` tool and associated rake tasks will almost certainly be moved to Python 3 as it is universally available without some of the hastles of a bundler based setup.
This repo contains my dot files and a tool to deploy them, and the programs that use them, to various OS's. Some additional tools that I consider part of my baseline setup are also installed and, if possible, configured by dots.
Dots is written in ruby and utilizes bundler to keep all its dependancies
as self-contained as possible. Installation of programs and management of git
repositories is handled by way of the
[Puppet gem](https://rubygems.org/gems/puppet).
Everything about dots macOS assumes you are running it as a normal user,
not as root. Strange and unexpected things could well happen if you run any part
of it as root or via sudo while on macOS. That said, sudo is required on Debian
due to there not being an equivalent to homebrew as you need sudo to use apt.
## Currently Supported OS's
* macOS
* Linux Mint 18.2
## Initial Setup
```bash
git clone git@github.com:genebean/dots.git ~/.dotfiles
cd ~/.dotfiles
bin/bootstrap.sh
This script takes care of getting dots ready to use
Enter the number of the task you want to perform:
1) Mac setup
2) EL setup
3) Mint setup
4) Quit
Task:
```
After you run the setup for your OS you will want to make sure that
[puppet/production/hieradata/nodes/](puppet/production/hieradata/nodes/)
contains a file matching the hostname of your machine. That file needs to
contain at least the following:
```yaml
---
homedir: '/Users/johndoe'
```
Naturally, you will want to adjust the entry to match the real path to your
home directory. On a Mac this is generally in `/Users/` or `/home/` on Linux.
## Running dots
The primary way to interact with dots is via `bundle exec rake dots`.
This will run an interactive cli program like so:
```
$ bundle exec rake dots
/usr/local/Cellar/ruby/2.4.1_1/bin/ruby bin/dots.rb
It seems you are on macOS 10.12.5
What would you like to do? (Use arrow keys, press Enter to select)
‣ copy
link
install
```
If not on macOS then you will need to use sudo for the install step:
```
$ sudo bundle exec rake dots
```
Additional tasks are available in the
dots namespace. You can see all the available tasks via
`bundle exec rake -T`.
## Notes
#### Running Puppet
```bash
# Any of these will work:
bundle exec rake dots:run_puppet
bundle exec rake dots:run_puppet_noop
bundle exec puppet apply --environmentpath ~/.dotfiles/puppet ~/.dotfiles/puppet/production/manifests/site.pp
```
As mentioned above, when not on macOS you will need to prefix bundle with sudo.
#### Installed Homebrew packages
To see what has been installed (not the deps) run `brew leaves`
## Project structure
* `bin/`: this is where the "application" bits live
* `bin/bootstrap`: platform specific helpers called by `bin/bootstrap.sh`
* `copy/`: files directly in this directory are copied to all hosts
* `copy/mac/`: files in here get copied to Macs
* `copy/nix/`: files in here get copied to all Posix systems
* `link/`: files directly in this directory are symlinked on all hosts.
* all symlinks are prefixed with a dot. Ex: `link/gemrc` becomes `~/.gemrc`
* `link/linux/`: files in here get symlinked on all Linux distros
* `link/mac/`: files in here get symlinked on all Macs
* `link/nix/`: files in here get symlinked on all Posix systems
* `link/ssh/`: these files get symlinked under `~/.ssh/` on all Posix systems
* `puppet/`: this is basically a control repo modified to suit this setup
* `puppet/production/`: items from an environment's branch in a control repo
* this setup assumes Puppet 4 and Hiera 5. Hiera's config is parsed as part of
the environment rather than from a global config file.
* `spec/`: unit tests go here
## Adding Packages
To add additional pacakages to be installed and managed by dots you will need to
edit the associated Puppet manifest. Currently, this consists of the following:
```bash
puppet/production/site/profile/manifests/
├── base.pp
├── linux
│   └── debian.pp
├── linux.pp
└── mac.pp
```
On macOS you can easily install packages and casks from homebrew or Python
modules from pip. On Linux Mint you can easily use any package provider
that supports Debian or Ubuntu since all installs are done via sudo. On both
platforms you can also use custom exec's to to work around limitations. For
example, an exec is used on Mint to set the shell to zsh and on both platforms
to install or update the powerline fonts.
## Puppet Customizations
This repo also contains some custom facts and functions under
`puppet/production/site/custom_libs`:
### Facts
* `os_release`: this creates a structured fact out of the contents of
/etc/os-release on Linux systems. This info is needed on Mint to determine
what version of Ubuntu it is based on.
### Functions
* `find_group`: returns the owning group's GID as a string for the file or
folder at a given path
* `find_owner`: returns the owning user's UID as a string for the file or
folder at a given path

63
legacy/Rakefile Normal file
View file

@ -0,0 +1,63 @@
# frozen_string_literal: true
require 'rubocop/rake_task'
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'tty-command'
require 'yamllint/rake_task'
require_relative 'bin/rake_tasks'
exclude_paths = [
'pkg/**/*',
'vendor/**/*',
'spec/**/*'
]
# https://docs.rubocop.org/rubocop/0.86/integration_with_other_tools.html#rake-integration
RuboCop::RakeTask.new
PuppetLint::RakeTask.new :lint do |config|
config.fail_on_warnings = true
config.ignore_paths = exclude_paths
end
PuppetSyntax.exclude_paths = exclude_paths
desc 'Validate manifests, templates, and ruby files'
task :validate do
Dir['puppet/manifests/**/*.pp',
'puppet/site/*/manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['bin/**/*.rb',
'spec/**/*.rb'].each do |ruby_file|
# rubocop:disable Style/RegexpLiteral
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
# rubocop:enable Style/RegexpLiteral
end
Dir['puppet/site/*/templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end
YamlLint::RakeTask.new do |yamllint|
yamllint.paths = %w[
.*.yaml
.*.yml
*.yaml
*.yml
copy/**/*.yml
link/**/*.yml
puppet/hieradata/**/*.yml
puppet/hieradata/**/*.yaml
]
end
task :tests do
Rake::Task[:lint].invoke
Rake::Task[:yamllint].invoke
Rake::Task[:validate].invoke
Rake::Task[:rubocop].invoke
Rake::Task[:spec].invoke
end

27
legacy/bin/bootstrap.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
echo 'This script takes care of getting dots ready to use'
echo 'Enter the number of the task you want to perform:'
PS3='Task: '
select TASK in 'Mac setup' 'EL setup' 'Mint setup' 'Quit';
do
case $TASK in
'Mac setup' )
~/.dotfiles/bin/bootstrap/bootstrap_mac.sh now
;;
'EL setup' )
~/.dotfiles/bin/bootstrap/bootstrap_el.sh now
;;
'Mint setup' )
~/.dotfiles/bin/bootstrap/bootstrap_mint.sh now
;;
'Quit' )
echo 'Exiting'
exit 0
;;
* )
echo 'Invalid selection, quitting.'
exit 1
;;
esac
done

View file

@ -0,0 +1,22 @@
#!/bin/bash
if [[ $1 == 'now' ]]; then
# Install dot's dependencies
sudo yum install -y centos-release-scl-rh.noarch
sudo yum install rh-ruby26 rh-ruby26-ruby-devel rh-ruby26-rubygem-bundler rh-ruby26-rubygem-rake cmake gcc
# Make dot usable
cd ~/.dotfiles
cat bin/sclbundle|sudo tee /usr/local/bin/dotbundle > /dev/null
sudo chmod a+x /usr/local/bin/dotbundle
cat bin/sclruby|sudo tee /usr/local/bin/dotruby > /dev/null
sudo chmod a+x /usr/local/bin/dotruby
/usr/local/bin/dotbundle install
# Install Puppet modules
/usr/local/bin/dotbundle exec rake dots:run_r10k
# Display tasks that can be run
echo 'These are the task that can now be executed:'
/usr/local/bin/dotbundle exec rake -T |grep --color=never 'rake dots'
fi

View file

@ -0,0 +1,21 @@
#!/bin/bash
if [[ $1 == 'now' ]]; then
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install dot's dependencies
/usr/local/bin/brew install ruby@2.7 cmake pkg-config
/usr/local/bin/gem install --no-ri --no-rdoc bundler
# Make dot usable
cd ~/.dotfiles
/usr/local/bin/bundle install
# Install Puppet modules
/usr/local/bin/bundle exec rake dots:run_r10k
# Display tasks that can be run
echo 'These are the task that can now be executed:'
/usr/local/bin/bundle exec rake -T |grep --color=never 'rake dots'
fi

View file

@ -0,0 +1,21 @@
#!/bin/bash
if [[ $1 == 'now' ]]; then
# Install dot's dependencies
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.4 ruby2.4-dev ruby-switch cmake build-essential
sudo ruby-switch --set ruby2.4
sudo gem install --no-ri --no-rdoc bundler
# Make dot usable
cd ~/.dotfiles
bundle install
# Install Puppet modules
bundle exec rake dots:run_r10k
# Display tasks that can be run
echo 'These are the task that can now be executed:'
bundle exec rake -T |grep --color=never 'rake dots'
fi

1
legacy/bin/casks.sh Executable file
View file

@ -0,0 +1 @@
brew install --cask adobe-acrobat-reader boinc virtualbox virtualbox-extension-pack vagrant

82
legacy/bin/dots.rb Executable file
View file

@ -0,0 +1,82 @@
# frozen_string_literal: true
require 'open3'
require 'os'
require 'tty-command'
require 'tty-file'
require 'tty-prompt'
require_relative 'dotutils'
cmd = TTY::Command.new
@prompt = TTY::Prompt.new(help_color: :magenta)
@home = File.expand_path('~')
@dotroot = File.dirname(File.dirname(File.expand_path($PROGRAM_NAME)))
@excludes = %w[linux mac nix ssh]
@files_copy = Dir.glob("#{@dotroot}/copy/*")
@files_link = Dir.glob("#{@dotroot}/link/*")
@ssh_link = Dir.glob("#{@dotroot}/link/ssh/*")
if OS.posix?
@files_copy.concat Dir.glob("#{@dotroot}/copy/nix/*")
@files_link.concat Dir.glob("#{@dotroot}/link/nix/*")
end
if OS.windows?
puts 'It seems you are on Windows'
elsif OS.mac?
mac_vers
@files_copy.concat Dir.glob("#{@dotroot}/copy/mac/*")
@files_link.concat Dir.glob("#{@dotroot}/link/mac/*")
elsif OS.linux?
@files_link.concat Dir.glob("#{@dotroot}/link/linux/*")
else
abort("I'm not sure what to do with this OS...") unless OS.posix?
end
task = @prompt.select('What would you like to do?', %w[copy link install exit])
case task
when 'copy'
if @prompt.yes?('Are you sure you want to copy these files?')
@files_copy.each do |file|
unless @excludes.include?(File.basename(file))
puts "Copying #{file} to #{@home}/.#{File.basename(file)}"
copy_file(file, "#{@home}/.#{File.basename(file)}")
end
end
else
puts 'not copying'
end
when 'link'
if @prompt.yes?('Are you sure you want to link your dot files?')
@files_link.each do |file|
unless @excludes.include?(File.basename(file))
# puts "Linking #{@home}/.#{File.basename(file)} to #{file}"
link_file(file, "#{@home}/.#{File.basename(file)}")
end
end
# rubocop:disable Style/NumericLiteralPrefix
Dir.mkdir("#{@home}/.ssh", 0700) unless File.directory?("#{@home}/.ssh")
# rubocop:enable Style/NumericLiteralPrefix
@ssh_link.each do |file|
link_file(file, "#{@home}/.ssh/#{File.basename(file)}")
end
else
puts 'not linking'
end
when 'install'
if @prompt.yes?('Are you sure you want to install your base packages?')
cmd.run('bundle exec rake dots:run_puppet')
cmd.run('bundle exec rake dots:vim_plugins')
end
when 'exit'
exit
end # end of the case statement

76
legacy/bin/dotutils.rb Normal file
View file

@ -0,0 +1,76 @@
# frozen_string_literal: true
def existing_symlink(source, destination)
return if File.readlink(destination).eql?(source)
# rubocop:disable Layout/LineLength
if @prompt.yes?("#{destination} currently points to #{File.readlink(destination)}, do you want point it at #{source}?")
File.unlink(destination)
puts "Linking #{destination} to #{source}"
File.symlink(source, destination)
puts 'link replaced'
else
puts "#{destination} is unchanged"
end
# rubocop:enable Layout/LineLength
end
# rubocop:disable Metrics/MethodLength
def rename_file(source, destination, action)
puts "#{destination} exists, renaming to #{destination}.predots"
File.rename(destination, "#{destination}.predots")
case action
when 'link'
puts "Linking #{destination} to #{source}"
File.symlink(source, destination)
when 'copy'
puts "Copying #{destination} to #{source}"
FileUtils.cp_r(source, destination)
else
raise ArgumentError, "'#{action}' is not a valid action", backtrace
end
end
# rubocop:enable Metrics/MethodLength
def copy_file(source, destination)
if File.exist?(destination)
if @prompt.yes?("#{destination} exists, do you want to replace it?")
rename_file(source, destination, 'copy')
else
puts "#{destination} is unchanged"
end
else
FileUtils.cp_r(source, destination)
end
end
def link_file(source, destination)
if File.exist?(destination) && File.symlink?(destination)
existing_symlink(source, destination)
elsif File.exist?(destination)
# this catches anything that is not a symlink
rename_file(source, destination, 'link')
else
puts "Linking #{destination} to #{source}"
File.symlink(source, destination)
end
end
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def mac_vers
stdout, _stderr, _status = Open3.capture3('sw_vers -productVersion')
if Integer(stdout.strip.split('.')[0]) == 10
if Integer(stdout.strip.split('.')[1]) >= 12
puts "It seems you are on macOS #{stdout.strip}"
else
puts "It seems you are on OX X #{stdout.strip}"
end
elsif Integer(stdout.strip.split('.')[0]) < 10
puts "Wow... you're sure running an old os (#{stdout.strip} to be exact)"
else
abort("It seems you are on a Mac but I don't know what to do on \
v#{stdout.strip}")
end
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize

42
legacy/bin/rake_tasks.rb Normal file
View file

@ -0,0 +1,42 @@
# frozen_string_literal: true
desc 'Run dots'
task :dots do
ruby 'bin/dots.rb'
end
# rubocop:disable Metrics/BlockLength
namespace 'dots' do
cmd = TTY::Command.new
desc 'Run r10k'
task :run_r10k do
command = 'bundle exec r10k puppetfile install \
--puppetfile ~/.dotfiles/puppet/production/Puppetfile -v'
cmd.run(command)
end
desc 'Run Puppet'
task :run_puppet do
command = 'bundle exec puppet apply \
--environmentpath ~/.dotfiles/puppet \
~/.dotfiles/puppet/production/manifests/site.pp'
cmd.run(command)
end
desc 'Run Puppet (noop)'
task :run_puppet_noop do
command = 'bundle exec puppet apply \
--environmentpath ~/.dotfiles/puppet \
~/.dotfiles/puppet/production/manifests/site.pp --noop'
cmd.run(command)
end
desc 'Install Vundle Plugins'
task :vim_plugins do
# running this command from bundler refuses to work
command = 'vim +PluginInstall! +qall'
puts "Run '#{command}' to get your Vundle plugins installed and/or updated"
end
end
# rubocop:enable Metrics/BlockLength

2
legacy/bin/sclbundle Executable file
View file

@ -0,0 +1,2 @@
source /opt/rh/rh-ruby24/enable
bundle "$@"

2
legacy/bin/sclruby Executable file
View file

@ -0,0 +1,2 @@
source /opt/rh/rh-ruby24/enable
ruby "$@"

26
legacy/bin/shell-setup.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "usage: sudo $0 username"
exit 1
fi
user=$1
zsh_path='/usr/local/bin/zsh'
if [ "$(id -u)" != "0" ]; then
echo "Editing your shell requires admin rights. Run via 'sudo $0'"
exit 1
else
if [ -f "$zsh_path" ]; then
shell_check=$(dscl localhost -read /Local/Default/Users/gene UserShell |grep -c $zsh_path)
if [ $shell_check -eq 0 ]; then
echo "setting shell via dscl"
dscl localhost -change /Local/Default/Users/$user UserShell /bin/bash $zsh_path
fi
else
echo "$zsh_path doesn't exist yet, run Puppet."
exit 1
fi
fi

21
legacy/copy/mac/gitconfig Normal file
View file

@ -0,0 +1,21 @@
[user]
name = Gene Liverman
email = gene@technicalissues.us
[commit]
gpgSign = true
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[gpg]
program = gpg2
[init]
defaultBranch = main
[merge]
conflictStyle = diff3
[pull]
rebase = false
[alias]
kraken = !open "gitkraken://repo$(cd "${1:-.}" && git rev-parse --show-toplevel); :"

View file

@ -0,0 +1,5 @@
---
url: 'https://forgeapi.puppetlabs.com'
username: 'genebean'
password: 'change-me-to-a-real-password'

View file

@ -0,0 +1,10 @@
# frozen_string_literal: true
forge 'http://forge.puppetlabs.com'
# The next line translates to '../../vendor/puppet_modules' aka ~/.dotfiles/vendor/puppet_modules
moduledir "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/vendor/puppet_modules"
mod 'puppetlabs-apt', '7.3.0'
mod 'puppetlabs-stdlib', '4.25.1'
mod 'puppetlabs-vcsrepo', '3.1.0'
mod 'thekevjames-homebrew', '1.8.3'

View file

@ -0,0 +1,2 @@
modulepath = modules:site:~/.dotfiles/vendor/puppet_modules:$basemodulepath
config_version = 'scripts/config_version.sh $environmentpath'

View file

@ -0,0 +1,11 @@
---
version: 5
defaults: # Used for any hierarchy level that omits these keys.
datadir : hieradata # This path is relative to hiera.yaml's directory.
data_hash : yaml_data # Use the built-in YAML backend.
hierarchy:
- name: "Per-node data"
path: "nodes/%{hostname}.yaml"
- name: "Common data"
path: "common.yaml"

View file

@ -0,0 +1,2 @@
---
foo: bar

View file

@ -0,0 +1,2 @@
---
homedir: '/Users/gene'

View file

@ -0,0 +1,2 @@
---
homedir: '/home/gene'

View file

@ -0,0 +1,2 @@
---
homedir: '/Users/gene.liverman'

View file

@ -0,0 +1,2 @@
---
homedir: '/home/gene'

View file

@ -0,0 +1,29 @@
## site.pp ##
# DEFAULT NODE
# The default node definition matches any node lacking a more specific node
# definition. If there are no other nodes in this file, classes declared here
# will be included in every node's catalog, *in addition* to any classes
# specified in the via an ENC for that node.
node default {
notify{'This is from the default node.':}
}
node 'bowl' {
include role::workstation
}
node 'gene' {
include role::workstation
}
node 'mintstring' {
include role::workstation
}
node 'yellowbadger' {
include role::workstation
}

View file

@ -0,0 +1,25 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
begin
require 'rugged'
rescue LoadError
t = Time.new
puts t.to_i
else
environmentpath = ARGV[0]
environment = ARGV[1]
repo = Rugged::Repository.discover(File.join(environmentpath, environment))
head = repo.head
# sha1 hash of the newest commit
head_sha = head.target_id
# the commit message associated the newest commit
# commit = repo.lookup(head_sha)
# add something to find the remote url
puts head_sha
end

View file

@ -0,0 +1,5 @@
#!/bin/bash
/usr/bin/git --version > /dev/null 2>&1 &&
/usr/bin/git --git-dir $1/../.git rev-parse HEAD ||
date +%s

View file

@ -0,0 +1,23 @@
# frozen_string_literal: true
Facter.add(:os_release) do
confine kernel: 'Linux'
setcode do
file_path = '/etc/os-release'
if File.exist?(file_path)
os_release_hash = {}
File.open(file_path, 'r') do |file|
file.each_line do |line|
next if line.nil? || line.strip.length.eql?(0)
line_data = line.split('=')
key = line_data[0].downcase
value = line_data[1].strip.gsub(/(^")|("$)/, '')
os_release_hash[key] = value
end
end
os_release_hash
end
end
end

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
Puppet::Functions.create_function(:find_group) do
dispatch :find_group do
param 'String', :some_path
return_type 'String'
end
def find_group(some_path)
File.stat(some_path).gid.to_s
end
end

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
Puppet::Functions.create_function(:find_owner) do
dispatch :find_owner do
param 'String', :some_path
return_type 'String'
end
def find_owner(some_path)
File.stat(some_path).uid.to_s
end
end

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
Puppet::Functions.create_function(:homedir_to_user) do
dispatch :homedir_to_user do
param 'String', :some_path
return_type 'String'
end
def homedir_to_user(some_path)
some_path.split('/')[-1]
end
end

View file

@ -0,0 +1,5 @@
# the base profile should include component modules that will be on all nodes
class profile::base {
}

View file

@ -0,0 +1,21 @@
# Select a profile based on the OS family
class profile::linux {
case $facts['os']['family'] {
'Debian': { include profile::linux::debian }
'RedHat': { include profile::linux::el }
default: { fail("${facts['os']['family']} isn't supported yet") }
}
exec { 'download hub':
path => '/bin:/usr/bin',
command => "curl -s https://api.github.com/repos/github/hub/releases/latest | grep \"browser_download_url.*linux-amd64\" | cut -d '\"' -f4 | xargs -n 1 curl -L | tar -xzvf - -C /tmp && mv /tmp/hub* /usr/local/hub",
creates => '/usr/local/hub',
}
file {'/usr/local/bin/hub':
ensure => 'link',
target => '/usr/local/hub/bin/hub',
}
}

View file

@ -0,0 +1,135 @@
# Profile for the Debian family of OS's
class profile::linux::debian {
$homedir = lookup('homedir')
$uid = find_owner($homedir)
$gid = find_group($homedir)
File {
owner => $uid,
group => $gid,
}
Vcsrepo {
user => $uid,
owner => $uid,
group => $gid,
}
if $facts['os_release']['ubuntu_codename'] {
$release = $facts['os_release']['ubuntu_codename']
}
elsif $facts['os']['lsb']['distcodename'] {
$release = $facts['os']['lsb']['distcodename']
}
else {
fail("Can't determine what to use in 'release' for the Docker repo")
}
apt::source { 'docker':
location => 'https://download.docker.com/linux/ubuntu',
release => $release,
repos => 'stable',
key => {
'id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88',
'source' => 'https://download.docker.com/linux/ubuntu/gpg',
},
}
$apt_packages = [
'apt-transport-https',
'bash-completion',
'ca-certificates',
'cmake',
'coreutils',
'curl',
'figlet',
'git',
'git-flow',
'pinentry-gnome3',
'powerline',
'python',
'python-pip',
'python-psutil',
'scdaemon',
'software-properties-common',
'tmux',
'tree',
'yubikey-personalization-gui',
'zsh',
]
package { $apt_packages:
ensure => 'installed',
require => Apt::Source['docker'],
}
exec { 'set-shell-to-zsh':
path => '/bin:/usr/bin',
command => "chsh -s /usr/bin/zsh `grep '${uid}:${gid}' /etc/passwd |cut -d ':' -f1`",
cwd => $homedir,
logoutput => true,
environment => "HOME=${homedir}",
unless => "grep '${uid}:${gid}' /etc/passwd | grep '/usr/bin/zsh'",
}
$dirs = [
"${homedir}/.local",
"${homedir}/.local/share",
"${homedir}/.local/share/fonts",
"${homedir}/.vim",
"${homedir}/.vim/bundle",
"${homedir}/repos",
]
file { $dirs:
ensure => 'directory',
}
vcsrepo { "${homedir}/.oh-my-zsh":
ensure => 'present',
provider => 'git',
source => 'https://github.com/robbyrussell/oh-my-zsh.git',
}
vcsrepo { "${homedir}/.oh-my-zsh/custom/themes":
ensure => 'latest',
provider => 'git',
source => 'git@github.com:genebean/my-oh-zsh-themes.git',
}
vcsrepo { "${homedir}/.vim/bundle/Vundle.vim":
ensure => 'latest',
provider => 'git',
source => 'https://github.com/VundleVim/Vundle.vim.git',
require => File[$dirs],
}
vcsrepo { "${homedir}/repos/powerline-fonts":
ensure => 'latest',
provider => 'git',
source => 'https://github.com/powerline/fonts.git',
require => File[$dirs],
notify => Exec['update-fonts'],
}
exec { 'update-fonts':
command => "${homedir}/repos/powerline-fonts/install.sh",
cwd => "${homedir}/repos/powerline-fonts",
logoutput => true,
environment => "HOME=${homedir}",
refreshonly => true,
notify => Exec['set-font-ownership'],
}
exec { 'set-font-ownership':
path => '/bin:/usr/bin',
command => "chown -R ${uid}:${gid} ${homedir}/.local/share/fonts/*",
cwd => $homedir,
logoutput => true,
environment => "HOME=${homedir}",
require => Exec['update-fonts'],
refreshonly => true,
}
}

View file

@ -0,0 +1,126 @@
# Profile for the Red Hat family of OS's
class profile::linux::el {
$homedir = lookup('homedir')
$uid = find_owner($homedir)
$gid = find_group($homedir)
$user = homedir_to_user($homedir)
include profile::linux::el::docker_repos
Yumrepo <| |> -> Package <| |> # lint:ignore:spaceship_operator_without_tag
$yum_packages = [
'cmake',
'device-mapper-persistent-data',
'docker-ce',
'figlet',
'git',
'gitflow',
'lvm2',
'python2-pip',
'python2-psutil',
'tmux',
'tree',
'yum-utils',
'zsh',
]
$python_pacakges = [
'powerline-status',
]
package {
default:
ensure => 'installed',
;
'epel-release':
notify => Exec['yum clean all'],
;
$yum_packages:
require => Package['epel-release'],
;
$python_pacakges:
ensure => 'latest',
provider => 'pip',
require => Package['python2-pip'],
;
}
$dirs = [
"${homedir}/.local",
"${homedir}/.local/share",
"${homedir}/.local/share/fonts",
"${homedir}/.vim",
"${homedir}/.vim/bundle",
"${homedir}/repos",
]
file { $dirs:
ensure => 'directory',
owner => $uid,
group => $gid,
}
# Unlike on Mint, powerline is pulled from pip.
# This makes it so that the line in .tmux.conf works on both.
file { '/usr/share/powerline':
ensure => 'link',
target => '/usr/lib/python2.7/site-packages/powerline',
require => Package[$python_pacakges],
}
vcsrepo {
default:
ensure => 'latest',
user => $user,
owner => $uid,
group => $gid,
provider => 'git',
;
"${homedir}/.oh-my-zsh":
ensure => 'present',
source => 'https://github.com/robbyrussell/oh-my-zsh.git',
;
"${homedir}/.oh-my-zsh/custom/themes":
source => 'git@github.com:genebean/my-oh-zsh-themes.git',
;
"${homedir}/.vim/bundle/Vundle.vim":
source => 'https://github.com/VundleVim/Vundle.vim.git',
require => File[$dirs],
;
"${homedir}/repos/powerline-fonts":
source => 'https://github.com/powerline/fonts.git',
require => File[$dirs],
notify => Exec['update-fonts'],
;
}
exec {
default:
logoutput => true,
environment => "HOME=${homedir}",
refreshonly => true,
;
'yum clean all':
command => '/bin/yum clean all',
;
'set-shell-to-zsh':
path => '/bin:/usr/bin',
command => "chsh -s /usr/bin/zsh `grep '${uid}:${gid}' /etc/passwd |cut -d ':' -f1`",
cwd => $homedir,
unless => "grep '${uid}:${gid}' /etc/passwd | grep '/usr/bin/zsh'",
require => Package['zsh'],
;
'update-fonts':
command => "${homedir}/repos/powerline-fonts/install.sh",
cwd => "${homedir}/repos/powerline-fonts",
notify => Exec['set-font-ownership'],
;
'set-font-ownership':
path => '/bin:/usr/bin',
command => "chown -R ${uid}:${gid} ${homedir}/.local/share/fonts/*",
cwd => $homedir,
require => Exec['update-fonts'],
;
}
}

View file

@ -0,0 +1,101 @@
# These repos are the ones setup by
# https://download.docker.com/linux/centos/docker-ce.repo
class profile::linux::el::docker_repos {
yumrepo { 'docker-ce-edge':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/$basearch/edge',
descr => 'Docker CE Edge - $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-edge-debuginfo':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/debug-$basearch/edge',
descr => 'Docker CE Edge - Debuginfo $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-edge-source':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/source/edge',
descr => 'Docker CE Edge - Sources',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-nightly':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/$basearch/nightly',
descr => 'Docker CE Nightly - $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-nightly-debuginfo':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/debug-$basearch/nightly',
descr => 'Docker CE Nightly - Debuginfo $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-nightly-source':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/source/nightly',
descr => 'Docker CE Nightly - Sources',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-stable':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/$basearch/stable',
descr => 'Docker CE Stable - $basearch',
enabled => '1',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-stable-debuginfo':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/debug-$basearch/stable',
descr => 'Docker CE Stable - Debuginfo $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-stable-source':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/source/stable',
descr => 'Docker CE Stable - Sources',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-test':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/$basearch/test',
descr => 'Docker CE Test - $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-test-debuginfo':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/debug-$basearch/test',
descr => 'Docker CE Test - Debuginfo $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-test-source':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/source/test',
descr => 'Docker CE Test - Sources',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
}

View file

@ -0,0 +1,128 @@
# this contains the mac specific stuff
class profile::mac {
# $path = '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin'
# notify{'This is from the mac profile.':}
# exec { 'install homebrew':
# command => '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"',
# path => $path,
# creates => '/usr/local/bin/brew',
# }
$homedir = lookup('homedir')
#Package { provider => 'homebrew' }
$homebrew_packages = [
'bash-completion',
'bundler-completion',
'cmake',
'coreutils',
'csshx',
'docker-completion',
'elixir',
'erlang',
'figlet',
'git',
'git-flow',
'gnu-tar',
'hub',
'iftop',
'jq',
'kompose',
'mutt',
'ncftp',
'openssh',
'packer',
'python',
'ruby',
'sl',
'socat',
'terraform',
'tmux',
'tree',
'unrar',
'vagrant-completion',
'vim',
'watch',
'wget',
'zsh',
'zsh-completions',
]
package { $homebrew_packages:
ensure => 'installed',
provider => 'brew',
}
# $homebrew_casks = [
# '1password',
# 'adium',
# 'android-file-transfer',
# 'android-platform-tools',
# 'araxis-merge',
# 'atom',
# 'caffeine',
# 'docker',
# 'firefox',
# 'fliqlo',
# 'google-chrome',
# 'hipchat',
# 'iterm2',
# 'slack',
# 'sourcetree',
# 'visual-studio-code',
# ]
#
# package { $homebrew_casks:
# ensure => 'installed',
# provider => 'brewcask',
# }
$pip_packages = [
'psutil',
'powerline-status',
]
package { $pip_packages:
ensure => 'latest',
provider => 'pip',
require => Package['python'],
}
file { "${homedir}/repos":
ensure => 'directory',
}
vcsrepo { "${homedir}/.vim/bundle/Vundle.vim":
ensure => 'latest',
provider => 'git',
source => 'https://github.com/VundleVim/Vundle.vim.git',
}
vcsrepo { "${homedir}/repos/powerline-fonts":
ensure => 'latest',
provider => 'git',
source => 'https://github.com/powerline/fonts.git',
require => File["${homedir}/repos"],
notify => Exec['update-fonts'],
}
exec { 'update-fonts':
command => "${homedir}/repos/powerline-fonts/install.sh",
cwd => "${homedir}/repos/powerline-fonts",
logoutput => true,
environment => "HOME=${homedir}",
refreshonly => true,
}
vcsrepo { "${homedir}/.oh-my-zsh":
ensure => 'present',
provider => 'git',
source => 'https://github.com/robbyrussell/oh-my-zsh.git',
}
vcsrepo { "${homedir}/.oh-my-zsh/custom/themes":
ensure => 'latest',
provider => 'git',
source => 'git@github.com:genebean/my-oh-zsh-themes.git',
}
}

View file

@ -0,0 +1,7 @@
# Includes all the profiles needed for a server.
# One big difference between this and the workstation role is that you generally
# are not standing in front of the system and / or there is no graphical
# interface.
class role::server {
include profile::base
}

View file

@ -0,0 +1,16 @@
# Includes all the profiles needed for a workstation
class role::workstation {
include profile::base
case $facts['kernel'] {
'Darwin': {
include profile::mac
}
'Linux': {
include profile::linux
}
default: {
fail("${facts['kernel']} hasn't been setup in the workstation role yet.")
}
} # end of kernel case statement
}

2
legacy/r10k.yaml Normal file
View file

@ -0,0 +1,2 @@
---
cachedir: 'vendor/r10k'