Ansible Quickstart Examples#

This section contains examples for how to set up a Squirro installation using Ansible. Please refer to the full documentation at Install and Manage Squirro with Ansible for more information.

Basic Setup#

If you’re looking for a quick single server setup of the latest Squirro release, follow the steps below.

  1. Secure a Rocky Linux 8, Red Hat Enterprise Linux 8, CentOS 7, or Red Hat Enterprise Linux 7 Linux server. Squirro recommends AWS, GCP, Azure, Hetzner Cloud, or any physical server.

    For development, Vagrant is a great choice, but any VM solution such as VirtualBox, Proxmox, VMware Workstation/Fusion/Player, etc. will work.

  2. Ensure your setup meets the requirements detailed in System Requirements.

  3. Log in to the server and become root.

  4. Install Ansible using the following commands:

    yum install -y epel-release
    yum install -y ansible
    

    Note: Ansible is a Python application and can also be installed using pip.

  5. Unzip the downloaded Squirro Ansible Module using the following command:

    unzip squirro-ansible-x.x.x-release.zip
    

    Note: Replace x.x.x with the desired version number. If there is no version that matches the exact Squirro version you’re using, use the latest squirro-ansible version in the same minor version. E.g. if you are using Squirro 3.6.9, use the latest squirro-ansible release in the 3.6.x series.

  6. Edit playbook-quickstart.yml to and edit the yum username and password to match your Squirro mirror username and password.

    Example code shown below:

    - name: Quickstart Install Squirro
      hosts: all
      become: true
      vars:
         squirro_clusternode: True
         squirro_storagenode: True
         yum_user: ...
         yum_password: ...
         squirro_channel: stable
         squirro_version: latest
         elasticsearch_discovery_type: single-node
      roles:
         - role: squirro-ansible
    
  7. Install Squirro using the following command:

    ansible-playbook --connection=local --inventory 127.0.0.1, playbook-quickstart.yml
    

    Note

    Depending on your system, the installation can take 15 to 20 minutes.

  8. Open the HTTP and HTTPS port on the firewall as shown below:

    firewall-cmd --zone=public --permanent --add-service=http
    firewall-cmd --zone=public --permanent --add-service=https
    
  9. Validate if all services are running using the following command:

    squirro_status
    
  10. Access the service at https://your-sytems-ip or http://your-systems-ip.

Note

To learn how to use Squirro, visit the Squirro Academy.

Offline Installation#

If your machine cannot reach mirror.squirro.net, you can install Squirro offline as shown below:

- name: Offline Squirro
  hosts: all
  become: true
  vars:
      squirro_clusternode: True
      squirro_storagenode: True
      squirro_install_mode: offline
      squirro_packages_tar: /path/to/os-n.n-stable-x86_64-n.n.n.tar.gz
      squirro_channel: stable
      squirro_version: latest
      elasticsearch_discovery_type: single-node

  roles:
      - role: squirro-ansible

The corresponding tar.gz file can be downloaded from the mirror.

Example: For Rocky Linux 8, you can get the correct package from: https://mirror.squirro.net/rocky/8/stable/x86_64/.

If you expect to run multiple installations, you can speed things up by extracting the tar.gz file and placing it on a shared file system, as shown below:

- name: Offline Squirro
  hosts: all
  become: true
  vars:
      squirro_clusternode: True
      squirro_storagenode: True
      squirro_install_mode: filesystem
      yum_repo_folder: /path/to/offline/yum/repo
      squirro_channel: stable
      squirro_version: latest
      elasticsearch_discovery_type: single-node
  roles:
      - role: squirro-ansible

This can be faster as the unzipping will not take place each time.

Note: The yum_repo_folder variable needs to point at the location that contains the repodata folder.

AWS Standalone Playbook#

Expanding on the quickstart example, on Amazon Web Services, when deploying Squirro, it is best practice to leverage managed services to increase availability and enable horizontal scaling.

In the example below, the following are leveraged:

  • RDS to externalize MariaDB / MySQL

  • ElastiCache to externalize the Key/Value Store

  • ElastiCache again to externalize the In-Memory Cache

  • EFS as a shared file system

These resources can be spun up manually in the AWS web console.

Important: Squirro highly recommends you leverage infrastructure automation solutions such as AWS CloudFormation or Terraform.

Once complete, edit the playbook-quickstart-aws.yml file to fill in all the blanks and adjust the RDS and ElastiCache endpoints, credentials, and IP addresses.

- name: Quickstart Install Squirro on AWS
  hosts: all
  become: true
  vars:
      squirro_clusternode: True
      squirro_storagenode: True
      yum_user: ...
      yum_password: ...
      squirro_channel: stable
      squirro_version: latest
      elasticsearch_squirro_cluster_name: squirro-quickstart
      elasticsearch_cluster_nodes: ['10.1.0.2', '10.1.0.3', '...']
      elasticsearch_network_interface: eth0
      remote_mysql_server: True
      mysql_host: yourproject-db.abcdefghij.eu-central-1.rds.amazonaws.com
      mysql_root_user: root
      mysql_root_password: ...
      mysql_shared_service_password: ...
      remote_redis_server: True
      redis_tls: True
      redis_storage_host: master.storage-abcdefgh.euc1.cache.amazonaws.com
      redis_storage_port: 6379
      redis_storage_password: ...
      redis_cache_host: master.storage-abcdefgh.euc1.cache.amazonaws.com
      redis_cache_port: 6380
      redis_cache_password: ...
      remote_filesystem: True
      remote_filesystem_path: /mnt/efs/squirro
  roles:
      - role: squirro-ansible

You then run the same steps as under the Quickstart section to install Ansible, but instead run this command to execute the install:

ansible-playbook --connection=local --inventory 127.0.0.1, playbook-quickstart-aws.yml

You can now repeat this on each EC2 instance.

Tip: For production deployments, Squirro typically recommends at least three instances.

This procedure can be fully automated with Cloud-init user data methods to bootstrap new instances or even to build AMI images using frameworks such as Packer.

Caution

This only serves as an example, for full production readiness you will need to delegate the secrets to a secrets manager (e.g. Hashicorp Vault) and also leverage the AWS EC2 discovery plugin for Elasticsearch.