DSpeichert / cloudvcl

Cloud VCL - let your students use virtual environments for class/assignments
https://dspeichert.github.io/cloudvcl/
3 stars 1 forks source link

cloud-init functionalities #31

Closed Nuyb closed 7 years ago

Nuyb commented 7 years ago

Objectives:

Do NOT edit this comment. Post new comments in this issue.

Linux

Functionality Success/Fail Priority Level Justification Use Cases
Install Packages Success High Programs or software that may be critical to the class are dependent on the successful installation of certain packages. 1. A lab assignment can be challenging students to view current packages installed on a given instance.
Users and Groups Success High User management is critical in maintaining a secure system. 1. Can create a lab that asks students to learn how to carry out different user management tasks such as viewing a list of existing users and groups (or changing permissions) in Ubuntu.
User Scripts Success High There can be a lot of customization done and content created with this functionality because of its versatility. 1. Can create labs that ask students to write or understand simple/complex commands using a Bash script and check to see if the commands ran successfully or not in the instance.
Timezone Success Medium Not a very extensive or important functionality. 1. Asking students to change the timezone via Bash script could be used as a simple question in a lab assignment.
Hostname Success Medium Not a very extensive or important functionality. 1. Tasking students to edit the default hostname before launching an Ubuntu instance via Bash script can be a simple question on a lab assignment.
Write Files Success Low Not very necessary. 1. Could be used as a lab assignment question like asking students to create a file and see if it was successful or not.
Final Message Success Low It's not necessary and other functionalities are not dependent on it. 1. Could be a utility tool such as measuring the uptime like in the example script below. 2. An instructor could add some kind of welcome message/instruction that the students can see when their instance first launches successfully.

Scripts

Install Packages Script:

#cloud-config

packages: 
- pwgen 
- pastebinit 

Users and Groups Script:

#cloud-config

# Add groups to the system
# The following example adds the ubuntu group with members foo and bar and
# the group cloud-users.
groups:
  - cloud-users

# Add users to the system. Users are added after groups are added.
users:
  - default
  - name: test
    primary-group: cloud-users
    passwd: passwordtest

User Scripts:

#!/bin/sh

sudo touch ../var/log/test.txt

Write Files Script:

#cloud-config

write_files:
  - path: /test.txt
    content: |
      Here is a line.
      Another line is here.

Final Message Script:

#cloud-config

final_message: "The system is finally up, after $UPTIME seconds"

Timezone Script:

#cloud-config

timezone: US/Eastern

Hostname Script:

#cloud-config

hostname: VCL

Windows

Functionality Success/Fail Priority Level Justification Use Cases
PowerShell Script Success High Windows lab assignments will most likely involve testing various PowerShell scripts since the other functionalities found in Cloudbase-init are not as extensive and explorable. 1. Can create labs that ask students to write or understand simple/complex commands using a PowerShell script and check to see if the commands ran successfully or not in the Windows instance.
Timezone Fail Low Not a very extensive or important functionality. 1. Asking students to change the timezone via PowerShell script could be used as a simple question in a lab assignment.
Hostname Fail Low Not a very extensive or important functionality. 1. Similar to the Timezone functionality, tasking students to edit the default hostname before launching a Windows instance via PowerShell script can be a simple question on a lab assignment.

Scripts

PowerShell Script:

#ps1_sysnative 

New-Item c:\VCL\Test -type directory

Timezone Script:

#cloud-config

set_timezone: Asia/Tbilisi

Hostname Script:

#cloud-config

set_hostname: newhostname
DSpeichert commented 7 years ago

https://yaml-online-parser.appspot.com/

DSpeichert commented 7 years ago

Those scripts you copied and pasted demonstrate examples of things you can put it. The data you put didn't work because it doesn't make sense. Nobody said that the examples would work right now. They are examples.

You have to read and understand documentation.

Nuyb commented 7 years ago

Tested hostname and timezone functionalities in Windows instances but they both failed. Tried digging through the Cloudbase-init log files but couldn't find anything useful. The script that I inputted appears in the log files but there's no indication as to why they failed. I tried Googling both of these issues but couldn't find anything helpful.

DSpeichert commented 7 years ago

Test powershell script.

Nuyb commented 7 years ago

@DSpeichert tested it and it works

DSpeichert commented 7 years ago

Try

#cloud-config
timezone: Eastern Standard Time

on Windows.

Nobody said timezone names are the same on Windows and Linux.

https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx

Nuyb commented 7 years ago

didn't work either

DSpeichert commented 7 years ago

Keep trying, or google a working example.

syavatkar commented 7 years ago

Cent OS

Functionality Success/Fail Priority Level Justification Use Cases
Yum Repo Success Low Package managment tool meant to be used CentOs to install RedHat package manager 1. Can be Used on CentOS to install packages

Yum Repo Script:

#cloud-config
`#cloud-config
yum_repos:
    # The name of the repository
    epel-testing:
        # Any repository configuration options
        # See: man yum.conf
        #
        # This one is required!
        baseurl: http://download.fedoraproject.org/pub/epel/testing/5/$basearch
        enabled: false
        failovermethod: priority
        gpgcheck: true
        gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
        name: Extra Packages for Enterprise Linux 5 - Testing`

Windows

#cloud-config
set_timezone: America/New_York

Cent OS

Functionality Success/Fail Priority Level Justification Use Cases
CA-Cert Failed Medium Allows users to add trusted certificates 1. Can be used for adding organization certificates for possible assignments

ca-cert Script

#cloud-config
ca-certs:
  # If present and set to True, the 'remove-defaults' parameter will remove
  # all the default trusted CA certificates that are normally shipped with
  # Ubuntu.
  # This is mainly for paranoid admins - most users will not need this
  # functionality.
  remove-defaults: true

  # If present, the 'trusted' parameter should contain a certificate (or list
  # of certificates) to add to the system as trusted CA certificates.
  # Pay close attention to the YAML multiline list syntax.  The example shown
  # here is for a list of multiline certificates.
  trusted: 
  - |
   -----BEGIN CERTIFICATE-----
     MIICCTCCAXKgAwIBAgIBATANBgkqhkiG9w0BAQUFADANMQswCQYDVQQDDAJjYTAe
     Fw0xMDAyMTUxNzI5MjFaFw0xNTAyMTQxNzI5MjFaMA0xCzAJBgNVBAMMAmNhMIGf
     MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCu7Q40sm47/E1Pf+r8AYb/V/FWGPgc
     b014OmNoX7dgCxTDvps/h8Vw555PdAFsW5+QhsGr31IJNI3kSYprFQcYf7A8tNWu
     1MASW2CfaEiOEi9F1R3R4Qlz4ix+iNoHiUDTjazw/tZwEdxaQXQVLwgTGRwVa+aA
     qbutJKi93MILLwIDAQABo3kwdzA4BglghkgBhvhCAQ0EKxYpUHVwcGV0IFJ1Ynkv
     T3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwDwYDVR0TAQH/BAUwAwEB/zAd
     BgNVHQ4EFgQUu4+jHB+GYE5Vxo+ol1OAhevspjAwCwYDVR0PBAQDAgEGMA0GCSqG
     SIb3DQEBBQUAA4GBAH/rxlUIjwNb3n7TXJcDJ6MMHUlwjr03BDJXKb34Ulndkpaf
     +GAlzPXWa7bO908M9I8RnPfvtKnteLbvgTK+h+zX1XCty+S2EQWk29i2AdoqOTxb
     hppiGMp0tT5Havu4aceCXiy2crVcudj3NFciy8X66SoECemW9UYDCb9T5D0d
   -----END CERTIFICATE-----
  - |
DSpeichert commented 7 years ago

Things to implement

Linux

Windows

Nuyb commented 7 years ago

Questions for @DSpeichert:

  1. Can you clarify the relationship details and development process between timezone/hostname & the existing VM definition model?
  2. Can you re-explain the development process for creating new models/form for the functionalities that require one?
  3. We recall that you mentioned to take a look at the relationship that exists between the Course and Assignment Model
  4. Once a user selects an options for the form, what form are we generating (YAML) and where is it sent to?
  5. Take for example the "packages to install" script. From our understanding we are creating a form for this model. Besides providing an option for what packages the user wants to install, what other options are we providing on the script?
DSpeichert commented 7 years ago

@Nuyb Come up with a proposal that works and open a PR with it. Then I'll tell you if that's viable.

syavatkar commented 7 years ago

@DSpeichert In terms of a proposal, do you want to specify model data and form entries for each script or actually code it first for your review.

DSpeichert commented 7 years ago

Just do it. Show me code.

DSpeichert commented 7 years ago

Completed according to new (slightly changed) requirements. We're dropping the support for defining extra users/groups.

Related work and other functionality previously unplanned in: