switch to new loop syntax
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2019-02-03 23:26:35 +01:00
parent 91eafefb9c
commit 627b461aac
5 changed files with 8 additions and 24 deletions

View File

@ -52,8 +52,6 @@ unifi_tls_certs_dir: "{{ unifi_base_dir }}/tls/certs"
unifi_tls_key_dir: "{{ unifi_base_dir }}/tls/private" unifi_tls_key_dir: "{{ unifi_base_dir }}/tls/private"
unifi_tls_cert_file: "{{ unifi_tls_certs_dir }}/mycert.pem" unifi_tls_cert_file: "{{ unifi_tls_certs_dir }}/mycert.pem"
unifi_tls_key_file: "{{ unifi_tls_key_dir }}/mykey.pem" unifi_tls_key_file: "{{ unifi_tls_key_dir }}/mykey.pem"
unifi_tls_source_use_content: False
unifi_tls_source_use_files: True
unifi_tls_cert_source: mycert.pem unifi_tls_cert_source: mycert.pem
unifi_tls_key_source: mykey.pem unifi_tls_key_source: mykey.pem

View File

@ -6,7 +6,7 @@
owner: "{{ unifi_user }}" owner: "{{ unifi_user }}"
group: "{{ unifi_group }}" group: "{{ unifi_group }}"
recurse: True recurse: True
with_items: loop:
- "{{ unifi_base_dir }}" - "{{ unifi_base_dir }}"
- "{{ unifi_base_dir }}/{{ unifi_version }}" - "{{ unifi_base_dir }}/{{ unifi_version }}"
- "{{ unifi_tmp_dir }}" - "{{ unifi_tmp_dir }}"
@ -86,7 +86,7 @@
state: "{{ item.state }}" state: "{{ item.state }}"
weight: "{{ item.weight|default(omit) }}" weight: "{{ item.weight|default(omit) }}"
table: "{{ item.table|default(omit) }}" table: "{{ item.table|default(omit) }}"
with_items: "{{ unifi_open_ports }}" loop: "{{ unifi_open_ports }}"
loop_control: loop_control:
label: "{{ item.name }}" label: "{{ item.name }}"
when: unifi_iptables_enabled when: unifi_iptables_enabled

View File

@ -1,30 +1,16 @@
--- ---
- block: - block:
- name: Copy certs and private key to nginx proxy (content) - name: Copy certs and private key to nginx proxy
copy:
content: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
with_items:
- { src: "{{ unifi_tls_key_source }}", dest: '/etc/pki/tls/private/{{ unifi_nginx_tls_key_file }}', mode: '0600' }
- { src: "{{ unifi_tls_cert_source }}", dest: '/etc/pki/tls/certs/{{ unifi_nginx_tls_cert_file }}', mode: '0750' }
loop_control:
label: "{{ item.dest }}"
notify: __nginx_reload
when: unifi_tls_source_use_content
- name: Copy certs and private key to nginx proxy (files)
copy: copy:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
with_items: loop:
- { src: "{{ unifi_tls_key_source }}", dest: '/etc/pki/tls/private/{{ unifi_nginx_tls_key_file }}', mode: '0600' } - { src: "{{ unifi_tls_key_source }}", dest: '/etc/pki/tls/private/{{ unifi_nginx_tls_key_file }}', mode: '0600' }
- { src: "{{ unifi_tls_cert_source }}", dest: '/etc/pki/tls/certs/{{ unifi_nginx_tls_cert_file }}', mode: '0750' } - { src: "{{ unifi_tls_cert_source }}", dest: '/etc/pki/tls/certs/{{ unifi_nginx_tls_cert_file }}', mode: '0750' }
loop_control: loop_control:
label: "{{ item.dest }}" label: "{{ item.dest }}"
notify: __nginx_reload notify: __nginx_reload
when: unifi_tls_source_use_files
delegate_to: "{{ unifi_nginx_server }}" delegate_to: "{{ unifi_nginx_server }}"
when: unifi_nginx_tls_enabled when: unifi_nginx_tls_enabled
become: True become: True

View File

@ -11,7 +11,7 @@
package: package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
with_items: loop:
- "java-{{ unifi_openjdk_version }}-openjdk" - "java-{{ unifi_openjdk_version }}-openjdk"
- unzip - unzip
- wget - wget

View File

@ -7,7 +7,7 @@
owner: "{{ unifi_user }}" owner: "{{ unifi_user }}"
group: "{{ unifi_group }}" group: "{{ unifi_group }}"
recurse: True recurse: True
with_items: loop:
- "{{ unifi_tls_certs_dir }}" - "{{ unifi_tls_certs_dir }}"
- "{{ unifi_tls_key_dir }}" - "{{ unifi_tls_key_dir }}"
become: True become: True
@ -19,7 +19,7 @@
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
with_items: loop:
- { src: "{{ unifi_tls_key_source }}", dest: '{{ unifi_tls_key_file }}', mode: '0600' } - { src: "{{ unifi_tls_key_source }}", dest: '{{ unifi_tls_key_file }}', mode: '0600' }
- { src: "{{ unifi_tls_cert_source }}", dest: '{{ unifi_tls_cert_file }}', mode: '0750' } - { src: "{{ unifi_tls_cert_source }}", dest: '{{ unifi_tls_cert_file }}', mode: '0750' }
loop_control: loop_control:
@ -32,7 +32,7 @@
content: "{{ item.src }}" content: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
with_items: loop:
- { src: "{{ unifi_tls_key_source }}", dest: '{{ unifi_tls_key_file }}', mode: '0600' } - { src: "{{ unifi_tls_key_source }}", dest: '{{ unifi_tls_key_file }}', mode: '0600' }
- { src: "{{ unifi_tls_cert_source }}", dest: '{{ unifi_tls_cert_file }}', mode: '0750' } - { src: "{{ unifi_tls_cert_source }}", dest: '{{ unifi_tls_cert_file }}', mode: '0750' }
loop_control: loop_control: