-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
c022d13
commit 8417aec
Showing
19 changed files
with
288 additions
and
34 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
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,14 @@ | ||
# THIS FILE IS MANAGED BY PUPPET | ||
[Unit] | ||
Description=hyperglass looking glass agent | ||
After=network.target | ||
|
||
[Service] | ||
User=hyperglass-agent | ||
Group=hyperglass-agent | ||
WorkingDirectory=/opt/hyperglass/hyperglass-server | ||
ExecStart=/opt/hyperglass/hyperglass-server/virtualenv/bin/python3 /opt/hyperglass/hyperglass-server/virtualenv/bin/hyperglass start | ||
PrivateTmp=true | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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 |
---|---|---|
@@ -1,6 +1,21 @@ | ||
# @summary installs the hyperglass linux agent | ||
# | ||
# @param manage_python installs python3 | ||
# @param manage_gcc installs gcc | ||
# | ||
# @see https://github.com/checktheroads/hyperglass-agent | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::agent {} | ||
class hyperglass::agent ( | ||
Boolean $manage_python = true, | ||
Boolean $manage_gcc = true, | ||
) { | ||
include hyperglass::hyperglassdir | ||
contain hyperglass::agent::install | ||
contain hyperglass::agent::config | ||
contain hyperglass::agent::service | ||
Class['hyperglass::hyperglassdir'] | ||
-> Class['hyperglass::agent::install'] | ||
-> Class['hyperglass::agent::config'] | ||
~> Class['hyperglass::agent::service'] | ||
} |
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,22 @@ | ||
# @summary configures the hyperglass looking agent | ||
# | ||
# @api private | ||
# | ||
class hyperglass::agent::config { | ||
assert_private() | ||
file { '/opt/hyperglass/hyperglass-agent/hyperglass-agent/agent_cert.pem': | ||
ensure => 'file', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
mode => '0400', | ||
source => "/etc/puppetlabs/puppet/ssl/certs/${trusted['certname']}.pem", | ||
} | ||
|
||
file { '/opt/hyperglass/hyperglass-agent/hyperglass-agent/agent_key.pem': | ||
ensure => 'file', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
mode => '0400', | ||
source => "/etc/puppetlabs/puppet/ssl/private_keys/${trusted['certname']}.pem", | ||
} | ||
} |
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,62 @@ | ||
# @summary installs the hyperglass agent on linux nodes | ||
# | ||
# @api private | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::agent::install ( | ||
Boolean $manage_python = $hyperglass::agent::manage_python, | ||
Boolean $manage_gcc = $hyperglass::agent::manage_gcc, | ||
) { | ||
assert_private() | ||
|
||
if $manage_python { | ||
include hyperglass::python | ||
Class['hyperglass::python'] | ||
-> Class['hyperglass::agent::install'] | ||
} | ||
if $manage_gcc { | ||
include hyperglass::gcc | ||
Class['hyperglass::gcc'] | ||
-> Class['hyperglass::agent::install'] | ||
} | ||
user { 'hyperglass-agent': | ||
ensure => 'present', | ||
managehome => true, | ||
purge_ssh_keys => true, | ||
system => true, | ||
home => '/opt/hyperglass/hyperglass-agent', | ||
} | ||
group { 'hyperglass-agent': | ||
ensure => 'present', | ||
system => true, | ||
} | ||
|
||
file { '/opt/hyperglass/hyperglass-agent': | ||
ensure => 'directory', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
} | ||
|
||
# we need to explicitly set the version here. During the first puppet run, python3 will be installed but isn't present yet | ||
# due to that the fact is undef and fails. the default of the `version` attribute is the fact. We workaround this by hardcoding | ||
# the python version | ||
python::pyvenv { '/opt/hyperglass/hyperglass-agent/virtualenv': | ||
ensure => 'present', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
systempkgs => false, | ||
version => pick($facts['python3_version'], '3.6'), | ||
} | ||
|
||
python::pip { 'hyperglass-agent': | ||
virtualenv => '/opt/hyperglass/hyperglass-agent/virtualenv', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
} | ||
|
||
file { '/opt/hyperglass/hyperglass-agent/hyperglass-agent': | ||
ensure => 'directory', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
} | ||
} |
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,13 @@ | ||
# @summary manages the hyperglass agent service + unit file | ||
# | ||
# @api private | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::agent::service { | ||
assert_private() | ||
systemd::unit_file { 'hyperglass-agent.service': | ||
source => "puppet:///modules/${module_name}/hyperglass-agent.service", | ||
enable => true, | ||
active => true, | ||
} | ||
} |
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,10 @@ | ||
# @summary module to workaround the broken puppetlabs/gcc class. Installs just gcc | ||
# | ||
# @api private | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::gcc { | ||
package { 'gcc': | ||
ensure => 'installed', | ||
} | ||
} |
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,14 @@ | ||
# @summary private class to create the main dir for hyperglass server and agent | ||
# | ||
# @api private | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::hyperglassdir { | ||
assert_private() | ||
|
||
file { '/opt/hyperglass/': | ||
ensure => 'directory', | ||
owner => 'root', | ||
group => 'root', | ||
} | ||
} |
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,13 @@ | ||
# @summary private class used by server/agent to install python3 | ||
# | ||
# @api private | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::python { | ||
assert_private() | ||
|
||
class { 'python': | ||
version => '3', | ||
dev => 'present', | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# @summary installs the hyperglass looking glass | ||
# | ||
# @param manage_depended_services if true, installs all other services that hyperglass requires, like redis, yarn, nginx, python | ||
# @param manage_python installs python3 | ||
# @param manage_gcc installs gcc | ||
# @param devices hash containing all the devices hyperglass can connect to. Defaults to demo data so the service starts properly. | ||
# @param commands specific commands that can be used by the devices | ||
# @param data generic hyperglass configuration hash. | ||
|
@@ -10,6 +12,8 @@ | |
# @author Tim Meusel <[email protected]> | ||
class hyperglass::server ( | ||
Boolean $manage_depended_services = true, | ||
Boolean $manage_python = true, | ||
Boolean $manage_gcc = true, | ||
Hash $data = {}, | ||
Hash $commands = {}, | ||
Hash $devices = { | ||
|
@@ -51,11 +55,13 @@ | |
-> Class['hyperglass::server::install'] | ||
} | ||
|
||
include hyperglass::hyperglassdir | ||
contain hyperglass::server::install | ||
contain hyperglass::server::config | ||
contain hyperglass::server::service | ||
|
||
Class['hyperglass::server::install'] | ||
Class['hyperglass::hyperglassdir'] | ||
-> Class['hyperglass::server::install'] | ||
-> Class['hyperglass::server::config'] | ||
~> Class['hyperglass::server::service'] | ||
} |
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 |
---|---|---|
|
@@ -3,13 +3,22 @@ | |
# @api private | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::server::dependencies { | ||
class hyperglass::server::dependencies ( | ||
Boolean $manage_python = $hyperglass::server::manage_python, | ||
Boolean $manage_gcc = $hyperglass::server::manage_gcc, | ||
) { | ||
assert_private() | ||
|
||
package { ['python3-pip', 'python3-devel', 'gcc']: | ||
ensure => 'installed', | ||
if $manage_python { | ||
include hyperglass::python | ||
Class['hyperglass::python'] | ||
-> Class['hyperglass::server::dependencies'] | ||
} | ||
if $manage_gcc { | ||
include hyperglass::gcc | ||
Class['hyperglass::gcc'] | ||
-> Class['hyperglass::server::dependencies'] | ||
} | ||
|
||
class { 'redis::globals': | ||
scl => 'rh-redis5', | ||
} | ||
|
Oops, something went wrong.