Nodes not displaying, console shows xml parsing error - rundeck

I'm having troubles viewing my nodes in a fresh rundeck install. resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<node name="fooweb01"
description="fooweb01" tags="foo,us-east,webserver"
osFamily="unix" osName="Linux"
hostname="fooweb01" username="user"
/>
<node name="fooweb02"
description="fooweb02" tags="foo,us-east,webserver"
osFamily="unix" osName="Linux"
hostname="fooweb02" username="user"
/>
<node name="fooweb03"
description="fooweb03" tags="foo,us-east,webserver"
osFamily="unix" osName="Linux"
hostname="fooweb03" username="user"
/>
<node name="fooweb04"
description="fooweb04" tags="foo,us-east,webserver"
osFamily="unix" osName="Linux"
hostname="fooweb04" username="user"
/>
<node name="foocorp01"
description="foocorp01" tags="foo,us-east,corporate"
osFamily="unix" osName="Linux"
hostname="foocorp01" username="user"
/>
<node name="foocorp02"
description="foocorp02" tags="foo,us-east,corporate"
osFamily="unix" osName="Linux"
hostname="foocorp02" username="user"
/>
<node name="foopartner01"
description="foopartner01" tags="foo,us-east,partner-api"
osFamily="unix" osName="Linux"
hostname="foopartner01" username="user"
/>
<node name="foodb01"
description="foodb01" tags="foo,us-east,cluster-node"
osFamily="unix" osName="Linux"
hostname="foodb01" username="user"
/>
<node name="foodb02"
description="foodb02" tags="foo,us-east,cluster-node"
osFamily="unix" osName="Linux"
hostname="foodb02" username="user"
/>
<node name="foodb03"
description="foodb03" tags="foo,us-east,cluster-node"
osFamily="unix" osName="Linux"
hostname="foodb03" username="user"
/>
<node name="foolb01"
description="foolb03" tags="foo,us-east,haproxy"
osFamily="unix" osName="Linux"
hostname="foolb03" username="user"
/>
<node name="foolb02"
description="foolb03" tags="foo,us-east,haproxy"
osFamily="unix" osName="Linux"
hostname="foolb03" username="user"
/>
<node name="foojobs01"
description="foojobs03" tags="foo,us-east,docker-services"
osFamily="unix" osName="Linux"
hostname="foojobs03" username="user"
/>
<node name="foomonitor"
description="Ops Host" tags="foo,us-east,monitor"
osFamily="unix" osName="Linux"
hostname="foomonitor" username="user"
/>
</project>
project.properties in the same folder
project.resources.file=/var/lib/rundeck/projects/cron_jobs/etc/resources.xml
resources.source.1.type=file
resources.source.1.config.file=/var/lib/rundeck/projects/cron_jobs/etc/resources.xml
resources.source.1.config.format=resourcexml
resources.source.1.config.requireFileExists=true
resources.source.1.config.includeServerNode=true
resources.source.1.config.generateFileAutomatically=true
project.resources.file=/var/lib/rundeck/projects/cron_jobs/etc/resources.xml was a recent test that didn't help. When i load project/cron_jobs/nodes in the browser console i see
XML Parsing Error: syntax error
Location: https://example.org/project/cron_jobs/nodes
Line Number 1: Column 1:
There are no errors in the logs, i have reimported the project each time i make a change to the file, which has not been frequent.
This is driving me crazy, looking for another pair of eyes. All other pages work fine.

Rundeck enumerates their model sources (for example: 1=your resources.xml file, 2=ansible inventory, 3=ec2 nodes, etc.) in your case, the first one is the resources.xml file.
Just delete the project.resources.file=/var/lib/rundeck/projects/cron_jobs/etc/resources.xml line and save.
I created a new project (on Rundeck 3.3.10), deleted the first model source (local), added your resources.xml file (which works like a charm) as first model source and the project.properties looks in the following way:
#Fri Mar 26 08:53:10 CLST 2021
#edit below
project.disable.executions=false
project.disable.schedule=false
project.execution.history.cleanup.batch=500
project.execution.history.cleanup.enabled=false
project.execution.history.cleanup.retention.days=60
project.execution.history.cleanup.retention.minimum=50
project.execution.history.cleanup.schedule=0 0 0 1/1 * ? *
project.jobs.gui.groupExpandLevel=1
project.name=ProjectEXAMPLE
project.nodeCache.enabled=true
project.nodeCache.firstLoadSynch=true
project.output.allowUnsanitized=false
project.ssh-authentication=privateKey
project.ssh-command-timeout=0
project.ssh-connect-timeout=0
project.ssh-keypath=/home/user/.ssh/id_rsa
resources.source.1.config.file=/path/to/your/resources.xml
resources.source.1.config.format=resourcexml
resources.source.1.config.generateFileAutomatically=true
resources.source.1.config.writeable=true
resources.source.1.type=file
service.FileCopier.default.provider=jsch-scp
service.NodeExecutor.default.provider=jsch-ssh
And the nodes on "Nodes" page.

Related

Is there any way to disable the rank order in rundeck?

I have nodes abcd1,abcd2,abcd3,abcd4
Input = abcd1,abcd3,abcd4,abcd2
If the rank order ascending - execution follows- abcd1,abcd2,abcd3,abcd4 order
IF the rank order descending - execution follows -abcd4,abcd3,abcd2,abcd1 order
.
I want my executions to follow same order as input i.e, abcd1,abcd3,abcd4,abcd2 . How can this be achieved?
You can use the "Rank Attribute" option on your job definition, for that, just define (or use) some attribute on your node source and Rundeck use it, for example, using this resources.xml (check myorder custom attribute):
<?xml version="1.0" encoding="UTF-8"?>
<project>
<node name="node00" description="Node 00" tags="" myorder="02" hostname="192.168.33.20" osArch="amd64" osFamily="unix" osName="Linux" osVersion="3.10.0-1062.4.1.el7.x86_64" username="vagrant" ssh-key-storage-path="keys/rundeck"/>
<node name="node01" description="Node 01" tags="" myorder="03" hostname="192.168.33.21" osArch="amd64" osFamily="unix" osName="Linux" osVersion="3.10.0-1062.4.1.el7.x86_64" username="vagrant" ssh-key-storage-path="keys/rundeck"/>
<node name="node02" description="Node 02" tags="" myorder="01" hostname="192.168.33.22" osArch="amd64" osFamily="unix" osName="Linux" osVersion="3.10.0-1062.4.1.el7.x86_64" username="vagrant" ssh-key-storage-path="keys/rundeck"/>
</project>
Now set set "Rank Attribute" textbox with myorder attribute, save the job and run again. You can see the order based on that attribute.
More information here.
UPDATE 30/07/2020:
Following the first comment of this answer, exist a way to modify the resource.xml file with a bash script, later update the node definition and later launch the child job to new rankAttribute order using Job Reference Step.
First, the script that changes the Rundeck Model Source (needs xmlstarlet):
#!/bin/bash
path=$RD_OPTION_PATH
myorder=$RD_OPTION_NODE_ORDER
counter=1
Field_Separator=$IFS
# set comma as internal field separator for the string list
IFS=,
for value in $myorder;
do
echo $counter
xmlstarlet ed --inplace -u "/project/node[$counter][#myorder]/#myorder" -v $value $path
counter=$((counter+1))
done
IFS=$Field_Separator
Now, the Parent Job (that calls the script above, refresh the Rundeck Model Source and finally launch the "target" job):
<joblist>
<job>
<context>
<options preserveOrder='true'>
<option name='node_order' value='3,2,1' />
<option name='path' required='true' value='/home/m68k/Rundeck/resources/farm.xml' />
</options>
</context>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>860e7189-f399-47c4-ab86-5b47017188dd</id>
<loglevel>INFO</loglevel>
<name>Parent</name>
<nodeFilterEditable>true</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='sequential'>
<command>
<description>Just a message</description>
<exec>echo "Starting..."</exec>
</command>
<command>
<description>Call the script</description>
<fileExtension>.sh</fileExtension>
<scriptargs />
<scriptfile>/home/m68k/Downloads/TEST.sh</scriptfile>
<scriptinterpreter>/bin/bash</scriptinterpreter>
</command>
<command>
<description>Refresh Rundeck Model Source</description>
<step-plugin type='source-refresh-plugin'>
<configuration>
<entry key='sleep' value='5' />
</configuration>
</step-plugin>
</command>
<command>
<description>And launch the "target" job against the new node order</description>
<jobref name='Child' nodeStep='true'>
<uuid>0e02890e-c9dd-4a65-ace1-bfe90b9b7a8e</uuid>
</jobref>
</command>
</sequence>
<uuid>860e7189-f399-47c4-ab86-5b47017188dd</uuid>
</job>
</joblist>
And finally, the Child Job, the "target job".
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<dispatch>
<excludePrecedence>true</excludePrecedence>
<keepgoing>false</keepgoing>
<rankAttribute>myorder</rankAttribute>
<rankOrder>ascending</rankOrder>
<successOnEmptyNodeFilter>false</successOnEmptyNodeFilter>
<threadcount>1</threadcount>
</dispatch>
<executionEnabled>true</executionEnabled>
<id>0e02890e-c9dd-4a65-ace1-bfe90b9b7a8e</id>
<loglevel>INFO</loglevel>
<name>Child</name>
<nodeFilterEditable>false</nodeFilterEditable>
<nodefilters>
<filter>node.*</filter>
</nodefilters>
<nodesSelectedByDefault>true</nodesSelectedByDefault>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>echo "Hello ${node.name}"</exec>
</command>
</sequence>
<uuid>0e02890e-c9dd-4a65-ace1-bfe90b9b7a8e</uuid>
</job>
</joblist>
So, if you set 3,1,2 order, you can see the result on myorder attribute on resources.xml file and the child job executes on that order.
<?xml version="1.0"?>
<project>
<node name="node00" description="Node 00" tags="" hostname="192.168.33.20" osArch="amd64" osFamily="unix" osName="Linux" osVersion="3.10.0-1062.4.1.el7.x86_64" username="vagrant" ssh-key-storage-path="keys/rundeck" myorder="3"/>
<node name="node01" description="Node 01" tags="" hostname="192.168.33.21" osArch="amd64" osFamily="unix" osName="Linux" osVersion="3.10.0-1062.4.1.el7.x86_64" username="vagrant" ssh-key-storage-path="keys/rundeck" myorder="1"/>
<node name="node02" description="Node 02" tags="" hostname="192.168.33.22" osArch="amd64" osFamily="unix" osName="Linux" osVersion="3.10.0-1062.4.1.el7.x86_64" username="vagrant" ssh-key-storage-path="keys/rundeck" myorder="2"/>
</project>

Is there an option to specify multiple user names for remote execution on the same node?

Is there anyway i can access the same node via 2 different users (appuser,webuser) to execute scripts?
Will it be ambiguous if there is another entry made for the same node with different username?
test1:
hostname: "10.35.20.76"
nodename: "test1"
osArch: "x86"
osFamily: "unix"
osName: "Solaris"
osVersion: "11.4"
tags: "TEST"
username: "appuser"
A good option to do that is to use a job option pointing to your resources file, in this way:
Job Definition example:
<joblist>
<job>
<context>
<options preserveOrder='true'>
<option name='opt1' value='vagrant' />
</options>
</context>
<defaultTab>nodes</defaultTab>
<description></description>
<dispatch>
<excludePrecedence>true</excludePrecedence>
<keepgoing>false</keepgoing>
<rankOrder>ascending</rankOrder>
<successOnEmptyNodeFilter>false</successOnEmptyNodeFilter>
<threadcount>1</threadcount>
</dispatch>
<executionEnabled>true</executionEnabled>
<id>eaf3f18e-97c0-4c85-b2fd-9a0b8dd8696e</id>
<loglevel>INFO</loglevel>
<name>HelloWorld</name>
<nodeFilterEditable>false</nodeFilterEditable>
<nodefilters>
<filter>name: node00</filter>
</nodefilters>
<nodesSelectedByDefault>true</nodesSelectedByDefault>
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>echo "done"</exec>
</command>
</sequence>
<uuid>eaf3f18e-97c0-4c85-b2fd-9a0b8dd8696e</uuid>
</job>
</joblist>
Resources.xml example (check the "username" attribute):
<?xml version="1.0" encoding="UTF-8"?>
<project>
<node name="mylocalhost" description="Rundeck server node" tags="" hostname="mylocalhost" osArch="amd64" osFamily="unix" osName="Linux" osVersion="5.15.0-66-generic" username="jdoe"/>
<node name="node00" description="Node 00" tags="" hostname="192.168.33.20" osArch="amd64" osFamily="unix" osName="Linux" osVersion="4.10.0-1062.4.1.el7.x86_64" username="${option.opt1}" ssh-key-storage-path="keys/rundeck"/>
</project>
Also, you can do the same using passwords. Take a look at this.

Why the node's name in the console is different that the one in .launch file?

I am working with the bebop_driver package and running the bebop_driver_node.
The bebop_node.launch file is like this:
<?xml version="1.0"?>
<launch>
<arg name="namespace" default="bebop" />
<arg name="ip" default="10.202.0.1" />
<arg name="drone_type" default="bebop2" /> <!-- available drone types: bebop1, bebop2 -->
<arg name="config_file" default="$(find bebop_driver)/config/defaults.yaml" />
<arg name="camera_info_url" default="package://bebop_driver/data/$(arg drone_type)_camera_calib.yaml" />
<group ns="$(arg namespace)">
<node pkg="bebop_driver" name="bebop_driver" type="bebop_driver_node" output="screen">
<param name="camera_info_url" value="$(arg camera_info_url)" />
<param name="bebop_ip" value="$(arg ip)" />
<rosparam command="load" file="$(arg config_file)" />
</node>
<include file="$(find bebop_description)/launch/description.launch" />
</group>
</launch>
But when I run rosnode list I receive :
/bebop/bebop_driver
Since I am trying to use the rospy.init_node('node_name') this is a problem because I cant type a namespace.
The namespace and name of your node is defined in the launch file. You can find the documentation at thr ROS wiki: roslaunch/XML.
Namespace:
Since you are using a group, the node will be placed in it's namespace, defined by the ns attribute:
<group ns="$(arg namespace)">
In your case the namespace is defined by the argument namespace which is bebop by default:
<arg name="namespace" default="bebop" />
Note that multiple and nested groups are also possible to create namespaces.
Node name:
The node name is specified by its name attribute:
<node [...] name="bebop_driver" [...]
The result is bebop/bebop_driver what you can see by calling rosnode list.

CXF wadl2java generate code from grammar

The code generation with for the methods works fine, but it seems to me that the grammar part is omitted because no Pojo and JAXB annotations are generated. Do I have to specify some additional configuration? I used this command: wadl2java.bat -p packagename /path/to/wadl
Here is a snippet of the wadl.
<application
xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.tns.de">
<grammer>
<xsd:include href="file1.xsd"></xsd:include>
<xsd:include href="file2.xsd"></xsd:include>
<xsd:include href="file3.xsd"></xsd:include>
<xsd:include href="file14.xsd"></xsd:include>
</grammer>
<resources base="http:localhost:8080/rest">
<resource path="status/{id}" id="statusId">
<param name="id" type="xsd:unsignedInt" required="true" default="" style="template"/>
<method name="GET" id="getById">
<request>
<representation mediaType="application/json" element="tns:type1"/>
</request>
<response>
<representation mediaType="application/json" element="tns:type2"/>
</response>
</method>
....
I found my mistake. There was a typo in the wadl. Previously I used <grammer> but you have to use <grammars>
Now it works.
<application
xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.tns.de">
<grammars>
<include href="file1.xsd"></xsd:include>
<include href="file2.xsd"></xsd:include>
<include href="file3.xsd"></xsd:include>
<include href="file14.xsd"></xsd:include>
</grammars>
<resources base="http:localhost:8080/rest">
<resource path="status/{id}" id="statusId">
<param name="id" type="xsd:unsignedInt" required="true" default="" style="template"/>
<method name="GET" id="getById">
<request>
<representation mediaType="application/json" element="tns:type1"/>
</request>
<response>
<representation mediaType="application/json" element="tns:type2"/>
</response>
</method>

Setting multiple Phing properties from command line

<?xml version="1.0" ?>
<project name="first" basedir="." default="build-skeleton">
<property name="dirName" value="module" />
<property name="fileName" value="config" />
<target name="build-skeleton" description="Making folders">
<mkdir dir="./${dirName}/Block" />
<touch file="./${dirName}/etc/${fileName}.xml" />
</target>
</project>
phing -f mage_module.xml -DdirName=moduleX,fileName=config
phing -f mage_module.xml -DdirName=moduleX fileName=config
Both throw an error - no surprise there.
Is it possible to set multiple properties in Phing via command line?
Just repeating the -D parameter should work:
phing -f mage_module.xml -DdirName=moduleX -DfileName=config