

Here’s the code from the playbook example01.yml: - hosts: default

The Ansible code iterates over the list and performs the action on the current item. The type of variable is a list, with either 1 or more elements. This time however I’d like to pass a list to the playbook indicating which block devices to partition. I used Ubuntu 22.04, patched to 230306 with both Ansible and Vagrant versions as provided by the distribution: The directory/file layout is also identical, repeated here for convenience: $ tree provisioning/ I’m going to reuse the Vagrantfile from the previous article: nfigure("2") do |config|Ĭ_key_path = "/home/martin/.ssh/debianbase"Ĭonfig.vm.provision "ansible" do |ansible|Īaybook = "provisioning/example01.yml" For this article the invocation of the Ansible playbook happens as part of a call to vagrant up or vagrant provision. I wrote a similar post for when you are in a situation where you invoke an Ansible playbook directly from the command line. After hitting the publish button I noticed that there might be a need for a part II – passing complex data types such as lists and dicts to Ansible via a Vagrantfile. Recently I wrote a post about one of my dream combinations, Ansible and Vagrant.
