Ansible Playbook
---
- hosts: localhost
become_user: awx
vars:
resource_group: sample-rg
location: westus2tasks:
- azure_rm_securitygroup:
resource_group: "{{ resource_group }}"
name: sample_nsg
rules:
- name: SSH
priority: 100
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 22- name: PythonServer
priority: 101
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 3200-3201- name: Gateway1
priority: 102
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 3300-3301- name: Gateway2
priority: 103
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 4800-4801- name: ICMHTTP
priority: 104
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 8000-8001- name: ICMHTTPS
priority: 105
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 44300-44301- name: HTTPS
priority: 106
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 443- name: ICMSMTP
priority: 107
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 25- name: MessageServer
priority: 108
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 3600-3601- name: MessageServerHTTP
priority: 109
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 8100-8101- name: MessageServerHTTPS
priority: 110
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 44400-44401- name: JAVAHTTP
priority: 111
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 50000-50100- name: JAVAHTTPS
priority: 112
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 50001-50101- name: TCPPort
priority: 113
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 50002-50010- name: JavaServer
priority: 114
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 50102-50110- name: PHP Server
priority: 115
protocol: Tcp
access: Allow
direction: Inbound
source_address_prefix: "*"
source_port_range: "*"
destination_address_prefix: "*"
destination_port_range: 50016-50116
Define resource_group and location in Ansible Tower Extra Variables Section with your specific.
Ansible Tower
Create Job Template, add —
1. Name,
2. description,
3. Job Type- Run,
4. Inventory — inventory01,
5. Project —Sample Project,
6. choose Playbook — Network Security Group/network.yml,
7. Credentials — Microsoft Azure Resource Manager Key
8. Forks — 0
9. Limit — <Empty>
10. Verbosity — 0 (Normal)
11. Job Tags — <Empty>
12. Skip Tags — <Empty>
13. Labels — <Empty>
14. Instance Groups — <Empty>
15. Job Slicing — <Empty>
16. Timeout — <Empty>
17. Show Changes — Off
18. Options — Enable Privilege Escalation
Click on SAVE and then when page will refresh Launch Button will be Enabled, Click on LAUNCH.
This Article has been published by OrionLab.io