Giter Site home page Giter Site logo

ansible-kubectl's Introduction

ansible-kubectl

Ansible playbook for installing kubectl on Virtual machine from Ansible-Galaxy Role andrewrothstein.kubectl.

About this playbook

These playbooks are intended to be a reference and starter's guide to building Ansible Playbooks for use with IBM Cloud and Schematics. These playbooks were tested on CentOS 7.x so we recommend that you use CentOS or RHEL to test these modules.

Prerequisites:

  • SSH Key on IBM Cloud

Input variables

Input variable Required/ optional Data type Description
Bastion_IP Required String bastion floating IP address
VSI_IP Required String IBM Cloud VSI IP address
SSH_KEY Required String IBM Cloud SSH Private key used for VSI installation

Running the playbook in Schematics by using UI

  1. Open the Schematics action configuration page.
  2. Review the name for your action, and the resource group and region where you want to create the action. Then, click Create.
  3. Select the site.yml playbook.
  4. Select the Verbosity level to control the depth of information that will be shown when you run the playbook in Schematics.
  5. Expand the Advanced options.
  6. Enter all required input variables as key-value pairs. Then, click Save.
  7. Click Check action to verify your action details. The Jobs page opens automatically. You can view the results of this check by looking at the logs.
  8. Click Run action to deploy the kubectl. You can monitor the progress of this action by reviewing the logs on the Jobs page.

Running the playbook in Schematics by using the command line

  1. Create the Schematics action. Enter all the input variable values that you retrieved earlier. When you run this command and are prompted to enter a GitHub token, enter the return key to skip this prompt.
ibmcloud schematics action create --name kubectl --location us-south --resource-group default --template https://github.com/Cloud-Schematics/ansible-kubectl --playbook-name site.yml

Example output:

Enter github-token>
The given --inputs option region: is not correctly specified. Must be a variable name and value separated by an equals sign, like --inputs key=value.

ID               us-south.ACTION.kubectl.1aa11a1a
Name             kubectl
Description
Resource Group   default
user State       live

OK
  1. Verify that your Schematics action is created and note the ID that was assigned to your action.

    ibmcloud schematics action list
    
  2. Create a job to run a check for your action. Replace <action_ID> with the action ID that you retrieved. In your CLI output, note the ID that was assigned to your job.

    ibmcloud schematics job run --command-object action --command-object-id <action_ID> --command-name ansible_playbook_check
    

    Example output:

    ID                  us-south.JOB.kubectl.fedd2fab
    Command Object      action
    Command Object ID   us-south.ACTION.kubectl.1aa11a1a
    Command Name        ansible_playbook_check
    Name                JOB.kubectl.ansible_playbook_check.2
    Resource Group      a1a12aaad12b123bbd1d12ab1a123ca1
    
  3. Verify that your job ran successfully by retrieving the logs.

    ibmcloud schematics job logs --id <job_ID>
    
  4. Create another job to run the action. Replace <action_ID> with your action ID.

    ibmcloud schematics job run --command-object action --command-object-id <action_ID> --command-name ansible_playbook_run
    
  5. Verify that your job ran successfully by retrieving the logs.

    ibmcloud schematics job logs --id <job_ID>
    
    

Verification

Check the job logs for of TASK: Display Index page content. The content should give information about installation successful if everything completed successfully.

Log into your VSI Instance by ssh to VSI using bastion, below is the command

ssh -i <ssh_privatekey_path> -o ProxyCommand="ssh -i <ssh_privatekey_path> -W %h:%p root@<bastion_ip>" root@<vsi_ip>

Check whether Kubectl is installed or not.

ansible-kubectl's People

Contributors

areddy548 avatar geethasathyamurthy avatar hkantare avatar praveengostu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.