|
| 1 | +--- |
| 2 | +title: Automation Basics |
| 3 | +parent: |
| 4 | +- tutorials |
| 5 | +- ci-automation |
| 6 | +sidebar: series |
| 7 | +tags: |
| 8 | +- open-source |
| 9 | +- terraform |
| 10 | +- iac |
| 11 | +- devops |
| 12 | +- get-started |
| 13 | +categories: |
| 14 | +- iac |
| 15 | +- opensource |
| 16 | +thumbnail: assets/ci-automation.png |
| 17 | +date: 2023-02-01 08:13 |
| 18 | +description: Heard about Infrastructure as Code (IaC) but not sure what it's about |
| 19 | + or why you should care? Tinkered with with OCI CLI but never really peeled back the layers? Well you're in the right place! |
| 20 | +toc: true |
| 21 | +author: eli-schilling |
| 22 | +redirect_from: "/collections/tutorials/1-automation-basics/" |
| 23 | +mrm: |
| 24 | +xredirect: https://developer.oracle.com/tutorials/ci-automation/1-automation-basics/ |
| 25 | +slug: 1-automation-basics |
| 26 | +--- |
| 27 | +{% imgx aligncenter assets/ci-automation.png 400 400 "Automating Container Instances" "Container Instances Automation Tutorial Series" %} |
| 28 | + |
| 29 | +What is the importance of automating infrastructure deployment and management? One key tenet of automation is to create consistent, repeatable capabilities that minimize / mitigate the potential for error. Whether you are just experimenting or working towards the implementation of error-free deployment activities, automation can help to realize those goals. |
| 30 | + |
| 31 | +While there are a myriad of choices when it comes to managing cloud infrastructure, it is best to select a tool that **a)** you're comfortable with, and **b)** can streamline your management tasks while reducing ongoing level of effort. |
| 32 | + |
| 33 | +In this tutorial we will focus on automating common tasks for OCI Container Instances, while discussing pros and cons of some alternate options. |
| 34 | + |
| 35 | +For additional information, see: |
| 36 | + |
| 37 | +* [Signing Up for Oracle Cloud Infrastructure](https://docs.oracle.com/iaas/Content/GSG/Tasks/signingup.htm) |
| 38 | +* [About the User Interfaces of the Oracle Integration Oracle Cloud Infrastructure (OCI) Console](https://docs.oracle.com/en/cloud/paas/integration-cloud/integration-cloud-auton/user-interfaces-oracle-integration-cloud-1.html) |
| 39 | +* [Working with the Command Line Interface (CLI)](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cliconcepts.htm) |
| 40 | +* [Terraform 101 series](https://developer.oracle.com/tutorials/tf-101) |
| 41 | + |
| 42 | +## Before you begin |
| 43 | + |
| 44 | +This tutorial assumes you already have some Terraform and/or OCI CLI experience. While not necessarily required, it would be beneficial that you check out the related tutorials first. Or just dive right in here, and use the other tutorials as a reference. |
| 45 | + |
| 46 | +* [Terraform 101 series](https://developer.oracle.com/tutorials/tf-101) |
| 47 | +* [OCI CLI Playground](https://apexapps.oracle.com/pls/apex/r/dbpm/livelabs/view-workshop?wid=650&clear=RR,180) |
| 48 | + |
| 49 | +### CLIs |
| 50 | + |
| 51 | +CLIs are a little bit better than GUIs for helping you manage critical issues. Instead of pointing-and-clicking, commands are directly issued into the application. When you get down to it, CLIs are really just a text user interface. Most CLIs allow for running "headless", meaning they don't require continuous user input (all input can be provided at runtime). One benefit is that it's easier to use CLIs with automated workflows, so it's definitely a step in the right direction. By themselves though, it's impossible to embed any sort of logic when using CLIs, unless there's some sort of scripting (shell scripts, Ruby, Python, etc.) involved. This means that it's great to send a single command (or even a series of commands), but it can be difficult to maintain a high level of assurance without more involved scripting logic being used with the CLI. |
| 52 | + |
| 53 | +### IaC tools |
| 54 | + |
| 55 | +When you really need to tailor your environment and maximize control over how it performs, IaC tools are what you need. IaC tools are designed from the ground-up to manage infrastructure resources using code. Resources are defined within the code, with the tool itself providing the necessary structure and logic to quickly and easily build a definition of what you need or want an environment to be. The basic "scaffolding" (logic elements, API interactions, etc.) are all abstracted, allowing you to focus on describing the resources you need or want to exist in the environment. |
| 56 | + |
| 57 | +By far, this is one of the easiest and fastest ways to build and maintain cloud environments. But this isn't just limited to the cloud, on-premesis resources can often be managed with IaC tools as well. Are you using multiple cloud providers? Even more reason to utilize IaC in managing your IT infrastructure. |
| 58 | + |
| 59 | +With IaC, it's common to use Git on the back-end. Git allows you to get a deep history of changes and its robust version control system enables easy and rapid rollbacks. Additionally, if you use Git for storing the code definitions, you're able to use standard processes and tools to monitor/approve/manage changes before they're made. Whether using policy-as-code (such as [Open Policy Agent](https://www.openpolicyagent.org), with implementations such as [Policy-as-Code on OCI using Open Policy Agent](https://github.com/oracle-devrel/oci-pac-opa)) or a manual pull request (PR)/merge request (MR) review process, you can have a really solid review/approval/compliance mechanism (not to mention yet another audit trail that's separate from the cloud/platform itself). |
| 60 | + |
| 61 | +#### Infrastructure management |
| 62 | + |
| 63 | +One of the most common and popular IaC tools is [HashiCorp Terraform](https://www.terraform.io). Other tools, such as [Pulumi](https://www.pulumi.com), are also available, but the common goal of each is the programmatic management of infrastructure. |
| 64 | + |
| 65 | +#### Configuration management |
| 66 | + |
| 67 | +Sometimes infrastructure isn't your major concern and what you really need are tools that predominantly operate in the realm of configuration management, such as [Ansible](https://www.ansible.com) or [Chef](https://www.chef.io)/[Cinc](https://cinc.sh). These are all options for managing infrastructure as well, but you may be better off with tools that focus exclusively on *infrastructure management*. For OCI's part, it's certainly no exception in supporting many of these different platforms. |
| 68 | + |
| 69 | +## IaC and Terraform |
| 70 | + |
| 71 | +In the rest of this series, we're going to target using Terraform to manage OCI infrastructure. Why Terraform? It's fairly mature at this point, widely adopted, and has support for a wide variety of cloud platforms, including OCI. Additionally, there are plenty of resources available and Terraform enjoys strong user support, making it an ideal tool. Terraform is mainly targeted at managing infrastructure and not so much the configuration management side of things. But it's super powerful when combined with a traditional configuration management tool like Ansible. |
| 72 | + |
| 73 | +## What's Next |
| 74 | + |
| 75 | +By now, you should be a little more familiar with IaC and ready to get started with Terraform! |
| 76 | + |
| 77 | +Until your next lesson, happy coding! Take a look at the [next lesson](2-experiencing-terraform) in the Terraform 101 series and go through a very quick experience in using Terraform. From there, you'll dive into several aspects of how Terraform works. |
| 78 | + |
| 79 | +To explore more information about development with Oracle products: |
| 80 | + |
| 81 | +* [Oracle Developers Portal](https://developer.oracle.com/) |
| 82 | +* [Oracle Cloud Infrastructure](https://www.oracle.com/cloud/) |
0 commit comments