Tuesday, May 02, 2023

Caring for animals with Ansible

Over the years, I’ve collected somewhere between 2 to 3 dozen buildfarm animals for supporting PostgreSQL’s development. Postgres’ distributed buildfarm system is world wide, ensuring that changes to the source code are automatically tested across a wide variety of platforms. I've been getting onto each of these systems one at a time whenever there’s a new buildfarm client to install. 


After learning some Ansible, I wanted to see if there were some tasks that could be done better when managing or configuring buildfarm animals. 


As one example, I tried building out my inventory file by listing systems by animal with the animal's specific configuration settings defined as follows:

 

buildfarm:

  hosts:

    aracari: # Use animal name for host identification

      ansible_host: z15rhel8 # The actual hostname or IP address

      install_path: /home/linux1 # Where to install build farm client

      secret: CHANGEME

      cc: clang # compiler to use

      config_opts_extra: | # Any extra PostgreSQL configure options

        --with-tclconfig=/usr/lib64

    ayu:

      ansible_host: p8debian

      install_path: /home/debian

      secret: CHANGEME

      cc: ccache clang-4.0

...

  vars:

    # Variables that apply to all animals

    build_farm_version: 16 # Build farm version

    build_root: "$confdir/buildroot"

    email: "'my.actual@email.address'"

    global_lock_dir: "'/tmp'"

 

After this initial setup, I’m also able to run a playbook to test builds and make sure the configuration files built correctly.  I’ve made these playbooks available on GitHub so others can use it to install the PostgreSQL Build Farm client, configure it, run a test against all branches, and set up a cron job.


Has anyone else worked on automating buildfarm animals or have other ideas on how to bring automation strategies to build farm animal management? Let us hear about it!

 

0 Comments:

Post a Comment

<< Home