Ask Your Question

How to check the operating system name,version & how to print the message on agent side according to this O.S.?

asked 2015-03-16 09:10:17 -0600

akshay gravatar image

I m trying to find the O.S. version of agent machine *E.g. If the agent machine is 32 bit then I want to print the message on agent side is* "The Machine is 32 bit O.S." * So what code I should written in my puppet manifest.? Please help me for that question. It is very important for me and I am no idea about how to print the message on agent side. Please please help me. Please give me a sample code. Please anyone help me.*

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-03-16 15:03:41 -0600

lorcutt gravatar image

You didn't say what OS you're using. I don't work with WIndows so I can't help you there, but with linux the following would work:

notify { "The machine architecture is $::architecture":}

Using apply I get:

[root@server state]# puppet apply -e "notify{\"The machine architecture is $::architecture\":}"
Notice: Compiled catalog for in environment production in 0.04 seconds
Notice: The machine architecture is x86_64
Notice: /Stage[main]/Main/Notify[The machine architecture is x86_64]/message: defined 'message' as 'The machine architecture is x86_64'
Notice: Finished catalog run in 0.05 seconds

The variable $::architecture doesn't quite come out in the form 32 or 64, but with a little effort you can exactly what you want.

edit flag offensive delete link more


I want to check the agent machine i.e.32 bit or 64 bit. I m also working on linux machine. I want to check only machine architecture so I m installing the compatible packages on that machine according to that bit(32 or 64) So how to check in script? Is there use of if condition or any loops? Help me

akshay gravatar imageakshay ( 2015-03-17 00:26:03 -0600 )edit

answered 2015-03-17 02:13:08 -0600

YOGESH DANGCHE gravatar image

node 'nodename' { if ($operatingsystem == 'OSname'') and ($architecture == 'x8664' ) { notify{ 'This module is worked successfully.': } include classname } elsif ($operatingsystem == 'OS_name') and ($architecture == 'i686') { notify{ 'This module is not working properly.': } }

} try this code. hope this helps.

edit flag offensive delete link more


Thank u so much my friend yogesh. You are solved my big issue. Thanks for such help man.

akshay gravatar imageakshay ( 2015-03-17 02:31:25 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-16 09:10:17 -0600

Seen: 5,935 times

Last updated: Mar 17 '15