Customising Host name for Discovery Rules?

Problem:
I understand that there are features within foreman that allows some customisation of hostnames
eg. Myhost-<%=@host.ip.to_s()%> that allows customising based on facts retrieved from the host.

I would like to know if this feature is extended to taking on values from Foreman itself?

For example, i would like to have my hostname to take on some custom values that tracks the number of hosts within a hostgroup

e.g. Myhost-HG1-<% "no of host in hostgroup %>

Expected outcome:

I am looking to have my host provisioned with running number
MyHost-HG1-1
MyHost-HG1-2

MyHost-HG1-N

Thanks

You are so lucky today!