[vRA8] Ansible Integration

Hello all!

Its been a while since I wrote my last blog post. All this COVID-19 stuff going on and also it was busy times. But finally, I got in a mood to write some short article 🙂

Enjoy reading!

vRealize Automation 8.1 got a possibility to integrate Ansible out-of-the-box.

First of all we have to meet some of the pre-requisites:

1. Install Ansible. My favorite linux distribution is CentOS7

yum install ansible -y

2. Go to the /etc/ansible/ansible.cfg and uncomment the lines :

  • host_key_checking = False
  • record_host_keys=False
  • vault_password_file = /path-to/vault-password
  • ssh_args = -o UserKnownHostFile=/dev/null

3. Create vault pass file

echo “secr3tPa$$w0rd”>/path-to/vault-password

At this part all our pre-reqs met and we can integrate vRA with Ansible.

1. Go to Cloud Assembly -> Infrastructure -> Integrations and choose Ansible

2. Fill in the forms validate and add.

3. Go to Design Tab and add the Ansible object connect it to the VM. In this example I have an input role which reflects the playbook and group in ansible:

4. And ofcourse within ansible we have to create the playbook itself i.e. for the Apache installation:


---
- name: This sets up an httpd webserver
  hosts: WebServers
  tasks:
  - name: Install apache packages
    yum:
      name: httpd
      state: present
  - name: ensure httpd is running
    service:
      name: httpd
      state: started
  - name: Open port 80 for http access
    firewalld:
      service: http
      permanent: true
      state: enabled
  - name: Restart the firewalld service to load in the firewall changes
    service:
      name: firewalld
      state: restarted

That is the nice and easy way to integrate Ansible with vRA.

Hope that it was informative. Enjoy your day!

One thought on “[vRA8] Ansible Integration

  1. Alexandro

    Marvelous article! Keep going 🙃

Leave a Reply to Alexandro Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.