This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
satellite_firewall role #21
Open
rdrazny
wants to merge
3
commits into
SatelliteQE:master
Choose a base branch
from
rdrazny:satellite_firewall
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
Role Name | ||
========= | ||
|
||
This Ansible role configures firewall on a server running Satellite 6, and opens ports required by Satellite to function. | ||
List of ports is taken from Satellite documentation | ||
|
||
https://access.redhat.com/documentation/en-us/red_hat_satellite/6.3/html/installation_guide/preparing_your_environment_for_installation#ports_prerequisites | ||
|
||
and from automation-tools available at | ||
|
||
https://github.com/SatelliteQE/automation-tools/blob/master/automation_tools/__init__.py#L623-L664 | ||
|
||
Requirements | ||
------------ | ||
|
||
No requirements are required for this role. | ||
|
||
Role Variables | ||
-------------- | ||
|
||
Requires lists of ports to open in the following wariables: | ||
- *common_ports* | ||
- *satellite_ports* | ||
- *capsule_ports* | ||
|
||
Format of the item contained in the port list is as follows: | ||
|
||
*\- {proto: '\<protocol\>', port: \<port number\>}* | ||
|
||
For example to open the port 22 for TCP: | ||
|
||
\- {proto: 'tcp', port: 22} | ||
|
||
See the current list of ports to open in the global *vars/satellite_common.yml* file. | ||
|
||
As a Satellite 6 server contains an integrated capsule, we should open both satellite and capsule ports. | ||
A role configuring firewall for a server running only stand-alone capsule should use only *common_ports* and | ||
*capsule_ports* variables. | ||
|
||
Dependencies | ||
------------ | ||
|
||
This role is not dependent upon any galaxy roles. | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
Here is a simple example of partitioning-disk role: | ||
ogajduse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- hosts: localhost | ||
roles: | ||
- satellite_firewall | ||
|
||
License | ||
------- | ||
|
||
GNU GENERAL PUBLIC LICENSE | ||
|
||
Version 3, 29 June 2007 | ||
|
||
Copyright (C) 2007 Free Software Foundation, Inc. | ||
|
||
Author Information | ||
------------------ | ||
|
||
This is developed by Satellite QE team, irc: #robottelo on Freenode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# defaults file for satellite_firewall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# handlers file for satellite_firewall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Standards: 0.2 | ||
galaxy_info: | ||
author: Satellite QE Team | ||
description: Satellite QE Team | ||
company: Red Hat | ||
|
||
license: GPLv3 | ||
|
||
min_ansible_version: 2.5.0 | ||
|
||
platforms: | ||
- name: RHEL | ||
versions: | ||
- 7 | ||
- 6 | ||
|
||
galaxy_tags: [] | ||
|
||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
- name: Make sure the firewalld package is present | ||
yum: | ||
name: firewalld | ||
state: present | ||
when: | ||
- ansible_distribution == "RedHat" | ||
- ansible_distribution_major_version|int >= 7 | ||
|
||
- name: Open Satellite ports using firewalld | ||
firewalld: | ||
port: "{{ item.port }}/{{ item.proto }}" | ||
permanent: true | ||
state: enabled | ||
immediate: true | ||
with_flattened: | ||
- "{{ common_ports }}" | ||
- "{{ satellite_ports }}" | ||
- "{{ capsule_ports }}" | ||
when: | ||
- ansible_distribution == "RedHat" | ||
- ansible_distribution_major_version|int >= 7 | ||
|
||
- name: Open Satellite ports using iptables | ||
iptables: | ||
chain: INPUT | ||
ctstate: NEW | ||
destination_port: "{{ item.port }}" | ||
protocol: "{{ item.proto }}" | ||
jump: ACCEPT | ||
with_flattened: | ||
- "{{ common_ports }}" | ||
- "{{ satellite_ports }}" | ||
- "{{ capsule_ports }}" | ||
when: | ||
- ansible_distribution == "RedHat" | ||
- ansible_distribution_major_version|int < 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
localhost | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- hosts: localhost | ||
remote_user: root | ||
roles: | ||
- satellite_firewall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# vars file for satellite_firewall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,31 @@ satellite_distribution: "cdn" | |
# Maintain URL | ||
satellite6_repositories_satellite_maintain_reponame: "Satellite6_Maintain_RHEL7" | ||
satellite6_repositories_satellite_maintain_repourl: "{{ repository_url }}/pulp/repos/Sat6-CI/QA/Satellite_Maintenance_RHEL7/custom/Satellite_Maintenance_Composes/Satellite_Maintenance_RHEL7/" | ||
|
||
# Ports needed both by a Sat 6 server and by a Capsule server to be open | ||
# List of ports taken from https://github.com/SatelliteQE/automation-tools/blob/master/automation_tools/__init__.py#L623-L664 | ||
# and from Satellite 6 documentation | ||
#(https://access.redhat.com/documentation/en-us/red_hat_satellite/6.3/html/installation_guide/preparing_your_environment_for_installation#ports_prerequisites) | ||
common_ports: | ||
- {proto: 'tcp', port: 22} | ||
- {proto: 'tcp', port: 80} | ||
- {proto: 'tcp', port: 443} | ||
- {proto: 'tcp', port: 5647} | ||
- {proto: 'tcp', port: 8000} | ||
- {proto: 'tcp', port: 8140} | ||
- {proto: 'tcp', port: 8443} | ||
- {proto: 'tcp', port: 9090} | ||
- {proto: 'udp', port: 53} | ||
- {proto: 'udp', port: 69} | ||
|
||
satellite_ports: | ||
- {proto: 'tcp', port: 5646} | ||
- {proto: 'tcp', port: 5671} | ||
- {proto: 'tcp', port: 2375} | ||
- {proto: 'tcp', port: 5000} | ||
- {proto: 'tcp', port: 16500} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo? 16509 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo. Fixed. |
||
|
||
capsule_ports: | ||
- {proto: 'tcp', port: 53} | ||
- {proto: 'udp', port: 67} | ||
- {proto: 'udp', port: 68} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fill a role name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed