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 will 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 220.127.116.11
This solutions assumes you have Ansible 2.9 and git already installed.
We will be using a role provided at ServiceNowITOM GitHub
- Log into your Ansible Controller
- Make a new directory to house the role files
mkdir mid-install cd mid-install
- Clone the role from ServiceNow github
git clone https://github.com/ServiceNowITOM/ansible-role-mid.git
- Edit the vars file and specify the required vars
- 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
- Use Ansible Vault to Encrypt the vars file if required
ansible-vault encrypt ansible-role-mid/vars/main.yml
- 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
- 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
- Run the playbook
sudo ansible-playbook pb.mid-install.yaml --ask-vault-pass
- 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.