/automation-scripts

General scripts

Primary LanguageCGNU General Public License v2.0GPL-2.0

automation-scripts

General scripts

oci-automation.sh README.md generated by ChatGPT

Bash Script for Creating Virtual Machines in OCI (oci-automation.sh)

This bash script is designed to automate the creation of Virtual Machines (VMs) in Oracle Cloud Infrastructure (OCI). It prompts the user for necessary inputs such as the compartment ID, subnet ID, base image ID, VM shape, and the boot size. It also allows the user to add multiple block devices to the VMs.

Prerequisites

    Bash shell
    OCI CLI installed and configured
    A text editor to edit the script file
    Access to OCI console

Installation

Clone the repository to your local machine using the following command:

git clone https://github.com/<username>/<repository_name>.git

Navigate to the cloned directory:

cd <repository_name>

Make the script executable:

chmod +x create-vm.sh

Usage

Execute the script:

./create-vm.sh

Follow the prompts to enter the required information. The script will prompt you for the following information:

  • VM hostname list
  • Compartment ID
  • Subnet ID
  • Base Image ID (not currently working)
  • VM shape
  • Boot size
  • Block device (optional)

The script will display a list of VMs that will be created based on the entered hostname list. Verify that the list is correct before proceeding.

  • Choose the instance shape for the VMs from the list displayed in the prompt.

  • Enter the boot size for the VMs.

  • If you want to add a block device to the VMs, enter "Yes" when prompted and provide the block name and size.

  • If you want to add more block devices, enter "Yes" when prompted and provide the block name and size.

  • The script will then create the VMs based on the provided information.

gitclones-user.sh

Installation

To use this code, follow the instructions below:

  • Clone the repository or download the script file.
  • Ensure that you have the necessary dependencies installed. This script requires curl and git to be installed on your system.
  • Open a terminal or command prompt and navigate to the directory where the script is located.
  • Run the script using the following command:
./gitclones-user.sh <username>

Replace with the GitHub username for which you want to clone the repositories.

  • The script will prompt you to enter the username if it is not provided as an argument. Enter the username and press Enter.
  • The script will then retrieve a list of repositories associated with the provided username from the GitHub API and save it to a file named repos_.json.
  • It will extract the SSH URLs of the repositories from the JSON file and save them to a file named clones_.json.
  • The script will then proceed to clone each repository by iterating over the SSH URLs and using the git clone command.
  • Once the cloning process is complete, the script will perform cleanup by deleting the JSON files created during the process.
  • Finally, the script will display a "Done" message to indicate the completion of the process.

Please note that you should have appropriate permissions and access rights to clone the repositories associated with the provided username.

Contributing

Contributions to this script are welcome. Feel free to open a pull request with any suggested changes or additions. License

This script is licensed under the GPLv2 License.