forked from robertdebock/ansible-role-firewall
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow adding a select interface to a selected zone. robertdebock#4
- Loading branch information
Showing
13 changed files
with
514 additions
and
10 deletions.
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
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
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
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
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,72 @@ | ||
******* | ||
Delegated driver installation guide | ||
******* | ||
|
||
Requirements | ||
============ | ||
|
||
Machines are pre-provisioned and externally managed via vagrant. Boxes are taken from https://roboxes.org/ | ||
|
||
Install | ||
======= | ||
|
||
* install vagrant | ||
* vagrant boxes | ||
```shell | ||
vagrant box add generic/alma8 | ||
vagrant box add generic/centos7 | ||
vagrant box add generic/centos8 | ||
vagrant box add generic/fedora28 | ||
vagrant box add generic/fedora29 | ||
vagrant box add generic/fedora35 | ||
vagrant box add generic/opensuse15 | ||
vagrant box add generic/rhel7 | ||
vagrant box add generic/rhel8 | ||
``` | ||
* create vagrant environment | ||
```shell | ||
vagrant up | ||
``` | ||
* export ssh config | ||
```shell | ||
vagrant ssh-config > molecule/physical/ssh_config | ||
``` | ||
* copy and change permissions on identityfiles. | ||
```shell | ||
VAGRANTFILE_BASEDIR=/mnt/c/Users/Public/Documents/EL | ||
pushd molecule/physical/.ssh | ||
for file in $(ls -1 "${VAGRANTFILE_BASEDIR}/.vagrant/machines/"*"/"*"/private_key") | ||
do | ||
cp -v "$file" "$(basename $(dirname $(dirname $file)))" | ||
chmod 0600 "$(basename $(dirname $(dirname $file)))" | ||
done | ||
``` | ||
* edit the path of IdentityFile property in ssh_config | ||
|
||
Access hosts | ||
------------ | ||
|
||
ssh to all hosts: | ||
|
||
for host in $(\grep -Po '^Host\s+\K.*' molecule/physical/ssh_config); do echo $host ; ssh -X -F molecule/physical/ssh_config $host ; done | ||
|
||
|
||
Details | ||
------- | ||
|
||
vagrant providers | ||
~~~~~~~~~~~~~~~~ | ||
|
||
* hyper-v | ||
|
||
this is on windows desktop with hyper-v virtualization and ansible running inside WSL. | ||
forwarding needs to be setup between the different switches: | ||
|
||
Get-NetIPInterface | where {$_.InterfaceAlias -eq 'vEthernet (WSL)' -or $_.InterfaceAlias -eq 'vEthernet (Default Switch)'} | Set-NetIPInterface -Forwarding Enabled | ||
|
||
vagrant image | ||
~~~~~~~~~~~~~ | ||
|
||
* generic/opensuse15 | ||
|
||
this image has some updating issues. it maybe required to login once and run: `sudo zypper ref && sudo zypper up && sudo reboot` |
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,29 @@ | ||
Vagrant.configure("2") do |config| | ||
config.vm.define "alma8" do |alma8| | ||
alma8.vm.box = "generic/alma8" | ||
end | ||
config.vm.define "centos7" do |centos7| | ||
centos7.vm.box = "generic/centos7" | ||
end | ||
config.vm.define "centos8" do |centos8| | ||
centos8.vm.box = "generic/centos8" | ||
end | ||
# config.vm.define "fedora28" do |fedora28| | ||
# fedora28.vm.box = "generic/fedora28" | ||
# end | ||
# config.vm.define "fedora29" do |fedora29| | ||
# fedora29.vm.box = "generic/fedora29" | ||
# end | ||
config.vm.define "fedora35" do |fedora35| | ||
fedora35.vm.box = "generic/fedora35" | ||
end | ||
config.vm.define "opensuse15" do |opensuse15| | ||
opensuse15.vm.box = "generic/opensuse15" | ||
end | ||
config.vm.define "rhel7" do |rhel7| | ||
rhel7.vm.box = "generic/rhel7" | ||
end | ||
config.vm.define "rhel8" do |rhel8| | ||
rhel8.vm.box = "generic/rhel8" | ||
end | ||
end |
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,36 @@ | ||
--- | ||
- name: Create | ||
# hosts: localhost | ||
hosts: all | ||
# connection: local | ||
gather_facts: false | ||
# no_log: "{{ molecule_no_log }}" | ||
# tasks: | ||
|
||
# # TODO: Developer must implement and populate 'server' variable | ||
|
||
# - when: server.changed | default(false) | bool | ||
# block: | ||
# - name: Populate instance config dict | ||
# set_fact: | ||
# instance_conf_dict: { | ||
# 'instance': "{{ }}", | ||
# 'address': "{{ }}", | ||
# 'user': "{{ }}", | ||
# 'port': "{{ }}", | ||
# 'identity_file': "{{ }}", } | ||
# with_items: "{{ server.results }}" | ||
# register: instance_config_dict | ||
|
||
# - name: Convert instance config dict to a list | ||
# set_fact: | ||
# instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}" | ||
|
||
# - name: Dump instance config | ||
# copy: | ||
# content: | | ||
# # Molecule managed | ||
|
||
# {{ instance_conf | to_json | from_json | to_yaml }} | ||
# dest: "{{ molecule_instance_config }}" | ||
# mode: 0600 |
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,25 @@ | ||
--- | ||
- name: Destroy | ||
# hosts: localhost | ||
hosts: all | ||
# connection: local | ||
gather_facts: false | ||
# no_log: "{{ molecule_no_log }}" | ||
# tasks: | ||
# # Developer must implement. | ||
|
||
# # Mandatory configuration for Molecule to function. | ||
|
||
# - name: Populate instance config | ||
# set_fact: | ||
# instance_conf: {} | ||
|
||
# - name: Dump instance config | ||
# copy: | ||
# content: | | ||
# # Molecule managed | ||
|
||
# {{ instance_conf | to_json | from_json | to_yaml }} | ||
# dest: "{{ molecule_instance_config }}" | ||
# mode: 0600 | ||
# when: server.changed | default(false) | bool |
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 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
options: | ||
role-file: requirements.yml | ||
requirements-file: requirements.yml | ||
driver: | ||
name: delegated | ||
options: | ||
managed: False | ||
login_cmd_template: 'ssh {instance} -F "${MOLECULE_SCENARIO_DIRECTORY}/ssh_config"' | ||
ansible_connection_options: | ||
ansible_connection: ssh | ||
ansible_ssh_common_args: '-F "${MOLECULE_SCENARIO_DIRECTORY}/ssh_config"' | ||
platforms: | ||
- name: alma8 | ||
- name: centos7 | ||
- name: centos8 | ||
# - name: fedora28 | ||
# - name: fedora29 | ||
- name: fedora35 | ||
- name: opensuse15 | ||
- name: rhel7 | ||
- name: rhel8 | ||
provisioner: | ||
name: ansible | ||
playbooks: | ||
# prepare: ../default/prepare.yml | ||
converge: ../default/converge.yml | ||
default_sequence: | ||
- converge | ||
test_sequence: | ||
# - prepare | ||
- converge | ||
# - verify | ||
verify_sequence: | ||
- converge |
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,98 @@ | ||
Host alma8 | ||
HostName 172.18.243.66 | ||
User vagrant | ||
Port 22 | ||
UserKnownHostsFile /dev/null | ||
StrictHostKeyChecking no | ||
PasswordAuthentication no | ||
IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/alma8 | ||
IdentitiesOnly yes | ||
LogLevel FATAL | ||
|
||
Host centos7 | ||
HostName 172.18.250.61 | ||
User vagrant | ||
Port 22 | ||
UserKnownHostsFile /dev/null | ||
StrictHostKeyChecking no | ||
PasswordAuthentication no | ||
IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/centos7 | ||
IdentitiesOnly yes | ||
LogLevel FATAL | ||
|
||
Host centos8 | ||
HostName 172.18.247.56 | ||
User vagrant | ||
Port 22 | ||
UserKnownHostsFile /dev/null | ||
StrictHostKeyChecking no | ||
PasswordAuthentication no | ||
IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/centos8 | ||
IdentitiesOnly yes | ||
LogLevel FATAL | ||
|
||
# Host fedora28 | ||
# HostName 172.18.255.86 | ||
# User vagrant | ||
# Port 22 | ||
# UserKnownHostsFile /dev/null | ||
# StrictHostKeyChecking no | ||
# PasswordAuthentication no | ||
# IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/fedora28 | ||
# IdentitiesOnly yes | ||
# LogLevel FATAL | ||
|
||
# Host fedora29 | ||
# HostName 172.18.253.40 | ||
# User vagrant | ||
# Port 22 | ||
# UserKnownHostsFile /dev/null | ||
# StrictHostKeyChecking no | ||
# PasswordAuthentication no | ||
# IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/fedora29 | ||
# IdentitiesOnly yes | ||
# LogLevel FATAL | ||
|
||
Host fedora35 | ||
HostName 172.18.241.212 | ||
User vagrant | ||
Port 22 | ||
UserKnownHostsFile /dev/null | ||
StrictHostKeyChecking no | ||
PasswordAuthentication no | ||
IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/fedora35 | ||
IdentitiesOnly yes | ||
LogLevel FATAL | ||
|
||
Host opensuse15 | ||
HostName 172.18.246.76 | ||
User vagrant | ||
Port 22 | ||
UserKnownHostsFile /dev/null | ||
StrictHostKeyChecking no | ||
PasswordAuthentication no | ||
IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/opensuse15 | ||
IdentitiesOnly yes | ||
LogLevel FATAL | ||
|
||
Host rhel7 | ||
HostName 172.18.245.107 | ||
User vagrant | ||
Port 22 | ||
UserKnownHostsFile /dev/null | ||
StrictHostKeyChecking no | ||
PasswordAuthentication no | ||
IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/rhel7 | ||
IdentitiesOnly yes | ||
LogLevel FATAL | ||
|
||
Host rhel8 | ||
HostName 172.18.254.195 | ||
User vagrant | ||
Port 22 | ||
UserKnownHostsFile /dev/null | ||
StrictHostKeyChecking no | ||
PasswordAuthentication no | ||
IdentityFile /home/robert.rettig/git/github.com/ndgit/ansible-role-firewall/molecule/physical/.ssh/rhel8 | ||
IdentitiesOnly yes | ||
LogLevel FATAL |
Oops, something went wrong.