This topic provides a catalog of sample Ansible playbooks for Oracle Cloud Infrastructure (OCI) that illustrate how to carry out common
infrastructure provisioning and configuration tasks using our Ansible collection.
These samples and solutions are organized in sections associated with OCI services. You can find a brief
description of each playbook along with links to each sample on the Oracle GitHub repository. Be sure to review the
Readme.md file that is included in each playbook's root directory
for additional instructions.
This sample playbook shows how to attach a block volume to a compute instance using the iSCSI volume attachment type, and then connect it to the compute instance using iscsiadm. The sample shows how to do the following:
Generate a temporary, host-specific SSH key pair.
Specify the public key from the key pair for connecting to the instance, and
then launch the instance.
Create a new Block Volume for the instance, attach the volume to the instance,
and specify iSCSI as the volume attachment type.
Connect to and then mount the volume from the Compute instance by executing
iscsiadm commands over SSH using an Ansible module.
This sample shows how a public compute instance can be launched using app_catalog and accessed from the internet using SSH with OCI Ansible collections.
This sample shows how to do the following:
Generate a temporary, host-specific SSH key pair.
Specify the public key from that key-pair to connect to the instance during
instance launch.
Fetch app_catalog and its versions and create a subscription for it.
Launch the instance using app_catalog and connect to it using SSH.
This sample shows how to manage your compute instances using resources such as instance configurations and instance pools that are provided using OCI Ansible collections. Instance pools help you create and provision multiple compute instances within the same region based on a single instance configuration.
This sample shows how to do the following:
Generate a temporary, host-specific SSH key pair.
Specify the public key from that key-pair to connect to the instance during
instance launch.
Create an instance configuration that defines settings for creating a compute instance as part of the instance pool. The configuration provides details such as base image, shape, and metadata.
Use the instance pool to launch compute instances based on the instance configuration.
Connect to one of the compute instances using SSH.
Set up the VCN, the NAT gateway, the internet gateway, the public and private
subnets, and the necessary security lists and route rules.
Provision a bastion instance in the public subnet and a private instance in the
private subnet.
Once set up, the private instance will have outbound Internet access through the NAT
gateway, and will be accessible using SSH from the bastion instance.
This sample shows how you can use OCI Ansible collections to enable internet access from compute instances in a private subnet using a NAT instance in a public subnet as discussed here and in the whitepaper here.
Note
An NAT gateway is available as a reliable and highly available solution in the OCI
Networking service. Please refer to the sample for more details.
This sample shows how to do the following:
Set up the topology described in the whitepaper by creating the VCN, the
internet gateway, the public and private subnets, and the necessary security
lists and route rules. A NAT instance is provisioned in the public subnet and a
private instance is provisioned in the private subnet.
After the setup, the private instance has outbound internet access through the
NAT instance in the public subnet.
Set up a user, group, and the policies required for managing buckets.
Create and upload the required API keys to the user.
Set up the VCN, the NAT gateway, the internet gateway, the public and private
subnets, as well as the required security lists and route tables. A bastion
instance is provisioned in the public subnet, and a private instance is
provisioned in the private subnet.
Provision a compute instance in the private subnet,
Install the OCI command line
interface (CLI) and configure the CLI using the cloud init script.
Disable the NAT gateway to restrict public access to the private instance.
Create a bucket from the private instance using the OCI CLI, then verify that the bucket
is created.
Following this setup, the private instance has private access to Object Storage.
This sample shows how you can use the OCI
Ansible collection to create an Always Free
Autonomous Database with Autonomous Database for Transaction Processing and Mixed Workloads and manage its
lifecycle. See Use Autonomous Database for Free for more
information.
This sample shows how to do the following:
Set up an Autonomous Database with Autonomous Database for Transaction Processing and Mixed Workloads.
List all of the Autonomous Database for Transaction Processing and Mixed Workloads instances available in a compartment, filtered by display name.
This sample shows how you can use the OCI
Ansible collection to create an Autonomous Database
with Autonomous Database for Transaction Processing and Mixed Workloads and manage
its lifecycle. Refer to the Autonomous Database for Transaction Processing and Mixed
Workloads for more information.
This sample shows how to do the following:
Set up an Autonomous Database with Autonomous Database for Transaction Processing and Mixed Workloads.
List all of the Autonomous Database for Transaction Processing and Mixed Workloads instances available in a compartment, filtered by display name.
This sample shows how you can use the OCI
Ansible collection to export one file system using two different export paths on two
different mount targets. It also demonstrates how a single mount target can export
paths from two different file systems.
This sample shows how to do the following:
Generate all network related dependencies (e.g. VCN, subnets) and security lists
with the configuration required by File Storage.
Generate the certificates required by instances.
Create File Storage components such as
mount target, file system, export, and snapshot.
Export one file system to two different mount targets.
Export paths from a single mount target to two different file systems.
This sample shows how you can use the OCI
Ansible collection to perform basic Oracle Cloud Infrastructure Identity and Access Management
(IAM) tasks. The sample assumes the default
user configured in the OCI configuration
is in the Administrator group or has the required access for managing users, groups,
policies.
This sample shows how to do the following:
Create a new group.
Create a policy.
Create a user then add it to the group and policy.
This sample shows how you can use the OCI Ansible collection to provision a virtual cloud network (VCN) with two private subnets in different availability domains and a Site-to-Site VPN. The Site-to-Site VPN uses a dynamic routing gateway (DRG), customer-premises equipment (CPE), and an IPSec connection. The provisioned resources are illustrated in this networking scenario.
This sample shows how to provision the following resources:
A VCN
Two private subnets
A dynamic routing gateway
Customer-premises equipment
An IPSec connection between DRG & CPE
Finally, it retrieves IPSec connection configuration information and status.
This sample playbook shows how to use the OCI Ansible collection to delete objects
created within a specified range of days from all buckets in a namespace. You can
modify the sample so that it deletes objects older than a specified number of days,
which helps you prune old or unwanted objects stored in the Object Storage service.
MuShop is a showcase of several Oracle Cloud Infrastructure (OCI) services in a unified reference
application. The sample application implements an e-commerce platform built as a set of
microservices. The accompanying content can be used to get started with cloud native
application development on OCI.
MuShop can be deployed in different ways to explore OCI based on your subscription. OCI offers Always Free tier with resources that can be used
indefinitely.
This project is an example of how you can build OCI infrastructure using the OCI Ansible collection.