Commit 7a061cf1 authored by Pietsch, Martin's avatar Pietsch, Martin

convert with_-loops to loop-loops; add missing name tags

parent 21160dd8
......@@ -22,7 +22,7 @@
line: "{{ rcline.line }}"
regexp: "{{ rcline.regexp }}"
create: yes
with_items:
loop:
- { line: 'sshd_enable="NO"', regexp: "^sshd_enable=" }
- { line: 'sendmail_enable="NONE"', regexp: "^sendmail_enable=" }
- { line: 'cron_enable="NO"', regexp: "^cron_enable=" }
......@@ -50,7 +50,7 @@
src: "{{ custfile.src }}"
dest: "{{ mfsbsdroot }}/customfiles/"
mode: "{{ custfile.mode }}"
with_items:
loop:
- { src: unattended.sh, mode: "0755" }
- { src: installerconfig.tpl, mode: "0755" }
loop_control:
......@@ -93,7 +93,7 @@
get_url:
url: "{{ '%s/%s/%s-RELEASE/%s' | format(freebsd_install_local_mirror | default(freebsd_install_home_mirror), distdata[0], distdata[1], repofile) }}"
dest: "{{ '%s/repo/%s' | format(mfsbsdroot, repofile) }}"
with_items:
loop:
- "base.txz"
- "kernel.txz"
loop_control:
......
- name: gathering IP addresses for "{{ container.name }}"
set_fact:
container_options: {}
_container_options: {}
- set_fact:
container_options: >-
- name: gathering IP addresses for "{{ container.name }}" within NAT settings
set_fact:
_container_options: >-
{% set opts = {} -%}
{% if item.container == container.name -%}
{% do opts.update({'ipv4': ((container_options | default({})).ipv4 | default([])) + [item.ipv4]}) if item.ipv4 is defined and not (item.ipv4 in ((container_options | default({})).ipv4 | default([]))) -%}
{% do opts.update({'ipv6': ((container_options | default({})).ipv6 | default([])) + [item.ipv6]}) if item.ipv6 is defined and not (item.ipv6 in ((container_options | default({})).ipv6 | default([]))) -%}
{% if _natif.container == container.name -%}
{% do opts.update({'ipv4': ((_container_options | default({})).ipv4 | default([])) + [_natif.ipv4]}) if _natif.ipv4 is defined and not (_natif.ipv4 in ((_container_options | default({})).ipv4 | default([]))) -%}
{% do opts.update({'ipv6': ((_container_options | default({})).ipv6 | default([])) + [_natif.ipv6]}) if _natif.ipv6 is defined and not (_natif.ipv6 in ((_container_options | default({})).ipv6 | default([]))) -%}
{% endif -%}
{{ (container_options | default({})) | combine(opts) }}
when: item.container is defined
with_items: "{{ network.nat | default([]) }}"
{{ (_container_options | default({})) | combine(opts) }}
when: _natif.container is defined
loop: "{{ network.nat | default([]) }}"
loop_control:
loop_var: _natif
- set_fact:
container_options: >-
- name: gathering IP addresses for "{{ container.name }}" within network device settings
set_fact:
_container_options: >-
{% set opts = {} -%}
{% if item.value.container == container.name -%}
{% do opts.update({'ipv4': ((container_options | default({})).ipv4 | default([])) + [item.value.ipv4]}) if item.value.ipv4 is defined and not (item.value.ipv4 in ((container_options | default({})).ipv4 | default([]))) -%}
{% do opts.update({'ipv6': ((container_options | default({})).ipv6 | default([])) + [item.value.ipv6]}) if item.value.ipv6 is defined and not (item.value.ipv6 in ((container_options | default({})).ipv6 | default([]))) -%}
{% if _natif.value.container == container.name -%}
{% do opts.update({'ipv4': ((_container_options | default({})).ipv4 | default([])) + [_natif.value.ipv4]}) if _natif.value.ipv4 is defined and not (_natif.value.ipv4 in ((_container_options | default({})).ipv4 | default([]))) -%}
{% do opts.update({'ipv6': ((_container_options | default({})).ipv6 | default([])) + [_natif.value.ipv6]}) if _natif.value.ipv6 is defined and not (_natif.value.ipv6 in ((_container_options | default({})).ipv6 | default([]))) -%}
{% endif -%}
{{ (container_options | default({})) | combine(opts) }}
when: item.value.container is defined
with_dict: "{{ network.devices | default({}) }}"
{{ (_container_options | default({})) | combine(opts) }}
when: _natif.value.container is defined
loop: "{{ network.devices | default({}) | dict2items }}"
loop_control:
loop_var: _netdev
- set_fact:
- name: append found IP addresses to container variable
set_fact:
container: >-
{% do container.container_options.update({'ip4.addr': container_options.ipv4 | join(',')}) if container_options.ipv4 is defined -%}
{% do container.container_options.update({'ip6.addr': container_options.ipv6 | join(',')}) if container_options.ipv6 is defined -%}
{% do container.container_options.update({'ip4.addr': _container_options.ipv4 | join(',')}) if _container_options.ipv4 is defined -%}
{% do container.container_options.update({'ip6.addr': _container_options.ipv6 | join(',')}) if _container_options.ipv6 is defined -%}
{% do container.update({'jailname': container.name | replace('.', '_')}) -%}
{{ container }}
......@@ -22,8 +22,8 @@
- name: get remote package checksums
set_fact:
chksums: "{{ bspkg | fbsdmfentry('new', chksums | default({})) }}"
with_url:
- "{{ '%s/%s/%s-RELEASE/MANIFEST' | format(freebsd_install_home_mirror, distdata[0], distdata[1]) }}"
loop:
- "{{ lookup('url', '%s/%s/%s-RELEASE/MANIFEST' | format(freebsd_install_home_mirror, distdata[0], distdata[1])) }}"
loop_control:
loop_var: bspkg
......@@ -37,7 +37,7 @@
set_fact:
chksums: "{{ bspkg | fbsdmfentry('old', chksums | default({})) }}"
when: bspkg != ""
with_items:
loop:
- "{{ lookup('file', '/tmp/MANIFEST') | split('\n') }}"
loop_control:
loop_var: bspkg
......@@ -54,7 +54,7 @@
dest: "{{ '%s/%s.txz' | format(release_path, bspkg.key) }}"
force: yes
when: bspkg.value.new != (bspkg.value.old | default(""))
with_dict: "{{ chksums }}"
loop: "{{ chksums | dict2items }}"
loop_control:
loop_var: bspkg
......
......@@ -2,7 +2,7 @@
- name: configure container
include_tasks: _pkgconfigure.yml
when: (container.container | default(False)) == True
with_items: "{{ function_packages }}"
loop: "{{ function_packages }}"
loop_control:
loop_var: container
......@@ -28,7 +28,7 @@
- name: configure containers devfs
include_tasks: _jaildevfs.yml
when: (container.container | default(False)) == True
with_items: "{{ function_packages }}"
loop: "{{ function_packages }}"
loop_control:
loop_var: container
......@@ -36,7 +36,7 @@
- name: create and configure container
include_tasks: _jailcreation.yml
when: (container.container | default(False)) == True
with_items: "{{ function_packages }}"
loop: "{{ function_packages }}"
loop_control:
loop_var: container
when: (system_suppress_container_creation | default(False)) == False
......
......@@ -8,9 +8,7 @@
include_role:
name: system.freebsd
tasks_from: _buildinstimg
with_nested:
- "{{ system_supported_architectures }}"
- "{{ system_supported_releases }}"
loop: "{{ system_supported_architectures | product(system_supported_releases) | list }}"
loop_control:
loop_var: distdata
......@@ -31,18 +31,18 @@
enabled: yes
- name: create and configure container
include_tasks: _jailconfig.yml
when: (item.container | default(False)) == True
with_items: "{{ function_packages }}"
include_tasks: _jailcreation.yml
when: (container.container | default(False)) == True
loop: "{{ function_packages }}"
loop_control:
loop_var: jail
loop_var: container
when: function_container_used == True
- name: install and configure native packages
include_role:
name: "package.{{ pkg.name }}"
when: (pkg.container | default(False)) == False
with_items: "{{ function_packages | default([]) }}"
loop: "{{ function_packages | default([]) }}"
loop_control:
loop_var: pkg
......@@ -7,9 +7,7 @@
- name: create freebsd release mirror
include_tasks: _releasemirror.yml
with_nested:
- "{{ system_supported_architectures }}"
- "{{ system_supported_releases }}"
loop: "{{ system_supported_architectures | product(system_supported_releases) | list }}"
loop_control:
loop_var: distdata
......@@ -21,8 +19,6 @@
- name: create freebsd release mirror
include_tasks: _packagemirror.yml
with_nested:
- "{{ system_supported_architectures }}"
- "{{ system_supported_releases }}"
loop: "{{ system_supported_architectures | product(system_supported_releases) | list }}"
loop_control:
loop_var: distdata
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment