diff --git a/SnowBear/blueprints/inventory/equipment/__pycache__/main.cpython-39.pyc b/SnowBear/blueprints/inventory/equipment/__pycache__/main.cpython-39.pyc index 564edda..97a6049 100644 Binary files a/SnowBear/blueprints/inventory/equipment/__pycache__/main.cpython-39.pyc and b/SnowBear/blueprints/inventory/equipment/__pycache__/main.cpython-39.pyc differ diff --git a/SnowBear/blueprints/inventory/groups/__pycache__/main.cpython-39.pyc b/SnowBear/blueprints/inventory/groups/__pycache__/main.cpython-39.pyc index 83050b8..d36de1e 100644 Binary files a/SnowBear/blueprints/inventory/groups/__pycache__/main.cpython-39.pyc and b/SnowBear/blueprints/inventory/groups/__pycache__/main.cpython-39.pyc differ diff --git a/SnowBear/blueprints/inventory/network/__pycache__/main.cpython-39.pyc b/SnowBear/blueprints/inventory/network/__pycache__/main.cpython-39.pyc new file mode 100644 index 0000000..b1efaa1 Binary files /dev/null and b/SnowBear/blueprints/inventory/network/__pycache__/main.cpython-39.pyc differ diff --git a/SnowBear/blueprints/inventory/network/main.py b/SnowBear/blueprints/inventory/network/main.py index f35bcce..83b9fae 100644 --- a/SnowBear/blueprints/inventory/network/main.py +++ b/SnowBear/blueprints/inventory/network/main.py @@ -1,9 +1,11 @@ import os import re +from time import time import yaml from flask import Blueprint, render_template, request from functions.bbui import load_yaml,dump_yaml + network = Blueprint('network', __name__, template_folder='templates') page_navigation_data = load_yaml('blueprints.yml') @@ -11,29 +13,116 @@ @network.route("/inventory/network/index.html", methods = ['GET', 'POST']) def inventory_network_index(): + return render_template("page.html.j2", \ + page_content_path="network/index.html.j2", \ + page_title="Inventory - network", \ + page_navigation_data=page_navigation_data, \ + page_left_menu="network/menu.html.j2", left_menu_active="networks", \ + ) + +@network.route("/inventory/network/networks.html", methods = ['GET', 'POST']) +def inventory_network_networks(): + absolute_path=load_yaml("general_settings.yml")["general_settings"]["root_path"] + if (os.path.isfile(absolute_path+"/group_vars/all/general_settings/network.yml") == True): + print(absolute_path+"/group_vars/all/general_settings/network.yml") + network_list=load_yaml(absolute_path+"/group_vars/all/general_settings/network.yml")["networks"] + else: + open((absolute_path+"/group_vars/all/general_settings/network.yml"), 'a').close() + dump_yaml(absolute_path+"/group_vars/all/general_settings/network.yml",{'domain_name': 'tumulus.local', 'networks': {'ice1-1': {'subnet': '10.10.0.0', 'prefix': 16, 'netmask': '255.255.0.0', 'broadcast': '10.10.255.255', 'dhcp_unknown_range': '10.10.254.1 10.10.254.254', 'gateway': '10.10.2.1', 'is_in_dhcp': True, 'is_in_dns': True, 'services_ip': {'pxe_ip': '10.10.0.1', 'dns_ip': '10.10.0.1', 'repository_ip': '10.10.0.1', 'authentication_ip': '10.10.0.1', 'time_ip': '10.10.0.1', 'log_ip': '10.10.0.1'}}}}) + network_list=load_yaml(absolute_path+"/group_vars/all/general_settings/network.yml")["networks"] + return render_template("page.html.j2", \ + page_content_path="network/networks.html.j2", \ + page_title="Inventory - networks", \ + page_navigation_data=page_navigation_data, \ + page_left_menu="network/menu.html.j2", left_menu_active="networks", \ + network_list=network_list, \ + ) + +@network.route("/inventory/network/network_add.html", methods = ['GET', 'POST']) +def inventory_network_network_add(): + if request.method== "POST": + try: + print("sucess") + network_identifier=request.form.get("network_identifier") + + subnet=(request.form.get("subnet")) + prefix=(request.form.get("prefix")) + netmask=(request.form.get("netmask")) + broadcast=(request.form.get("broadcast")) + dhcp_unknown_range=(request.form.get("dhcp_unknow_range")) + gateway=(request.form.get("gateway")) + is_in_dhcp=(request.form.get("is_in_dhcp")) + is_in_dns=(request.form.get("is_in_dns")) - # Gather list of existing equipment groups - equipment_groups_data = {} - for folder in os.listdir("etcbluebanquiseinventory/group_vars/"): - if re.match('^equipment_.*', folder): - yaml_buffer = load_yaml('etcbluebanquiseinventory/group_vars/' + folder + '/data.yml') - equipment_groups_data[folder] = yaml_buffer + pxe_ip=(request.form.get("pxe_ip")) + dns_ip=(request.form.get("dns_ip")) + repository_ip=(request.form.get("repository_ip")) + authentication_ip=(request.form.get("authentication_ip")) + time_ip=(request.form.get("time_ip")) + log_ip=(request.form.get("log_ip")) + + absolute_path=load_yaml("general_settings.yml")["general_settings"]["root_path"] + yaml_buffer = load_yaml(absolute_path+"/group_vars/all/general_settings/network.yml") + yaml_buffer['networks'][network_identifier] = {'subnet': subnet, 'prefix': prefix, 'netmask': netmask, 'broadcast': broadcast, 'dhcp_unknown_range': dhcp_unknown_range, 'gateway': gateway, 'is_in_dhcp': is_in_dhcp, 'is_in_dns': is_in_dns, 'services_ip': {'pxe_ip': pxe_ip, 'dns_ip': dns_ip, 'repository_ip': repository_ip, 'authentication_ip': authentication_ip, 'time_ip': time_ip, 'log_ip': log_ip}} + + dump_yaml(absolute_path+"/group_vars/all/general_settings/network.yml",yaml_buffer) + return render_template("page.html.j2", \ + page_content_path="network/network_add.html.j2", \ + page_title="Inventory - network list", \ + page_navigation_data=page_navigation_data, \ + page_left_menu="network/menu.html.j2", left_menu_active="networks", \ + is_success="true", \ + ) + except: + return render_template("page.html.j2", \ + page_content_path="network/network_add.html.j2", \ + page_title="Inventory - network list", \ + page_navigation_data=page_navigation_data, \ + page_left_menu="network/menu.html.j2", left_menu_active="networks", \ + is_success="false", \ + ) + + + absolute_path=load_yaml("general_settings.yml")["general_settings"]["root_path"] + network_list=load_yaml(absolute_path+"/group_vars/all/general_settings/network.yml") return render_template("page.html.j2", \ - page_content_path="equipment/index.html.j2", \ - page_title="Inventory - equipment", \ + page_content_path="network/network_add.html.j2", \ + page_title="Inventory - network list", \ page_navigation_data=page_navigation_data, \ - page_left_menu="equipment/menu.html.j2", left_menu_active="index", \ - equipment_groups_data=equipment_groups_data) + page_left_menu="network/menu.html.j2", left_menu_active="networks", \ + ) -@network.route("/inventory/equipment/add.html") -def inventory_equipment_add(): +@network.route("/inventory/network/network_delete.html", methods = ['GET', 'POST']) +def inventory_network_delete(): + absolute_path=load_yaml("general_settings.yml")["general_settings"]["root_path"] + if request.method== "POST": + try: + network=request.form.get("network") + + network_list=load_yaml(absolute_path+"/group_vars/all/general_settings/network.yml")["networks"] + yaml_buffer = load_yaml(absolute_path+"/group_vars/all/general_settings/network.yml") + x = yaml_buffer['networks'].pop(network) + dump_yaml(absolute_path+"/group_vars/all/general_settings/network.yml",yaml_buffer) + + except: + print("error") - equipment_variables = load_yaml('blueprints/inventory/equipment/equipment_variables.yml') + network_list=load_yaml(absolute_path+"/group_vars/all/general_settings/network.yml")["networks"] + + return render_template("page.html.j2", \ + page_content_path="network/network_delete.html.j2", \ + page_title="Inventory - network delete", \ + page_navigation_data=page_navigation_data, \ + page_left_menu="network/menu.html.j2", left_menu_active="networks", \ + network_list=network_list, \ + ) +@network.route("/inventory/network/network_modify.html", methods = ['GET', 'POST']) +def inventory_network_modify(): return render_template("page.html.j2", \ - page_content_path="equipment/add.html.j2", \ - page_title="Inventory - equipment - Add", \ + page_content_path="network/network_modify.html.j2", \ + page_title="Inventory - network modify", \ page_navigation_data=page_navigation_data, \ - page_left_menu="equipment/menu.html.j2", left_menu_active="add", \ - equipment_variables=equipment_variables ) \ No newline at end of file + page_left_menu="network/menu.html.j2", left_menu_active="networks", \ + ) \ No newline at end of file diff --git a/SnowBear/blueprints/inventory/network/templates/network/index.html.j2 b/SnowBear/blueprints/inventory/network/templates/network/index.html.j2 index 033a7b1..bf18d63 100644 --- a/SnowBear/blueprints/inventory/network/templates/network/index.html.j2 +++ b/SnowBear/blueprints/inventory/network/templates/network/index.html.j2 @@ -3,27 +3,26 @@ Manage cluster networks
+
+    ___   _      ___   _      ___   _      ___   _      ___   _
+ [(_)] |=|    [(_)] |=|    [(_)] |=|    [(_)] |=|    [(_)] |=|
+  '-`  |_|     '-`  |_|     '-`  |_|     '-`  |_|     '-`  |_|
+ /mmm/  /     /mmm/  /     /mmm/  /     /mmm/  /     /mmm/  /
+       |____________|____________|____________|____________|
+                             |            |            |
+                         ___  \_      ___  \_      ___  \_
+                        [(_)] |=|    [(_)] |=|    [(_)] |=|
+                         '-`  |_|     '-`  |_|     '-`  |_|
+                        /mmm/        /mmm/        /mmm/
 
-
-  Add equipment profile
-
-
-  Remove equipment profile
-
-
-
-
-{% if (equipment_groups_data | length) == 0 %} -
- No equipment profiles detected.
-
-{% endif %} -{% for mg in equipment_groups_data %} - -
-

{{ mg }}

-
{{ equipment_groups_data[mg]['description'] }}
-
-
-
-{% endfor %} +
+ + +
+

+In this section, you will find everything network-related. +

+

+This includes networks, nics, etc... +

+
\ No newline at end of file diff --git a/SnowBear/blueprints/inventory/network/templates/network/menu.html.j2 b/SnowBear/blueprints/inventory/network/templates/network/menu.html.j2 new file mode 100644 index 0000000..60ea8cd --- /dev/null +++ b/SnowBear/blueprints/inventory/network/templates/network/menu.html.j2 @@ -0,0 +1,16 @@ + + + diff --git a/SnowBear/blueprints/inventory/network/templates/network/network_add.html.j2 b/SnowBear/blueprints/inventory/network/templates/network/network_add.html.j2 new file mode 100644 index 0000000..84a9e39 --- /dev/null +++ b/SnowBear/blueprints/inventory/network/templates/network/network_add.html.j2 @@ -0,0 +1,388 @@ + + + + + +

Networks management

+

+ Manage networks
+

+ + + + + + + + + + + +
+ +
+ + + +{% if is_success == "true" %} +
+
+

+ Success +

+
+
+{% endif %} + +{% if is_success == "false" %} +
+
+

+ An error occured +

+
+
+{% endif %} + + + + +
+ +
+
+ +
+
+
+
+ +
+

+ This field is required +

+
+
+
+ + + + + +
+ +
+ + +
    + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is required +

    +
    +
    +
    +
  • + + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is required +

    +
    +
    +
    +
  • + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is required +

    +
    +
    +
    +
  • + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is required +

    +
    +
    +
    +
  • + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is required +

    +
    +
    +
    +
  • + +
  • +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
  • + + + +
  • +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
  • +
+ + + + + +
+
+
+ +
+ + +
    +
  • +
    +
    + +
    +
    +
    +
    + + +

    + This field is optional +

    +
    +
    +
    +
  • + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is optional +

    +
    +
    +
    +
  • + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is optional +

    +
    +
    +
    +
  • + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is optional +

    +
    +
    +
    +
  • + + + + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is optional +

    +
    +
    +
    +
  • + +
  • +
    +
    + +
    +
    +
    +
    + +
    +

    + This field is optional +

    +
    +
    +
    +
  • + + +
+ +
+
+ +
+
+ +
+
+ + +
+ diff --git a/SnowBear/blueprints/inventory/network/templates/network/network_delete.html.j2 b/SnowBear/blueprints/inventory/network/templates/network/network_delete.html.j2 new file mode 100644 index 0000000..9be9fd8 --- /dev/null +++ b/SnowBear/blueprints/inventory/network/templates/network/network_delete.html.j2 @@ -0,0 +1,65 @@ +

Network Management

+

+ Network delete
+

+ + + + + + + + + +
+ +
+ + + + +
+ +
diff --git a/SnowBear/blueprints/inventory/network/templates/network/network_modify.html.j2 b/SnowBear/blueprints/inventory/network/templates/network/network_modify.html.j2 new file mode 100644 index 0000000..e20f41a --- /dev/null +++ b/SnowBear/blueprints/inventory/network/templates/network/network_modify.html.j2 @@ -0,0 +1,42 @@ +

Network Management

+

+ Network modify
+

+ + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/SnowBear/blueprints/inventory/network/templates/network/networks.html.j2 b/SnowBear/blueprints/inventory/network/templates/network/networks.html.j2 new file mode 100644 index 0000000..679afd7 --- /dev/null +++ b/SnowBear/blueprints/inventory/network/templates/network/networks.html.j2 @@ -0,0 +1,78 @@ + + +

Networks management

+

+ Manage networks
+

+ + + + + +
+ +
+ +{% for net in network_list %} + + +{% endfor %} + + + diff --git a/SnowBear/functions/__pycache__/bbui.cpython-39.pyc b/SnowBear/functions/__pycache__/bbui.cpython-39.pyc index 5348d6d..01feaa5 100644 Binary files a/SnowBear/functions/__pycache__/bbui.cpython-39.pyc and b/SnowBear/functions/__pycache__/bbui.cpython-39.pyc differ diff --git a/SnowBear/functions/bbui.py b/SnowBear/functions/bbui.py index cd59b02..cd68400 100644 --- a/SnowBear/functions/bbui.py +++ b/SnowBear/functions/bbui.py @@ -37,4 +37,44 @@ def load_page_navigation_data(page_navigation_data): for service in page_navigation_data: if service['sub_navigation']: page_navigation_data[0]['sub_navigation_elements'] = load_yaml(service['path'].replace('.','/').replace('main','navigation.yml')) - return page_navigation_data \ No newline at end of file + return page_navigation_data + +def update_yaml(yamlFile,yamlPath,data): + """This function inserts yaml data into a file + + Args: + yamlFile ([string]): path to the file to write to + yamlPath ([String]): list of the path to get to the attribute + data ([string]): data that you want to insert into the path in the file. + + for example, if your file looks like this : + general_settings: + root_path: + + then insertFile("file.yml",['general_settings','root_path'],test) + will result in your file looking like this: + general_settings: + root_path: test + + """ + if(len(yamlPath)==2): + stream=open(yamlFile,'r') + fileData=yaml.safe_load(stream) + fileData[yamlPath[0]][yamlPath[1]]=data + with open(yamlFile, 'w', encoding='utf8') as outfile: + outfile.write(yaml.dump(fileData,default_flow_style=False)) + elif(len(yamlPath)==3): + stream=open(yamlFile,'r') + fileData=yaml.safe_load(stream) + fileData[yamlPath[0]][yamlPath[1]][yamlPath[2]]=data + with open(yamlFile, 'w', encoding='utf8') as outfile: + outfile.write(yaml.dump(fileData,default_flow_style=False)) + elif(len(yamlPath)==4): + stream=open(yamlFile,'r') + fileData=yaml.safe_load(stream) + fileData[yamlPath[0]][yamlPath[1]][yamlPath[2]][yamlPath[3]]=data + with open(yamlFile, 'w', encoding='utf8') as outfile: + outfile.write(yaml.dump(fileData,default_flow_style=False)) + else: + print("Path superior to 4 is not supported") + \ No newline at end of file diff --git a/SnowBear/general_settings.yml b/SnowBear/general_settings.yml new file mode 100644 index 0000000..6959fe8 --- /dev/null +++ b/SnowBear/general_settings.yml @@ -0,0 +1,2 @@ +general_settings: + root_path: simple_cluster/inventory diff --git a/SnowBear/simple_cluster/README b/SnowBear/simple_cluster/README new file mode 100644 index 0000000..06e71c4 --- /dev/null +++ b/SnowBear/simple_cluster/README @@ -0,0 +1,11 @@ +This examples is composed of: + +* 1 management node. Network: 10.10.0.1 as main interface, 10.10.100.1 as bmc +* 1 login node. Network: 10.10.2.1, 10.10.102.1 +* 4 computes nodes. Network: 10.10.3.[1-4], 10.10.103.[1-4] + +Each node is also connected to an interconnect, on 10.20.0.0 subnet. + +All of them are link with a single ethernet management network, and with an interconnect. + +Management node exports /opt/software and /home to the others nodes through NFS. diff --git a/SnowBear/simple_cluster/inventory/cluster/groups/rack1 b/SnowBear/simple_cluster/inventory/cluster/groups/rack1 new file mode 100644 index 0000000..2ac2a9f --- /dev/null +++ b/SnowBear/simple_cluster/inventory/cluster/groups/rack1 @@ -0,0 +1,7 @@ +[rack_1] +management1 +c[001:004] +login1 + +[rack_1:vars] +rack_number=1 diff --git a/SnowBear/simple_cluster/inventory/cluster/nodes/computes.yml b/SnowBear/simple_cluster/inventory/cluster/nodes/computes.yml new file mode 100644 index 0000000..6330ad5 --- /dev/null +++ b/SnowBear/simple_cluster/inventory/cluster/nodes/computes.yml @@ -0,0 +1,60 @@ +mg_computes: + children: + equipment_typeC: + hosts: + c001: + bmc: + name: bc001 + ip4: 10.10.103.1 + mac: 08:00:27:dc:44:91 + network: ice1-1 + network_interfaces: + - interface: enp0s9 + ip4: 10.10.3.1 + mac: 08:00:27:0d:44:90 + network: ice1-1 + - interface: ib0 + ip4: 10.20.3.1 + network: interconnect-1 + c002: + bmc: + name: bc002 + ip4: 10.10.103.2 + mac: 08:00:27:dc:54:91 + network: ice1-1 + network_interfaces: + - interface: enp0s9 + ip4: 10.10.3.2 + mac: 08:00:27:0d:54:90 + network: ice1-1 + - interface: ib0 + ip4: 10.20.3.2 + network: interconnect-1 + c003: + bmc: + name: bc003 + ip4: 10.10.103.3 + mac: 08:00:27:dc:64:91 + network: ice1-1 + network_interfaces: + - interface: enp0s9 + ip4: 10.10.3.3 + mac: 08:00:27:0d:64:90 + network: ice1-1 + - interface: ib0 + ip4: 10.20.3.3 + network: interconnect-1 + c004: + bmc: + name: bc004 + ip4: 10.10.103.4 + mac: 08:00:27:dc:74:91 + network: ice1-1 + network_interfaces: + - interface: enp0s9 + ip4: 10.10.3.4 + mac: 08:00:27:0d:74:91 + network: ice1-1 + - interface: ib0 + ip4: 10.20.3.4 + network: interconnect-1 diff --git a/SnowBear/simple_cluster/inventory/cluster/nodes/logins.yml b/SnowBear/simple_cluster/inventory/cluster/nodes/logins.yml new file mode 100644 index 0000000..23ffd5b --- /dev/null +++ b/SnowBear/simple_cluster/inventory/cluster/nodes/logins.yml @@ -0,0 +1,18 @@ +mg_logins: + children: + equipment_typeL: + hosts: + login1: + bmc: + name: blogin1 + ip4: 10.10.102.1 + mac: 08:00:27:dc:f8:a7 + network: ice1-1 + network_interfaces: + - interface: enp0s3 + ip4: 10.10.2.1 + mac: 08:00:27:dc:f8:a5 + network: ice1-1 + - interface: ib0 + ip4: 10.20.2.1 + network: interconnect-1 diff --git a/SnowBear/simple_cluster/inventory/cluster/nodes/managements.yml b/SnowBear/simple_cluster/inventory/cluster/nodes/managements.yml new file mode 100644 index 0000000..ec4f18e --- /dev/null +++ b/SnowBear/simple_cluster/inventory/cluster/nodes/managements.yml @@ -0,0 +1,18 @@ +mg_managements: + children: + equipment_typeM: + hosts: + management1: + bmc: + name: bmanagement1 + ip4: 10.10.100.1 + mac: 08:00:27:dc:f8:f6 + network: ice1-1 + network_interfaces: + - interface: enp0s3 + ip4: 10.10.0.1 + mac: 08:00:27:dc:f8:f5 + network: ice1-1 + - interface: ib0 + ip4: 10.20.0.1 + network: interconnect-1 diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/equipment_all/authentication.yml b/SnowBear/simple_cluster/inventory/group_vars/all/equipment_all/authentication.yml new file mode 100644 index 0000000..6d5c625 --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/equipment_all/authentication.yml @@ -0,0 +1,7 @@ +--- +# Root password to be used on deployed hosts +authentication_root_password_sha512: $6$M3crarMVoUV3rALd$ZTre2CIyss7zOb4lkLoG23As9OAkYPw2BM88Y1F43n8CCyV5XWwAYEwBOrS8bcCBIMjIPdJG.ndOfzWyAVR4j0 # This password is 'root', change it! + +# SSH public keys to be added as authorized keys on deployed/managed hosts +authentication_ssh_keys: + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDodjKUXHm1K7HkQ8rgyXDfOAW9wvWHz24+YpkNGO0wI/jS0E44F4pdfNSqUWfLfBwwyiJ/+iLQAcJZjrQ1CnECNtImpHNRuMVH6shXX99oYRDOfJ8/MV89zrAe/KDUR677/j1dHYIS1fGzOzsxey00n+2c4LqxiFvwEIOGkB6W96aIQTx+V7eTxMegYrNttlh9eSR8yr8n4+0qk29wVVvtMysEUIt1z12dtqOr7lBuXhOy9EIUz+EZpPyXFrJiNBaKFpZBJXjzzRwR0uplyH5qf3tb3vgIxgHDPKiYRIOf3Caa9XAgmE1BU+R36wvLoS2z58ELQekJeO5z7TpsxXeB root@localhost.localdomain diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/equipment_all/equipment_profile.yml b/SnowBear/simple_cluster/inventory/group_vars/all/equipment_all/equipment_profile.yml new file mode 100644 index 0000000..4a520e8 --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/equipment_all/equipment_profile.yml @@ -0,0 +1,51 @@ +--- + +# iPXE network driver +# default should be good for most of NIC, but some need SNP. Refer to http://ipxe.org/appnote/buildtargets for more information. +ep_ipxe_driver: default # default or snp or snponly +ep_ipxe_platform: pcbios # can be pcbios (for legacy/bios) or efi +ep_ipxe_embed: standard # can be standard or dhcpretry + +# When installing in EFI, grub2 break the boot order and set next boot to disk (seriously, why??!) +# In most case, you prefer system to continue to boot on PXE, and so the stack can restore first boot device after grub2 installation +ep_preserve_efi_first_boot_device: true # true or false + +ep_console: +ep_kernel_parameters: + +ep_access_control: enforcing # Selinux, AppArmor, etc. Selinux: enforcing, permissive, disabled +ep_firewall: true # Enable or disable native firewall + +ep_partitioning: | # Please provide native distribution partitioning. This example is for Centos/RedHat systems. + clearpart --all --initlabel + autopart --type=plain --fstype=ext4 --nohome + +ep_autoinstall_pre_script: # Add optional pre script in auto installer file (kickstart, preseed, autoyast) +ep_autoinstall_post_script: # Add optional post script in auto installer file (kickstart, preseed, autoyast) + +ep_operating_system: + distribution: centos # centos, redhat, debian, ubuntu, opensuse, etc. + distribution_major_version: 8 + # Optional: define a minor distribution version to force (repositories/PXE) + # distribution_version: 8.0 + # Optional: add an environment in the repositories path (eg. production, staging) (repositories/PXE) + # repositories_environment: production + +ep_equipment_type: none # If server, a pxe profile will be generated + +ep_configuration: + keyboard_layout: us # us, fr, etc. + system_language: en_US.UTF-8 # You should not update this if you want to google issues... + +ep_hardware: + cpu: + architecture: x86_64 # Can be x86_64 or arm64 + cores: 1 # Mainly for slurm, but optional. You can define here detailed information on the CPUs. + cores_per_socket: 1 + sockets: 1 + threads_per_core: 1 + gpu: + +ep_equipment_authentication: # login/password for BMC, storage bay controller, switch, etc. + user: user + password: password diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/external.yml b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/external.yml new file mode 100644 index 0000000..864605f --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/external.yml @@ -0,0 +1,19 @@ +external_time: + time_server: + pool: # List of possible time pools + - pool.ntp.org + server: # List of possible time servers + - 0.pool.ntp.org + - 1.pool.ntp.org + time_client: + pool: + server: + +external_dns: + dns_server: # set as forwarders in named.conf + dns_client: # set directly on client side in resolv.conf + - 208.67.220.220 + +# Hosts defined here will be automatically added into /etc/hosts +external_hosts: + sphenisc.com: 213.186.33.3 diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/general.yml b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/general.yml new file mode 100644 index 0000000..a2913b2 --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/general.yml @@ -0,0 +1,17 @@ +### General settings file + +cluster_name: algoric + +# Localisation +time_zone: Europe/Brussels + +# Internal mechanisms +icebergs_system: false # Activate or deactivate icebergs topology system. Experimental. + +# Services handling +enable_services: true # Enable or disable services on startup (set to false when using high availability) +start_services: true # Handle start/restart of the services (set to false when using high availability) + +# /etc/hosts +hosts_file: + range: all # can be all (all hosts) or iceberg (iceberg only) diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/internal_variables.yml b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/internal_variables.yml new file mode 100644 index 0000000..667f929 --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/internal_variables.yml @@ -0,0 +1,7 @@ +### Internal variables, used to define naming convention + +iceberg_naming: iceberg +equipment_naming: equipment +management_networks_naming: ice +master_groups_naming: mg +managements_group_name: mg_managements diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/network.yml b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/network.yml new file mode 100644 index 0000000..9bd5155 --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/network.yml @@ -0,0 +1,9 @@ +domain_name: tumulus.local +networks: + interconnect-1: + broadcast: 10.20.255.255 + is_in_dhcp: false + is_in_dns: true + netmask: 255.255.0.0 + prefix: 16 + subnet: 10.20.0.0 diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/nfs.yml b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/nfs.yml new file mode 100644 index 0000000..d46734e --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/nfs.yml @@ -0,0 +1,26 @@ +nfs_settings: + selinux: + use_nfs_home_dirs: true # Will automatically set this boolean to true if /home is mounted on client side + +nfs: + softwares: + mount: /opt/software # Which path clients should mount this NFS + export: /opt/software # What path server should export + server: management1 # The server that export this storage space + clients_groups: # Can be an equipment group, or a main group (mg), or any other ansible group + - mg_computes + - mg_logins + take_over_network: ice1-1 # Network used to share this storage space + export_arguments: ro,no_root_squash,async # Arguments for the server (export) + mount_arguments: ro,intr,nfsvers=4.2,bg # Arguments for the client (mount) + + home: + mount: /home + export: /home + server: management1 + clients_groups: + - mg_computes + - mg_logins + take_over_network: ice1-1 + export_arguments: rw,no_root_squash,sync + mount_arguments: rw,intr,rsize=32768,wsize=32768,nfsvers=4.2,bg diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/repositories.yml b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/repositories.yml new file mode 100644 index 0000000..8d32640 --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/repositories.yml @@ -0,0 +1,3 @@ +repositories: + - bluebanquise + - os diff --git a/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/security.yml b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/security.yml new file mode 100644 index 0000000..bc21e8b --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/all/general_settings/security.yml @@ -0,0 +1,4 @@ +--- +security: + ssh: + hostkey_checking: true # enable or disable hostkey checking diff --git a/SnowBear/simple_cluster/inventory/group_vars/equipment_typeC/equipment_profile.yml b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeC/equipment_profile.yml new file mode 100644 index 0000000..9b9215f --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeC/equipment_profile.yml @@ -0,0 +1,21 @@ +--- + +ep_console: console=tty0 console=ttyS1,115200n8 +ep_kernel_parameters: nomodeset + +ep_access_control: disabled +ep_firewall: false + +ep_equipment_type: server + +ep_hardware: + cpu: + architecture: x86_64 + cores: 24 + cores_per_socket: 12 + sockets: 2 + threads_per_core: 1 + +ep_equipment_authentication: + user: ADMIN + password: ADMIN diff --git a/SnowBear/simple_cluster/inventory/group_vars/equipment_typeG/equipment_profile.yml b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeG/equipment_profile.yml new file mode 100644 index 0000000..204d05c --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeG/equipment_profile.yml @@ -0,0 +1,23 @@ +--- + +ep_console: console=tty0 console=ttyS1,115200n8 +ep_kernel_parameters: nomodeset + +ep_access_control: disabled +ep_firewall: false + +ep_equipment_type: server + +ep_hardware: + cpu: + architecture: x86_64 + cores: 24 + cores_per_socket: 12 + sockets: 2 + threads_per_core: 1 + gpu: + - Hercules 3D Prophet 4000 XT + +ep_equipment_authentication: + user: ADMIN + password: ADMIN diff --git a/SnowBear/simple_cluster/inventory/group_vars/equipment_typeL/equipment_profile.yml b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeL/equipment_profile.yml new file mode 100644 index 0000000..a88194c --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeL/equipment_profile.yml @@ -0,0 +1,12 @@ +--- + +ep_console: console=tty0 console=ttyS1,115200n8 + +ep_access_control: enforcing +ep_firewall: true + +ep_equipment_type: server + +ep_equipment_authentication: + user: ADMIN + password: ADMIN diff --git a/SnowBear/simple_cluster/inventory/group_vars/equipment_typeM/equipment_profile.yml b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeM/equipment_profile.yml new file mode 100644 index 0000000..c968c8b --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeM/equipment_profile.yml @@ -0,0 +1,27 @@ +--- + +ep_console: console=tty0 console=ttyS1,115200n8 + +ep_access_control: enforcing +ep_firewall: true + +ep_partitioning: | + clearpart --all --initlabel + part /boot --fstype=ext4 --size=1024 + part / --fstype=ext4 --size=60000 + part /home --fstype=ext4 --size=4096 --grow + +ep_equipment_type: server + +ep_hardware: + cpu: + architecture: x86_64 + cores: 8 + cores_per_socket: 4 + sockets: 1 + threads_per_core: 2 + gpu: + +ep_equipment_authentication: + user: ADMIN + password: ADMIN diff --git a/SnowBear/simple_cluster/inventory/group_vars/equipment_typeS/equipment_profile.yml b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeS/equipment_profile.yml new file mode 100644 index 0000000..29062fa --- /dev/null +++ b/SnowBear/simple_cluster/inventory/group_vars/equipment_typeS/equipment_profile.yml @@ -0,0 +1,13 @@ +--- + +ep_partitioning: | + clearpart --all --initlabel + part /boot --fstype=ext4 --size=1024 + part / --fstype=ext4 --size=60000 + part /home --fstype=ext4 --size=4096 --grow + +ep_equipment_type: server + +ep_equipment_authentication: + user: ADMIN + password: ADMIN diff --git a/SnowBear/simple_cluster/playbooks/computes.yml b/SnowBear/simple_cluster/playbooks/computes.yml new file mode 100644 index 0000000..11dfa84 --- /dev/null +++ b/SnowBear/simple_cluster/playbooks/computes.yml @@ -0,0 +1,23 @@ +--- +# use '--limit c001' to restrict playbook to +# c001 if mg_computes contains multiple compute nodes +- name: computes + hosts: "mg_computes" # Will deploy on all mg_computes group nodes if no --limit + roles: + + - role: set_hostname + tags: set_hostname + - role: repositories_client + tags: repositories_client + - role: nic_nmcli + tags: nic_nmcli + - role: hosts_file + tags: hosts_file + - role: dns_client + tags: dns_client + - role: time + tags: time + vars: + time_profile: client + - role: nfs_client + tags: nfs_client diff --git a/SnowBear/simple_cluster/playbooks/logins.yml b/SnowBear/simple_cluster/playbooks/logins.yml new file mode 100644 index 0000000..e61b503 --- /dev/null +++ b/SnowBear/simple_cluster/playbooks/logins.yml @@ -0,0 +1,23 @@ +--- +# use '--limit login1' to restrict playbook to +# login1 if mg_logins contains multiple login nodes +- name: logins playbook + hosts: "mg_logins" + roles: + + - role: set_hostname + tags: set_hostname + - role: repositories_client + tags: repositories_client + - role: nic_nmcli + tags: nic_nmcli + - role: hosts_file + tags: hosts_file + - role: dns_client + tags: dns_client + - role: time + tags: time + vars: + time_profile: client + - role: nfs_client + tags: nfs_client diff --git a/SnowBear/simple_cluster/playbooks/managements.yml b/SnowBear/simple_cluster/playbooks/managements.yml new file mode 100644 index 0000000..4fc4953 --- /dev/null +++ b/SnowBear/simple_cluster/playbooks/managements.yml @@ -0,0 +1,35 @@ +--- +# use '--limit management1' to restrict playbook to +# management1 if mg_managements contains multiple management nodes +- name: managements playbook + hosts: "mg_managements" + roles: + + - role: set_hostname + tags: set_hostname + - role: nic_nmcli + tags: nic_nmcli + - role: repositories_server + tags: repositories_server + - role: repositories_client + tags: repositories_client + - role: bluebanquise + tags: bluebanquise + - role: hosts_file + tags: hosts_file + - role: ssh_client + tags: ssh_client + - role: dhcp_server + tags: dhcp_server + - role: dns_server + tags: dns_server + - role: dns_client + tags: dns_client + - role: time + tags: time + vars: + time_profile: server + - role: pxe_stack + tags: pxe_stack + - role: nfs_server + tags: nfs_server diff --git a/SnowBear/snowbear.py b/SnowBear/snowbear.py index 2f62ed8..3fedf90 100644 --- a/SnowBear/snowbear.py +++ b/SnowBear/snowbear.py @@ -22,7 +22,8 @@ import yaml import json import importlib -from functions.bbui import load_yaml,dump_yaml,load_page_navigation_data +from functions.bbui import load_yaml,dump_yaml,load_page_navigation_data,update_yaml + app = Flask(__name__) @@ -47,19 +48,22 @@ app.register_blueprint(getattr(module, navigation['name'])) print('') + @app.route("/", methods=["GET","POST"]) def index(): if request.method== "POST": full_path=request.form.get("full_path") + #check if the path exists if (path.exists(str(full_path))): + update_yaml("general_settings.yml",['general_settings','root_path'],str(full_path)) return render_template("page.html.j2", page_content_path="home/index.html.j2", page_title="Home", page_navigation_data=page_navigation_data, path_check="Given path exists and will be used") - #check if the path exists print("checked"+full_path) return render_template("page.html.j2", page_content_path="home/index.html.j2", page_title="Home", page_navigation_data=page_navigation_data, path_check="Given path does not exist") return render_template("page.html.j2", page_content_path="home/index.html.j2", page_title="Home", page_navigation_data=page_navigation_data, path_check="Please enter a path") if __name__ == '__main__': - + print("loading configuration with the following parameters:") + print(load_yaml("general_settings.yml")) print(''' _.--""""--.._ _."" ." `-._ diff --git a/SnowBear/static/js/modal.js b/SnowBear/static/js/modal.js new file mode 100644 index 0000000..0d6dd1c --- /dev/null +++ b/SnowBear/static/js/modal.js @@ -0,0 +1,87 @@ +document.addEventListener('DOMContentLoaded', () => { + + // Get all dropdowns on the page that aren't hoverable. + const dropdowns = document.querySelectorAll('.dropdown:not(.is-hoverable)'); + + if (dropdowns.length > 0) { + // For each dropdown, add event handler to open on click. + dropdowns.forEach(function(el) { + el.addEventListener('click', function(e) { + closeDropdowns(); + e.stopPropagation(); + el.classList.toggle('is-active'); + }); + }); + + // If user clicks outside dropdown, close it. + document.addEventListener('click', function(e) { + closeDropdowns(); + }); + } + + /* + * Close dropdowns by removing `is-active` class. + */ + function closeDropdowns() { + dropdowns.forEach(function(el) { + el.classList.remove('is-active'); + }); + } + + // Close dropdowns if ESC pressed + document.addEventListener('keydown', function (event) { + let e = event || window.event; + if (e.key === 'Esc' || e.key === 'Escape') { + closeDropdowns(); + } + }); + + + // Functions to open and close a modal + function openModal($el) { + $el.classList.add('is-active'); + } + + function closeModal($el) { + $el.classList.remove('is-active'); + } + + function closeAllModals() { + (document.querySelectorAll('.modal') || []).forEach(($modal) => { + closeModal($modal); + }); + } + + // Add a click event on buttons to open a specific modal + (document.querySelectorAll('.js-modal-trigger') || []).forEach(($trigger) => { + const modal = $trigger.dataset.target; + const $target = document.getElementById(modal); + console.log($target); + + $trigger.addEventListener('click', () => { + openModal($target); + }); + }); + + // Add a click event on various child elements to close the parent modal + (document.querySelectorAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button') || []).forEach(($close) => { + const $target = $close.closest('.modal'); + + $close.addEventListener('click', () => { + closeModal($target); + }); + }); + + // Add a keyboard event to close all modals + document.addEventListener('keydown', (event) => { + const e = event || window.event; + + if (e.keyCode === 27) { // Escape key + closeAllModals(); + } + }); + }); + + + +