Bug #3297

CLI success story tracker

Added by Martin Bacovsky over 3 years ago. Updated over 2 years ago.

Status:Resolved
Priority:Normal
Assigned To:Martin Bacovsky
Category:Foreman commands
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:
Story points-
Velocity based estimate-

Description

The goal is to provision bare metal host on a clean install of Foreman. The following steps are necessary:

  • create smart proxy
        hammer proxy create --name myproxy --url https://proxy.my.net:8443
    
  • create architecture
        hammer architecture create --name x86_64
    
  • create new subnet
        hammer subnet create --name "My Net" --network "192.168.122.0" --mask "255.255.255.0" --gateway "192.168.122.1" --dns-primary "192.168.122.1" 
    
  • import existing subnet from a proxy
    missing, see #3355
  • create new domain
        hammer domain create --name "my.net" --fullname "My network" 
    
  • associate domain with proxy
        hammer domain update --id 1 --dns-id 1
    
  • associate subnet with domain
        hammer subnet update --id 1 --domain-ids 1
    
  • associate subnet with proxy (DHCP, TFTP, DNS)
        hammer subnet update --id 1 --dhcp-id 1 --tftp-id 1 --dns-id 1
    
  • create new partition table
        hammer partition_table create --name "Redhat test" --file /tmp/rh_test.txt
    
  • create new OS
        hammer os create --name RHEL --major 6 --minor 4
    

    --family does not work yet - PR https://github.com/theforeman/foreman/pull/777
  • create new template
        hammer template create --name "kickstart mynet" --type provision --file /tmp/ks.txt
    
  • edit existing pre-defined template
        hammer template dump --id 4 > /tmp/ks.txt
        vim /tmp/ks.txt
        hammer template update --id 4 --file /tmp/ks.txt
    
  • associate applicable OS with pre-defined template
        hammer template update --id 1 --operatingsystem-ids 1
    

    Confirmed through the UI, but listing of templates does not work. Version on GH has listing fixed, but listing associated OS's is still missing - see #3360
  • associate OS with architecture
        hammer os update --id 1 --architecture-ids 1
    
  • associate OS with part table
        hammer os update --id 1 --ptable-ids 1
    
  • associate OS with install media
        hammer os update --id 1 --medium-ids 1
    
  • associate OS with install provision and pxelinux templates
    Added to API in #3928, Hammer feature is #3970
  • create libvirt compute resource
        hammer compute_resource create --name libvirt --url "qemu:///system" --provider Libvirt
    
  • import puppet classes
    missing - see #3035
  • and finally create a host
        hammer -v host create --name "clitest.mynet.com" --ip "192.168.122.5" --host-group-id 1 --compute-resource-id 1 --interface "type=network,model=virtio,network=default" --volume "capacite=10G" --compute-attributes "start=true" 
    

    creates host in my case on Libvirt with NAT and 10GB storage
    related issues - #3063

History

#1 Updated by Martin Bacovsky over 3 years ago

  • Tracker changed from Tracker to Bug

#2 Updated by Martin Bacovsky over 3 years ago

  • Description updated (diff)

#3 Updated by Martin Bacovsky over 3 years ago

  • Description updated (diff)

#4 Updated by Martin Bacovsky over 3 years ago

  • Description updated (diff)

#5 Updated by Martin Bacovsky over 3 years ago

  • Description updated (diff)

#6 Updated by Martin Bacovsky over 3 years ago

  • Description updated (diff)

#7 Updated by Martin Bacovsky over 3 years ago

  • Description updated (diff)

#8 Updated by Martin Bacovsky over 3 years ago

  • Description updated (diff)

#9 Updated by Martin Bacovsky over 3 years ago

I found nice option if you want to try the latest upstream

gem install specific_install
gem specific_install -l "theforeman/hammer-cli" 
gem specific_install -l "theforeman/hammer-cli-foreman" 

#10 Updated by Lukas Zapletal over 3 years ago

Specific install does not work for me on RHEL6 Ruby 1.8:

[root@lzap-aa ~]# gem install specific_install
Successfully installed backports-3.3.5
Successfully installed specific_install-0.2.8
2 gems installed
Installing ri documentation for backports-3.3.5...
Installing ri documentation for specific_install-0.2.8...
Installing RDoc documentation for backports-3.3.5...
Installing RDoc documentation for specific_install-0.2.8...
[root@lzap-aa ~]# gem specific_install -l "theforeman/hammer-cli" 
/usr/lib/ruby/gems/1.8/gems/specific_install-0.2.8/lib/rubygems/commands/specific_install_command.rb:19: warning: multiple values for a block parameter (2 for 1)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/command.rb:435
Error: must end with .git to be a git repositoryor be in shorthand form: rdp/specific_install
[root@lzap-aa ~]# gem specific_install -l "theforeman/hammer-cli-foreman" 
/usr/lib/ruby/gems/1.8/gems/specific_install-0.2.8/lib/rubygems/commands/specific_install_command.rb:19: warning: multiple values for a block parameter (2 for 1)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/command.rb:435
Error: must end with .git to be a git repositoryor be in shorthand form: rdp/specific_install

Can I use latest nightly build now?

#11 Updated by Martin Bacovsky over 3 years ago

Hmm, you are right, specific_install does not work in 1.8. You can use nightlies or 'gem install hammer-cli'. We will try to release more often to make testing less pain. Thanks!

#12 Updated by Martin Bacovsky over 3 years ago

  • Description updated (diff)

#13 Updated by Martin Bacovsky over 3 years ago

  • Target version changed from Sprint 16 to Sprint 17

#14 Updated by Dominic Cleal over 3 years ago

  • Target version changed from Sprint 17 to Sprint 18

#15 Updated by Dmitri Dolguikh about 3 years ago

  • Target version changed from Sprint 18 to Sprint 19

#16 Updated by Dmitri Dolguikh about 3 years ago

  • Target version changed from Sprint 19 to Sprint 20

#17 Updated by Dmitri Dolguikh about 3 years ago

  • Target version changed from Sprint 20 to Sprint 21

#18 Updated by Dominic Cleal about 3 years ago

  • Description updated (diff)

#19 Updated by Dominic Cleal about 3 years ago

  • Description updated (diff)

#20 Updated by Dmitri Dolguikh about 3 years ago

  • Target version changed from Sprint 21 to Sprint 22

#21 Updated by Dmitri Dolguikh almost 3 years ago

  • Target version changed from Sprint 22 to Sprint 23

#22 Updated by Dmitri Dolguikh almost 3 years ago

  • Target version deleted (Sprint 23)

#23 Updated by Ohad Levy over 2 years ago

  • Status changed from Assigned to Resolved

Also available in: Atom PDF