Running the role

First of all, let's launch the CentOS 7 Vagrant box by running one of the following commands:

$ vagrant up$ vagrant up --provider=vmware_fusion

Now that we have our server, we need to update the host inventory; in the production file, enter the following:

box ansible_host=192.168.50.4.nip.io[boxes]box[boxes:vars]ansible_connection=sshansible_user=vagrantansible_private_key_file=~/.ssh/id_rsahost_key_checking=False

Finally, we need something that will execute our role. Add the following content to the site.yml file:

---- hosts: boxes  gather_facts: true  become: yes  become_method: sudo  vars_files:    - group_vars/common.yml  roles:    - roles/common

Now that we have our playbook file ready, we can run it against our Vagrant box by ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.