-
-
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
739dcf8
commit 49d269d
Showing
19 changed files
with
308 additions
and
44 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-agent 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,30 @@ | ||
# @summary installs the hyperglass linux agent | ||
# | ||
# @param manage_python installs python3 | ||
# @param manage_gcc installs gcc | ||
# @param data generic hyperglass configuration hash. | ||
# | ||
# @see https://github.com/checktheroads/hyperglass-agent | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::agent {} | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::agent ( | ||
Boolean $manage_python = true, | ||
Boolean $manage_gcc = true, | ||
Hash $data = { | ||
'debug' => true, | ||
'listen_address' => '127.0.0.1', | ||
'mode' => 'bird', | ||
'secret' => fqdn_rand_string(20), | ||
'ssl' => { | ||
'enable' => false, | ||
}, | ||
}, | ||
) { | ||
require hyperglass::hyperglassdir | ||
contain hyperglass::agent::install | ||
contain hyperglass::agent::config | ||
contain hyperglass::agent::service | ||
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,17 @@ | ||
# @summary configures the hyperglass looking agent | ||
# | ||
# @api private | ||
# | ||
class hyperglass::agent::config ( | ||
Hash $data = $hyperglass::agent::data, | ||
) { | ||
assert_private() | ||
|
||
file { '/opt/hyperglass/hyperglass-agent/hyperglass-agent/config.yaml': | ||
ensure => 'file', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
mode => '0400', | ||
content => to_yaml($data), | ||
} | ||
} |
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 @@ | ||
# @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 { | ||
require hyperglass::python | ||
} | ||
if $manage_gcc { | ||
require hyperglass::gcc | ||
} | ||
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,11 @@ | ||
# @summary module to workaround the broken puppetlabs/gcc class. Installs just gcc | ||
# | ||
# @api private | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::gcc { | ||
assert_private() | ||
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
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 |
---|---|---|
|
@@ -2,14 +2,19 @@ | |
# | ||
# @api private | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::server::dependencies { | ||
# @author Tim Meusel <[email protected]> | ||
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 { | ||
require hyperglass::python | ||
} | ||
if $manage_gcc { | ||
require hyperglass::gcc | ||
} | ||
|
||
class { 'redis::globals': | ||
scl => 'rh-redis5', | ||
} | ||
|
Oops, something went wrong.