Important
|
The setup of Vagrant, VirtualBox and SSH is not part of this documentation. Please follow the documentation. |
With one command, the following will happen…
-
An Oracle Linux VM will be created.
-
A docker container is setup in this Linux VM.
-
Why do we need a docker container? Ansible runs in the docker container to configure the Oracle Linux VM and install the Oracle database. See Details of Ansible as a Docker Container for more information
-
The Oracle database installation is started from the docker container. See details below.
Value | Description |
---|---|
~/git/ansible-oracle |
git Repository on Host System |
~/git/ansible-oracle |
git Repository in VM |
~/.ssh/id_rsa |
private Key on Host System |
vagrant |
SSH-User for Login and Ansible |
~/git/ansible-oracle/example/beginner |
Vagrantfile location |
Important
|
All steps are executed on the Host System inside a git+bash .
|
mkdir ~/git cd ~/git git clone https://github.com/oravirt/ansible-oracle.git
Download the installation media for Oracle RDBMS 19c for Linux x86_64.
Place the ZIP archive into the directory of Vagrantfile.
cd <Downloadlocation> cp LINUX.X64_193000_db_home.zip ~/git/ansible-oracle/example/beginner/vagrant
Important
|
Do not skip the preparation for Vagrant and SSH. Please follow the documentation. |
cp ~/.ssh/id_rsa.pub ~/git/ansible-oracle/example/beginner/vagrant
eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa
Important
|
The Deployment und provisioning of the VM takes some minutes. It highly depends on the speed of the internet connection. |
Important
|
The SSH public key is configured during the provisioning phase of the VM. Do not forget to copy the file before starting the box with vagrant up .
|
cd ~/git/ansible-oracle/example/beginner/vagrant VAGRANT_EXPERIMENTAL=disks vagrant up
-
Using the vagrantfile, an Oracle Linux VM is installed (2x CPU, 4096MB RAM, 150GB HDD). IP = 192.168.56.161
-
A mount point /vagrant is available in the Oracle Linux VM. This is a shared folder from your Windows machine.
-
Your ssh key is used to connect to the VM in a secure way
-
docker is installed in the Oracle Linux VM
-
docker-compose is installed in the Oracle Linux VM
-
The ansible-oracle repository is cloned to the Oracle Linux VM
-
A docker container "Ansible Container" is built with docker-compose. This runs in the Oracle Linux VM
-
No Oracle database is yet installed. See below
Important
|
The next steps are done inside the VM. The SSH-Setup from the previous chapter must be completed before continuing! |
git+bash
ssh -A vagrant@192.168.56.161
The installation media is mounted with vboxsf from Vagrant into the Linux VM, mounted as /vagrant
.
Use the following command to check this…
[vagrant@beginner-dbfs-151-192-168-56-161 ~]$ ls /vagrant/LINUX.X64_193000_db_home.zip /vagrant/LINUX.X64_193000_db_home.zip
Important
|
Check the prompt shown in this documentation, as to whether you should start the commands in the shell or inside the Ansible-Container.ansible@ansible-oracle is for working inside the container.
|
cd ~/git/ansible-oracle/docker docker-compose run --rm -w /git/ansible-oracle/example/beginner/ansible ansible bash
[vagrant@beginner-dbfs-151-192-168-56-161 docker]$ docker-compose run --rm -w /git/ansible-oracle/example/beginner/ansible ansible bash [+] Running 2/0 ⠿ Network docker_default Created ⠿ Volume "docker_ansible_galaxy" Created ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$
Important
|
The collection is installed once and stored on the docker volume. |
ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$ ansible-galaxy collection install -r requirements.yml
ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$ ansible-galaxy collection install -r requirements.yml Starting galaxy collection install process Process install dependency map Starting collection install process Downloading https://galaxy.ansible.com/download/devsec-hardening-8.2.0.tar.gz to /home/ansible/.ansible/tmp/ansible-local-25z8isd809/tmp25w_hn4o/devsec-hardening-8.2.0-0j9481f1 Installing 'devsec.hardening:8.2.0' to '/ansible/galaxy/ansible_collections/devsec/hardening' Downloading https://galaxy.ansible.com/download/opitzconsulting-ansible_oracle-3.2.0.tar.gz to /home/ansible/.ansible/tmp/ansible-local-25z8isd809/tmp25w_hn4o/opitzconsulting-ansible_oracle-3.2.0-x3wo4c3b devsec.hardening:8.2.0 was installed successfully Installing 'opitzconsulting.ansible_oracle:3.2.0' to '/ansible/galaxy/ansible_collections/opitzconsulting/ansible_oracle' Downloading https://galaxy.ansible.com/download/ansible-posix-1.4.0.tar.gz to /home/ansible/.ansible/tmp/ansible-local-25z8isd809/tmp25w_hn4o/ansible-posix-1.4.0-1jub71c6 opitzconsulting.ansible_oracle:3.2.0 was installed successfully Installing 'ansible.posix:1.4.0' to '/ansible/galaxy/ansible_collections/ansible/posix' Downloading https://galaxy.ansible.com/download/community-mysql-3.5.1.tar.gz to /home/ansible/.ansible/tmp/ansible-local-25z8isd809/tmp25w_hn4o/community-mysql-3.5.1-lkcnbkd5 ansible.posix:1.4.0 was installed successfully Installing 'community.mysql:3.5.1' to '/ansible/galaxy/ansible_collections/community/mysql' Downloading https://galaxy.ansible.com/download/community-crypto-2.8.0.tar.gz to /home/ansible/.ansible/tmp/ansible-local-25z8isd809/tmp25w_hn4o/community-crypto-2.8.0-6sco_75m community.mysql:3.5.1 was installed successfully Installing 'community.crypto:2.8.0' to '/ansible/galaxy/ansible_collections/community/crypto' Downloading https://galaxy.ansible.com/download/community-general-5.8.0.tar.gz to /home/ansible/.ansible/tmp/ansible-local-25z8isd809/tmp25w_hn4o/community-general-5.8.0-up2j_3iq community.crypto:2.8.0 was installed successfully Installing 'community.general:5.8.0' to '/ansible/galaxy/ansible_collections/community/general' community.general:5.8.0 was installed successfully
Important
|
Make sure to start the installation inside the Ansible Container. The prompt shows the correct location. The execution takes ~60 minutes. |
cd /git/ansible-oracle/example/beginner/ansible ansible-playbook -i inventory/ -e hostgroup=dbfs playbooks/single-instance-fs.yml
The Database creation is now complete.
See the following chapter for details about how to work with the VM.
[vagrant@beginner-dbfs-151-192-168-56-161 ~]$ sudo su - oracle
[vagrant@beginner-dbfs-151-192-168-56-161 ~]$ sudo su - oracle Last login: Sun Nov 6 11:16:54 UTC 2022 on pts/2 execute ocenv to source Oracle Environment
[oracle@beginner-dbfs-151-192-168-56-161 ~]$ ocenv
[oracle@beginner-dbfs-151-192-168-56-161 ~]$ ocenv ##################################################################################### ## Version: 2022-08-10 ## get command overview by typing envhelp ##################################################################################### home oracle OraHome_OraDB19Home1 /u01/app/oracle/product/19/db1 db oracle DB1 (up) /u01/app/oracle/product/19/db1 lsnr oracle LISTENER /u01/app/oracle/product/19/db1 [oracle@beginner-dbfs-151-192-168-56-161] [] [~]
[oracle@beginner-dbfs-151-192-168-56-161] [] [~] $ DB1
[oracle@beginner-dbfs-151-192-168-56-161] [] [~] $ DB1 ================================= INSTANCE NAME : DB1 INSTANCE STATUS : OPEN (READ WRITE) INSTANCE START TIME : 2022-11-06 11:34:06 DB NAME : DB1 DB UNIQUE NAME : DB1 DB ID : 1713907024 DB LOGGING MODE : NOARCHIVELOG DB ROLE : PRIMARY DB FORCE LOGGING : YES DB FLASHBACK ON : NO DB is CDB : YES PDBs PDB NAME STATUS RESTRICTED OPEN TIME LOCAL UNDO --------------- ---------- ---------- ------------------- ---------- ORCLPDB READ WRITE NO 2022-11-06 11:34:28 YES ================================= [oracle@beginner-dbfs-151-192-168-56-161] [DB1] [~]
[oracle@beginner-dbfs-151-192-168-56-161] [DB1] [~] $ sql
[oracle@beginner-dbfs-151-192-168-56-161] [DB1] [~] $ sql SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 6 11:41:40 2022 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 11:41:40 SYS@DB1 SQL>