mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 09:27:44 -04:00
Added support for Linux Mint
This commit is contained in:
parent
e23ea50d4b
commit
b0ec3a08ba
23 changed files with 337 additions and 87 deletions
19
puppet/production/site/custom_facts/lib/facter/os_release.rb
Normal file
19
puppet/production/site/custom_facts/lib/facter/os_release.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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|
|
||||
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
|
||||
|
|
@ -1,13 +1,5 @@
|
|||
# the base profile should include component modules that will be on all nodes
|
||||
class profile::base {
|
||||
$pip_packages = [
|
||||
'psutil',
|
||||
'powerline-status',
|
||||
]
|
||||
|
||||
package { $pip_packages:
|
||||
ensure => 'latest',
|
||||
provider => 'pip',
|
||||
require => Package['python'],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
20
puppet/production/site/profile/manifests/linux.pp
Normal file
20
puppet/production/site/profile/manifests/linux.pp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Select a profile based on the OS family
|
||||
class profile::linux {
|
||||
case $facts['os']['family'] {
|
||||
'Debian': { include ::profile::linux::debian }
|
||||
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',
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
135
puppet/production/site/profile/manifests/linux/debian.pp
Normal file
135
puppet/production/site/profile/manifests/linux/debian.pp
Normal 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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +71,18 @@ class profile::mac {
|
|||
provider => 'brewcask',
|
||||
}
|
||||
|
||||
$pip_packages = [
|
||||
'psutil',
|
||||
'powerline-status',
|
||||
]
|
||||
|
||||
package { $pip_packages:
|
||||
ensure => 'latest',
|
||||
provider => 'pip',
|
||||
require => Package['python'],
|
||||
}
|
||||
|
||||
|
||||
file { "${homedir}/repos":
|
||||
ensure => 'directory',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ class role::workstation {
|
|||
'Darwin': {
|
||||
include ::profile::mac
|
||||
}
|
||||
'Linux': {
|
||||
include ::profile::linux
|
||||
}
|
||||
default: {
|
||||
fail("${facts['kernel']} hasn't been setup in the workstation role yet.")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue