Friday, December 18, 2015

Basic configuration of Satelite 6.1 using Hammer commands

Introduction:
Hammer is the Satellite 6's command line tool.
You can use hammer to manage entities in Satellite instead of using GUI.

To run hammer you need to provide authentication, you can specify the username and password each time,
# hammer -u admin -p

or simple edit /etc/hammer/cli.modules.d/foreman.yml

:foreman:
    :enable_module: true
    :host: 'https://localhost/'
    :username: 'admin'
    :password: ''

If you ever forget the password, you can always reset as below

# foreman-rake permissions:reset
Reset to user: admin, password: qwJxBptxb7Gfcjj5


Here are some basic hammer commands keeping in mind that you have stored the satellite credentials in foreman.ym

1, To create an organization for your Satellite

# hammer organization create  --name "MyCompany"

2. To create a location for your organization

# hammer location create --name "Chennai"

3. To import the manifest that you've downloaded from Redhat site.

# hammer subscription upload --organization "MyCompany" --file /tmp/manifest-file

4. To display all the repository sets available.

# hammer repository-set  list --organization "MyCompany"

5. To enable a repository

# hammer repository-set enable  --organization "MyCompany" \
 --product "Red Hat Enterprise Linux Server" \
 --name "Red Hat Enterprise Linux 7 Server (RPMs)" --releasever "7.0" --basearch "x86_64"

6. To disable a repository

# hammer repository-set disable  --organization "MyCompany" \
 --product "Red Hat Enterprise Linux Server" \
 --name "Red Hat Enterprise Linux 7 Server (RPMs)" --releasever "7.0" --basearch "x86_64"


7. To synchronize a repository

# hammer repository synchronize --product "Red Hat Enterprise Linux Server" \
 --name "Red Hat Enterprise Linux 7 Server (RPMs)" --organization "MyComapany"

Or use the repo id

# hammer repository synchronize --id 1 --organization "MyCompany"

8. Create the Development and Production life cycle environments

# hammer lifecycle-environment create --name "Development" \
--description "Development" --organization "MyCompany" --prior "Library"

# hammer lifecycle-environment create --name "Production" \
--description "Production" --organization "MyCompany" --prior "Development"

No comments: