Skip to content

Commit

Permalink
Merge pull request #118 from martinbalint/051sourcetype
Browse files Browse the repository at this point in the history
Address #107, enable file and puppet sources for deployment and module
  • Loading branch information
jairojunior committed Feb 15, 2016
2 parents b1c46cc + 583e4b2 commit 6c45759
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 29 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,19 @@ or with java_opts instead of java_xmx, java_xms, java_maxpermsize

**From a source:**

Source supports: http:// and ftp://
Source supports: http://, ftp://, puppet://, file:

wildfly::deployment { 'hawtio.war':
source => 'http://central.maven.org/maven2/io/hawt/hawtio-web/1.4.48/hawtio-web-1.4.48.war',
}

wildfly::deployment { 'hawtio.war':
source => 'puppet:///modules/profile/wildfly/hawtio-web-1.4.48.war',
}

wildfly::deployment { 'hawtio.war':
source => 'file:/var/tmp/hawtio-web-1.4.48.war',
}

**To a server-group (domain mode):**

Expand Down Expand Up @@ -250,12 +258,22 @@ And associate groups or roles to them (requires server restart)

## Module installation

Install a JAR module from a remote file system.
Install a JAR module from a remote file system, puppet file server or local file system.

wildfly::config::module { 'org.postgresql':
source => 'http://central.maven.org/maven2/org/postgresql/postgresql/9.3-1103-jdbc4/postgresql-9.3-1103-jdbc4.jar',
dependencies => ['javax.api', 'javax.transaction.api']
}

wildfly::config::module { 'org.postgresql':
source => 'puppet:///modules/profile/wildfly/postgresql-9.3-1103-jdbc4.jar',
dependencies => ['javax.api', 'javax.transaction.api']
}

wildfly::config::module { 'org.postgresql':
source => 'file:/var/tmp/postgresql-9.3-1103-jdbc4.jar',
dependencies => ['javax.api', 'javax.transaction.api']
}

## Datasources

Expand Down
35 changes: 22 additions & 13 deletions manifests/config/module.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,28 @@

$file_name = inline_template('<%= File.basename(URI::parse(@source).path) %>')

exec { "download module from ${source}":
command => "wget -N -P ${dir_path} ${source} --max-redirect=5",
path => ['/bin','/usr/bin', '/sbin'],
loglevel => 'notice',
creates => "${dir_path}/${file_name}",
require => File[$wildfly::dirname],
}

file { "${dir_path}/${file_name}":
owner => $::wildfly::user,
group => $::wildfly::group,
mode => '0755',
require => Exec["download module from ${source}"],
if $source =~ /^(file:|puppet:)/ {
file { "${dir_path}/${file_name}":
owner => $::wildfly::user,
group => $::wildfly::group,
mode => '0755',
source => $source
}
} else {
exec { "download module from ${source}":
command => "wget -N -P ${dir_path} ${source} --max-redirect=5",
path => ['/bin','/usr/bin', '/sbin'],
loglevel => 'notice',
creates => "${dir_path}/${file_name}",
require => File[$wildfly::dirname],
}

file { "${dir_path}/${file_name}":
owner => $::wildfly::user,
group => $::wildfly::group,
mode => '0755',
require => Exec["download module from ${source}"],
}
}

file { "${dir_path}/module.xml":
Expand Down
39 changes: 25 additions & 14 deletions manifests/deployment.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,30 @@
$file_name = inline_template('<%= File.basename(URI::parse(@source).path) %>')
$local_source = "/tmp/${file_name}"

exec { "download deployable from ${source}":
command => "wget -N -P /tmp ${source} --max-redirect=5",
path => ['/bin', '/usr/bin', '/sbin'],
loglevel => 'notice',
creates => $local_source,
if $source =~ /^(file:|puppet:)/ {
file { $local_source:
ensure => 'present',
owner => $::wildfly::user,
group => $::wildfly::group,
mode => '0755',
source => $source
}
} else {
exec { "download deployable from ${source}":
command => "wget -N -P /tmp ${source} --max-redirect=5",
path => ['/bin', '/usr/bin', '/sbin'],
loglevel => 'notice',
creates => $local_source,
}
->
file { $local_source:
ensure => 'present',
owner => $::wildfly::user,
group => $::wildfly::group,
mode => '0755',
}
}
->
file { $local_source:
ensure => 'present',
owner => $::wildfly::user,
group => $::wildfly::group,
mode => '0755',
}
~>

wildfly_deployment { $name:
ensure => $ensure,
server_group => $server_group,
Expand All @@ -35,7 +45,8 @@
host => $::wildfly::mgmt_bind,
port => $::wildfly::mgmt_http_port,
timeout => $timeout,
source => "file:${local_source}"
source => "file:${local_source}",
require => File[$local_source]
}

}

0 comments on commit 6c45759

Please sign in to comment.