diff --git a/README.md b/README.md index 1ebdbed..f7a95d0 100644 --- a/README.md +++ b/README.md @@ -407,7 +407,7 @@ Features -------- Features let you configure call parking and special numbers that trigger -special functionality. The `asterisk::feature` defined type helps you +special functionality. The `asterisk::cfg::feature` defined type helps you configuring such features. The `options` parameter is mandatory. Define features that are contained within feature group "myfeaturegroup": @@ -417,18 +417,18 @@ $ft_options = { 'pausemonitor' => '#1,self/callee,Pausemonitor', 'unpauseMonitor' => '#3,self/callee,UnPauseMonitor', } -asterisk::feature { 'myfeaturegroup': +asterisk::cfg::feature { 'myfeaturegroup': options => $ft_options, } ``` A special section in the features configuration file, namely `[applicationmaps]` lets you define global features. The -`asterisk::feature::applicationmap` defined type helps you configure such a +`asterisk::cfg::feature::applicationmap` defined type helps you configure such a global feature. The `feature` and `value` parameters are mandatory: ```puppet -asterisk::feature::applicationmap { 'pausemonitor': +asterisk::cfg::feature::applicationmap { 'pausemonitor': feature => 'pausemonitor', value => '#1,self/callee,Pausemonitor', } @@ -456,11 +456,11 @@ in this context. Another special context, `applicationmap`, lets you configure dynamic features. To set entries in this context, you should use the -`asterisk::feature::applicationmap` defined type. Note also that for dynamic +`asterisk::cfg::feature::applicationmap` defined type. Note also that for dynamic features to work the DYNAMIC_FEATURES channel variable must be set by listing features enabled in the channel, separated by '#'. -To configure additional feature contexts, you can use the `asterisk::feature` +To configure additional feature contexts, you can use the `asterisk::cfg::feature` defined type. Queues diff --git a/manifests/init.pp b/manifests/init.pp index a8a423c..f4353ba 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -218,7 +218,19 @@ # mess everything up. You can read about this at: # http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues anchor { 'asterisk::begin': } - -> class { '::asterisk::repos': } + -> + case $::operatingsystem { + 'CentOS', 'Fedora', 'Scientific', 'RedHat', 'Amazon', 'OracleLinux': { + # rhel-based + class { '::asterisk::repos::rhel': } + } + 'Debian', 'Ubuntu': { + class { '::asterisk::repos::debian': } + } + default: { + fail("\"${module_name}\" provides no packages for \"${::operatingsystem}\"") + } + } -> class { '::asterisk::install': } -> class { '::asterisk::config': } ~> class { '::asterisk::service': } diff --git a/manifests/install.pp b/manifests/install.pp index fd41d9e..8430a60 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -3,36 +3,29 @@ # TODO: make packages dependend on loaded modules if $asterisk::real_manage_package['manage_package'] { - ensure_packages([ - $asterisk::real_manage_package['package_name'], - "${asterisk::real_manage_package['package_name']}-dahdi", - "${asterisk::real_manage_package['package_name']}-devel", - "${asterisk::real_manage_package['package_name']}-sounds-core-en-alaw.noarch", - "${asterisk::real_manage_package['package_name']}-mysql", - "${asterisk::real_manage_package['package_name']}-iax2", - "${asterisk::real_manage_package['package_name']}-sip", - "${asterisk::real_manage_package['package_name']}-snmp"], - { - 'provider' => 'yum', - 'ensure' => 'present', - 'require' => [ - Yumrepo['asterisk-common'], - Yumrepo['asterisk-13'] - ] + $rhel_packages = ['dahdi', 'devel', 'sounds-core-en-alaw.noarch', 'asterisk-sounds-core-en', 'asterisk-sounds-core-en-gsm', 'mysql', 'iax2', 'sip', 'snmp'] + $debian_packages = ['dahdi', 'dev', 'core-sounds-en', 'mysql'] + case $::operatingsystem { + 'CentOS', 'Fedora', 'Scientific', 'RedHat', 'Amazon', 'OracleLinux': { + $rhel_packages.each |String $package| { + package { "${asterisk::real_manage_package['package_name']}-${package}": + ensure => 'present', + require => [ + Yumrepo['asterisk-common'], + Yumrepo['asterisk-13'] + ] + } + } + } + 'Debian', 'Ubuntu': { + $debian_packages.each |String $package| { + package { "${asterisk::real_manage_package['package_name']}-${package}": + ensure => 'present', + } + } } - ) - - ensure_packages([ - $asterisk::real_manage_package['package_name'], - 'asterisk-sounds-core-en', - 'asterisk-sounds-core-en-gsm', - ], - { - ensure => installed } - ) } - if $asterisk::real_manage_package['manage_directories'] { if has_key($asterisk::real_asterisk_options['directories'], 'astetcdir') and $asterisk::real_asterisk_options['directories']['astetcdir'] != $asterisk::confdir { notify { "The defined 'astetcdir' is different from where this module will generate the configruation in. Please adjust.": diff --git a/manifests/repos/debian.pp b/manifests/repos/debian.pp new file mode 100644 index 0000000..0f1fbb3 --- /dev/null +++ b/manifests/repos/debian.pp @@ -0,0 +1,6 @@ +# Installs the repos needed to install asterisk and it's components +# +class asterisk::repos::debian { + + # nothing right now +} diff --git a/manifests/repos.pp b/manifests/repos/rhel.pp similarity index 98% rename from manifests/repos.pp rename to manifests/repos/rhel.pp index d172122..aff7a8a 100644 --- a/manifests/repos.pp +++ b/manifests/repos/rhel.pp @@ -1,6 +1,6 @@ # Installs the repos needed to install asterisk and it's components # -class asterisk::repos { +class asterisk::repos::rhel { if $asterisk::real_manage_package['manage_repos'] == 'all' or $asterisk::real_manage_package['manage_repos'] == 'only-asterisk' @@ -54,4 +54,4 @@ } } -} \ No newline at end of file +} diff --git a/metadata.json b/metadata.json index 1928642..dc030ef 100644 --- a/metadata.json +++ b/metadata.json @@ -18,6 +18,12 @@ "6", "7" ] + }, + { "operatingsystem": "Debian", + "operatingsystemrelease": [ + "8", + "9" + ] } ], "tags": [ @@ -33,4 +39,3 @@ } ] } -