Skip to content

Commit d4b10a8

Browse files
authored
Merge pull request #15 from cobaltcore-dev/hostname
Configure controller host entry via nixos option
2 parents f19affe + 780f14a commit d4b10a8

4 files changed

Lines changed: 40 additions & 15 deletions

File tree

modules/compute/compute.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{ ... }:
33
{
44
imports = [
5+
../generic/controller-host-entry.nix
56
(import ./neutron.nix { inherit neutron; })
67
(import ./nova.nix { inherit nova; })
78
];

modules/controller/openstack-controller.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ in
2525
{
2626
imports = [
2727
./generic.nix
28+
../generic/controller-host-entry.nix
2829
(import ./keystone.nix { inherit keystone; })
2930
(import ./glance.nix { inherit glance; })
3031
(import ./placement.nix { inherit placement; })
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{ lib, config, ... }:
2+
with lib;
3+
{
4+
options.openstack = {
5+
controllerIP = mkOption {
6+
type = types.str;
7+
description = ''
8+
IP address of the controller. Will be used to make a /etc/hosts entry
9+
to make the controller available via "controller".
10+
'';
11+
};
12+
};
13+
14+
config = {
15+
networking.extraHosts = ''
16+
${config.openstack.controllerIP} controller controller.local
17+
'';
18+
};
19+
}

modules/testing/default.nix

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,30 @@ let
1313
common =
1414
{ pkgs, lib, ... }:
1515
{
16-
system.stateVersion = lib.trivial.release;
16+
imports = [
17+
../generic/controller-host-entry.nix
18+
];
1719

18-
services.getty.autologinUser = "root";
20+
config = {
21+
system.stateVersion = lib.trivial.release;
1922

20-
networking.extraHosts = ''
21-
10.0.0.11 controller controller.local
22-
'';
23+
services.getty.autologinUser = "root";
2324

24-
networking = {
25-
useDHCP = false;
26-
networkmanager.enable = false;
27-
useNetworkd = true;
28-
firewall.enable = false;
29-
};
25+
openstack.controllerIP = "10.0.0.11";
3026

31-
environment.systemPackages = [
32-
pkgs.openstackclient
33-
];
27+
networking = {
28+
useDHCP = false;
29+
networkmanager.enable = false;
30+
useNetworkd = true;
31+
firewall.enable = false;
32+
};
3433

35-
environment.variables = adminEnv;
34+
environment.systemPackages = [
35+
pkgs.openstackclient
36+
];
37+
38+
environment.variables = adminEnv;
39+
};
3640
};
3741
in
3842
{

0 commit comments

Comments
 (0)