A demo designed to showcase many of the use cases that people are looking for. We are using the workflow visualizer to show how the various building blocks are put together and enable the delivery on demand of a custom website. The playbooks call roles, the roles allow for ease of sharing the code and also allow for documentation of the various things needed in each role. The demo is designed to be integrated with an IT Service Management (ITSM) system. Everything will be documented in ITSM system via the skillfull use of automation. Check out the video below to see that "the art of the possible."
The playbooks
1. Create our network container
2. Create our virtual machine
3. Update our inventory
Ansible Controller Credential
Input configuration
fields:
- id: url
type: string
label: Controller URL
- id: user
type: string
label: Controller Username
- id: password
type: string
label: Controller Password
secret: true
required:
- url
- user
- password
Injector configuration
extra_vars:
controller_url: '{{url}}'
controller_user: '{{user}}'
controller_passwd: '{{password}}'
4. Gather instance information
5. Red Hat Registration
Red Hat Customer Portal Credential
Input configuration
fields:
- id: user
type: string
label: Red Hat Customer Portal Username (access.redhat.com)
- id: password
type: string
label: Red Hat Customer Portal Password
secret: true
required:
- user
- password
Injector configuration
extra_vars:
customer_portal_password: '{{user}}'
customer_portal_username: '{{password}}'
6. Configuration Management
7. User access
8. Application install
9. Website deployment
10. Reporting
11. Send notification that the website is ready
Custom Mail Server credential
Input configuration
fields:
- id: smtp_server
type: string
label: Mail Server
- id: smtp_port
type: string
label: Mail Server Port
- id: smtp_username
type: string
label: Mail Server Username
- id: smtp_password
type: string
label: Mail Server Password
secret: true
required:
- smtp_server
- smtp_port
- smtp_username
- smtp_password
Injector configuration
extra_vars:
MAILHOST: '{{smtp_server}}'
MAILHOST_PORT: '{{smtp_port}}'
MAILHOST_PASSWORD: '{{smtp_password}}'
MAILHOST_USERNAME: '{{smtp_username}}'
Site Delete will clean everything up
The playbooks
Create a CMDB record
Create a CMDB relationship
ServiceNow credential
Input configuration
fields:
- id: instance
type: string
label: Instance
- id: username
type: string
label: username
- id: password
type: string
label: password
secret: true
required:
- instance
- username
- password
Injector configuration
env:
SN_HOST: '{{instance}}'
SN_PASSWORD: '{{password}}'
SN_USERNAME: '{{username}}'
- ServiceNow Ansible spoke setup
Ansible spoke setup - Alex Dworjan
Ansible spoke youtube - Alex Dworjan
- ServiceNow Ansible spoke setup additional Ansible controllers
Flow Designer -> Connections -> Add Connection
Connection Name: ericamesAAPalias
Connection URL: https://ericames.ddns.net
Credential Name: Eric Ames AAP Spoke Credentials
Application Registry Name: Eric Ames Spoke Registry
OAuth Client ID: %SECRETID%
OAuth Client Secret: %SECRETGOESHERE%
Oauth Entity Profile Name: Eric Ames Spoke Registry default_profile
OAuth Entity Scope: write
Authorization URL: https://ericames.ddns.net/api/o/authorize/
Token URL: https://ericames.ddns.net/api/o/token/
OAuth Redirect URL: https://ven05433.service-now.com/api/sn_ansible_spoke/ansible_oauth_redirect
- Automated incident management example
Example Error Handling in support of incident enrichment
- name: Adding incident management error handling
block:
PUT YOUR TASKS HERE
rescue:
- name: Capture the error message
register: my_error
ansible.builtin.set_stats:
data:
my_error: "{{ ansible_failed_result.msg }}"
- name: Capture the Job ID
register: my_job_id
ansible.builtin.set_stats:
data:
my_job_id: "{{ tower_job_id }}"
- name: Capture the Job Template name
register: my_job_template_name
ansible.builtin.set_stats:
data:
my_job_template_name: "{{ tower_job_template_name }}"
- name: Fail the job even though the rescue worked
ansible.builtin.fail:
msg: failing so we create the incident ticket
- Patching Report