fix indentation and spaces

This commit is contained in:
Robert Kaussow 2019-01-09 22:11:03 +01:00
parent 52226b4267
commit 7ca5074157
2 changed files with 75 additions and 74 deletions

View File

@ -1,3 +1,4 @@
# Standards: 0.1
--- ---
galaxy_info: galaxy_info:
author: xoxys author: xoxys
@ -5,9 +6,9 @@ galaxy_info:
license: MIT license: MIT
min_ansible_version: 2.4 min_ansible_version: 2.4
platforms: platforms:
- name: EL - name: EL
versions: versions:
- 7 - 7
galaxy_tags: galaxy_tags:
- network - network
- unifi - unifi

View File

@ -14,57 +14,57 @@
become_user: root become_user: root
- block: - block:
- name: Download unifi version '{{ unifi_version }}' - name: Download unifi version '{{ unifi_version }}'
get_url: get_url:
url: "https://dl.ubnt.com/unifi/{{ unifi_version }}/UniFi.unix.zip" url: "https://dl.ubnt.com/unifi/{{ unifi_version }}/UniFi.unix.zip"
dest: /tmp/UniFi.unix.zip dest: /tmp/UniFi.unix.zip
force: true force: true
- name: Setup unifi version '{{ unifi_version }}' - name: Setup unifi version '{{ unifi_version }}'
unarchive: unarchive:
src: /tmp/UniFi.unix.zip src: /tmp/UniFi.unix.zip
dest: "{{ unifi_base_dir }}/{{ unifi_version }}" dest: "{{ unifi_base_dir }}/{{ unifi_version }}"
remote_src: yes remote_src: yes
- name: Cleanup - name: Cleanup
file: file:
path: /tmp/UniFi.unix.zip path: /tmp/UniFi.unix.zip
state: absent state: absent
become: True become: True
become_user: "{{ unifi_user }}" become_user: "{{ unifi_user }}"
when: unifi_version is version(unifi_current_version, ">") or unifi_current_version is version('0.0.0', "=") when: unifi_version is version(unifi_current_version, ">") or unifi_current_version is version('0.0.0', "=")
- block: - block:
- name: Remove data folder from new version - name: Remove data folder from new version
file: file:
path: "{{ unifi_base_dir }}/{{ unifi_version }}//UniFi/data" path: "{{ unifi_base_dir }}/{{ unifi_version }}//UniFi/data"
state: absent state: absent
become: True become: True
become_user: "{{ unifi_user }}" become_user: "{{ unifi_user }}"
- name: Stop service while restore process - name: Stop service while restore process
systemd: systemd:
state: stopped state: stopped
enabled: yes enabled: yes
name: unifi name: unifi
become: True become: True
become_user: root become_user: root
- name: Copy data folder from previews version - name: Copy data folder from previews version
synchronize: synchronize:
src: "{{ unifi_base_dir }}/{{ unifi_current_version }}/UniFi/data" src: "{{ unifi_base_dir }}/{{ unifi_current_version }}/UniFi/data"
dest: "{{ unifi_base_dir }}/{{ unifi_version }}/UniFi" dest: "{{ unifi_base_dir }}/{{ unifi_version }}/UniFi"
become: True become: True
become_user: "{{ unifi_user }}" become_user: "{{ unifi_user }}"
delegate_to: "{{ inventory_hostname }}" delegate_to: "{{ inventory_hostname }}"
- name: Start service after restore process - name: Start service after restore process
systemd: systemd:
state: started state: started
enabled: yes enabled: yes
name: unifi name: unifi
become: True become: True
become_user: root become_user: root
when: when:
- unifi_version is version(unifi_current_version, ">") - unifi_version is version(unifi_current_version, ">")
- unifi_restore_after_upgrade - unifi_restore_after_upgrade
@ -79,37 +79,37 @@
become_user: "{{ unifi_user }}" become_user: "{{ unifi_user }}"
- block: - block:
- name: Open ports in iptables - name: Open ports in iptables
iptables_raw: iptables_raw:
name: "{{ item.name }}" name: "{{ item.name }}"
rules: "{{ item.rules }}" rules: "{{ item.rules }}"
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 }}" with_items: "{{ unifi_open_ports }}"
loop_control: loop_control:
label: "{{item.name}}" label: "{{ item.name }}"
when: unifi_iptables_enabled when: unifi_iptables_enabled
- name: Create systemd unit files - name: Create systemd unit files
template: template:
src: "etc/systemd/system/unifi.service.j2" src: "etc/systemd/system/unifi.service.j2"
dest: "/etc/systemd/system/unifi.service" dest: "/etc/systemd/system/unifi.service"
mode: 0644 mode: 0644
notify: notify:
- __unifi_restart - __unifi_restart
- name: Ensure service is up and running - name: Ensure service is up and running
systemd: systemd:
state: started state: started
daemon_reload: yes daemon_reload: yes
enabled: yes enabled: yes
name: unifi name: unifi
- name: Set current version to custom fact - name: Set current version to custom fact
template: template:
src: etc/ansible/facts.d/unifi.fact.j2 src: etc/ansible/facts.d/unifi.fact.j2
dest: /etc/ansible/facts.d/unifi.fact dest: /etc/ansible/facts.d/unifi.fact
when: unifi_version is version(unifi_current_version, ">") or unifi_current_version is version('0.0.0', "=") when: unifi_version is version(unifi_current_version, ">") or unifi_current_version is version('0.0.0', "=")
become: True become: True
become_user: root become_user: root