aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/network.yml
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-06-23 11:16:59 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-06-23 14:45:50 +0300
commit054b2815758e93c699e9a6bb32853e2a4cdef2ff (patch)
tree5f97e1b91ce90e104ba726ba70ec682846883aec /tasks/network.yml
parentb3c6ca37500b52821b2b66147b22190414c09993 (diff)
Add email, network, zfs tasks
Diffstat (limited to 'tasks/network.yml')
-rw-r--r--tasks/network.yml39
1 files changed, 39 insertions, 0 deletions
diff --git a/tasks/network.yml b/tasks/network.yml
new file mode 100644
index 0000000..da194b9
--- /dev/null
+++ b/tasks/network.yml
@@ -0,0 +1,39 @@
+- name: Check existence of lan0
+ shell: ifconfig lan0 || echo "failed"
+ register: lan0_status
+
+- name: Check existence of wan0
+ shell: ifconfig wan0 || echo "failed"
+ register: wan0_status
+
+- name: Set up network interfaces
+ shell: |
+ sysrc -x ifconfig_igc0
+ sysrc -x ifconfig_igc0_ipv6
+ sysrc ifconfig_igc0_name="lan0"
+ sysrc ifconfig_igc1_name="wan0"
+ sysrc ifconfig_lan0="DHCP"
+ sysrc ifconfig_lan0_ipv6="inet6 accept_rtadv"
+ sysrc ifconfig_wan0="DHCP"
+ sysrc ifconfig_wan0_ipv6="inet6 accept_rtadv"
+
+- name: Restart networking if custom interfaces do not exist
+ shell: service netif restart
+ when: lan0_status.stdout.find('failed') != -1 or
+ wan0_status.stdout.find('failed') != -1
+
+- name: Update facts
+ setup:
+
+- name: Set up sshd
+ template:
+ src: etc_ssh_sshd_config.j2
+ dest: /etc/ssh/sshd_config
+ owner: root
+ group: wheel
+ mode: "0644"
+ register: etc_sshd_config
+
+- name: Restart sshd
+ shell: service sshd restart
+ when: etc_sshd_config.changed