ServiceNow MID Server Install with Ansible
This article demonstrates a way to auto download and install the MID server files from ServiceNow using Ansible on the localhost. This allows you to leverage Ansible easily by passing ServiceNow workflows to Ansible which is already installed on the MID server.
Although this solution installs the MID server local, the role from ServiceNow we'll be using here will allow remote MID server installs using this role from the controller (not tested by me, but looks right). It is even configured to allow MID server installs for Windows as long as you have your Ansible inventory and vars configured properly and you point the main playbook to your inventory hosts or groups.
Install and configure a ServiceNow MID server using Ansible so we can leverage the Ansible controller in ServiceNow workflows.
- CentOS 7.7
- Ansible 2.9
- ServiceNow Role (ansible-role-mid)
- Git 22.214.171.124
This solution assumes you have Ansible 2.9 and git already installed.
We will be using a role provided at ServiceNowITOM GitHub
1- Log into your Ansible Controller
2- Make a new directory to house the role files
mkdir mid-install cd mid-install
3- Clone the role from ServiceNow github
git clone https://github.com/ServiceNowITOM/ansible-role-mid.git
4- Edit the vars file and specify the required vars
5- Add the required content (replace YOUR.. with your required details)
# vars file for ansible-role-mid # now_instance: YOURINSTANCE.FQDN.COM now_instance_username: YOURINSTANCEUSER now_instance_password: YOURINSTANCEUSERPASS
6- Use Ansible Vault to Encrypt the vars file if required
ansible-vault encrypt ansible-role-mid/vars/main.yml
7- Create a playbook to execute the role
Enter the contents as shown for localhost install
--- - name: Main playbook for mid role install hosts: localhost roles: - ansible-role-mid
8- Check the playbook syntax
sudo ansible-playbook pb.mid-install.yaml --syntax-check --ask-vault-pass
or.. if your didn't encrypt
sudo ansible-playbook pb.mid-install.yaml --syntax-check
9 - Run the playbook
sudo ansible-playbook pb.mid-install.yaml --ask-vault-pass
10 - Verify the MID server is registered in SNOW
That's it basically.. some additional configuration may be required based on your desired state.
I just upgraded to Orlando and deployed the MID server with the Orlando bits. Additional MID Server configuration detail information from ServiceNow can be found here.