Skip to content

running ansible in a docker to administer ROS2 based systems

License

Notifications You must be signed in to change notification settings

johnjamesmiller/docker-ansible-ros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

docker-ansible-ros

Running ansible in a docker from vscode to administer ROS2 based systems via SSH. Tested using tailscale and formant as the vpns.

The goal is this repo could be pulled down by any admin on your team or even your CI server and used to easily get all the right software and configs on all the robots.

Credits

Getting started

  • Check this code out
  • Open with vscode
  • Add your robots to the inventory/robots and remove localhost
  • Make sure you can ssh to all your robots without a password. See SSH config below.
  • Use 're-open in container' option to launch the docker container
  • Run ansible all --list-hosts to make sure ansible are picking up your hosts
  • Run ansible all -m ping to make sure you can connect to all the hosts
  • Run ansible-playbook --ask-become-pass run_pre_update_script_on_all_bots.yaml to run the pre update script playbook on all hosts

Todo

Things I want to be able to do

  • make sure all the robots have the right docker image.
  • make sure the robots have the right debian packages.
  • make sure the robtos have the right configs

Inventory

Target machines are specified in /ansible/inventory/robots

The ansible process knows to look here because of the inventory setting specified in ansible.cfg

SSH config

  • ssh-keygen
    • You probably want to protect your personal ssh key with a passphrase
    • for the key you use for ansible you will either want to leave the key unprotected or use ssh-agent
  • ssh-copy-id username@robot to copy your public key to the authorized_keys file on each remote system
  • now make sure you can ssh username@robot to the robots without entering password

Ansibile config

Config generated with ansible-config init --disabled -t all > ansible.cfg and lives in /ansible/ansible.cfg inside the container.

The config location is given to the ansible process via environment variable ANSIBLE_CONFIG specified in the Dockerfile.

By default the ansible process searches for the config file the following locations

  • ANSIBLE_CONFIG (environment variable if set)
  • ansible.cfg (in the current directory)
  • ~/.ansible.cfg (in the home directory)
  • /etc/ansible/ansible.cfg

https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings-locations

About

running ansible in a docker to administer ROS2 based systems

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published