From bcc487c2af0c9a9ab97dcea411b73057f4dd6358 Mon Sep 17 00:00:00 2001 From: Michael Goodwin Date: Wed, 14 Sep 2016 17:49:07 -0400 Subject: [PATCH] Style updates for modern ansible: (when: and att=var notation) - Change all attrib=var notation to be YAML colon notation - Change all remaining when: and conditionals to be lists --- tasks/main.yml | 24 ++++++++++++++++-------- tasks/mongodb.yml | 5 ++++- tasks/nginx.yml | 9 +++++++-- tasks/repo_RedHat.yml | 8 ++++++-- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 2c636e5..ed042aa 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -86,8 +86,9 @@ package: name: acl state: present - when: (ansible_distribution == "Ubuntu") - and (ansible_distribution_major_version == "16") + when: + - ansible_distribution == "Ubuntu" + - ansible_distribution_major_version == "16" - name: Fetch the Rocket.Chat binary tarball get_url: @@ -106,8 +107,9 @@ - name: Upgrade Rocket.Chat include: upgrade.yml - when: ( result|changed ) - and ( rocket_chat_deploy_state.stat.exists ) + when: + - result|changed + - rocket_chat_deploy_state.stat.exists tags: - upgrade @@ -139,8 +141,9 @@ state: link force: yes - when: (ansible_distribution == "Ubuntu") - and (ansible_distribution_major_version == "14") + when: + - ansible_distribution == "Ubuntu" + - ansible_distribution_major_version == "14" - name: Ensure the Rocket.Chat application data permissions are correct file: @@ -182,11 +185,16 @@ when: rocket_chat_include_mongodb|bool - name: Restart the Rocket.Chat service [UPGRADE] - service: name=rocketchat state=restarted + service: + name: rocketchat + state: restarted when: rocket_chat_upgraded|bool - name: Ensure the Rocket.Chat service is running/enabled - service: name=rocketchat state=started enabled=true + service: + name: rocketchat + state: started + enabled: true tags: service - include: nginx.yml diff --git a/tasks/mongodb.yml b/tasks/mongodb.yml index f7fbe1b..14ac638 100644 --- a/tasks/mongodb.yml +++ b/tasks/mongodb.yml @@ -35,4 +35,7 @@ - meta: flush_handlers - name: Ensure the MongoDB service is started/enabled - service: name=mongod state=started enabled=yes + service: + name: mongod + state: started + enabled: yes diff --git a/tasks/nginx.yml b/tasks/nginx.yml index dbbbcf8..3fdf8af 100644 --- a/tasks/nginx.yml +++ b/tasks/nginx.yml @@ -8,7 +8,9 @@ (ansible_selinux.status != "disabled") - name: Ensure Nginx is present - package: name=nginx state=present + package: + name: nginx + state: present - name: Deploy Nginx configuration template: @@ -62,4 +64,7 @@ notify: Reload the Nginx service - name: Ensure the Nginx service is running/enabled - service: name=nginx state=started enabled=true + service: + name: nginx + state: started + enabled: true diff --git a/tasks/repo_RedHat.yml b/tasks/repo_RedHat.yml index 1d34ae3..d1b2909 100644 --- a/tasks/repo_RedHat.yml +++ b/tasks/repo_RedHat.yml @@ -2,7 +2,11 @@ # tasks/repo_RedHat.yml: RedHat based distro repository configuration for RocketChat.Ansible - name: Ensure the EPEL repository is present - yum: name=epel-release state=present + yum: + name: epel-release + state: present - name: Ensure the EPEL repository GPG key is imported - rpm_key: key=/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 state=present + rpm_key: + key: /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 + state: present