-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
651 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Gemfile | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'debug', '1.8.0' | ||
gem 'google-protobuf', '3.25.0' | ||
gem 'io-console', '0.6.0' | ||
gem 'irb', '1.8.3' | ||
gem 'pry' | ||
gem 'pry-doc' | ||
gem 'psych', '5.1.1.1' | ||
gem 'rake' | ||
gem 'rdoc', '6.5.0' | ||
gem 'reline', '0.3.9' | ||
gem 'sorbet-runtime', '0.5.11116' | ||
gem 'stringio', '3.0.8' | ||
gem 'tty-progressbar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
coderay (1.1.3) | ||
debug (1.8.0) | ||
irb (>= 1.5.0) | ||
reline (>= 0.3.1) | ||
google-protobuf (3.25.0) | ||
google-protobuf (3.25.0-aarch64-linux) | ||
google-protobuf (3.25.0-arm64-darwin) | ||
google-protobuf (3.25.0-x86-linux) | ||
google-protobuf (3.25.0-x86_64-darwin) | ||
google-protobuf (3.25.0-x86_64-linux) | ||
io-console (0.6.0) | ||
irb (1.8.3) | ||
rdoc | ||
reline (>= 0.3.8) | ||
method_source (1.0.0) | ||
pry (0.14.2) | ||
coderay (~> 1.1) | ||
method_source (~> 1.0) | ||
pry-doc (1.4.0) | ||
pry (~> 0.11) | ||
yard (~> 0.9.11) | ||
psych (5.1.1.1) | ||
stringio | ||
rake (13.1.0) | ||
rdoc (6.5.0) | ||
psych (>= 4.0.0) | ||
reline (0.3.9) | ||
io-console (~> 0.5) | ||
sorbet-runtime (0.5.11116) | ||
stringio (3.0.8) | ||
strings-ansi (0.2.0) | ||
tty-cursor (0.7.1) | ||
tty-progressbar (0.18.2) | ||
strings-ansi (~> 0.2) | ||
tty-cursor (~> 0.7) | ||
tty-screen (~> 0.8) | ||
unicode-display_width (>= 1.6, < 3.0) | ||
tty-screen (0.8.2) | ||
unicode-display_width (2.5.0) | ||
yard (0.9.34) | ||
|
||
PLATFORMS | ||
aarch64-linux | ||
arm64-darwin | ||
ruby | ||
x86-linux | ||
x86_64-darwin | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
debug (= 1.8.0) | ||
google-protobuf (= 3.25.0) | ||
io-console (= 0.6.0) | ||
irb (= 1.8.3) | ||
pry | ||
pry-doc | ||
psych (= 5.1.1.1) | ||
rake | ||
rdoc (= 6.5.0) | ||
reline (= 0.3.9) | ||
sorbet-runtime (= 0.5.11116) | ||
stringio (= 3.0.8) | ||
tty-progressbar | ||
|
||
BUNDLED WITH | ||
2.5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require 'cli/ui' | ||
require 'yaml' | ||
require 'json' | ||
require 'csv' | ||
require 'open4' | ||
require "tty-prompt" | ||
|
||
|
||
if ENV['ANSIBLE_HOME'] | ||
ANSIBLE_HOME = ENV['ANSIBLE_HOME'] | ||
else | ||
ANSIBLE_HOME = File.expand_path('..', __dir__) | ||
end | ||
|
||
VARS = File.join(ANSIBLE_HOME, 'vars') | ||
PLAYBOOKS = File.join(ANSIBLE_HOME, 'playbooks') | ||
GROUP_VARS = File.join(ANSIBLE_HOME, 'group_vars') | ||
HOST_VARS = File.join(ANSIBLE_HOME, 'host_vars') | ||
ROLES = File.join(ANSIBLE_HOME, 'roles') | ||
INVENTORY = File.join(ANSIBLE_HOME, 'inventory.ini') | ||
|
||
|
||
|
||
class Ansible | ||
|
||
attr_accessor :inventory, :playbooks, :group_vars, :host_vars, :tags | ||
|
||
def initialize(location) | ||
@playbooks = Dir.children(PLAYBOOKS) | ||
@group_vars = File.join(location, 'group_vars') | ||
@host_vars = File.join(location, 'host_vars') | ||
end | ||
|
||
def tags(playbook) | ||
@tags = `ansible-playbook -i #{INVENTORY} #{playbook} --list-tags | awk -F 'TASK TAGS:' '{print $2}'`.chomp.strip.gsub(/\[|\]|,/,'') | ||
end | ||
|
||
|
||
end | ||
|
||
# select playbook | ||
|
||
|
||
syncopated = Ansible.new(ANSIBLE_HOME) | ||
|
||
p syncopated.playbooks | ||
|
||
playbook = `gum filter #{Dir.children(PLAYBOOKS).join(' ')}`.chomp.strip | ||
p playbook | ||
|
||
tags = syncopated.tags(File.join(PLAYBOOKS, playbook)) | ||
p tags | ||
|
||
t = `gum filter #{tags} --no-limit`.chomp.split("\n") | ||
|
||
p t | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
CLI::UI::StdoutRouter.enable | ||
|
||
|
||
|
||
CLI::UI::Frame.open('{{*}} {{bold:a}}', color: :green) do | ||
puts "hey fucker, select a playbook" | ||
puts "full playbook selected, retriveing tags" | ||
CLI::UI::Frame.open('{{i}} b', color: :magenta) do | ||
puts "select tags to run..." | ||
CLI::UI::Frame.open('{{?}} c', color: :cyan) do | ||
|
||
@distro = CLI::UI.ask('Select Distro', options: %w(AlmaLinux Archlinux)) | ||
|
||
end | ||
|
||
end | ||
|
||
CLI::UI::Frame.divider('{{v}} lol') | ||
|
||
puts "#{@distro}" | ||
|
||
packages = YAML.load_file(File.join(VARS, "#{@distro}", "packages.yml")) | ||
|
||
prompt = TTY::Prompt.new | ||
|
||
choice = prompt.multi_select("Select packages", packages["packages"]).flatten | ||
|
||
t = `gum filter #{choice.join(' ')} --no-limit`.chomp.split("\n") | ||
|
||
p t | ||
|
||
end | ||
|
||
|
||
def test(arg) | ||
puts "hey fucker" | ||
end | ||
|
||
CLI::UI::Frame.open('{{i}} b', color: :magenta) do | ||
|
||
CLI::UI::Prompt.ask('What language/framework do you use?') do |handler| | ||
handler.option('rails') { |selection| test(selection) } | ||
handler.option('go') { |selection| selection } | ||
handler.option('ruby') { |selection| selection } | ||
handler.option('python') { |selection| selection } | ||
end | ||
|
||
end | ||
|
||
CLI::UI::Progress.progress do |bar| | ||
100.times do | ||
bar.tick | ||
end | ||
end | ||
|
||
CLI::UI::SpinGroup.new do |spin_group| | ||
spin_group.add('Title') { |spinner| `ansible-playbook -C -i /home/b08x/Workspace/syncopatedIaC/inventory.ini /home/b08x/Workspace/syncopatedIaC/playbooks/full.yml --limit lapbot --tags desktop` } | ||
spin_group.add('Title 2') { |spinner| sleep 3.0; spinner.update_title('New Title'); sleep 3.0 } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
# Supported filters are: | ||
# | ||
# search | ||
# project name substring to look for | ||
# maintainer | ||
# return projects maintainer by specified person | ||
# category | ||
# return projects with specified category | ||
# inrepo | ||
# return projects present in specified repository | ||
# notinrepo | ||
# return projects absent in specified repository | ||
# repos | ||
# return projects present in specified number of repositories (exact values and open/closed ranges are allowed, e.g. 1, 5-, -5, 2-7 | ||
# families | ||
# return projects present in specified number of repository families (for instance, use 1 to get unique projects) | ||
# repos_newest | ||
# return projects which are up to date in specified number of repositories | ||
# families_newest | ||
# return projects which are up to date in specified number of repository families | ||
# newest | ||
# return newest projects only | ||
# outdated | ||
# return outdated projects only | ||
# problematic | ||
# return problematic projects only | ||
|
||
# Example: get unique outdated projects not present in FreeBSD maintainer by [email protected] | ||
# | ||
# /api/v1/projects/?notinrepo=freebsd&[email protected]&families=1&outdated=1 | ||
|
||
curl -s "https://repology.org/api/v1/projects/?inrepo=arcg&search=ambix"|jq | ||
|
||
curl -s "https://repology.org/api/v1/project/ambix" | jq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env ruby | ||
require 'cli/ui' | ||
require 'yaml' | ||
require 'json' | ||
require 'csv' | ||
require 'open4' | ||
require "tty-prompt" | ||
|
||
INVENTORY = '$ANSIBLE_HOME/hosts' | ||
PLAYBOOK = '$ANSIBLE_HOME/soundbot.yml' | ||
|
||
# module Ansible | ||
# module_function | ||
# | ||
# def playbook(*args) | ||
# Soundbot::Command.tty("ansible-playbook -i #{INVENTORY} #{PLAYBOOK} #{args.join(' ')}") | ||
# end | ||
# | ||
# def tags | ||
# | ||
# tags = playbook("--list-tags") | ||
# | ||
# return tags | ||
# | ||
# end | ||
# | ||
# def tasks | ||
# | ||
# tasks = playbook("--list-tasks") | ||
# | ||
# return tasks | ||
# end | ||
# | ||
# def start_at_task(task) | ||
# playbook("--start-at-task=#{task}") | ||
# end | ||
# | ||
# end | ||
|
||
#!/usr/bin/env ruby | ||
# send osc messages to sonic-pi for every line printed when running a playbook | ||
# https://stackoverflow.com/a/43208709/10073106 | ||
|
||
require 'open3' | ||
require 'tty-progressbar' | ||
bar = TTY::ProgressBar.new("importing [:bar] :elapsed :percent", total: 225 ) | ||
|
||
|
||
Dir.chdir(File.join(ENV["HOME"], "Workspace", "syncopatedIaC")) do | ||
Open3.popen3 "ansible-playbook -C -i inventory.ini playbooks/full.yml --limit lapbot" do |stdin, stdout, stderr, thread| | ||
while line = stdout.gets | ||
# puts line | ||
# `oscsend localhost 4560 /test/thing s "#{line}"` if line.include?("TASK") | ||
bar.log("#{line.gsub(/\*/,'')}") | ||
bar.advance if line.include?("TASK") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.