-
-
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.
* Add complete spec test coverage * Default values for hyperglass::server no longer contain bogus devices * Simplify the classes * Make managing users and groups optional * Make each of the service dependencies for the server optional
- Loading branch information
1 parent
a0eba90
commit a5cfb86
Showing
21 changed files
with
683 additions
and
399 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
Style/TrailingCommaInLiteral: | ||
Enabled: false | ||
inherit_gem: | ||
voxpupuli-test: rubocop.yml |
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,22 @@ | ||
--- | ||
hyperglass::server::data: | ||
listen_address: 0.0.0.0 | ||
|
||
hyperglass::server::devices: | ||
routers: | ||
- name: atl_router01 | ||
address: 10.0.0.2 | ||
network: | ||
name: secondary | ||
display_name: That Other Network | ||
credential: | ||
username: user2 | ||
password: " secret2" | ||
display_name: Atlanta, GA | ||
port: 22 | ||
nos: juniper | ||
vrfs: | ||
- name: default | ||
display_name: Global | ||
ipv4: | ||
source_address: 192.0.2.2 |
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 @@ | ||
--- {} |
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 @@ | ||
--- | ||
version: 5 | ||
defaults: | ||
datadir: data | ||
data_hash: yaml_data | ||
hierarchy: | ||
- name: "Acceptance testing with Beaker" | ||
path: "beaker/%{facts.beaker}.yaml" | ||
- name: "common" | ||
path: "common.yaml" | ||
|
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,16 +1,24 @@ | ||
# @summary installs the hyperglass linux agent | ||
# | ||
# @param manage_python installs python3 | ||
# @param manage_gcc installs gcc | ||
# @param data generic hyperglass configuration hash. | ||
# @param manage_python | ||
# installs python3 | ||
# @param manage_gcc | ||
# installs gcc | ||
# @param manage_user | ||
# When true, the user 'hyperglass-agent' is managed. | ||
# @param manage_group | ||
# When true, the group 'hyperglass-agent' is managed. | ||
# @param data | ||
# generic hyperglass configuration hash. | ||
# | ||
# @see https://github.com/checktheroads/hyperglass-agent | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
class hyperglass::agent ( | ||
Boolean $manage_python = true, | ||
Boolean $manage_gcc = true, | ||
Hash $data = { | ||
Boolean $manage_gcc = true, | ||
Boolean $manage_user = true, | ||
Boolean $manage_group = true, | ||
Hash $data = { | ||
'debug' => true, | ||
'listen_address' => '127.0.0.1', | ||
'mode' => 'bird', | ||
|
@@ -20,11 +28,85 @@ | |
}, | ||
}, | ||
) { | ||
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'] | ||
file { '/opt/hyperglass': | ||
ensure => 'directory', | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0755', | ||
} | ||
|
||
if $manage_python { | ||
ensure_resource('class', 'python', { 'version' => '3', 'dev' => 'present' }) | ||
} | ||
|
||
if $manage_gcc { | ||
ensure_resource('package', 'gcc', { 'ensure' => 'installed' }) | ||
} | ||
|
||
if $manage_user { | ||
user { 'hyperglass-agent': | ||
ensure => 'present', | ||
managehome => true, | ||
purge_ssh_keys => true, | ||
system => true, | ||
home => '/opt/hyperglass/hyperglass-agent', | ||
} | ||
} | ||
|
||
if $manage_group { | ||
group { 'hyperglass-agent': | ||
ensure => 'present', | ||
system => true, | ||
} | ||
} | ||
|
||
file { '/opt/hyperglass/hyperglass-agent': | ||
ensure => 'directory', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
mode => '0700', | ||
notify => Systemd::Unit_file['hyperglass-agent.service'], | ||
} | ||
|
||
# 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'), | ||
notify => Systemd::Unit_file['hyperglass-agent.service'], | ||
} | ||
|
||
python::pip { 'hyperglass-agent': | ||
virtualenv => '/opt/hyperglass/hyperglass-agent/virtualenv', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
notify => Systemd::Unit_file['hyperglass-agent.service'], | ||
} | ||
|
||
file { '/opt/hyperglass/hyperglass-agent/hyperglass-agent': | ||
ensure => 'directory', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
mode => '0755', | ||
notify => Systemd::Unit_file['hyperglass-agent.service'], | ||
} | ||
|
||
file { '/opt/hyperglass/hyperglass-agent/hyperglass-agent/config.yaml': | ||
ensure => 'file', | ||
owner => 'hyperglass-agent', | ||
group => 'hyperglass-agent', | ||
mode => '0400', | ||
content => to_yaml($data), | ||
notify => Systemd::Unit_file['hyperglass-agent.service'], | ||
} | ||
|
||
systemd::unit_file { 'hyperglass-agent.service': | ||
source => 'puppet:///modules/hyperglass/hyperglass-agent.service', | ||
enable => true, | ||
active => true, | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.