Project

General

Profile

Feature #3860

Implement fully automated provisioning

Added by Lukas Zapletal over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Discovery plugin
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Razor does use tags and policies to define rules which assigns OS and hostname. We can add also assigning puppet classes (host groups) and we can do fully automated provisioning too.

-- from 7910 --

In Foreman, we can easily implement automated discovery by creating new model called DiscoveryRule with:

- name: name a the rule
- query: scoped_search expression
- host group: associated host group
- hostname: safemode expression to generate hostname (e.g. "node#{facts[:mac]}.example.com")
- max count: maximum allocation for this rule
- priority: integer giving rule priorities
- enabled: temporary disable a rule

For each discovered node, our plugin would execute query for each rule sorted by given priority. If a rule matches, host group is associated, host created and node rebooted for provisioning. Counter for each rule is increased and if it hits maximum count, query is no longer active. To speed up queries, we will add "and hostname = 'discovered_host_name'" to each query.

In the UI, we will need to create:

- rules CRUD
- re-apply automated provisioning button on the Discovered Hosts

Foreman core integration require to decrease counter when a host is deleted. For fluent user experience, we may want to add new button Delete and Reboot so users are able to return machines back to pool easily.


Related issues

Related to Discovery - Tracker #8332: [Discovery 2.0] Usability alignment and autoprovisioningResolved2014-11-10

Related to Foreman - Feature #4528: Support Facter 2 structured factsClosed2014-03-03
Is duplicate of Discovery - Feature #7910: Implement razor-like automated provisioningDuplicate2014-10-13

Associated revisions

Revision d3e7c8b9 (diff)
Added by Lukas Zapletal over 6 years ago

Fixes #3860 - automated discovery provisioning

Revision 9dbf1065 (diff)
Added by Lukas Zapletal over 6 years ago

Refs #3860 - fixed broken discovered hosts RABL

History

#1 Updated by Lukas Zapletal almost 7 years ago

  • Status changed from New to Duplicate

#2 Updated by Lukas Zapletal almost 7 years ago

  • Has duplicate Feature #7910: Implement razor-like automated provisioning added

#3 Updated by Bryan Kearney almost 7 years ago

Just thinking out loud (scope creep ahead)

1) I assume this would include rules per org and location, so that one org can have different cases to auto-provision
2) It would be nice to have emails/notifications sent out when rules activate
3) I assume full rbac for access to the rules

#4 Updated by Ohad Levy almost 7 years ago

Bryan Kearney wrote:

Just thinking out loud (scope creep ahead)

1) I assume this would include rules per org and location, so that one org can have different cases to auto-provision

not sure about this one, as initially discovered hosts land in the 'default org of your liking'.

I could see some sort of an approval process (and maybe an org selection) as a useful thing (e.g. before you turn away your db passwords, allow the new system to access).

#5 Updated by Lukas Zapletal almost 7 years ago

Thinking loud:

If we implement this scoped_search rule engine, can we leverage it for the purpose of setting up organization and location for newly discovered (and possibly incoming registered) hosts?

I mean, once we have it, we can easily build another set of screens to do this. Or we can incorporate everything into one set of screens. Think of Zimbra filters - they also allows you to drop mails into folders and set various flags.

#6 Updated by Greg Sutcliffe almost 7 years ago

I think we need to solve Disocvery on multiple subnets first (via allowing a PXE Default template per subnet) - I can't see mutliple Locs/Orgs wanting to share the same subnet. It's far more likely that subnet will be isolated - eg Client1 has discovery on 10.1.2.0/24 but Client2 has discovery on 172.20.10.0/24.

Once we have that, we be a lot more flexible with passing kernel options specific to a subnet into the discovery image, for use when registering the host. We can also be a lot smarter about detecting which subnet the host is on, and using it to guess things like the Loc/Org/Subnet/Domain, etc.

I like the use of scoped search rules for the actual automation though, but watch out for the fact that by default all facts are strings, so rules like "memorysize > 4096" for 4Gb servers won't work without some changes.

#7 Updated by Greg Sutcliffe almost 7 years ago

  • Description updated (diff)

I've copied the description from 7910 since all the discussion is happening here.

#8 Updated by Greg Sutcliffe almost 7 years ago

  • Has duplicate deleted (Feature #7910: Implement razor-like automated provisioning)

#9 Updated by Greg Sutcliffe almost 7 years ago

  • Is duplicate of Feature #7910: Implement razor-like automated provisioning added

#10 Updated by Greg Sutcliffe almost 7 years ago

  • Status changed from Duplicate to Needs design

Duplicate relation reversed too.

#11 Updated by Lukas Zapletal almost 7 years ago

  • Category set to Discovery plugin
  • Assignee set to Lukas Zapletal

Good catch with facts, our long-term goal is to support non-string facts too in future (Facter 2.0 feature). We can just live with this fact for now maybe... A Tech Preview :-)

#12 Updated by The Foreman Bot over 6 years ago

  • Status changed from Needs design to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_discovery/pull/97 added
  • Pull request deleted ()

#13 Updated by Lukas Zapletal over 6 years ago

  • Related to Tracker #8332: [Discovery 2.0] Usability alignment and autoprovisioning added

#14 Updated by Lukas Zapletal over 6 years ago

  • Related to Feature #4528: Support Facter 2 structured facts added

#15 Updated by Lukas Zapletal over 6 years ago

For the record, the way we are finalizing auto-provisioning feature is no per org/loc support, except you can set which org/loc all the discovered (thus auto-provisioned) hosts land.

Permissions for rules do not allow per-resource granularity, but it does support RBAC (Discovery Manager can manage rules, Reader can read them).

No e-mails or notifications support in this first cut as well.

But Greg has a working code of per-subnet Default PXELinux template which allows at least some flexibility. First of all, a lock on this template will no longer be necessary. Second, we can easily extend our Discovery Image to accept arbitrary facts via kernel command line, so each organization/location (subnet) can set their own facts to trigger different rules.

This is what we have right now, I am finishing with unit tests this week.

#16 Updated by Anonymous over 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF