Skip to content

Commit

Permalink
ossec lab update
Browse files Browse the repository at this point in the history
  • Loading branch information
goffinet committed Nov 19, 2022
1 parent fea5f6d commit c199e80
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
7 changes: 7 additions & 0 deletions inventories/custom/osseclab/host_vars/controller
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
hostname: srv1
interfaces:
- id: "System eth0"
ipv4_address: "11.12.13.1/24"
ipv4_dns: "11.12.13.1"
login_prompt: "localhost login:"
1 change: 1 addition & 0 deletions inventories/custom/osseclab/host_vars/pc1
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
hostname: pc1
interfaces:
- id: "System eth0"
login_prompt: "localhost login:"
1 change: 1 addition & 0 deletions inventories/custom/osseclab/host_vars/pc2
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
hostname: pc2
interfaces:
- id: "System eth0"
login_prompt: "localhost login:"
1 change: 1 addition & 0 deletions inventories/custom/osseclab/host_vars/srv1
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ interfaces:
ipv4_dns: "192.168.1.1"
# ipv6_address: "2001:db8:acad:1060::50/64"
# ipv6_gateway: "fe80::d1:3"
login_prompt: "localhost login:"
1 change: 1 addition & 0 deletions inventories/custom/osseclab/host_vars/srv2
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ interfaces:
ipv4_dns: "192.168.1.1"
# ipv6_address: "2001:db8:acad:3085::50/64"
# ipv6_gateway: "fe80::3:3"
login_prompt: "localhost login:"
11 changes: 8 additions & 3 deletions inventories/custom/osseclab/templates/controller_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ systemd-machine-id-setup
hostnamectl set-hostname controller
echo controller > /etc/hostname
echo "" > /etc/motd
curl -s https://raw.githubusercontent.com/goffinet/ansible-ccna-lab/master/tests/setup-controller.sh -o setup.sh
bash setup.sh &
disown %1
echo "curl -s https://raw.githubusercontent.com/goffinet/ansible-ccna-lab/master/tests/setup-controller.sh -o setup.sh" > readme.txt
echo "bash setup.sh ; reboot" >> readme.txt
{% for interface in interfaces %}
nmcli c mod "{{ interface['id'] }}" ipv4.method manual ipv4.addresses {{ interface['ipv4_address'] }}
nmcli c mod "{{ interface['id'] }}" ipv4.dns {{ interface['ipv4_dns'] }}
nmcli c up "{{ interface['id'] }}"
{% endfor %}
#disown %1
28 changes: 14 additions & 14 deletions playbooks/lab_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,6 @@
post_login: 120
login_prompt: 60
config_dialog: 60
- name: "Push config on centos nodes"
when: image_style == "centos"
telnet:
host: "{{ nodes_inventory[inventory_hostname]['server'] }}"
port: "{{ nodes_inventory[inventory_hostname]['console_port'] }}"
login_prompt: "localhost login:"
user: "{{ ansible_user }}"
password: "{{ ansible_password }}"
send_newline: yes
prompts:
- "[#]"
command: "{{ boilerplate_config.splitlines() }}"
timeout: 180
pause: 2
- name: "Push config on openwrt nodes"
when: image_style == "openwrt"
gns3_telnet_console:
Expand All @@ -148,6 +134,20 @@
post_login: 60
login_prompt: 30
config_dialog: 30
- name: "Push config on centos nodes"
when: image_style == "centos"
telnet:
host: "{{ nodes_inventory[inventory_hostname]['server'] }}"
port: "{{ nodes_inventory[inventory_hostname]['console_port'] }}"
login_prompt: "{{ login_prompt | default('localhost login:') }}"
user: "{{ ansible_user }}"
password: "{{ ansible_password }}"
send_newline: yes
prompts:
- "[#]"
command: "{{ boilerplate_config.splitlines() }}"
timeout: 30
pause: 2
tags:
- provision
- name: "Pause for 5 minutes to build all nodes"
Expand Down

0 comments on commit c199e80

Please sign in to comment.