post_install, post_install_args and script output logs ?

0

Hi all,

I am trying to setup NIS on the Cluster.
Therefore I am writing a script to add the needed packages and run the configuration commands, start services and so on.

My questions:

  1. What can be used as "post_install_args" ? Is it possible to have there the MASTER_IP? How?
  2. How can I differentiate if the script is running on the master or on a compute node?
  3. Where is the output of the script? Can I send it to /tmp/script.log or something similar on the node being installed?

Many thanks,
Richard

rems
asked 5 years ago193 views
3 Answers
0

Hi,

the post_install_args content is passed as argument to the post_install script:
https://github.com/aws/aws-parallelcluster-cookbook/blob/v2.3.1/files/default/fetch_and_run#L24

It is possible to differentiate between master and compute nodes execution by sourcing the /etc/parallelcluster/cfnconfig file and evaluating the cfn_node_type environment variable, whose possible values are MasterServer and ComputeFleet for the master and compute node respectively.

#!/bin/bash

. "/etc/parallelcluster/cfnconfig"

case "${cfn_node_type}" in
    MasterServer)
        echo "I am the master" >> /tmp/master.txt
    ;;
    ComputeFleet)
        echo "I am a compute node" >> /tmp/compute.txt
    ;;
    *)
        ;
esac

In the /etc/parallelcluster/cfnconfig file of the Compute instances you can also find the master ip, in the cfn_master variable.

The output of the pre/post-install scripts can be found in the /var/log/cfn-init.log and /var/log/cfn-init-cmd.log files.

Please refer to the official docs:
https://aws-parallelcluster.readthedocs.io/en/latest/pre_post_install.html
https://aws-parallelcluster.readthedocs.io/en/latest/configuration.html#pre-install

I just created a patch to clarify the documentation and add an example for the post_install_args usage: https://github.com/aws/aws-parallelcluster/commit/02c08c177c1e732010f62439f08a6939858a379e

Let us know if it helps

AWS
answered 5 years ago
0

Hi Enrico,

yes, your answer helps a lot !
And yes, I am following the official docs, but either I am not finding all answers or not understanding it.
Now I don't get my post_install script to start, post_install shows as NONE, despite me setting an URL to an s3 bucket script in my config. I'll write a new post on this, if the Forum allows me to send a new one, to many post restrictions here ...

Many thanks,
Richard

rems
answered 5 years ago
0

Can you please post your config? (redact any keys you have in it)

Also if the forum post restrictions are bothering you, you can always open a github issue: https://github.com/aws/aws-parallelcluster/issues

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions