Vagrant Multi VM provisioning

Multiple VMs required

I am looking into Postgresql, replication and fail over. One way to set this up is to have a primary, a standby and a witness server. Two run databases, and one - the witness to decide whether a fail over is needed. To test this it would be nice to create three VMs on my desktop to help test ansible scripts. I have downloaded Virtualbox from Oracle, and my desktop has loads of memory. It would be nice to be able to script the creation of the VMs and then be able to run the same ansible playbook that has been developed for the “real” VMs. Then I can learn postgres and help develop the playbook and associated scripts.

How We Use Ansible

Introduction

I realise I have written a few posts on Ansible, but no overview on how we manage it. I haven’t done any training on Ansible, and this is my first effort at automation (Apart from some bash and python scripts) so there is probably much that could be improved.

Our Systems

We have about 15 - 25 environments to manage, depending on how you count them. Around 2-5 of these are vanilla in one form or another, so don’t need to be managed by Ansible. The rest are all production like to some extent, so need to be managed in a similar manner.

Ansible Strings And Numbers

I had a playbook fail because of the error dict object has no element

It took me ages to debug it, but the problem is that I had defined the index as a string, but was trying to match it to a number. To fix it, I only had to quote the version in the inventory, and everything worked.

I was only caught by this because I was using an old inventory file to test with. I think it used to automatically cast numbers to string, but that stopped a while ago.

Managing Windows with Ansible

After a lot of trial and error, I finally found a way to make it work. Here is what I did.

As noted before, rather than trying to run an installer from a share, I simply copied it on to the local disc of the VM.

Before running Ansible on windows, the operating system has to be configured using (for example) the ConfigureRemotingForAnsible.ps1 script. I took the defaults. I didn’t bother setting up any of the advanced options like CredSSP, as in practice there didn’t seem to be any benefit.

Getting Windows and Ansible to play nicely

The challenge is to run an installer from a share, then run some extra configuration. We do this in Unix (Well, GNU/Linux) all the time, and it is really, really easy. We even have the software on a Windows share, so we just need to mount that and run it!

It turns out that Windows is different from Unix. A mounted share doesn’t belong to the system like in Linux, it belongs to a session. A windows session is what is created when a user logs in to Windows, it contains the desktop, the windows, and the various attributes of the connected user, their permissions for example.

Weird PeopleTools Install Issue On Windows

I am not sure how this situation arises, but I discovered that sometimes the windows installer (Puppet based) on Windows gets into a state where it isn’t installed, but thinks it is, which means that the install won’t work, but it generates messages as if it had worked.

Under c:\psft\pt\ps_home8.55.23 is only the jre directory. Running the install again appears to work, but doesn’t do anything.

The solution is to run the uninstall, then the install will work.

Powershell Parameters

I got an error from powershell:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
PS C:\> Start-Process -NoNewWindow -Verb RunAs
Start-Process : Parameter set cannot be resolved using the specified named
parameters.
At line:1 char:1
+ start-process -NoNewWindow -verb runas
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterB
   indingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Comma
   nds.StartProcessCommand

This is because the Start-Process command has two parameter sets. Looking at the page linked, the parameters are listed in two groups. These groups can’t be mixed and matched. You have to pick one or the other. So if you want to do runas, you can’t use NoNewWindow.

More Recovery Manager Problems

A nice feature of RMAN is that if a restore fails, and you rerun it, it realises that it doesn’t have to redo all the work it has already done.

At least, that is usually what happens.

Today we got:

1
2
3
4
5
6
7
8
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/29/2018 12:54:29
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-06004: ORACLE error from recovery catalog database:
    RMAN-20003: target database incarnation not found in recovery catalog

As documented in oracle support note 2036644.1, this is caused by oracle bug 14683854, and the workaround is to remove