Debugging foreman and ssl cert issues using vagrant

Problem:
When using foreman-installer in a vagrant created vbox, I found that the default DNS address was being assigned to the wrong interface for my LAB.

I wanted the domain on the host-only interface or bridge interface, not the vagrant NAT one.

While the system still worked sort of , I found I was getting issues around CA’s and kept getting the dreaded.

On the master:
puppet cert clean
On the Agent
clear PUPPET/ssl

Expected outcome:
Not to have to clear the certs down.

Foreman and Proxy versions: 1.15, havent tested 1.16 yet

Foreman and Proxy plugin versions:

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]

I wrote this little shell function to help me juggle the names around. I am posting this here because I could nt find very many good examples to do this.

#/bin/bash
vbox_sort_interfaces() {
  F_HOST=$1
  PREFIX="v"
  HOST_ID=$(sudo -E hammer host list |grep ${F_HOST} |cut -f 1 -d ' ')
  sudo -E hammer host interface list --host-id ${HOST_ID} |grep ${PREFIX}${F_HOST}
  if [[ $? -eq 0 ]]
  then
    echo "Already been juggled around"
    sudo -E hammer host interface list --host-id ${HOST_ID}
  else
    echo "Needs to be juggled"
    sudo -E hammer host interface list --host-id ${HOST_ID}
    sudo -E hammer host interface update --host-id 1 --id 1 --name ${PREFIX}${F_HOST}
    sudo -E hammer host interface update --host-id 1 --id 2 --name ${F_HOST} --primary --provision
    sudo -E hammer host interface list --host-id ${HOST_ID}
  fi
}

vbox_sort_interfaces example.com

This juggles the Service DNS name to another interface.