Download Ansible Playbooks for Confluent Platform

This topic describes how to download Ansible Playbooks for Confluent Platform as the first step in the installation process.

Download Playbooks from Ansible Galaxy

If you are using Ansible 2.11 or higher, download the Ansible Playbooks for Confluent Platform collection using ansible-galaxy as described in this section.

Starting in Confluent Platform 7.0, Ansible is packaged as an Ansible Collection.

  • Get the latest Confluent collection from Ansible Galaxy using the following command:

    ansible-galaxy collection install confluent.platform
    

    The command downloads the collection into your default collections directory, ~/.ansible/collections/ansible_collections/confluent/platform/.

  • You can get a specific version by appending the version number along with the package name. For example:

    ansible-galaxy collection install confluent.platform:7.1.2
    
  • To download the Confluent collection behind a proxy, run the following command with the https_proxy environment variable:

    https_proxy=http://proxy-server:port/ \
      ansible-galaxy collection install confluent.platform
    

For more details on package installation from Ansible Galaxy, see Galaxy User Guide.

Download playbooks from the GitHub source repository

As an alternative to the recommended method of downloading from Ansible Galaxy, you can install the package directly from the source repository.

  • To download Ansible Playbooks for Confluent Platform onto your controller, run the following command. The command pulls the roles and playbooks into your default collections directory.

    ansible-galaxy collection install \
      git+https://github.com/confluentinc/cp-ansible.git
    
  • To download a specific branch of Ansible Playbooks for Confluent Platform, run the following command. 7.0 or higher is supported for <branch>.

    ansible-galaxy collection install \
      git+https://github.com/confluentinc/cp-ansible.git,<branch>
    
  • To download Ansible Playbooks for Confluent Platform behind a proxy, run the following command with the https_proxy environment variable:

    https_proxy=http://proxy-server:port/ ansible-galaxy collection install \
      git+https://github.com/confluentinc/cp-ansible.git
    

    Alternatively, you can clone the Ansible Playbooks for Confluent Platform repo and build the collection locally as described in Build Ansible Playbooks for Confluent Platform collection.

After downloading the collection, enable hash merging as described in Configure hash merging.

Build Ansible Playbooks for Confluent Platform collection

An option to install Ansible Playbooks for Confluent Platform collection behind a proxy is to clone the repo and locally build the collection tarball which you will use to install the collection. The steps to build and install are:

  1. Set up a proxy server:

    git config --global http.proxy http://proxy-server:port/
    git config --global https.proxy http://proxy-server:port/
    
  2. Download the Ansible Playbooks for Confluent Platform code:

    git clone https://github.com/confluentinc/cp-ansible.git
    cd cp-ansible
    git checkout 7.1.2-post
    
  3. Create the collection:

    ansible-galaxy collection build
    

    The command builds a tarball of the collection in the current directory.

  4. Upload the collection tarball to your control node.

  5. Install the collection on your Ansible control node:

    ansible-galaxy collection install <the tarball created in the previous step>
    

Download Playbooks for Ansible 2.9 hosts

To download Ansible Playbooks for Confluent Platform when using Ansible 2.9:

  1. Create a directory with the following structure:

    mkdir -p <path_to_cp-ansible>/ansible_collections/confluent/
    

    You can put <path_to_cp-ansible> anywhere in your directory structure, but the directory structure under <path_to_cp-ansible> should be set up exactly as specified above.

  2. Clone the Ansible Playbooks for Confluent Platform repo into the platform directory inside the directory you created in the previous step:

    git clone https://github.com/confluentinc/cp-ansible \
      <path_to_cp-ansible>/ansible_collections/confluent/platform
    

    Important

    The cp-ansible directory created with the above command must not have the world-writable permissions (777). Due to a security risk, Ansible will not load the configuration file, ansible.cfg if the file is in the world-writable directory.

    If you do not use git clone, make sure the permissions setting on the cp-ansible source code is 755.

  3. Check out the 7.1.2-post branch:

    cd <path_to_cp-ansible>/ansible_collections/confluent/platform
    git fetch
    git checkout 7.1.2-post
    

    The master branch in the Ansible GitHub repo is a development branch and not meant for production deployments. Use the specific version branch for production deployments, upgrades, or testing.

  4. Enable hash merging as described in Configure hash merging.

Configure hash merging

Ansible Playbooks for Confluent Platform requires hash merging to be enabled. Configure the setting in your Ansible configuration file as below:

[defaults]
hash_behaviour=merge