Use new commands

This commit is contained in:
László Károlyi 2021-05-16 20:12:06 +02:00
parent a0996607a4
commit 5cec9fc098
Signed by: karolyi
GPG Key ID: 2DCAF25E55735BFE
11 changed files with 17 additions and 17 deletions

View File

@ -7,14 +7,14 @@
ignore_errors: true
- name: Refresh pkg mirror when package install failed
command: |
ansible.builtin.command: |
'{{ ansible_roles_path }}/karolyi.ansible-freebsd-jailhost-tools/tools/pkgmirror-jailrevalidator.py'
'{{ pkgmirror_url }}' '{{ vars["jail_" + jail_name + "_new_path"] }}' '{{ install_packages }}'
register: revalidate_command
when: install_result.failed
- name: Cleaning downloaded package cache in jail
command:
ansible.builtin.command:
/usr/sbin/pkg
-c {{ vars["jail_" + jail_name + "_new_path"] }}
clean -ayq

View File

@ -1,11 +1,11 @@
- name: Cleaning pkg cache
command:
ansible.builtin.command:
/usr/sbin/pkg
-c {{ vars["jail_" + jail_name + "_new_path"] }}
clean -ayq
- name: Unmounting directories
command:
ansible.builtin.command:
/sbin/umount
-a -F
{{ dynamic_jails_path }}/configs/{{ vars["jail_" + jail_name + "_newest_id"] }}/fstab

View File

@ -23,7 +23,7 @@
state: mounted
- name: Mounting directories
command:
ansible.builtin.command:
/sbin/mount
-a -F
{{ dynamic_jails_path }}/configs/{{ vars["jail_" + jail_name + "_newest_id"] }}/fstab

View File

@ -53,7 +53,7 @@
when: local_resolv is failed
- name: Setup timezone in jail
command:
ansible.builtin.command:
/usr/sbin/tzsetup
-C {{ vars['jail_' + jail_name + '_new_path'] }}
{{ vars['jail_' + jail_name + '_timezone'|default(vars['default_timezone'])] }}

View File

@ -84,10 +84,10 @@
loop_var: jail_id
- name: Reload PF
command: /sbin/pfctl -f /etc/pf.conf
ansible.builtin.command: /sbin/pfctl -f /etc/pf.conf
- name: Starting jail when IPv6 present
command:
ansible.builtin.command:
jail -c
{{
vars['jail_' + jail_name + '_newest_id']

View File

@ -65,7 +65,7 @@
when: 'jail_THIS_with_ip6 != False'
- name: Starting jail when no IPv6 present
command:
ansible.builtin.command:
jail -c
{{
vars['jail_' + jail_name + '_newest_id']

View File

@ -4,7 +4,7 @@
{{ jail_id in running_jail_ids }}
- name: Terminating jail when running
command:
ansible.builtin.command:
/usr/sbin/jail -r {{ jail_id }}
when: jail_is_old_running

View File

@ -19,7 +19,7 @@
marker: '# {mark} ANSIBLE MANAGED BLOCK: {{ jail_id }}'
- name: Getting mounts under this jail
shell:
ansible.builtin.shell:
/sbin/mount -p
| grep '{{ dynamic_jails_path }}/{{ jail_id }}'
| awk '{print $2}'
@ -31,7 +31,7 @@
_root_mount_point: '{{ dynamic_jails_path + "/" + jail_id }}'
- name: Unmounting all mounts from under the jail so it could be destroyed
command:
ansible.builtin.command:
/sbin/umount
'{{ mountpoint }}'
when: mountpoint != _root_mount_point
@ -67,7 +67,7 @@
# Due to a possible bug in the ZFS/FreeBSD kernel, destroying the dataset
# sometimes isn't possible after freeing it up. Hence we use '-f'
- name: Force-destroying ZFS dataset {{ dynamic_jails_dataset_name }}/{{ jail_id }}
command:
ansible.builtin.command:
/sbin/zfs destroy -f
{{ dynamic_jails_dataset_name }}/{{ jail_id }}
# when: 'zfs_destroy is failed and ": Device busy" in zfs_destroy.msg'

View File

@ -21,7 +21,7 @@
- block:
- name: Check if packages have to be upgraded
command:
ansible.builtin.command:
/usr/sbin/pkg
-j {{ vars['jail_' + jail_name + '_newest_id'] }}
upgrade --dry-run
@ -38,7 +38,7 @@
jail_{{ jail_name }}_pkgs: '{{ jail_pkgs }}'
- name: Upgrade packages when necessary
command:
ansible.builtin.command:
/usr/sbin/pkg
-j {{ vars['jail_' + jail_name + '_newest_id'] }}
upgrade

View File

@ -18,7 +18,7 @@
when: 'jail_THIS_with_ip6 != False'
- name: Sending HUP to any any crucial processes to reload their configuration
command:
ansible.builtin.command:
/usr/bin/killall -HUP dnsmasq
failed_when: false

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3.7
#!/usr/bin/env python3
from argparse import ArgumentParser
from collections import defaultdict