Update jail updater, add vim control statements

This commit is contained in:
László Károlyi 2020-09-19 10:06:25 +02:00
parent 97409d661f
commit 9202a2643c
Signed by: karolyi
GPG key ID: 2DCAF25E55735BFE
6 changed files with 46 additions and 27 deletions

View file

@ -84,3 +84,5 @@ jail_MODIFY_ME_timezone: Europe/Berlin
# Include file places, override in your role config with absolute paths to your tasks # Include file places, override in your role config with absolute paths to your tasks
jail_include_noop: '{{ vars["ansible_roles_path"] }}/karolyi.ansible-freebsd-jailhost-tools/tasks/noop.yml' jail_include_noop: '{{ vars["ansible_roles_path"] }}/karolyi.ansible-freebsd-jailhost-tools/tasks/noop.yml'
# vim: sw=2

View file

@ -23,3 +23,4 @@
content: | content: |
nameserver {{ vars["jail_" + jail_name + "_new_ip4"] }} nameserver {{ vars["jail_" + jail_name + "_new_ip4"] }}
# vim: sw=2

View file

@ -64,3 +64,5 @@
vars['jail_' + jail_name + '_newest_id'] vars['jail_' + jail_name + '_newest_id']
}} }}
when: not jail_THIS_with_ip6 when: not jail_THIS_with_ip6
# vim: sw=2

View file

@ -9,3 +9,4 @@
when: jail_is_old_running when: jail_is_old_running
# vim: sw=2

View file

@ -17,13 +17,18 @@
# --- # ---
# UPDATING the existing jail when the base system is not outdated # UPDATING the existing jail when the base system is not outdated
# --- # ---
- block: - block:
- name: Check if packages have to be upgraded - name: Check if packages have to be upgraded
command: command:
/usr/sbin/pkg /usr/sbin/pkg
-j {{ vars['jail_' + jail_name + '_newest_id'] }} -j {{ vars['jail_' + jail_name + '_newest_id'] }}
upgrade --dry-run -y upgrade --dry-run
environment:
AUTOCLEAN: YES
ASSUME_ALWAYS_YES: YES
HANDLE_RC_SCRIPTS: YES
register: jail_pkgs register: jail_pkgs
ignore_errors: true ignore_errors: true
changed_when: jail_pkgs.rc != 0 changed_when: jail_pkgs.rc != 0
@ -36,37 +41,43 @@
command: command:
/usr/sbin/pkg /usr/sbin/pkg
-j {{ vars['jail_' + jail_name + '_newest_id'] }} -j {{ vars['jail_' + jail_name + '_newest_id'] }}
upgrade -y upgrade
environment:
AUTOCLEAN: YES
ASSUME_ALWAYS_YES: YES
HANDLE_RC_SCRIPTS: YES
when: jail_pkgs is changed when: jail_pkgs is changed
when: jail_THIS_must_replace when: not jail_THIS_must_replace
# --- # # ---
# CREATING a new jail when the base system is outdated # # CREATING a new jail when the base system is outdated
# --- # # ---
- block: #
# - block:
- include_tasks: '{{ vars["jail_" + jail_name + "_include_update_precreate"] | default(jail_include_noop) }}' #
vars: # - include_tasks: '{{ vars["jail_" + jail_name + "_include_update_precreate"] | default(jail_include_noop) }}'
include_type: '{{ "jail_" + jail_name + "_include_update_precreate" }}' # vars:
# include_type: '{{ "jail_" + jail_name + "_include_update_precreate" }}'
- name: Creating a new {{ jail_name }} jail #
include_tasks: '{{ ansible_roles_path }}/karolyi.ansible-freebsd-jailhost-tools/tasks/jail/create.yml' # - name: Creating a new {{ jail_name }} jail
# include_tasks: '{{ ansible_roles_path }}/karolyi.ansible-freebsd-jailhost-tools/tasks/jail/create.yml'
- include_tasks: '{{ vars["jail_" + jail_name + "_include_update_prestart"] | default(jail_include_noop) }}' #
vars: # - include_tasks: '{{ vars["jail_" + jail_name + "_include_update_prestart"] | default(jail_include_noop) }}'
include_type: '{{ "jail_" + jail_name + "_include_update_prestart" }}' # vars:
# include_type: '{{ "jail_" + jail_name + "_include_update_prestart" }}'
- name: Starting the new {{ jail_name }} jail #
include_tasks: '{{ ansible_roles_path }}/karolyi.ansible-freebsd-jailhost-tools/tasks/jail/start.yml' # - name: Starting the new {{ jail_name }} jail
# include_tasks: '{{ ansible_roles_path }}/karolyi.ansible-freebsd-jailhost-tools/tasks/jail/start.yml'
- include_tasks: '{{ vars["jail_" + jail_name + "_include_update_poststart"] | default(jail_include_noop) }}' #
vars: # - include_tasks: '{{ vars["jail_" + jail_name + "_include_update_poststart"] | default(jail_include_noop) }}'
include_type: '{{ "jail_" + jail_name + "_include_update_poststart" }}' # vars:
# include_type: '{{ "jail_" + jail_name + "_include_update_poststart" }}'
when: jail_THIS_must_replace #
# when: jail_THIS_must_replace
# vim: sw=2

View file

@ -2,3 +2,5 @@
'NOOP, included variable name: {{ include_type | default("unknown")}}' 'NOOP, included variable name: {{ include_type | default("unknown")}}'
debug: debug:
msg: 'NOOP, included variable name: {{ include_type | default("unknown")}}' msg: 'NOOP, included variable name: {{ include_type | default("unknown")}}'
# vim: sw=2