On Feb 22, 2012, at 1:24 PM, Marco Pizzoli wrote:

> Hi guys,
> I see that there's no way to rename a host once created. Same issue with host 
> groups.
> Could you confirm that it is by design and so I never will be able to do that?
> Thanks
>     Marco (wanting to rename everything :-( )

Hi Marco.  Yes, you do need to fully delete and uninstall a host from FreeIPA 
before readding it with a new name.


What may make this easier for you is a feature in 389 DS called Automember:


Automember is a way to use regular expression to tie a given fqdn-type to a 
given hostgroup.  So that when you 'add' a host with a similar name. say: 
webserver2.example.com, the host automatically ends up in the 'webservers' host 

If you wish for a bunch of hosts to be "renamed"/re-provisioned, and 
automatically assigned to a new hostgroup, you can predefine the regex mapping 
and make this process a little easier.

FreeIPA provides a CLI (and in 2.1.90, a WebUI) for managing these entries.

Here is the help doc from the cli tool:

Auto Membership Rule.

Bring clarity to the membership of hosts and users by configuring inclusive
or exclusive regex paterns, you can automatically assign a new entries into
a group or hostgroup based upon attribute information.

A rule is directly associated with a group by name, so you cannot create
a rule without an accompanying group or hostgroup

A condition is a regular expression used by 389-ds to match a new incoming
entry with an automember rule. If it matches an inclusive rule then the
entry is added to the appropriate group or hostgroup.


 Create the initial group or hostgroup:
   ipa hostgroup-add --desc="Web Servers" webservers
   ipa group-add --desc="Developers" devel

 Create the initial rule:
   ipa automember-add --type=hostgroup webservers
   ipa automember-add --type=group devel

 Add a condition to the rule:
   ipa automember-add-condition --key=fqdn --type=hostgroup 
--inclusive-regex=^web[1-9]+\.example\.com webservers
   ipa automember-add-condition --key=manager --type=group 
--inclusive-regex=^uid=mscott devel

 Add an exclusive condition to the rule to prevent auto assignment:
   ipa automember-add-condition --key=fqdn --type=hostgroup 
--exclusive-regex=^web5\.example\.com webservers

 Add a host:
    ipa host-add web1.example.com

 Add a user:
    ipa user-add --first=Tim --last=User --password tuser1 --manager=mscott

 Verify automembership:
    ipa hostgroup-show webservers
      Host-group: webservers
      Description: Web Servers
      Member hosts: web1.example.com

    ipa group-show devel
      Group name: devel
      Description: Developers
      GID: 1004200000
      Member users: tuser

 Remove a condition from the rule:
   ipa automember-remove-condition --key=fqdn --type=hostgroup 
--inclusive-regex=^web[1-9]+\.example\.com webservers

 Modify the automember rule:
    ipa automember-mod

 Set the default target group:
    ipa automember-default-group-set --default-group=webservers --type=hostgroup
    ipa automember-default-group-set --default-group=ipausers --type=group

 Set the default target group:
    ipa automember-default-group-remove --type=hostgroup
    ipa automember-default-group-remove --type=group

 Show the default target group:
    ipa automember-default-group-show --type=hostgroup
    ipa automember-default-group-show --type=group

 Find all of the automember rules:
    ipa automember-find

 Display a automember rule:
    ipa automember-show --type=hostgroup webservers
    ipa automember-show --type=group devel

 Delete an automember rule:
    ipa automember-del --type=hostgroup webservers
    ipa automember-del --type=group devel

Topic commands:
  automember-add                   Add an automember rule.
  automember-add-condition         Add conditions to an automember rule.
  automember-default-group-remove  Remove default group for all unmatched 
  automember-default-group-set     Set default group for all unmatched entries.
  automember-default-group-show    Display information about the default 
automember groups.
  automember-del                   Delete an automember rule.
  automember-find                  Search for automember rules.
  automember-mod                   Modify an automember rule.
  automember-remove-condition      Remove conditions from an automember rule.
  automember-show                  Display information about an automember rule.

Freeipa-users mailing list

Reply via email to