Forge Home


Install Atlassian stash


6,625 latest version

5.0 quality score

Version information

  • 4.0.0 (latest)
  • 3.1.2
  • 3.1.1
  • 3.1.0
  • 3.0.0
  • 2.0.0
  • 1.3.0
  • 1.2.2
released May 7th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x
  • Puppet >= 5.5.8 < 7.0.0
  • , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'puppet-stash', '4.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppet-stash
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppet-stash --version 4.0.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.



puppet/stash — version 4.0.0 May 7th 2020

Stash module for Puppet

Build Status Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

:warning: This module is going through a number of changes in preparation for version 4 (Bitbucket-server). It is recommended to use the puppet-forge versions and not the github master branch.

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with Stash
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module
  8. Testing - How to test the Stash module
  9. Contributors


This is a puppet module to install Atlassian Stash. On-premises source code management for Git that's secure, fast, and enterprise grade.

Module Version Support Stash versions
1.3.0 3.0.0 - 3.9.2
2.0.0 3.9.2 - 4.x.x

Module Description

This module installs/upgrades Atlassian's Enterprise source code management tool. The Stash module also manages the stash configuration files with Puppet.


Stash Prerequisites

  • Stash requires a Java Developers Kit (JDK) or Java Run-time Environment (JRE) platform to be installed on your server's operating system. Oracle JDK / JRE (formerly Sun JDK / JRE) versions 7 and 8 and Open JDK/ JRE versions 7 and 8 are currently supported by Atlassian.

  • Stash requires a relational database to store its configuration data. This module currently supports PostgreSQL 8.4 to 9.x and MySQL 5.x. We suggest using puppetlabs-postgresql/puppetlabs-mysql modules to configure/manage the database. The module uses PostgreSQL as a default.

  • Whilst not required, for production use we recommend using nginx/apache as a reverse proxy to Stash. We suggest using the jfryman/nginx puppet module.

What Stash affects

If installing to an existing Stash instance, it is your responsibility to backup your database. We also recommend that you backup your Stash home directory and that you align your current Stash version with the version you intend to use with puppet Stash module.

You must have your database setup with the account user that Stash will use. This can be done using the puppetlabs-postgresql and puppetlabs-mysql modules. The mysql java connector can be installed using the puppet/mysql_java_connector module.

When using this module to upgrade Stash, please make sure you have a database/Stash home backup. We plan to include a class for backing up the stash home directory in a future release.

When upgrading stash from < 3.8.0 to >= 3.8.0 puppet will notify the stash service to restart for two puppet runs. This is because the stash upgrade makes file attribute and content changes to the See issue #74

Beginning with Stash

This puppet module will automatically download the Stash tar.gz from Atlassian and extracts it into /opt/stash/atlassian-stash-$version. The default Stash home is /home/stash.

Basic examples

  class { 'stash':
    javahome    => '/opt/java',
  class { 'stash':
    version        => '3.3.0',
    javahome       => '/opt/java',
    dburl          => 'jdbc:postgresql://',
    dbpassword     => $stashpass,

Schedule a weekly git garbage collect for all repositories.

  class { 'stash::gc': }

Enable external facts for stash version.

  class { 'stash::facts': }

Enable a stash backup

  class { 'stash':
    backup_ensure          => present,
    backupclient_version    => '1.6.0',
    backup_home            => '/opt/stash-backup',
    backupuser             => 'admin',
    backuppass             => 'password',
    backup_keep_age        => '3d',
    backup_schedule_hour   => '5',
    backup_schedule_minute => '0',
Upgrades to Stash

Stash can be upgraded by incrementing this version number. This will STOP the running instance of Stash and attempt to upgrade. You should take caution when doing large version upgrades. Always backup your database and your home directory. The stash::facts class is required for upgrades.

  class { 'stash':
    javahome => '/opt/java',
    version  => '3.4.0',
  class { 'stash::facts': }

If the stash service is managed outside of puppet the stop_stash paramater can be used to shut down stash.

  class { 'stash':
    javahome   => '/opt/java',
    version    => '3.4.0',
    stop_stash => 'crm resource stop stash && sleep 15',
  class { 'stash::facts': }


This module also allows for direct customization of the JVM, following Atlassian's recommendations

This is especially useful for setting properties such as HTTP/https proxy settings. Support has also been added for reverse proxying stash via Apache or nginx.

A more complex example

  class { 'stash':
    version        => '2.2.0',
    installdir     => '/opt/atlassian/atlassian-stash',
    homedir        => '/opt/atlassian/application-data/stash-home',
    javahome       => '/opt/java',
    download_url    => '',
    dburl          => 'jdbc:postgresql://',
    dbpassword     => $stashpass,
    service_manage => false,
    jvm_xms        => '1G',
    jvm_xmx        => '4G',
    java_opts      => ' -Dhttp.proxyPort=8080 -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=\"localhost||172.*.*.*|10.*.*.*|*\"',
    proxy          => {
      scheme       => 'https',
      proxyName    => '',
      proxyPort    => '443',
    tomcat_port    => '7991'
  class { 'stash::facts': }
  class { 'stash::gc': }

A Hiera example

This example is used in production for 500 users in an traditional enterprise environment. Your mileage may vary. The dbpassword can be stored using eyaml hiera extension.

# Stash configuration
stash::version:        '3.4.0'
stash::installdir:     '/opt/atlassian/atlassian-stash'
stash::homedir:        '/opt/atlassian/application-data/stash-home'
stash::javahome:       '/opt/java'
stash::dburl:          'jdbc:postgresql://'
stash::service_manage: false
stash::download_url:    ''
stash::jvm_xms:        '1G'
stash::jvm_xmx:        '4G'
stash::java_opts: >
  - ''
  - ''
  scheme:     'https'
  proxyName:  ''
  proxyPort:  '443'
stash::stash_stop: '/usr/sbin crm resource stop stash'



Public Classes

  • stash: Main class, manages the installation and configuration of Stash.
  • stash::facts: Enable external facts for running instance of Stash. This class is required to handle upgrades of Stash. As it is an external fact, we chose not to enable it by default.
  • stash::gc: Schedule a weekly git garbage collect for all repositories
  • stash::backup: Schedule a backup of stash

Private Classes

  • stash::install: Installs Stash binaries
  • stash::config: Modifies Stash/tomcat configuration files
  • stash::service: Manage the Stash service.


Stash parameters


Specify the java home directory. No assumptions are made re the location of java and therefore this option is required. Default: undef


Specifies the version of Stash to install, defaults to latest available at time of module upload to the forge. It is recommended to pin the version number to avoid unnecessary upgrades of Stash


The format of the file stash will be installed from. Default: 'tar.gz'


The installation directory of the stash binaries. Default: '/opt/stash'


The home directory of stash. Configuration files are stored here. Default: '/home/stash'


Whether or not this module will manage the stash user and group associated with the install. You must either allow the module to manage both aspects or handle both outside the module. Default: true


The user that stash should run as, as well as the ownership of stash related files. Default: 'stash'


The group that stash files should be owned by. Default: 'stash'


Specify a uid of the stash user. Default: undef


Specify a gid of the stash user: Default: undef


Specify context path, defaults to ''. If modified, Once Stash has started, go to the administration area and click Server Settings (under 'Settings'). Append the new context path to your base URL.


Specify the port that you wish to run tomcat under, defaults to 7990

database parameters


The name of the database user that stash should use. Default: 'stash'


The database password for the database user. Default: 'password'


The uri to the stash database server. Default: 'jdbc:postgresql://localhost:5432/stash'


The driver to use to connect to the database. Default: 'org.postgresql.Driver'

JVM Java parameters


Default: '256m'


Default: '1024m'


Default: '-XX:-HeapDumpOnOutOfMemoryError'


Default: ''


Default: ''

Tomcat parameters


Reverse https proxy configuration. See examples for more detail. Default: {}

Miscellaneous parameters


The URL used to download the Stash installation file. Defaults to ''


The md5 checksum of the archive file. Only supported with deploy_module => archive. Defaults to 'undef'


Should puppet manage this service? Default: true


Manage the stash service, defaults to 'running'


Defaults to 'true'


If the stash service is managed outside of puppet the stop_stash paramater can be used to shut down stash for upgrades. Defaults to 'service stash stop && sleep 15'


Module to use for installed stash archive fille. Supports puppet-archive and puppet-staging. Defaults to 'archive'. Archive supports md5 hash checking, Staging support s3 buckets.


Extra configuration options for stash ( See for available options. Must be a hash, Default: {}

Backup parameters


Enable or disable the backup cron job. Defaults to present.


The version of the backup client to install. Defaults to '1.9.1'


Home directory to use for backups. Backups are created here under /archive. Defaults to '/opt/stash-backup'.


The username to use to initiate the stash backup. Defaults to 'admin'


The password to use to initiate the stash backup. Defaults to 'password'


How long to keep the backup archives for. You can choose seconds, minutes, hours, days, or weeks by specifying the first letter of any of those words (e.g., ‘1w’). Specifying 0 will remove all files.


Hour schedule for when to perform backup. Defaults to '5'.


Minute schedule for when to perform backup. Defaults to '0'.


  • Puppet 3.8.7+
  • Puppet Enterprise

The puppetlabs repositories can be found at: and

  • RedHat / CentOS 5/6/7
  • Ubuntu 12.04 / 14.04
  • Debian 7

We plan to support other Linux distributions and possibly Windows in the near future.


Please feel free to raise any issues here for bug fixes. We also welcome feature requests. Feel free to make a pull request for anything and we make the effort to review and merge. We prefer with tests if possible.

Testing - How to test the Stash module

Using puppetlabs_spec_helper. Simply run:

bundle install && bundle exec rake spec

to get results.

/usr/bin/ruby1.9.1 -S rspec spec/classes/stash_config_spec.rb spec/classes/stash_facts_spec.rb spec/classes/stash_install_spec.rb spec/classes/stash_service_spec.rb spec/classes/stash_upgrade_spec.rb --color
ldapname is deprecated and will be removed in a future version

Finished in 2.02 seconds
23 examples, 0 failures

Using Beaker - Puppet Labs cloud enabled acceptance testing tool.

run (Additional yak shaving may be required):

BEAKER_set=ubuntu-server-12042-x64 bundle exec rake beaker
BEAKER_set==debian-73-x64 bundle exec rake beaker
BEAKER_set==centos-64-x64 bundle exec rake beaker