salt.modules.jboss7

Module for managing JBoss AS 7 through the CLI interface.

2015.5.0 新版功能.

In order to run each function, jboss_config dictionary with the following properties must be passed:
  • cli_path: the path to jboss-cli script, for example: '/opt/jboss/jboss-7.0/bin/jboss-cli.sh'
  • controller: the IP address and port of controller, for example: 10.11.12.13:9999
  • cli_user: username to connect to jboss administration console if necessary
  • cli_password: password to connect to jboss administration console if necessary

Example:

jboss_config:
   cli_path: '/opt/jboss/jboss-7.0/bin/jboss-cli.sh'
   controller: 10.11.12.13:9999
   cli_user: 'jbossadm'
   cli_password: 'jbossadm'
salt.modules.jboss7.create_datasource(jboss_config, name, datasource_properties, profile=None)

Create datasource in running jboss instance

jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
datasource_properties
A dictionary of datasource properties to be created:
profile
The profile name (JBoss domain mode only)

CLI Example:

salt '*' jboss7.create_datasource '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' 'my_datasource' '{"driver-name": "mysql", "connection-url": "jdbc:mysql://localhost:3306/sampleDatabase", "jndi-name": "java:jboss/datasources/sampleDS", "user-name": "sampleuser", "password": "secret", "min-pool-size": 3, "use-java-context": True}'
salt.modules.jboss7.create_simple_binding(jboss_config, binding_name, value, profile=None)

Create a simple jndi binding in the running jboss instance

jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
value
Binding value
profile
The profile name (JBoss domain mode only)

CLI Example:

salt '*' jboss7.create_simple_binding \
        '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", \
        "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' \
        my_binding_name my_binding_value
salt.modules.jboss7.deploy(jboss_config, source_file)

Deploy the application on the jboss instance from the local file system where minion is running.

jboss_config
Configuration dictionary with properties specified above.
source_file
Source file to deploy from

CLI Example:

salt '*' jboss7.deploy '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' /opt/deploy_files/my_deploy
salt.modules.jboss7.list_deployments(jboss_config)

List all deployments on the jboss instance

jboss_config
Configuration dictionary with properties specified above.

CLI Example:

salt '*' jboss7.list_deployments '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}'
salt.modules.jboss7.read_datasource(jboss_config, name, profile=None)

Read datasource properties in the running jboss instance.

jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
Profile name (JBoss domain mode only)

CLI Example:

salt '*' jboss7.read_datasource '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}'
salt.modules.jboss7.read_simple_binding(jboss_config, binding_name, profile=None)

Read jndi binding in the running jboss instance

jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
profile
The profile name (JBoss domain mode only)

CLI Example:


salt '*' jboss7.read_simple_binding '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' my_binding_name

salt.modules.jboss7.reload(jboss_config, host=None)

Reload running jboss instance

jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode. The host name is the "name" attribute of the "host" element in host.xml

CLI Example:

salt '*' jboss7.reload '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}'
salt.modules.jboss7.remove_datasource(jboss_config, name, profile=None)

Remove an existing datasource from the running jboss instance.

jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
The profile (JBoss domain mode only)

CLI Example:

salt '*' jboss7.remove_datasource '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' my_datasource_name
salt.modules.jboss7.status(jboss_config, host=None, server_config=None)

Get status of running jboss instance.

jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode. The host name is the "name" attribute of the "host" element in host.xml
server_config
The name of the Server Configuration. JBoss Domain mode only - and required if running in domain mode.

CLI Example:

salt '*' jboss7.status '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}'
salt.modules.jboss7.stop_server(jboss_config, host=None)

Stop running jboss instance

jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode. The host name is the "name" attribute of the "host" element in host.xml

CLI Example:

salt '*' jboss7.stop_server '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}'
salt.modules.jboss7.undeploy(jboss_config, deployment)

Undeploy the application from jboss instance

jboss_config
Configuration dictionary with properties specified above.
deployment
Deployment name to undeploy

CLI Example:

salt '*' jboss7.undeploy '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' my_deployment
salt.modules.jboss7.update_datasource(jboss_config, name, new_properties, profile=None)

Update an existing datasource in running jboss instance. If the property doesn't exist if will be created, if it does, it will be updated with the new value

jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
new_properties
A dictionary of datasource properties to be updated. For example:
profile
The profile name (JBoss domain mode only)

CLI Example:

salt '*' jboss7.update_datasource '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' 'my_datasource' '{"driver-name": "mysql", "connection-url": "jdbc:mysql://localhost:3306/sampleDatabase", "jndi-name": "java:jboss/datasources/sampleDS", "user-name": "sampleuser", "password": "secret", "min-pool-size": 3, "use-java-context": True}'
salt.modules.jboss7.update_simple_binding(jboss_config, binding_name, value, profile=None)

Update the simple jndi binding in the running jboss instance

jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be updated
value
New binding value
profile
The profile name (JBoss domain mode only)

CLI Example:

salt '*' jboss7.update_simple_binding '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' my_binding_name my_binding_value