Even if YaK Core does not manage on-premises servers provisioning, these can be easily added to YaK inventory. If you are too excited, can’t wait to test YaK and have no cloud account handy, you can use our demo or deploy on premises.

Infrastructure Definitions

For on premise, we have to create the directory structure under configuration/infrastructure. Let’s call it on_prem.

In my yak container, it looks like this:

yak@315bd06eb7ad:~/yak$ tree -d configuration/infrastructure/on_prem/
configuration/infrastructure/on_prem/
|-- srv-linux-ols-1
|   `-- WLS_DOMAIN
|       `-- secrets

As you can see, this server has one components declared (WLS_DOMAIN).

Let’s create variables.yml in on_prem directory:

is_cloud_environment: no
environment: development
ansible_user: ansible
provider: on-premises

The important key here is “provider“. For the cloud, this field can be equal to aws, azure or oci. In our case, it is equal to “on-premises“.

And, we have to define hosts details in another variables.yml inside srv-linux-ols-1 directory:

hostname: srv-linux-ols-1
host_ip_access: private_ip
private_ip:
   mode: manual
   ip: 192.168.222.111

Virtual Machine Provisioning

I will use Vagrant to provision a local VM with Oracle Linux 8. Vagrantfile (without extension) will look like:

Vagrant.configure("2") do |config|
  config.vm.box = "generic/oracle8"
  config.vm.network "private_network", ip: "192.168.222.111"
  config.vm.provider "virtualbox" do |vb|
    vb.memory = "4096"
  end
end

This file must be alone in a directory. Then, I simply trigger “vagrant up” to bring it up and “vagrant ssh” to ssh into it. This must be ran from that directory.

Deployment

Keep in mind that Ansible controller (aka as our YaK container) must have ssh access with a user allowed to sudo. As for me, I have created a user named ansible and added sudo for it. We have to exchange ssh key to make connection from YaK to VM password-less:

ssh-copy-id [email protected]

As a main difference with cloud deployment, we do not need (and can’t) create VM on premises with YaK, thus step below is not necessary:

ansible-playbook servers/deploy.yml -e target=on_prem/srv-linux-ols-1

We can go directly to the deployment of our component:

ansible-playbook components/weblogic_domain/playbooks/linux/deploy.yml -e target=on_prem/srv-linux-wls-ols-1/WLS_DOMAIN

This command is doing the following tasks:

  • Configuration of Linux including packages prerequisites and kernel configuration
  • Java installation
  • DMK WebLogic installation
  • WebLogic installation
  • WebLogic patching including Critical Patch Updates (CPU)
  • WebLogic domain creation
  • Domain configuration including dbi services best practices
  • Installation and configuration of Node Manager and domain services

Output example

For a typical hello-world example output will look like:

yak@315bd06eb7ad:~/yak$ ansible-playbook srv-linux-ols-1s/hello-world/hello-world.yml -e target=on_prem/srv-linux-ols-1/COMPONENT

PLAY [Testing playbook] ************************

TASK [Gathering Facts] ************************
Thursday 06 October 2022  14:19:44 +0000 (0:00:00.024)       0:00:00.024 ******
ok: [on_prem/srv-linux-ols-1/COMPONENT]

TASK [System details] ************************
Thursday 06 October 2022  14:19:47 +0000 (0:00:02.870)       0:00:02.894 ******
ok: [on_prem/srv-linux-ols-1/COMPONENT -> localhost] => {
    "msg": "inventory_hostname: on_prem/srv-linux-ols-1/COMPONENT"
}

PLAY RECAP ************************
on_prem/srv-linux-ols-1/COMPONENT : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Thursday 06 October 2022  14:19:47 +0000 (0:00:00.084)       0:00:02.979 ******
===============================================================================
Gathering Facts ---------------------------------- 2.87s
System details ----------------------------------- 0.09s

What’s Next?

Now that we have added host into YaK inventory, it is time to develop a component.

See you in my next blog to get more insights.