From 04b813ad37c6780f2e1bf516bf806f15cfb85ab1 Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Mon, 7 May 2018 17:39:15 +0200 Subject: [PATCH] Use stanza style for modules with multiple parameters --- handlers/main.yml | 8 +++++--- tasks/icinga2-Debian.yml | 16 ++++++++++++---- tasks/icinga2-RedHat.yml | 8 ++++++-- tasks/main.yml | 5 ++++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index edb701c..6f016c2 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -2,6 +2,8 @@ - name: start icinga2 become: yes - service: name=icinga2 state=started enabled=yes - when: - - i2_manage_service + service: + name=icinga2 + state=started + enabled=yes + when: i2_manage_service diff --git a/tasks/icinga2-Debian.yml b/tasks/icinga2-Debian.yml index 19de05b..2e83fc7 100644 --- a/tasks/icinga2-Debian.yml +++ b/tasks/icinga2-Debian.yml @@ -2,23 +2,31 @@ - name: Debian - Install apt-transport-https become: yes - apt: name=apt-transport-https state=present + apt: + name=apt-transport-https + state=present when: i2_manage_repository - name: Debian - Add Icinga 2 repository key become: yes - apt_key: url="{{ i2_apt_key }}" state=present + apt_key: + url="{{ i2_apt_key }}" + state=present when: i2_manage_repository and i2_apt_key - name: Debian - Add Icinga 2 repository become: yes - apt_repository: repo={{ item.repo }} state={{ item.state}} + apt_repository: + repo={{ item.repo }} + state={{ item.state}} with_items: - { repo: "{{ i2_apt_url }}", state: "present" } when: i2_manage_repository - name: Debian - Ensure icinga2 is installed become: yes - apt: name=icinga2 state=present + apt: + name=icinga2 + state=present notify: start icinga2 when: i2_manage_package diff --git a/tasks/icinga2-RedHat.yml b/tasks/icinga2-RedHat.yml index 405ff41..be90aba 100644 --- a/tasks/icinga2-RedHat.yml +++ b/tasks/icinga2-RedHat.yml @@ -2,11 +2,15 @@ - name: RedHat - Add Icinga 2 repository become: yes - template: src=ICINGA-release.repo dest=/etc/yum.repos.d/ICINGA-release.repo + template: + src=ICINGA-release.repo + dest=/etc/yum.repos.d/ICINGA-release.repo when: i2_manage_repository - name: RedHat - Ensure icinga2 is installed become: yes - yum: name=icinga2 state=present + yum: + name=icinga2 + state=present notify: start icinga2 when: i2_manage_package diff --git a/tasks/main.yml b/tasks/main.yml index a0a8d0e..d2c0638 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,5 +5,8 @@ - install - name: Make sure Icinga 2 is started - service: name=icinga2 state=started enabled=yes + service: + name=icinga2 + state=started + enabled=yes when: i2_manage_service -- GitLab