Foreman Templates

Hey there,

I got a problem with the templates.
I wanted to write a ping template like this:

<%
ping @host
%>

After I studied some of the other templates that should send a ping to the
host. I only done that to test if the connection and execution of templates
is working on the host.
But now I can't give my hosts any templates. If I choose under Hosts > All
Hosts my host I can't add a template to the host. Nowhere is it possible.
But there are so many example provision templates.

Why didn't the web UI recognize them to add them to the host?
Did I misunderstand the templates/provision templates?

Main question: How can I send a ping or package-install command to the
hosts I want to manage with foreman? The documentation doesn't seemed
helpful there.

Hi Chris,

Provisioning templates are for provisioning the hosts, they are used by
kickstart, preseed, etc to build the host and configure it for the first
time.

It sounds like you want to run a command on a host, in that case you
should have a look at foreman_remote_execution plugin which can do
this via SSH.

https://theforeman.org/plugins/foreman_remote_execution/0.3/index.html

  • Stephen
ยทยทยท ----- Original Message ----- > From: "Christoph Siebert" > To: "Foreman users" > Sent: Tuesday, July 26, 2016 9:43:56 AM > Subject: [foreman-users] Foreman Templates > > Hey there, > > I got a problem with the templates. > I wanted to write a ping template like this: > > <% > ping @host > %> > > After I studied some of the other templates that should send a ping to the > host. I only done that to test if the connection and execution of templates > is working on the host. > But now I can't give my hosts any templates. If I choose under Hosts > All > Hosts my host I can't add a template to the host. Nowhere is it possible. > But there are so many example provision templates. > > Why didn't the web UI recognize them to add them to the host? > Did I misunderstand the templates/provision templates? > > Main question: How can I send a ping or package-install command to the > hosts I want to manage with foreman? The documentation doesn't seemed > helpful there.

Thx for the answer.
I don't exactly want to execute a command remotely. I thought foreman in
conenction with puppet is doing this in standard.
What I really want is to know how I use the templates (or what else) to
manage my hosts in general. I mean, copy config files, backup them, install
or remove software packages or updates. You see, use theforeman GUI to
manage my hosts like it is meant for the software puppet.

And I thought I realise this with the templates in foreman. For example I
write something like this puppet host configuration:
package { "vim":
ensure=>installed
}

and it can be executed through the GUI. I save it in the template, assign
to a host or hostgroup and somehow execute this.

That was my plan and thought of foreman.