NailGun provides an easy to us Python library that facilitates easy usage of the Satellite 6 API. This is an Upstream project and is not officially supported by Red Hat.
Official project website: visit Github
Documentation: visit Red the Docs
I have created a Python script which automatically registers your existing RHEL clients to a Satellite 6 / Katello 2 server or Capsule. It also configures your Puppet agent, creates a “Host” entry in Satellite 6 / Katello 2 Web-UI and starts an initial Puppet run. All you need to do is to sign the Puppet agent cert request on your Satellite or Capsule server (if autosign is not configured which is default).
You can run the script either interactively (The script searches all needed values on your Satellite and shows the findings as options. Currently you have to copy/paste the values.) or unattended (where you have to pass by ALL needed values like organization, location, hostgroup etc.).
You can find the script on Github: https://github.com/hambuergaer/sat6_client_configuration
To get current date and time Python offers “datetime”. To format the output according to your needs you can use “strftime”, otherwise a month would for example be shown as 8 instead of 08.
#!/usr/bin/python from datetime import datetime i = datetime.now() print str(i) print i.strftime('%Y/%m/%d %H:%M:%S')
2015-08-13 08:15:30.495228 2015/08/13 08:15:30