I'm trying to change the domain controller IP address in JBoss/Wildfly managed servers using the management cli, but the configuration either keeps unchanged or changes in the wrong way.
I can find the domain controller settings in /opt/wildfly/domain/configuration/host-slave.xml:
<host xmlns="urn:jboss:domain:4.0">
<domain-controller>
<remote security-realm="ManagementRealm">
<discovery-options>
<static-discovery name="primary" protocol="${jboss.domain.master.protocol:remote}" host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}"/>
</discovery-options>
</remote>
</domain-controller>
</host>
And these were my failed attempts so far:
/opt/wildfly/bin/jboss-cli.sh -Djboss.domain.master.address=192.168.57.13
embed-host-controller --host-config=host-slave.xml
set host=`:read-children-names(child-type=host)`
/host=$host/core-service=discovery-options/static-discovery=primary:write-attribute(name=host,value="${jboss.domain.master.address:192.168.57.13}")
/host=$host:write-remote-domain-controller(host=192.168.57.13,port=9999,security-realm=ManagementRealm)
/host=$host:write-remote-domain-controller(host=192.168.57.13, security-realm=ManagementRealm)
/host=$host:write-remote-domain-controller(host=remote,security-realm=ManagementRealm)
After restarting Wildfly, I get errors like this, making it clear the managed server still doesn't know about the managed domain IP:
WFLYCTL0013: Operation ("add") failed - address: ([
("host" => "gerenciado-centos-7"),
("core-service" => "discovery-options"),
("static-discovery" => "primary")
]) - failure description: "WFLYCTL0211: Cannot resolve expression '${jboss.domain.master.address}'"
The setting I expect to change is host="${jboss.domain.master.address}"
, but it just doesn't.
This is one of my managed servers info:
cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
JAVA_HOME=/usr /opt/wildfly/bin/standalone.sh -v
...
WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final)
Which is the right syntax to point my managed servers to the correct domain controller?
Why don't I just edit the file? Because I need to automate the thing, and I understand the Management CLI is the way to get it done safely.