Merge pull request #205 from genebean/ansible

Ansible playbook for carbonbean
This commit is contained in:
Gene Liverman 2022-06-25 15:38:54 -04:00 committed by GitHub
commit 60ad339a5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 333 additions and 34 deletions

15
.github/workflows/ansible-lint.yml vendored Normal file
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
.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

View file

@ -1,22 +0,0 @@
language: ruby
cache: bundler
os:
- linux
# - osx
rvm:
- 2.5
- 2.6
- 2.7
before_install:
- gem update --system
- gem --version
script: 'bundle exec rake tests'
notifications:
slack:
on_success: always
secure: "HLf1vdPyg/2ezvShnwmRRtkXXap2yrMCsbU9Ow2moIhdPfDBhecXBBUsZ7/9vkIq6aTjvNb40708Q72Ndhycr1v9BE4y1KGTxcid99IhRuQEBFKkJRQpRSAqUhKq46hgUb986alQ5NoxYfMgXIC9+HzQYkoM1TXVrS3+D0cqBpkjUGl5pBG2DCa6nyAVeXzmVcs4+xeEOhkblfE5I7mXiFO0/aVcUeo+TYwSwDslPWx8OFd2PJjuceLMM8B1iBk4zY47FMdveUSA4lDQAtYMantiJvUrAGcyOUNEQZ8AsvVHuYW4HL3h3dvKXy6DM9ejwYxSFIYYtDlfCvTkY/m5HPCXvwLjABxV1JGCNkVs2vhmiCcvKSt4T4IdPxoGnMiT0UljVke5SY16hYaHkoaBtuzkRqCkRjD+nyPH5Y90c4D0uhrlob9dmUS7RkRqIZRDoaPoNS2xfrIHyEpsaXYr4rY0gBVB+ILd1DWJPIyAjRURkOVxKg1+0Tslq3B1FLAMmW/SkqYTtek680I5r+BDPFA9Eo+hxYqpWed/j68imRy6x6ZvwjS0ku+TG1G4z3P0W0wbys31/uC0PRP6YRJt1APKYxzP13rMWc21LXJoUgFtu19PbaCG2tHeb2oEdWkv3ilbbpMogjkU0+lrBP3ZLSIduuEvDDC9kpQy6Nrea5Y="

View file

@ -195,7 +195,7 @@ GEM
tty-screen (~> 0.8) tty-screen (~> 0.8)
wisper (~> 2.0) wisper (~> 2.0)
tty-screen (0.8.1) tty-screen (0.8.1)
unicode-display_width (2.1.0) unicode-display_width (2.2.0)
webrick (1.7.0) webrick (1.7.0)
wisper (2.0.1) wisper (2.0.1)
xmlrpc (0.3.2) xmlrpc (0.3.2)
@ -204,8 +204,7 @@ GEM
trollop (~> 2) trollop (~> 2)
PLATFORMS PLATFORMS
ruby x86_64-darwin-19
x86_64-darwin-16
x86_64-linux x86_64-linux
DEPENDENCIES DEPENDENCIES
@ -236,4 +235,4 @@ DEPENDENCIES
yamllint (~> 0.0.9) yamllint (~> 0.0.9)
BUNDLED WITH BUNDLED WITH
2.2.16 2.3.5

View file

@ -1,8 +1,7 @@
# dots # dots
[![Build Status](https://travis-ci.com/genebean/dots.svg?branch=master)](https://travis-ci.com/genebean/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)
[![Dependency Status](https://gemnasium.com/badges/github.com/genebean/dots.svg)](https://gemnasium.com/github.com/genebean/dots) [![Ruby](https://github.com/genebean/dots/actions/workflows/ruby.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ruby.yml)
[![security](https://hakiri.io/github/genebean/dots/master.svg)](https://hakiri.io/github/genebean/dots/master)
My dot files and a tool to deploy them, and the programs that use them, to 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 various OS's. Some additional tools that I consider part of my baseline setup

View file

@ -6,7 +6,7 @@ require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint' require 'puppet-lint/tasks/puppet-lint'
require 'tty-command' require 'tty-command'
require 'yamllint/rake_task' require 'yamllint/rake_task'
require_relative 'bin/rake_tasks.rb' require_relative 'bin/rake_tasks'
exclude_paths = [ exclude_paths = [
'pkg/**/*', 'pkg/**/*',

1
ansible/ansible_hosts Normal file
View file

@ -0,0 +1 @@
carbonbean ansible_connection=local

280
ansible/carbonbean.yaml Normal file
View file

@ -0,0 +1,280 @@
---
- name: Install packages
hosts: carbonbean
vars:
ansible_python_interpreter: '/usr/bin/python3'
tasks:
- name: Add 1Password apt signing key
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 Okta ASA client apt signing key
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
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 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
- ansible-lint
- bat
- boinc-manager
- boinctui
- bundler
- cmake
- code
- dconf-editor
- dos2unix
- exa
- gh
- git
- git-lfs
- gnupg
- htop
- httpie
- hub
- hugo
- iftop
- jq
- libssl-dev
- neofetch
- packer
- pcsc-tools
- pcscd
- pdk
- puppet-bolt
- rake
- ruby
- ruby-dev
- scdaemon
- scaleft-client-tools
- scaleft-url-handler
- snapd
- tailscale
- terraform
- tilix
- traceroute
- tree
- vagrant
- vim
- virtualbox-6.1
- vivaldi-stable
- xclip
- yubikey-manager
- zsh
- 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 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
- 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
- net.cozic.joplin_desktop
- org.fritzing.Fritzing
- org.gnome.meld
- org.onlyoffice.desktopeditors
- org.remmina.Remmina
- name: Base packages from Snapcraft
become: true
community.general.snap:
name:
- cctv-viewer # only available here
- slack # official version
- name: Snaps requiring classic mode
become: true
community.general.snap:
classic: true
name:
- gitkraken # official version
- google-cloud-cli # 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:
name:
- 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
become: true
ansible.builtin.user:
name: "{{ lookup('env', 'USER') }}"
shell: /usr/bin/zsh

View file

@ -5,7 +5,7 @@ require 'os'
require 'tty-command' require 'tty-command'
require 'tty-file' require 'tty-file'
require 'tty-prompt' require 'tty-prompt'
require_relative 'dotutils.rb' require_relative 'dotutils'
cmd = TTY::Command.new cmd = TTY::Command.new
@prompt = TTY::Prompt.new(help_color: :magenta) @prompt = TTY::Prompt.new(help_color: :magenta)

View file

@ -19,10 +19,11 @@ end
def rename_file(source, destination, action) def rename_file(source, destination, action)
puts "#{destination} exists, renaming to #{destination}.predots" puts "#{destination} exists, renaming to #{destination}.predots"
File.rename(destination, "#{destination}.predots") File.rename(destination, "#{destination}.predots")
if action.eql?('link') case action
when 'link'
puts "Linking #{destination} to #{source}" puts "Linking #{destination} to #{source}"
File.symlink(source, destination) File.symlink(source, destination)
elsif action.eql?('copy') when 'copy'
puts "Copying #{destination} to #{source}" puts "Copying #{destination} to #{source}"
FileUtils.cp_r(source, destination) FileUtils.cp_r(source, destination)
else else

View file

@ -241,7 +241,13 @@ elif [[ `uname` == 'Linux' ]]; then
PATH="$HOME/.local/bin:$PATH" PATH="$HOME/.local/bin:$PATH"
fi fi
export CLOUDSDK_PYTHON="/usr/bin/python2" if [ -d "$HOME/.local/share/gem/ruby/3.0.0/bin" ] ; then
PATH="$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH"
fi
# export CLOUDSDK_PYTHON="/usr/bin/python2"
gcloud_zsh_completions='/snap/google-cloud-cli/current/completion.zsh.inc'
if [ -f $gcloud_zsh_completions ]; then source $gcloud_zsh_completions; fi
fi fi