ssh sending of the config
This commit is contained in:
parent
be2534386a
commit
1c863a8495
2 changed files with 42 additions and 16 deletions
|
@ -104,6 +104,10 @@ let module_inst = {
|
||||||
"me0"
|
"me0"
|
||||||
];
|
];
|
||||||
in (import <nixpkgs/lib>).evalModules {
|
in (import <nixpkgs/lib>).evalModules {
|
||||||
modules = [ module module_inst ];
|
specialArgs.pkgs = import <nixpkgs> {};
|
||||||
|
modules = [
|
||||||
|
module
|
||||||
|
module_inst
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
interfaces:
|
interfaces:
|
||||||
{ lib, config, ... }:
|
{ lib, pkgs, config, ... }:
|
||||||
let cfg = config;
|
let cfg = config;
|
||||||
in with lib; {
|
in with lib; {
|
||||||
options = {
|
options = {
|
||||||
|
@ -41,6 +41,7 @@ in with lib; {
|
||||||
in types.listOf vlan_type;
|
in types.listOf vlan_type;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
|
# TODO: use this option
|
||||||
dhcp_trusted = mkOption {
|
dhcp_trusted = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -147,18 +148,39 @@ in with lib; {
|
||||||
</interface>
|
</interface>
|
||||||
''
|
''
|
||||||
else "";
|
else "";
|
||||||
in [ ''
|
config = ''
|
||||||
<interfaces operation="replace">
|
<interfaces operation="replace">
|
||||||
${builtins.concatStringsSep "\n" interface_xmls}
|
${builtins.concatStringsSep "\n" interface_xmls}
|
||||||
${irb_intf}
|
${irb_intf}
|
||||||
</interfaces>
|
</interfaces>
|
||||||
<protocols>
|
<protocols>
|
||||||
<rstp operation="replace">
|
<rstp operation="replace">
|
||||||
${builtins.concatStringsSep "\n" rstps}
|
${builtins.concatStringsSep "\n" rstps}
|
||||||
</rstp>
|
</rstp>
|
||||||
</protocols>
|
</protocols>
|
||||||
<vlans operation="replace">
|
<vlans operation="replace">
|
||||||
${builtins.concatStringsSep "\n" vlans}
|
${builtins.concatStringsSep "\n" vlans}
|
||||||
</vlans>'' vlan_trust_table
|
</vlans>
|
||||||
];
|
'';
|
||||||
|
rpc_requests = pkgs.writeText "config_rpc.xml" ''
|
||||||
|
<rpc>
|
||||||
|
<edit-config>
|
||||||
|
<config>
|
||||||
|
<configuration>
|
||||||
|
${config}
|
||||||
|
</configuration>
|
||||||
|
</config>
|
||||||
|
<target>
|
||||||
|
<candidate/>
|
||||||
|
</target>
|
||||||
|
</edit-config>
|
||||||
|
</rpc>
|
||||||
|
<rpc>
|
||||||
|
<commit/>
|
||||||
|
</rpc>
|
||||||
|
'';
|
||||||
|
in pkgs.writeShellScript "deploy.sh" ''
|
||||||
|
${pkgs.openssh}/bin/ssh jourdan01.dgn -p 830 -s netconf < ${rpc_requests}
|
||||||
|
''
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue