Skip to content

Commit

Permalink
Style updates for modern ansible: (when: and att=var notation)
Browse files Browse the repository at this point in the history
 - Change all attrib=var notation to be YAML colon notation
 - Change all remaining when: and conditionals to be lists
  • Loading branch information
xenithorb committed Sep 14, 2016
1 parent e0423f6 commit bcc487c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
24 changes: 16 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tasks/mongodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions tasks/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
8 changes: 6 additions & 2 deletions tasks/repo_RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bcc487c

Please sign in to comment.