Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help with postbootscripts ( how - to ) #5575

Closed
techie879 opened this issue Aug 30, 2018 · 17 comments
Closed

help with postbootscripts ( how - to ) #5575

techie879 opened this issue Aug 30, 2018 · 17 comments

Comments

@techie879
Copy link

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 bybai added this to the 2.14.4 milestone Aug 31, 2018
@bybai bybai added the sprint1 label Aug 31, 2018
@bybai
Copy link
Contributor

bybai commented Aug 31, 2018

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
Copy link
Member

@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
Copy link
Author

techie879 commented Aug 31, 2018 via email

@whowutwut
Copy link
Member

@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
Copy link
Author

techie879 commented Aug 31, 2018 via email

@whowutwut
Copy link
Member

@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
Copy link
Author

techie879 commented Aug 31, 2018 via email

@immarvin
Copy link
Contributor

immarvin commented Sep 3, 2018

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
Copy link
Author

techie879 commented Sep 3, 2018 via email

@bybai
Copy link
Contributor

bybai commented Sep 5, 2018

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
Copy link
Author

techie879 commented Sep 5, 2018 via email

@bybai
Copy link
Contributor

bybai commented Sep 6, 2018

@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
Copy link
Author

techie879 commented Sep 6, 2018 via email

@bybai bybai closed this as completed Sep 7, 2018
@tomers007
Copy link

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 ;)

@tomers007
Copy link

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
Copy link
Member

besawn commented Mar 6, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants