Which command works in `jboss` 6.3 to check server status? - jboss6.x

I am trying to check servers status in domain mode in jboss 6.3 , I cant find the appropriate command, this is the only close I could get to it
[domain#zlt09196:9999 /] :read-attribute(name=server-state)
{
"outcome" => "failed",
"failure-description" => "JBAS014792: Unknown attribute server-state",
"rolled-back" => true
}
[domain#zlt09196:9999 /]
it says server-state as unknown

command you are using is specific to standalone mode, for domain mode use below CLI command:
/host=/server=:read-attribute(name=server-state)

Related

How to provide a startup service file in Puppet

We have RedHat 7.2 Linux OS and use puppet to perform our tasks. I am using puppet to install some software, which has worked fine and now the final step is to create an OS level service. In earlier versions of RHEL, we used chkconfig but that has been replaced with systemctl. Of course, the recommended way of performing this task is using a service. Since this is a custom software, I have my own startup script that I usually copy over to /etc/init.d, run chkconfig and then startup the service. How do I perform these tasks via Puppet for RedHat 7.2 OS ? I only want to create the service (not start it up or anything). This way, when the server reboots, the service will startup the app.
EDIT :
#redstonemercury for RHEL 7 I would think the following would be required. But your suggestion definitely helps as I was thinking along the same lines.
https://serverfault.com/questions/814611/puppet-generated-systemd-unit-files
file { '/lib/systemd/system/myservice.service':
mode => '0644',
owner => 'root',
group => 'root',
content => template('modulename/myservice.systemd.erb'),
}~>
exec { 'myservice-systemd-reload':
command => 'systemctl daemon-reload',
path => [ '/usr/bin', '/bin', '/usr/sbin' ],
refreshonly => true,
}
In puppet, use a package resource to install the package (assuming it's in repos that you're declaring already), then use a file resource to declare the /etc/init.d file, and put require => Package[<package_resource_name>] as a parameter in the file declaration to ensure the custom file gets created after the package has installed (so doesn't potentially get overwritten by the package's /etc/init.d file). E.g.:
package { 'mypackage':
ensure => present,
}
file { '/etc/init.d/mypackage':
ensure => present,
content => template('mypackage/myinitd'),
require => Package['mypackage'],
}
This is if you want to use a template. For a file, instead of content use source: source => puppet://modules/mypackage/myinitd

Troubleshooting Puppet Manifests for Windows puppet Node

I have puppet manifests which would download exe file and get installed in windows server.I am getting an error while running command: puppet agent -t on windows server.
Manifests file: /etc/puppet/modules/mercury/manifests/iisserver.pp
class mercury::iisserver {
download_file { "Download dotnet core 2":
url => 'http://download.microsoft.com/download/7/3/A/73A3E4DC-F019-47D1-9951-0453676E059B/dotnet-sdk-2.0.2-win-gs-x64.exe',
destination_directory => 'C:/dotnet-sdk-2.0.2-win-gs-x64.ex',
notify => Package["dotnercore2"],
}
package { "dotnercore2":
ensure => installed,
source => "C:/dotnet-sdk-2.0.2-win-gs-x64.exe",
require => File["C:/dotnet-sdk-2.0.2-win-gs-x64.exe"],
}
}
Error on windows server after running Puppet agent -t:
Error :Could not retreive catalog from remote server:error 400 on server:Syntax error at 'Stdlib::HTTPUrl'; Expected')' at /etc/puppet/modules/download_file/manifests/init.pp on node XXXX
Warning : not using cache on failed catalog.
Error: Could not retrieve catalog; Skipping run
If you look closely, your error output shows what is wrong. There is a Syntax error with your HTTPUrl on your /etc/puppet/modules/download_file/manifests/init.pp file. It is expecting a ')' character somewhere. Could you recheck your manifest for the download_file module or post it here so that we can review :)

How do I run a Puppet Manifest on a Windows server with Puppet Agent?

I have done it in the past. I don't know why I cannot do it this way below. I am using CentOS 7 for the Puppet Master server. I am using Windows Server 2012 with Puppet Agent.
All the content below was taken from the Puppet Master server. Here is site.pp (which is in /etc/puppet/manifests):
node 'fqdnOfWindowsServer' { import 'good.pp'}
node 'fqdnOfLinuxServer' {}
Here is good.pp (which is in /etc/puppet/manifests):
file { 'c:/fun.ps1':
ensure => 'present',
source => '/tmp/special.ps1',
source_permissions => 'ignore',
}
Here is what happens when I run puppet agent -t:
...Caching catalog for fqdnOfLinuxServer... Error: Failed to apply
catalog: Parameter path failed on File[c:/fun.ps1]: File paths must be
fully qualified, not 'c:/fun.ps1' at /etc/puppet/manifests/good.pp:5
How do I input a fully qualified path? It seems to be having a problem with a Windows server as the Puppet Agent. Paths are different from Linux Puppet Agents.
From what I can make of the error message, you're trying to create a Windows file resource on a Linux server (the error mentions caching catalog for fqdnOfLinuxServer). If that's the case, the error message makes sense because on Linux, the agent expects file paths to start with a forward slash.

Puppet Network module sets enable on every run

Using razorsedge-network (v3.6.0)
On every puppet run, I get the following:
Notice: /Stage[main]/Network/Service[network]/enable: enable changed 'false' to 'true'
Client is running CentOS 7.1, tried with agents 4.2.1 and 4.2.3.
Puppetmaster is PE 2015
It seems to rely on SysV scripts, but that has everything set correctly:
[root#srv08 ~]# service network status
Configured devices:
lo ens160
Currently active devices:
lo ens160
[root#srv08 ~]# echo $?
0
The manifest is called as:
class profiles::networking {
$allinterfaces = split($::interfaces, ',')
$pri_if = $allinterfaces[0]
::network::if::static {$pri_if:
ensure => hiera('network::if::static:ensure'),
ipaddress => hiera('network::if::static:ipaddress'),
netmask => hiera('network::if::static:netmask'),
gateway => hiera('network::if::static:gateway'),
peerdns => true,
dns1 => hiera('network::if::static:dns1'),
dns2 => hiera('network::if::static:dns2'),
domain => hiera('network::if::static:domain'),
}
}
Hiera in turn returns the single value
Because the network service doesn't remain up after you start it. So at each invocation the service is seen as "exited" and puppet is trying to start it again
Not the proper way I am sure, but I 'solved' it by adding this to my manifest:
file_line { 'Kill enabled':
ensure => 'absent',
line => ' enable => true,',
path => '/etc/puppetlabs/code/environments/production/modules/network/manifests/init.pp',
}
So basically remove the enable line. I had to do it in the manifest as the module is controlled by Puppetfile, this will ensure it stays absent.

Running a command once after a group of packages is installed

I have an existing puppet manifest which installs a bunch of php5 packages and only after being installed restarts apache. The simplified manifest is something like
package { 'apache-php':
name => $modules,
ensure => installed
}
exec {'enable-mod-php':
command => $enable_cmd,
refreshonly => true
}
Package['apache-php'] ~> Exec['enable-mod-php'] ~> Service['apache']
After a system upgrade catalog runs have started failing with the following error message:
Error: Failed to apply catalog: Parameter name failed on Package[apache-php]: Name must be a String not Array at /etc/puppet/modules/apache/manifests/php.pp:22
I found out that I was using an undocumented feature/bug: Puppet 3.4.0 name as an array in package.
However, I'm having a hard time finding out how to redo my setup after the upgrade. How can I rewrite this manifest so that it works with more recent puppet versions?
Instead of using an arbitrary title for the package define in your example. (eg. apache-php) and using a name parameter, you can do the following:
$modules = ['foo','bar','baz']
package { $modules:
ensure => present
notify => Exec['enable-mod-php']
}
exec {'enable-mod-php':
command => $enable_cmd,
refreshonly => true,
notify => Service['apache']
}
service { 'apache':
# your apache params
}
I haven't looked at the code for the package provider, but can verify that the above works. You should also note that chaining arrows are all well and good, but according to the Puppet style guide, metaparameters are preferred.
Hope this helps.

Resources