Skip to content

Commit

Permalink
Adding one task to install debian and ubuntu (#571)
Browse files Browse the repository at this point in the history
depends on: RackHD/on-taskgraph#346
Install Debian - Ubuntu with only one task: Task.Os.Install.Debian 
osName is a new required variable with default value debian. we use this variable in following files : 

- on-tasksgraph/data/template/install-debian/debian-preseed 
- on-tasksgraph/data/template/install-debian/debian-sources 

to install ubuntu you have to create a payload file with following details : 
```
            "osName": "Ubuntu", 
            "version": "xenial",
            "baseUrl": "dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64",
            "repo": "http://172.31.128.1:8080/ubuntu",
```

current default values are : 

```
            "osName": "debian",
            "version": "stretch",
            "baseUrl": "dists/stretch/main/installer-amd64/current/images/netboot/debian-installer/amd64",
            "repo": "http://172.31.128.1:8080/debian",
```

Successfully tested with Debian Jessie, Debian stretch, ubuntu xenial on HP Proliant servers.
  • Loading branch information
Ara4Sh authored and anhou committed Dec 28, 2017
1 parent 263ad90 commit f9c2636
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"copyright": "Copyright 2016, EMC, Inc.",
"copyright": "Copyright 2017, Dell EMC, Inc.",
"definitions": {
"BaseUrl": {
"type": "string",
Expand All @@ -15,6 +15,9 @@
"$ref": "types-installos.json#/definitions/OsType",
"readonly": true
},
"osName": {
"$ref": "types-installos.json#/definitions/OsName"
},
"version": {
"$ref": "types-installos.json#/definitions/Version"
},
Expand Down Expand Up @@ -68,8 +71,14 @@
},
"progressMilestones": {
"$ref": "types-installos.json#/definitions/ProgressMilestones"
},
"timezone": {
"$ref": "types-installos.json#/definitions/Timezone"
},
"ntp": {
"$ref": "types-installos.json#/definitions/Ntp"
}
},
"required": ["osType", "version", "repo", "profile", "installScript",
"required": ["osType", "osName", "version", "repo", "profile", "installScript",
"installScriptUri", "comport", "rootPassword", "hostname", "baseUrl"]
}
14 changes: 14 additions & 0 deletions lib/task-data/schemas/types-installos.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"description": "The type of OS which is used by code internally",
"enum": [ "esx", "linux", "windows" ]
},
"OsName": {
"description": "The name of Linux OS based on LSB Distributor ID (debian, ubuntu)",
"enum": [ "debian", "ubuntu" ]
},
"UserName": {
"description": "The user account name",
"type": "string",
Expand Down Expand Up @@ -367,6 +371,16 @@
"description": "Extra (persistent) kernel boot parameters",
"minLength": 1
},
"Timezone": {
"description": "The Timezone based on $TZ (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)",
"type": "string",
"minLength": 1
},
"Ntp": {
"description": "The NTP server address",
"type": "string",
"minLength": 1
},
"PackagesArray": {
"description": "specify additional packages to install",
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
// Copyright 2015, EMC, Inc.
// Copyright 2017, Dell EMC, Inc.

'use strict';

module.exports = {
friendlyName: 'Install Ubuntu',
injectableName: 'Task.Os.Install.Ubuntu',
friendlyName: 'Install Debian/Ubuntu',
injectableName: 'Task.Os.Install.Debian',
implementsTask: 'Task.Base.Os.Install',
optionsSchema: 'install-ubuntu.json',
optionsSchema: 'install-debian.json',
options: {
osType: 'linux', //readonly options, should avoid change it
profile: 'install-ubuntu.ipxe',
installScript: 'ubuntu-preseed',
osName: 'debian', //use "ubuntu" if you want to install ubuntu.
profile: 'install-debian.ipxe',
installScript: 'debian-preseed',
installScriptUri: '{{ api.templates }}/{{ options.installScript }}?nodeId={{ task.nodeId }}', //jshint ignore: line
rackhdCallbackScript: 'ubuntu.rackhdcallback',
rackhdCallbackScript: 'debian.rackhdcallback',
hostname: 'localhost',
comport: 'ttyS0',
version: 'trusty',
repo: '{{file.server}}/ubuntu',
baseUrl: 'dists/{{ options.version }}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64',
version: 'stretch',
repo: '{{file.server}}/{{options.osName}}',
baseUrl: 'dists/{{ options.version }}/main/installer-amd64/current/images/netboot/{{options.osName}}-installer/amd64',
rootPassword: "RackHDRocks!",
interface: "auto",
installDisk: "/dev/sda",
Expand All @@ -26,7 +27,7 @@ module.exports = {

//Some milestones are injected where can add custom commands.
//Refer to below link for those injectable points:
//https://help.ubuntu.com/lts/installation-guide/armhf/apbs05.html
//https://www.debian.org/releases/stable/amd64/apbs05.html.en
progressMilestones: {
//jshint ignore: start
requestProfile: { value: 1, description: 'Enter ipxe and request OS installation profile' },
Expand All @@ -42,7 +43,7 @@ module.exports = {
properties: {
os: {
linux: {
distribution: 'ubuntu'
distribution: 'debian'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Copyright 2016, EMC, Inc.
// Copyright 2017, Dell EMC, Inc.
/* jshint node: true */

'use strict';

describe(require('path').basename(__filename), function() {
var schemaFileName = 'install-ubuntu.json';
var schemaFileName = 'install-debian.json';

var partialCanonical = {
"baseUrl": "ubuntu.baseUrl",
"baseUrl": "debian.baseUrl",
"osName": "debian"
};

var positiveSetParam = {
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/task-data/schemas/install-os-schema-ut-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var canonical = {
};

var positiveSetParam = {
version: ["trusty", "6", "6.5", "6_8", "LATEST", "0.*"],
version: ["stretch", "6", "6.5", "6_8", "LATEST", "0.*"],
installDisk: ["sda", "naa.123", "/dev/sdb", 0, 1, null],
"networkDevices[0].ipv4.vlanIds[0]": [0, 1009, 4095]
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015, EMC, Inc.
// Copyright 2017, Dell EMC, Inc.
/* jshint node:true */

'use strict';
Expand All @@ -7,11 +7,12 @@ describe(require('path').basename(__filename), function () {
var base = require('./base-tasks-spec');

base.before(function (context) {
context.taskdefinition = helper.require('/lib/task-data/tasks/install-ubuntu.js');
context.taskdefinition = helper.require('/lib/task-data/tasks/install-debian.js');
});

describe('task-data', function () {
base.examples();
});

});
});

0 comments on commit f9c2636

Please sign in to comment.