Server Management with Remove Don MacVittie, Sr. Solutions Architect
Overview
• There are some things in Stacki that you can only do with Remove commands. This tutorial takes you over the most common remove commands and offers an overview of how they work.
Removing Hosts
NOTE:Removing a host will remove it and all the entries about it from the database. If command-line customizations have been implemented – such as adding routes – those customizations will be lost with remove host, and will require re-entry if the host is ever returned to the system.
[root@stackihw ~]# stack list host HOST RACK RANK CPUS APPLIANCE DISTRIBUTION RUNACTION INSTALLACTIONstackihw: 0 0 1 frontend default os installbackend-0-1: 0 1 4 backend default os install
backend-0-2: 0 2 1 backend default os installpuppet: 0 3 4 backend default os install [root@stackihw ~]# stack remove host backend-0-2 [root@stackihw ~]# stack list host
HOST RACK RANK CPUS APPLIANCE DISTRIBUTION RUNACTION INSTALLACTIONstackihw: 0 0 1 frontend default os installbackend-0-1: 0 1 4 backend default os installpuppet: 0 3 4 backend default os install
[root@stackihw ~]#
Later, the host can be re-added by adding it with any of the normal methods. Stacki will see it as a new server, simply because remove deleted all trace of it from the system.
stack remove host [hostname]
Removing host Bootaction
• Effectively removes the server from management by Stacki. • Tells Stacki to do nothing when this machine boots and asks what to do. This causes the machine to boot to
local disk, just as it would if bootaction was set to “os”, except that stacki never gets a say.• This is useful in place of Remove host because all customizations are kept, though it is functionally the same
as removing the host from the Stacki database.
[root@stackihw ~]# stack list host boot HOST ACTION stackihw: ------- backend-0-1: install puppet: os [root@stackihw ~]# stack remove host boot backend-0-1 [root@stackihw ~]# stack list host boot HOST ACTION stackihw: ------ backend-0-1: ------ puppet: os
Remove outdated routes
stack remove route and stack remove host route will remove routing information from the routing table. This is useful when access needs or routes change. After the command, don’t forget to sync host network so the changes you just made to the database are propagated to the server
[root@stackidon ~]# stack remove host route backend-0-0 address = 0.0.0.0[root@stackidon ~]# stack sync host network backend-0-0
Remove SSH Keys
User-defined SSH keys can be cleaned up using remove host key. Default keys cannot be removed in this manner.
First, list the keys, then get the “ID” field, use that to pass which key into remove host key. Done.
[root@stackihw ~]# stack list host key HOST ID PUBLIC KEY puppet: 1 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0+98qKuKvry9rFfCCHI4QunO6ompIqqLL8Z5R0cJ0Gdmkvd69g9JZMX0zJ4LbQBpICLyvz3nneZQ8fLFG6B0DlxibQQd2/Ds27mG5lmcqKsBtE47LQiD48dAq+9aYaoD8J/eqP1rbk4eQk+nkhnqFnBLjcg2RnFULDnSHtXftK6pEjTEFVcacmtLxwQjMlBTxk4c/veKwDtzazuo1nqVHl734s4nyxOQeN4qMQym6Jmuzb5W9hOCa0kzFtZkiibiiEN5RciAFOW0j5ztKkLKq9Cg3y17y9jz355hQ6LwHHZqPkmPuFWhAQGTdkH5GGSSKkkWJDIi9/uZMXXbVJozR [email protected] ------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[root@stackihw ~]# stack remove host key puppet id=1 [root@stackihw ~]# stack list host key [root@stackihw ~]#
And attributes
stack remove attr attr=[attrname] stack remove host attr [hostname] attr=[attrname] stack remove appliance attr [appliance_name] attr=[attrname]
The three commands below all do the same thing at different levels. The first removes a globally defined attribute, the second, a host visible attribute, and the third, an appliance visible attribute. Note that some attributes, particularly at the global level, are required for proper operation of Stacki. We strongly recommend you only change attributes you have created, or ones that you know exactly what they do.
Stacki Resources
• There is a lot more to Stacki than this few slides can show. Join us at the linksbelow to explore Stacki’s rich command structure and see how it answers yourproblems.
Quick access to Stacki resources:• Visit www.Stacki.com to download a pre-build ISO for RHEL/CentOS 6 & 7 and to sign up
for our charter program• Stacki source code is available on the StackIQ GitHub: https://github.com/StackIQ/stacki• Engage with other users and developers in the Stacki Google Group:
https://groups.google.com/forum/#!forum/stacki
Follow us on Twitter @StackIQ