Adding jail precreation chroot tools

This commit is contained in:
László Károlyi 2019-09-01 17:12:05 +02:00
parent 5091481b42
commit 09e19a53a8
Signed by: karolyi
GPG key ID: 2DCAF25E55735BFE
6 changed files with 46 additions and 1 deletions

View file

@ -0,0 +1,11 @@
- name: Unmounting devFS from chroot
mount:
path: '{{ vars["jail_" + jail_name + "_new_path"] }}/dev'
state: unmounted
- name: Create resolv.conf for live usage in jail
copy:
dest: '{{ vars["jail_" + jail_name + "_new_path"] }}/etc/resolv.conf'
content: |
nameserver {{ vars["jail_" + jail_name + "_new_ip4"] }}

View file

@ -0,0 +1,28 @@
- name: Create local repo config dir
file:
path: '{{ vars["jail_" + jail_name + "_new_path"] }}/usr/local/etc/pkg/repos'
state: directory
- name: Copy FreeBSD repo config in place
copy:
src: FreeBSD.conf
dest: '{{ vars["jail_" + jail_name + "_new_path"] }}/usr/local/etc/pkg/repos/FreeBSD.conf'
- name: Create resolv.conf for install usage in jail
copy:
dest: '{{ vars["jail_" + jail_name + "_new_path"] }}/etc/resolv.conf'
content: |
nameserver 127.0.0.1
- name: Mounting devFS into chroot for pkg
mount:
src: devfs
path: '{{ vars["jail_" + jail_name + "_new_path"] }}/dev'
fstype: devfs
state: mounted
- name: Restarting syslog
service:
name: syslogd
state: restarted

View file

@ -104,3 +104,4 @@
ip6_addr = {{ jail_THIS_with_ip6 }}
when: 'jail_THIS_with_ip6 != False'
# vim: sw=2

View file

@ -83,6 +83,9 @@
loop_control:
loop_var: jail_id
- name: Reload PF
command: /sbin/pfctl -f /etc/pf.conf
- name: Starting jail when IPv6 present
command:
jail -c
@ -102,4 +105,4 @@
loop_control:
loop_var: jail_id
# vim: sw=2

View file

@ -71,3 +71,4 @@
{{ dynamic_jails_path }}/{{ jail_id }}
state: absent
# vim: sw=2

View file

@ -51,3 +51,4 @@
name: syslogd
state: restarted
# vim: sw=2