1

OK, so I have setup in the user-data section of my launch configuration, a way for an instance to automatically register itself with Foreman, and put itself into the correct host group through API calls.

Now with the ephemeral nature of auto scaling, is there a way in foreman to clean hosts if they haven't checked in a certain amount of time? I don't want to rely upon a script to call the API on instance termination, just in-case of a hardware failure, or any other reason the script would not run cleanly.

seemach1
  • 111
  • 1

2 Answers2

1

If youre using userdata, you can set the hostname to something containing $instanceid and then do your foreman callback. that will result in less collision.

0

I decided to just do a host name check in the beginning of my foreman registration script, if it sees the host name already registered to foreman it will do a delete, then I will register my new instance that has the same name. Since I will be setting my host names to the local ip address, it can happen where a new instance will get the same ip as a retired instance.

seemach1
  • 111
  • 1