This Ruby script can be used to create new Ansible inventories from YAML files in Puppet repository filesystems.
Reads YAML files from the data/nodes
and data/roles
directories for each environment,
and builds inv
representing your updated Ansible inventory.
The create_inventory.rb ruby script parses puppet environment filesystems and converts each role and host file to a single Ansible compatible inventory file.
- Ruby is included in most modern Linux distributions.
sudo apt install ruby
-
If you're using Windows, you can install Ruby from rubyinstaller.org.
-
All Puppet agents include Ruby The Ruby runtime environment on Puppet includes the Ruby language, some Ruby libraries and a set of Puppet specific gems.
Put this script in the root of your puppet environments folder, then change to the directory and run:
ruby create_inventory.rb > inventory.yaml
A new inventory.yaml file will be created.
You can use this inventory file to run Ansible playbooks on your environments, roles and nodes.