Puppet Class: odoo

Defined in:
manifests/init.pp

Overview

Install and configure Odoo Community.

Examples:

Declaring the class with Odoo 10

class { '::odoo':
  install_wkhtmltopdf => true,
  settings            => {
    'options' => {
      'admin_passwd' => 'XXX_TOP_SECRET_XXX',
      'db_host'      => 'False',
      'db_port'      => 'False',
      'db_user'      => 'odoo',
      'db_password'  => 'False',
      'addons_path'  => '/usr/lib/python2.7/dist-packages/odoo/addons',
    }
  },
  version             => present,
}

Declaring the class with Odoo 9

class { '::odoo':
  install_wkhtmltopdf => true,
  settings            => {
    'options' => {
      'admin_passwd' => 'XXX_TOP_SECRET_XXX',
      'db_host'      => 'False',
      'db_port'      => 'False',
      'db_user'      => 'odoo',
      'db_password'  => 'False',
      'addons_path'  => '/usr/lib/python2.7/dist-packages/openerp/addons',
    }
  },
  version             => present,
}

Parameters:

  • config_file (string) (defaults to: '/etc/odoo/odoo.conf')

    The Odoo configuration file. Will need to be changed to /etc/odoo/openerp-server.conf for Odoo 9.

  • install_wkhtmltopdf (boolean) (defaults to: false)

    Whether or not to install the optional wkhtmltopdf package.

  • settings (hash) (defaults to: {})

    A hash of settings to be passed to the create_ini_settings (see forge.puppet.com/puppetlabs/inifile#manage-multiple-ini_settings for details).

  • version (string) (defaults to: present)

    The version of the odoo package to be installed. Valid values are present, latest or the version of the version of the package to be installed (i.e. '9.0c.20161009').



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'manifests/init.pp', line 46

class odoo (
  $config_file         = '/etc/odoo/odoo.conf',
  $install_wkhtmltopdf = false,
  $settings            = {},
  $version             = present,
  ) {
  if $install_wkhtmltopdf {
    package { 'wkhtmltopdf':
      ensure => present,
      notify => Service['odoo']
    }
  }

  package { 'odoo':
    ensure => $version,
    notify => Service['odoo']
  }

  if $::osfamily == 'RedHat' {
    exec { '/usr/bin/systemctl daemon-reload':
      refreshonly => true,
      subscribe   => Package['odoo'],
    }
  }

  $defaults = {
    path    => $config_file,
    require => Package['odoo'],
    notify  => Service['odoo'],
  }

  create_ini_settings($settings, $defaults)

  service { 'odoo':
    ensure => running,
    enable => true,
  }
}