This project spins up a Google Cloud Centos7 instance with Terraform and connects to a preexisting LDAP server using Ansible. This way you can have a ready to go instance without extra, automatable steps. You can view my project on GitHub here. To run it on your own machine you need to create a Google Platform account, configure it on your machine, and fill in your custom environmental variables. Then you can simply run a script and the rest is done for you!
Set up Your Google Cloud Platform
To run my project, you need to have or create a Google Cloud Platform account. You can sign up for a free tier account with a $300 credit here.
After you have set up your account, go to your Google Cloud Console here. Create a new project or select an existing one.
Once this is complete, go to your computer’s terminal.
Install Google Cloud SDK with the following command. You will then need to source your bashrc with the last command.
curl https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash | bash
To install Google Cloud SDK you first need to add a repo. Run the following command and then vim into the repo you just created to add the gpgcheck, repo_gpgcheck, and the gpgkey. From there you can simply install the package.
yum-config-manager –add-repo https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
After configuring the repo you can simply run yum install -y google-cloud-sdk and you are ready to move onto the next step!
Configure Environment and Custom Variables
To set up your environment run gcloud init. You will then have to fill in many prompts asking you to confirm credentials from Google Cloud and also pick some optional variables. The optional ones may or my not be filled based on your preference.
From this point you are ready to simply download my project from my GitHub here.
To run this script first you must add your own variables. Navigate to terraform/terraform.tfvars.orig and replace the values with your own Google Cloud Platform details. Save the file with the changes as terraform/terraform.tfvars. Then navigate to ansible/vars/ansible_vars.yml.orig, add your own LDAP connection details, and save the file as ansible/vars/ansible_var.yml.
From here you are ready to spin up your own Centos7 machines configured with a preexisting LDAP server by running ./run.sh