xcat2 / xcat-core

Code repo for xCAT core packages
Eclipse Public License 1.0
360 stars 171 forks source link

help with postbootscripts ( how - to ) #5575

Closed techie879 closed 6 years ago

techie879 commented 6 years ago

Hi,

I can't get my head wrapped up about how to do 'postbootscripts' in Xcat world. I have an ansible hook that I want Xcat to run after the node is imaged and rebooted the first time after the initial image is done. Where do I go about setting up 'postbootscript' to do that?

Currently I have the following postscripts defined for the group:

lsdef -l -t group -o compute75 Object name: compute75 grouptype=static members=compute-7-7,dtn-2,dtn-1,nas-7-8,test-xcat1 os=centos7.5 postscripts=confignics -s,setupntp,CentOS7xInitPost provmethod=centos7.5-x86_64-install-compute

But these are all done before the node reboots for the first time after installation is complete. I want to run this ansible platbook after the node reboots, as a 'postbootscript'. what is a typical format of a 'postbootscript' file and what do I need to do to plug that in for a group?

thanks.

bybai commented 6 years ago

Hi @techie879, In centos diskful OS provision, postscripts will be run before the node reboots for the first time after installation is complete, postbootscripts will be run after the node reboots for the first time after installation is complete.

You can get more help information from tabdump -d postscripts.

The right process:

  1. copy your scripts under xcat MN /install/postscripts/ directory
  2. Use chdef to append your postscripts or postbootscripts. "xcatdefaults" scripts will be assigned to node automatically, they can not be removed.
    chdef <noderange> -p postscripts="<your-scripts>" postbootscripts="<your-postbootscripts>"
whowutwut commented 6 years ago

@techie879 Thank you for bringing up this issue! I have also been struggling with a more easier way for new users to understand at what point in time in the provisioning process, scripts are executed.

After looking at our documentation on prescripts/postscripts, it does seem there is some incorrect information there and after we resolve your problem, we will fix up the documentation based on the findings here.

techie879 commented 6 years ago

hi Victor, thanks.

Can you guys at least tell me some detailed information about postbootscripts? I am working on a setup for a cluster right now. You can update documentation later :-)

thanks

On Fri, Aug 31, 2018 at 7:26 AM Victor Hu notifications@github.com wrote:

@techie879 https://github.com/techie879 Thank you for bringing up this issue! I have also been struggling with a more easier way for new users to understand at what point in time in the provisioning process, scripts are executed.

After looking at our documentation on prescripts/postscripts, it does seem there is some incorrect information there and after we resolve your problem, we will fix up the documentation based on the findings here.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xcat2/xcat-core/issues/5575#issuecomment-417680859, or mute the thread https://github.com/notifications/unsubscribe-auth/AXGJc97fut3I0pjTNisdXfBhRbTJ7zGgks5uWUd9gaJpZM4WUGFo .

-- Regards, Imam Toufique 213-700-5485

whowutwut commented 6 years ago

@techie879 Sure, like @bybai said above

In centos diskful OS provision, postscripts will be run before the node reboots for the first time after installation is complete, postbootscripts will be run after the node reboots for the first time after installation is complete.

What is the piece that's not working in your environment?

The scripts need to be in /install/postscripts on the MN node... they can be in subdirectories, but you would need to pass a relative path.

For example:

/install/postscripts/custom/script1

You would add this by doing chdef <node> -p postscripts=custom/script1 or chdef <node> -p postbootscripts=custom/script1

You can test the script outside of provisioning by running updatenode <node> -P "path/to/script"

techie879 commented 6 years ago

Hi Victor,

Thanks for the clarification.

If I set a postbootscript for a node, as you showed in your example above, will this script run every time the node reboots? Or, is it just the first time when the node reboots after the initial installation?

Also, instead of setting a script on a per-node basis ( as you showed with your chdef -p ... command ) , can this be setup on a group (?), so any node that belongs to that particular group ( i.e. centos75 ) will inherit that postbootscript?

Thanks again!

--imam

On Fri, Aug 31, 2018 at 10:22 AM Victor Hu notifications@github.com wrote:

@techie879 https://github.com/techie879 Sure, like @bybai https://github.com/bybai said above

In centos diskful OS provision, postscripts will be run before the node reboots for the first time after installation is complete, postbootscripts will be run after the node reboots for the first time after installation is complete.

What is the piece that's not working in your environment?

The scripts need to be in /install/postscripts on the MN node... they can be in subdirectories, but you would need to pass a relative path.

For example:

/install/postscripts/custom/script1

You would add this by doing chdef -p postscripts=custom/script1 or chdef -p postbootscripts=custom/script1

You can test the script outside of provisioning by running updatenode

-P "path/to/script" — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

-- Regards, Imam Toufique 213-700-5485

whowutwut commented 6 years ago

@techie879 The postscript runs single time after install of the OS , but before the installer reboots the OS for first boot.

The postbootscript will execute on every node reboot, after the OS comes up.

And yes, you can set this into the group, to make it more manageable across a number of nodes. When you list the definition of the node, you should see the attributes are set for the node, but pulled from the group

techie879 commented 6 years ago

thank you, Victor ! :-)

On Fri, Aug 31, 2018 at 11:25 AM Victor Hu notifications@github.com wrote:

@techie879 https://github.com/techie879 The postscript runs single time after install of the OS , but before the installer reboots the OS for first boot.

The postbootscript will execute on every node reboot, after the OS comes up.

And yes, you can set this into the group, to make it more manageable across a number of nodes. When you list the definition of the node, you should see the attributes are set for the node, but pulled from the group

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xcat2/xcat-core/issues/5575#issuecomment-417751477, or mute the thread https://github.com/notifications/unsubscribe-auth/AXGJc6AlepWlMX1quUqXk-xi1FeXhuD-ks5uWX-kgaJpZM4WUGFo .

-- Regards, Imam Toufique 213-700-5485

immarvin commented 6 years ago

hi @techie879 @whowutwut , for diskful node, postbootscript will be execute during normal reboot only when site. runbootscripts is "yes". The default value of this attribute is "no", which means that postbootscript will only be run during the 1st reboot after installation, will not be run during normal reboots then.

# tabdump -d site|grep runbootscripts -A10
 runbootscripts:  If set to 'yes' the scripts listed in the postbootscripts
                  attribute in the osimage and postscripts tables will be run during
                  each reboot of stateful (diskful) nodes. This attribute has no
                  effect on stateless and statelite nodes. Run the following
                  command after you change the value of this attribute:
                  'updatenode <nodes> -P setuppostbootscripts'
techie879 commented 6 years ago

Thank you, everyone,, who responded to help me. I am getting close setting this up. I will keep you all posted as soon as I get a chance to test.

Thanks again! You guys are all awesome! :-)

On Sun, Sep 2, 2018 at 7:45 PM yangsong notifications@github.com wrote:

hi @techie879 https://github.com/techie879 @whowutwut https://github.com/whowutwut , for diskful node, postbootscript will be execute during normal reboot only when site. runbootscripts is "yes". The default value of this attribute is "no", which means that postbootscript will only be run during the 1st reboot after installation, will not be run during normal reboots then.

tabdump -d site|grep runbootscripts -A10

runbootscripts: If set to 'yes' the scripts listed in the postbootscripts attribute in the osimage and postscripts tables will be run during each reboot of stateful (diskful) nodes. This attribute has no effect on stateless and statelite nodes. Run the following command after you change the value of this attribute: 'updatenode -P setuppostbootscripts'

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xcat2/xcat-core/issues/5575#issuecomment-417986006, or mute the thread https://github.com/notifications/unsubscribe-auth/AXGJc1cMkYQ0nuDux893LKxHdbqIp7YNks5uXJffgaJpZM4WUGFo .

-- Regards, Imam Toufique 213-700-5485

bybai commented 6 years ago

Hi @techie879, We have using postscripts doc in https://xcat-docs.readthedocs.io/en/latest/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/post_script.html?highlight=postscript, in order to make this doc clearer, do you hit any problems during following the steps from this doc?

techie879 commented 6 years ago

To be honest, I have not tried it yet. But, I will , for sure . I have been flooded with other non xcat related issues lately.

I will definitely let you know how it went , very soon.

thanks again so much for all your help!

On Tue, Sep 4, 2018 at 7:21 PM Yuan Bai notifications@github.com wrote:

Hi @techie879 https://github.com/techie879, We have using postscripts doc in https://xcat-docs.readthedocs.io/en/latest/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/post_script.html?highlight=postscript, in order to make this doc clearer, do you hit any problems during following the steps from this doc?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xcat2/xcat-core/issues/5575#issuecomment-418578032, or mute the thread https://github.com/notifications/unsubscribe-auth/AXGJcw4E5sIZ6svgK_QBwzlIYjlrv_Nxks5uXzU4gaJpZM4WUGFo .

-- Regards, Imam Toufique 213-700-5485

bybai commented 6 years ago

@techie879, I think your problems are resolved here, I will set this help request as done, if any needed, you can re-open it later. Thanks

techie879 commented 6 years ago

no problem, thanks.

On Thu, Sep 6, 2018 at 2:21 AM Yuan Bai notifications@github.com wrote:

@techie879 https://github.com/techie879, I think your problems are resolved here, I will set this help request as done, if any needed, you can re-open it later. Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xcat2/xcat-core/issues/5575#issuecomment-419025874, or mute the thread https://github.com/notifications/unsubscribe-auth/AXGJc-7tn0xtX-4rExolymoNrtkJZ11hks5uYOkugaJpZM4WUGFo .

-- Regards, Imam Toufique 213-700-5485

tomers007 commented 1 year ago

I am really confused and need help with the understanding which kind of scripts are running in postscript and which are running postbootscrips . For example configuring ip to ib interface , mount iso , install rpm etc .

Thanks ahead , Hpc beginner ;)

gurevichmark commented 1 year ago

Maybe this will help:

tomers007 commented 1 year ago

Thank you , But it still confusing because I don't understand the whole concept of that , like which type of script (postscript of postbootscript) will run once ? And which one every boot ? Where is the folder to locate the scripts ? And some examples to scripts that needs to run before on the unit d stage .

besawn commented 1 year ago

@tomers007

The answer to your questions depends on whether you are working with a diskful node or a diskless node. For diskful nodes, the OS is installed to the local hard disk of the node. For diskless nodes, the OS is loaded over the network on every reboot.

Which type of script (postscript or postbootscript) will run once?

For diskful nodes: postscripts run once when the OS is installed and postbootscripts run once on the first boot of the node after it has been installed. For diskless nodes: The postinstall script is run one time when the diskless image is generated. It will be re-run any time you regenerate the image.

And which one every boot?

For diskful nodes: By default, no postscripts run on every boot. It is possible to change the postbootscripts to run on every boot by following this procedure:

xCAT, by default, for diskful installs only runs the postbootscripts on the install and not on reboot. In xCAT a site table attribute runbootscripts is available to change this default behavior. If set to yes or y or 1, then the postbootscripts will be run on install and on reboot. To avoid reinstallation, run updatenode -P setuppostbootscripts command to update the value of runbootscripts attribute on the compute or service nodes.

For diskless nodes: postscripts and postbootscripts run on every reboot: postscripts run first, then postbootscripts.

Where is the folder to locate the scripts?

On the management node, the postscripts are located at /install/postscripts. These scripts are then copied to /xcatpost on the compute nodes.

Also please open a new issue if you have further questions, rather than reusing this old issue.