Project

General

Profile

Actions

Feature #2436

open

Ability to update Puppet CA and Puppet Master for multiple hosts

Added by Oliver Weinmann over 11 years ago. Updated almost 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Host groups
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi,

when recently changing our foreman environment I had to change the Puppet CA and Puppet Master on multiple hosts (200+) to a different proxy. I noticed that this is not possible even through changing the hostgroup. Only chance to change this is to run SQL queries.

Best Regards,
Oliver


Related issues 5 (0 open5 closed)

Related to Foreman - Feature #9323: Hosts should be able to inherit their environment from their hostgroupResolvedActions
Has duplicate Foreman - Feature #2468: implement a way to switch the puppetmaster on many hosts at onceDuplicate05/07/2013Actions
Has duplicate Foreman - Bug #3348: Selecting a host/multiple hosts and action change group does not update Puppet CA and Puppet MasterDuplicate10/17/2013Actions
Has duplicate Foreman - Bug #8883: Changes to puppetmaster field in hostgroup not propagating to hostsDuplicate01/09/2015Actions
Has duplicate Foreman - Feature #9861: Can multi-select change the CA or puppet-proxy of a host?Duplicate03/22/2015Actions
Actions #1

Updated by Benjamin Papillon over 11 years ago

The easy way to massively change the puppet master and puppet ca entries for a huge number of hosts is to use the API with a little script.
Here are 2 samples based on python and shell.

Sample script in python : https://gist.github.com/ekohl/5813331

Sample script in shell. You need to identify the good puppet master and ca proxy id, and replace the variables before using this script

#! /bin/sh
#

USER="admin" 
PASS="xxxxx" 
FOREMAN_URL="https://10.1.1.1/api" 
puppet_ca_proxy_id=3
puppet_proxy_id=3

curl    -s -H 'Accept:application/json' \
        -k -u "${USER}:${PASS}" \
        -G \
        $FOREMAN_URL/hosts | \
        prettify_json.rb | \
        sed -ne  '/"id":/s/.*: \([0-9]\+\),/\1/p'  | \
while read a ; do \
        curl -s -H 'Accept:application/json' \
        -k -u "${USER}:${PASS}" \
        -X PUT \
        -d "host[puppet_ca_proxy_id]=${puppet_ca_proxy_id}" \
        -d "host[puppet_proxy_id]=${puppet_proxy_id}" \
        ${FOREMAN_URL}/hosts/$a
done

Actions #2

Updated by Oliver Weinmann over 11 years ago

Hi,

thanks a lot for the script. :)

Meanwhile I had to do it manually. :(

Best Regards,
Oliver

Actions #3

Updated by Dominic Cleal about 11 years ago

  • Has duplicate Bug #3348: Selecting a host/multiple hosts and action change group does not update Puppet CA and Puppet Master added
Actions #4

Updated by Dominic Cleal almost 10 years ago

  • Has duplicate Bug #8883: Changes to puppetmaster field in hostgroup not propagating to hosts added
Actions #5

Updated by Corey Osman almost 10 years ago

  • Description updated (diff)

As another work around you could use the foreman hooks plugin to auto inherit the puppet proxy and puppet master anytime a host is updated. Might not be ideal but it would be automatic. Not sure if it would cause a hook loop though since an update hook would be causing another update.

Actions #6

Updated by Erwin Van de Velde almost 10 years ago

  • Related to Feature #9323: Hosts should be able to inherit their environment from their hostgroup added
Actions #7

Updated by Dominic Cleal almost 10 years ago

  • Category set to Host groups
Actions #8

Updated by Dominic Cleal over 9 years ago

  • Has duplicate Feature #9861: Can multi-select change the CA or puppet-proxy of a host? added
Actions

Also available in: Atom PDF