Generate configuration drives manually

Generate configuration drives manuallyΒΆ

You may need to manually generate the configuration drives for an automated MCP deployment after you customize their content to meet specific requirements of your deployment. This section describes how to generate the configuration drives using the create-config-drive script.

To generate a configuration drive for the cfg01 VM:

  1. Download the create-config-drive script for generating the configuration drive:

    export MCP_VERSION="master"
    wget -O /root/create-config-drive.sh \
    https://raw.githubusercontent.com/Mirantis/mcp-common-scripts/${MCP_VERSION}/config-drive/create_config_drive.sh
    chmod +x /root/create-config-drive.sh
    
  2. Download the Salt Master configuration script:

    wget -O /root/user_data.yaml \
    https://raw.githubusercontent.com/Mirantis/mcp-common-scripts/${MCP_VERSION}/config-drive/master_config.yaml
    
  3. In user_data.yaml, modify the lines that start with export to fit your environment. If you use local (aptly) repositories, select the following parameters to point to your local repositories address on port 8088:

    • MCP_VERSION

    • PIPELINES_FROM_ISO=false

    • PIPELINE_REPO_URL

    • MCP_SALT_REPO_KEY

    • MCP_SALT_REPO_URL


  4. For debugging purposes, configure custom access to the cfg01 node in user_data.yaml using the following parameters:

    • name - user name.

    • sudo, NOPASSWD - the sudo permissions for a user. The value ALL grants administrator privileges to a user.

    • groups - a user group. For example, admin. Add a comma-separated list of groups if necessary.

    • lock_passwd - deny or allow logging in using a password. Possible values are true (deny) or false (allow). Select false.

    • passwd - a password hash, not the password itself. To generate a password and its hash, run mkpasswd --method=SHA-512 --rounds=4096. Remember the generated password for further access to the virsh console.


    Configuration example:

    users:
      - name: barfoo
        sudo: ALL=(ALL) NOPASSWD:ALL
        groups: admin
        lock_passwd: false
        passwd: <generated_password_hash>
    
  5. Select from the following options:

    • If you do not use local repositories:

      1. Clone the mk-pipelines and pipeline-library Git repositories:

        git clone --mirror https://github.com/Mirantis/mk-pipelines.git /root/mk-pipelines
        git clone --mirror https://github.com/Mirantis/pipeline-library.git /root/pipeline-library
        
      2. Put your Reclass model that contains the classes/cluster, classes/system, nodes, .git, and .gitmodules directories in /root/model.

      3. Install genisoimage:

        apt install genisoimage
        
      4. Run the configuration drive generator script:

        /root/create-config-drive.sh -u /root/user_data.yaml -h cfg01 \
        --model /root/model --mk-pipelines /root/mk-pipelines \
        --pipeline-library /root/pipeline-library cfg01-config.iso
        

      The generated configuration drive becomes available as the cfg01-config.iso file.

    • If you use local repositories:

      1. Install genisoimage:

        apt install genisoimage
        
      2. Put your Reclass model that contains the classes/cluster, classes/system, nodes, .git, and .gitmodules directories in /root/model.

        mkdir /root/model
        cp -r /root/mcpdoc/{classes, .git, .gitmodules, nodes } /root/model
        tree /root/model -aL 2
        
      3. Run the configuration drive generator script:

        /root/create-config-drive.sh -u /root/user_data.yaml -h cfg01 \
        --model /root/model cfg01-config.iso
        

      The generated configuration drive becomes available as the cfg01-config.iso file.

To generate a configuration drive for the APT VM:

  1. Download the create-config-drive script for generating the configuration drive:

    export MCP_VERSION="master"
    wget -O /root/create-config-drive.sh \
    https://raw.githubusercontent.com/Mirantis/mcp-common-scripts/${MCP_VERSION}/config-drive/create_config_drive.sh
    chmod +x /root/create-config-drive.sh
    
  2. Download the mirror configuration script:

    wget -O /root/user_data.yaml \
    https://raw.githubusercontent.com/Mirantis/mcp-common-scripts/${MCP_VERSION}/config-drive/mirror_config.yaml
    
  3. In user_data.yaml, modify the lines that start with export to fit your environment.

  4. Run the configuration drive generator script:

    /root/create-config-drive.sh -u /root/user_data.yaml -h apt01 apt-config.iso
    

The generated configuration drive should now be available as the apt-config.iso file.

To generate a simple configuration drive for any cloud-image:

  1. Install the cloud-image-utils tool:

    apt-get install -y cloud-image-utils
    
  2. For example, create a configuration file with the config-drive-params.yaml name.

  3. In this file, enable the password access for root and Ubuntu users. For example:

    #cloud-config
    debug: True
    ssh_pwauth: True
    disable_root: false
    chpasswd:
      list: |
        root:r00tme
        ubuntu:r00tme
      expire: False
    
    runcmd:
      - sed -i 's/PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
      - sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config
      - service sshd restart
    
  4. Create the configuration drive:

    cloud-localds  --hostname testvm --dsmode local mynewconfigdrive.iso  config-drive-params.yaml
    

Now, you can use mynewconfigdrive.iso with any cloud-image. For example, with the MCP VCP images or any other image that has cloud-init pre-installed.