Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package manager updates #47

Merged
merged 11 commits into from
Sep 2, 2018
Merged
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ fixtures:
repositories:
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
mysql: "git://github.com/puppetlabs/puppetlabs-mysql.git"
apt: "git://github.com/puppetlabs/puppetlabs-apt.git"
symlinks:
proxysql: "#{source_dir}"
51 changes: 8 additions & 43 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,9 @@ You can customize options such as (but not limited to) `listen_port`, `admin_pas
admin_password => '654321',
monitor_password => '123456',
override_config_settings => $override_settings,
repo => {
'debs_proxysql_repo' => {
comment => 'Percona repo',
location => 'http://repo.percona.com/apt',
repos => 'main',
key => {
'id' => '4D1BB29D63D98E422B2113B19334A25F8507EFA5',
'server' => 'keyserver.ubuntu.com',
}
},
},
}
```

On `Yum` based systems you can do and the module will install ProxySQL from the Percona repo's.
```
class { '::proxysql':
listen_port => 3306,
admin_password => '654321',
monitor_password => '123456',
manage_repo => true,
}
```

## Usage

Configuration is done by the `proxysql` class.
Expand Down Expand Up @@ -187,44 +166,30 @@ Specifies wheter te managed ProxySQL resources should be immediately loaded to t
##### `save_to_disk`
Specifies wheter te managed ProxySQL resources should be immediately save to disk. Boolean, defaults to 'true'.

##### `repo`
These are the repo's we will configure. Currently only Debian is supported. This hash will be passed on to `apt::source`. Defaults to {}.

##### `manage_repo`
Determines wheter this module will manage the repositories where ProxySQL might be. Defaults to 'true'

##### `repo`
These are the repo's we will configure. Currently only Debian is supported. This hash will be passed on to `apt::source`. Defaults to {}.
These are the repo's we will configure. Currently only Debian is supported. This hash will be passed on to `apt::source` or `yumrepo` (depending on the OS family).
Defaults to the official upstream repo for your OS. See http://repo.proxysql.com for more info.

##### `manage_rpm`
Determines wheter this module will use local provider instead of the repo to install ProxySQL, defaults to false,

##### `package_source`
location ot the proxysql package for the `package_provider`. Default to 'https://www.percona.com/redir/downloads/proxysql/proxysql-1.3.2/binary/redhat/6/x86_64/proxysql-1.3.2-1.1.x86_64.rpm'
location ot the proxysql package for the `package_provider`.
- Default to 'https://github.com/sysown/proxysql/releases/download/v1.4.7/proxysql-1.4.7-1-centos7.x86_64.rpm' for RedHat based systems
- Default to 'https://github.com/sysown/proxysql/releases/download/v1.4.7/proxysql_1.4.7-ubuntu16_amd64.deb' for Debian based systems

##### `package_provider`
provider for package-resource. defaults to `dpkg` for debian-based, `rpm` for redhat base or `undef` for others

##### `sys_owner`
owner of the datadir and config_file, defaults to 'root' on most systems, to 'proxysql' on redhat-based
owner of the datadir and config_file, defaults to 'root'

##### `sys_group`
group of the datadir and config_file, defaults to 'root' on most systems, to 'proxysql' on redhat-based

##### `rpm_repo_name`
title for the yumrepo-resource in RedHat-based systems, defaults to 'percona_repo'

##### `rpm_repo_descr`
description for the yumrepo-resource in RedHat-based systems, defaults to 'percona_repo_contains_proxysql'

##### `rpm_repo`
repo url for the yumrepo-resource in RedHat-based systems, defaults to 'http://repo.percona.com/release/$releasever/RPMS/$basearch'

##### `rpm_repo_key`
key utl for the yumrepo-resource in RedHat-based systems, defaults to 'https://www.percona.com/downloads/RPM-GPG-KEY-percona'
group of the datadir and config_file, defaults to 'root'

##### `override_config_settings`
Which configuration variables should be overriden. Hash, defaults to {} (empty hash).
Which configuration variables should be overriden. Hash, defaults to `{}` (empty hash).


## Types
Expand Down
7 changes: 0 additions & 7 deletions examples/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
class { '::proxysql':
listen_port => 3306,
admin_password => 'SuperSecretPassword',
repo => {
'debs_proxysql_repo' => {
comment => 'ProxySQL repo',
location => 'http://debs.ugent.be/debian',
repos => 'mysql-dev',
},
},
}

proxy_mysql_server { '192.168.33.31:3306-31':
Expand Down
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
class proxysql::config {

$config_settings = $::proxysql::config_settings
$config_settings = $proxysql::config_settings
if $proxysql::manage_config_file {
file { 'proxysql-config-file':
ensure => file,
Expand Down
87 changes: 38 additions & 49 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -81,81 +81,70 @@
#
# * `repo`
# These are the repo's we will configure. Currently only Debian is supported. This hash will be passed on
# to `apt::source`. Defaults to {}.
# to `apt::source` or `yumrepo` (depending on the OS family).
# Defaults to the official upstream repo for your OS. See http://repo.proxysql.com for more info.
#
# * `package_source`
# location ot the proxysql package for the `package_provider`. Default to 'https://www.percona.com/redir/downloads/proxysql/proxysql-1.3.2/binary/redhat/6/x86_64/proxysql-1.3.2-1.1.x86_64.rpm'
# location ot the proxysql package for the `package_provider`.
# Default to 'https://github.com/sysown/proxysql/releases/download/v1.4.7/proxysql-1.4.7-1-centos7.x86_64.rpm' for RedHat based systems
# Default to 'https://github.com/sysown/proxysql/releases/download/v1.4.7/proxysql_1.4.7-ubuntu16_amd64.deb' for Debian based systems
#
# * `package_provider`
# provider for package-resource. defaults to `dpkg` for debian-based, `rpm` for redhat base or undef for others
#
# * `sys_owner`
# owner of the datadir and config_file, defaults to root on most systems, to proxysql on redhat-based
# owner of the datadir and config_file, defaults to root.
#
# * `sys_group`
# group of the datadir and config_file, defaults to root on most systems, to proxysql on redhat-based
#
# * `rpm_repo_name`
# title for the yumrepo-resource in RedHat-based systems, defaults to 'percona_repo'
#
# * `rpm_repo_descr`
# description for the yumrepo-resource in RedHat-based systems, defaults to 'percona_repo_contains_proxysql'
#
# * `rpm_repo`
# repo url for the yumrepo-resource in RedHat-based systems, defaults to 'http://repo.percona.com/release/$releasever/RPMS/$basearch'
#
# * `rpm_repo_key`
# key utl for the yumrepo-resource in RedHat-based systems, defaults to 'https://www.percona.com/downloads/RPM-GPG-KEY-percona'
# group of the datadir and config_file, defaults to root.
#
# * `override_config_settings`
# Which configuration variables should be overriden. Hash, defaults to {} (empty hash).
#
class proxysql (
String $package_name = $::proxysql::params::package_name,
String $package_ensure = $::proxysql::params::package_ensure,
Array[String] $package_install_options = $::proxysql::params::package_install_options,
String $service_name = $::proxysql::params::service_name,
String $service_ensure = $::proxysql::params::service_ensure,
String $package_name = $proxysql::params::package_name,
String $package_ensure = $proxysql::params::package_ensure,
Array[String] $package_install_options = $proxysql::params::package_install_options,
String $service_name = $proxysql::params::service_name,
String $service_ensure = $proxysql::params::service_ensure,

String $datadir = $::proxysql::params::datadir,
String $datadir = $proxysql::params::datadir,

String $listen_ip = $::proxysql::params::listen_ip,
Integer $listen_port = $::proxysql::params::listen_port,
String $listen_socket = $::proxysql::params::listen_socket,
String $listen_ip = $proxysql::params::listen_ip,
Integer $listen_port = $proxysql::params::listen_port,
String $listen_socket = $proxysql::params::listen_socket,

String $admin_username = $::proxysql::params::admin_username,
Sensitive[String] $admin_password = $::proxysql::params::admin_password,
String $admin_listen_ip = $::proxysql::params::admin_listen_ip,
Integer $admin_listen_port = $::proxysql::params::admin_listen_port,
String $admin_listen_socket = $::proxysql::params::admin_listen_socket,
String $admin_username = $proxysql::params::admin_username,
Sensitive[String] $admin_password = $proxysql::params::admin_password,
String $admin_listen_ip = $proxysql::params::admin_listen_ip,
Integer $admin_listen_port = $proxysql::params::admin_listen_port,
String $admin_listen_socket = $proxysql::params::admin_listen_socket,

String $monitor_username = $::proxysql::params::monitor_username,
Sensitive[String] $monitor_password = $::proxysql::params::monitor_password,
String $monitor_username = $proxysql::params::monitor_username,
Sensitive[String] $monitor_password = $proxysql::params::monitor_password,

String $config_file = $::proxysql::params::config_file,
Boolean $manage_config_file = $::proxysql::params::manage_config_file,
String $config_file = $proxysql::params::config_file,
Boolean $manage_config_file = $proxysql::params::manage_config_file,

String $mycnf_file_name = $::proxysql::params::mycnf_file_name,
Boolean $manage_mycnf_file = $::proxysql::params::manage_mycnf_file,
String $mycnf_file_name = $proxysql::params::mycnf_file_name,
Boolean $manage_mycnf_file = $proxysql::params::manage_mycnf_file,

Boolean $restart = $::proxysql::params::restart,
Boolean $restart = $proxysql::params::restart,

Boolean $load_to_runtime = $::proxysql::params::load_to_runtime,
Boolean $save_to_disk = $::proxysql::params::save_to_disk,
Boolean $load_to_runtime = $proxysql::params::load_to_runtime,
Boolean $save_to_disk = $proxysql::params::save_to_disk,

Boolean $manage_repo = true,
Hash $repo = {},

String $package_source = $::proxysql::params::package_source,
String $package_provider = $::proxysql::params::package_provider,
Hash $repo = $proxysql::params::repo,

String $sys_owner = $::proxysql::params::sys_owner,
String $sys_group = $::proxysql::params::sys_group,
String $package_source = $proxysql::params::package_source,
String $package_checksum_value = $proxysql::params::package_checksum_value,
String $package_checksum_type = $proxysql::params::package_checksum_type,
Array $package_dependencies = $proxysql::params::package_dependencies,
String $package_provider= $proxysql::params::package_provider,

String $rpm_repo_name = $::proxysql::params::rpm_repo_name,
String $rpm_repo_descr = $::proxysql::params::rpm_repo_descr,
String $rpm_repo = $::proxysql::params::rpm_repo,
String $rpm_repo_key = $::proxysql::params::rpm_repo_key,
String $sys_owner = $proxysql::params::sys_owner,
String $sys_group = $proxysql::params::sys_group,

Hash $override_config_settings = {},
) inherits ::proxysql::params {
Expand Down
41 changes: 29 additions & 12 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,42 @@
#
class proxysql::install {

if !$::proxysql::manage_repo {
package { $::proxysql::package_name:
ensure => $::proxysql::package_ensure,
source => $::proxysql::package_source,
provider => $::proxysql::package_provider,
install_options => $::proxysql::package_install_options,
if !$proxysql::manage_repo {
case $facts['os']['family'] {
'Debian': {
archive { '/root/proxysql-package.deb':
ensure => present,
source => $proxysql::package_source,
checksum => $proxysql::package_checksum_value,
checksum_type => $proxysql::package_checksum_type,
}

$real_package_source = '/root/proxysql-package.deb'
}
default: {
$real_package_source = $proxysql::package_source
}
}

ensure_packages($proxysql::package_dependencies)
package { $proxysql::package_name:
ensure => $proxysql::package_ensure,
source => $real_package_source,
provider => $proxysql::package_provider,
install_options => $proxysql::package_install_options,
}
} else {
package { $::proxysql::package_name:
ensure => $::proxysql::package_ensure,
install_options => $::proxysql::package_install_options,
package { $proxysql::package_name:
ensure => $proxysql::package_ensure,
install_options => $proxysql::package_install_options,
}
}

file { 'proxysql-datadir':
ensure => directory,
path => $::proxysql::datadir,
owner => $::proxysql::sys_owner,
group => $::proxysql::sys_group,
path => $proxysql::datadir,
owner => $proxysql::sys_owner,
group => $proxysql::sys_group,
mode => '0600',
}

Expand Down
Loading