A sample Ansible playbook to install a Greenplum Database software release onto the hosts that will comprise a Greenplum Database system.

This Ansible playbook shows how tasks described in Installing the Greenplum Database Software might be automated using Ansible.


This playbook is provided as an example only to illustrate how Greenplum Database cluster configuration and software installation tasks can be automated using provisioning tools such as Ansible, Chef, or Puppet. VMware does not provide support for Ansible or for the playbook presented in this example.

The example playbook is designed for use with CentOS 7. It creates the gpadmin user, installs the Greenplum Database software release, sets the owner and group of the installed software to gpadmin, and sets the Pam security limits for the gpadmin user.

You can revise the script to work with your operating system platform and to perform additional host configuration tasks.

Following are steps to use this Ansible playbook.

  1. Install Ansible on the control node using your package manager. See the Ansible documentation for help with installation.

  2. Set up passwordless SSH from the control node to all hosts that will be a part of the Greenplum Database cluster. You can use the ssh-copy-id command to install your public SSH key on each host in the cluster. Alternatively, your provisioning software may provide more convenient ways to securely install public keys on multiple hosts.

  3. Create an Ansible inventory by creating a file called hosts with a list of the hosts that will comprise your Greenplum Database cluster. For example:


    This file can be edited and used with the Greenplum Database gpssh-exkeys and gpinitsystem utilities later on.

  4. Copy the playbook code below to a file ansible-playbook.yml on your Ansible control node.

  5. Edit the playbook variables at the top of the playbook, such as the gpadmin administrative user and password to create, and the version of Greenplum Database you are installing.

  6. Run the playbook, passing the package to be installed to the package_path parameter.

    ansible-playbook ansible-playbook.yml -i hosts -e package_path=./greenplum-db-6.0.0-rhel7-x86_64.rpm

Ansible Playbook - Greenplum Database Installation for CentOS 7


- hosts: all
    - version: "6.0.0"
    - greenplum_admin_user: "gpadmin"
    - greenplum_admin_password: "changeme"
    # - package_path: passed via the command line with: -e package_path=./greenplum-db-6.0.0-rhel7-x86_64.rpm
  remote_user: root
  become: yes
  become_method: sudo
  connection: ssh
  gather_facts: yes
    - name: create greenplum admin user
        name: "{{ greenplum_admin_user }}"
        password: "{{ greenplum_admin_password | password_hash('sha512', 'DvkPtCtNH+UdbePZfm9muQ9pU') }}"
    - name: copy package to host
        src: "{{ package_path }}"
        dest: /tmp
    - name: install package
        name: "/tmp/{{ package_path | basename }}"
        state: present
    - name: cleanup package file from host
        path: "/tmp/{{ package_path | basename }}"
        state: absent
    - name: find install directory
        paths: /usr/local
        patterns: 'greenplum*'
        file_type: directory
      register: installed_dir
    - name: change install directory ownership
        path: '{{ item.path }}'
        owner: "{{ greenplum_admin_user }}"
        group: "{{ greenplum_admin_user }}"
        recurse: yes
      with_items: "{{ installed_dir.files }}"
    - name: update pam_limits
        domain: "{{ greenplum_admin_user }}"
        limit_type: '-'
        limit_item: "{{ item.key }}"
        value: "{{ item.value }}"
        nofile: 524288
        nproc: 131072
    - name: find installed greenplum version
      shell: . /usr/local/greenplum-db/greenplum_path.sh && /usr/local/greenplum-db/bin/postgres --gp-version
      register: postgres_gp_version
    - name: fail if the correct greenplum version is not installed
        msg: "Expected greenplum version {{ version }}, but found '{{ postgres_gp_version.stdout }}'"
      when: "version is not defined or version not in postgres_gp_version.stdout"

When the playbook has run successfully, you can proceed with Creating the Data Storage Areas and Initializing a Greenplum Database System.

Parent topic: Installing and Upgrading Greenplum

check-circle-line exclamation-circle-line close-line
Scroll to top icon