Skip to content

Commit 2ad37d5

Browse files
committed
create README
1 parent 826b6dc commit 2ad37d5

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed

olvm/README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Install Oracle Linux Virtualization Manager in Oracle Cloud Infrastructure (OCI)
2+
3+
This sample includes a series of playbooks that:
4+
5+
- Deploy the OCI resources for an Oracle Linux Virtualization Manager installation
6+
- Virtual Private Network (VCN), Subnets, VLAN (L2), etc.
7+
- An engine and several KVM hosts
8+
- Block Storage
9+
10+
- Provisions a 3-node (default) Oracle Linux Virtualization Manager installation using the included `defaults_vars.yml` file.
11+
12+
## Prerequisites
13+
14+
- Ansible Core (< 2.16 due to compatibility with Python 3.6 in Oracle Linux 8)
15+
- Oracle Cloud Infrastructure SDK for Python
16+
- Ovirt Python SDK version 4
17+
- Python modules - jmespath, passlib
18+
- Access to an OCI tenancy with the proper resources
19+
- SSH public and private key pair for use to connect to the OCI instances
20+
21+
The easiest way to do this is using a Python Virtual environment. For example, on macOS:
22+
23+
1. Create a directory for the virtual environment.
24+
25+
```shell
26+
mkdir python-env
27+
cd python-env
28+
```
29+
30+
1. Create the Python virtual environment.
31+
32+
```shell
33+
python3 -m venv ansible2.16
34+
```
35+
36+
1. Activate the Python virtual environment.
37+
38+
```shell
39+
source ansible2.16/bin/activate
40+
```
41+
42+
1. Install Ansible in the virtual environment.
43+
44+
```shell
45+
python3 -m pip install ansible-core==2.16
46+
```
47+
48+
1. Verify the installation.
49+
50+
```shell
51+
ansible --version
52+
```
53+
54+
The output reports the version 2.16 if everything installed correctly.
55+
56+
1. Install the OCI SDK for Python
57+
58+
```shell
59+
pip install oci
60+
```
61+
62+
1. Install the oVirt 4 Python SDK
63+
64+
```shell
65+
pip install ovirt-engine-sdk-python
66+
```
67+
68+
1. Install Jmespath and Passlib Python modules.
69+
70+
```shell
71+
pip install jmespath
72+
pip install passlib
73+
```
74+
75+
## Instructions
76+
77+
1. Create custom varibles file.
78+
79+
Rather than modify the `default_vars.yml` file directly, create a new YAML custom variables file. Provide values specific to your tenancy and environment.
80+
81+
> ```text
82+
> ad_placement: <Enter the OCI Availability Domain to use [1,2,3]>
83+
> compartment_id: <Enter the OCID for the compartment within your tenancy>
84+
> private_key: <Enter the name of your SSH key without the extension>
85+
> ```
86+
87+
- The `private_key` variable defaults to looking for the file `id_rsa` in your local users $HOME/.ssh directory
88+
- If your OCI configuration file om `~/.oci/config` has multiple profiles, then also set the variable `oci_config_section` to the profile name.
89+
90+
> Sample:
91+
>
92+
> ```shell
93+
> cat << EOF | tee sample.yml > /dev/null
94+
> ad_placement: 2
95+
> compartment_id: "ocid1.compartment.oc1..aaa..............zzz"
96+
> private_key: "my_sshkey"
97+
> EOF
98+
> ```
99+
100+
1. Install the required collections:
101+
102+
```shell
103+
ansible-galaxy collection install -r requirements.yml
104+
```
105+
106+
1. (Optional) Create an inventory file for localhost.
107+
108+
This is required in environments that use non-venv environments for the Python and Ansible to ensure that Ansible can find the OCI and oVirt modules.
109+
110+
```shell
111+
cat << EOF | tee hosts > /dev/null
112+
localhost ansible_connection=local ansible_connection=local ansible_python_interpreter=/usr/bin/python3.6
113+
EOF
114+
```
115+
116+
1. Deploy the environment.
117+
118+
```shell
119+
ansible-playbook create_instance.yml -e "@<name of custom vars file>.yml"
120+
```
121+
122+
You can pass extra variables or variable files on the `ansible-playbook` command line using `-e` or `--extra-vars`. Ansible treats these variables as having the highest precedence and reads them from the command line from left to right.
123+
124+
> Sample:
125+
>
126+
> ```shell
127+
> ansible-playbook create_instance.yml -e "@sample.yml" -e debug_enabled=true
128+
> ```
129+
130+
## Related Links
131+
132+
Explore our other tutorials and labs on our [Oracle Linux Training Station](www.oracle.com/goto/oltrain).

0 commit comments

Comments
 (0)