Running automation mesh jobs

Automation mesh is a scalable cluster of Receptor nodes that execute Ansible playbooks. Ansible SDK lets you invoke jobs directly on nodes in the automation mesh.

Before you begin:

  • Install Ansible SDK and required software.

  • Install Ansible Receptor.

Create a locally running cluster of Receptor nodes with configuration files in the examples/receptor_config directory:

  1. Open your /etc/hosts file for editing.

  2. Add the following entries to your hosts file:

    127.0.0.1 foo.example.com
    127.0.0.1 bar.example.com
    127.0.0.1 baz.example.com
    
  3. Open a terminal and start the first Receptor node.

    1. Activate your virtual environment for Ansible SDK.

      $ source env/bin/activate
      
    2. Start a node with the foo.yml configuration.

      $ receptor --config foo.yml
      
  4. Open a new terminal and start the second Receptor node.

    1. Activate your virtual environment for Ansible SDK.

    2. Start a node with the bar.yml configuration.

      $ receptor --config bar.yml
      
  5. Open a new terminal and start the third Receptor node.

    1. Activate your virtual environment for Ansible SDK.

    2. Start a node with the baz.yml configuration.

      $ receptor --config baz.yml
      
  6. Verify that the automation mesh is running.

    $ receptorctl --socket /tmp/bar.sock status
    

Run the example automation job on the mesh with Ansible SDK as follows:

  1. Open a terminal and change to the examples directory.

  2. Run the following command:

    $ python example_mesh_job.py
    

The example_mesh_job.py program has a main() function that connects to the Receptor nodes and runs the examples/datadir/project/pb.yml playbook. You can verify the job is successful when Ansible SDK prints the following to stdout:

submitting work
work submitted
payload builder completed ok
getting results
got results
waiting for jobs
job done: True, has <x> events

Troubleshooting

If you encounter issues with this scenario, troubleshoot as follows:

  • Ensure receptorctl is installed.

  • Ensure your /etc/hosts file contains entries for each local Receptor node.

  • Ensure you run each Receptor node in a separate terminal in the Ansible SDK virtual environment.

You can find more help in Troubleshooting