ansible: avoid jinja template syntax in when: statements; r=sheehan
authorGregory Szorc <gps@mozilla.com>
Fri, 02 Nov 2018 15:35:06 +0000
changeset 6678 811de1502626e0b4730497dfb5e3907907beb11a
parent 6677 88fa0246970b6eee18512b7f6a2a8a6fbe43b585
child 6679 e586b1e2a0ab70cc5114014d3964c4a6ba4071e3
push id3306
push usercosheehan@mozilla.com
push dateFri, 02 Nov 2018 15:44:43 +0000
treeherderversion-control-tools@a3d756fd35b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssheehan
ansible: avoid jinja template syntax in when: statements; r=sheehan Ansible 2.3 added a warning when "{{ }}" syntax is used in when: conditionals. There were a few of these in our repo. This commit removes them. Differential Revision: https://phabricator.services.mozilla.com/D10660
ansible/deploy-hgmo.yml
ansible/roles/hg-ssh/meta/main.yml
ansible/roles/hg-web/meta/main.yml
ansible/roles/kafka-broker/tasks/main.yml
--- a/ansible/deploy-hgmo.yml
+++ b/ansible/deploy-hgmo.yml
@@ -105,17 +105,17 @@
   tasks:
     - name: discover kafka topics
       command: /opt/kafka/bin/kafka-topics.sh --zookeeper {{ kafka_zookeeper_connect }} --list
       register: kafka_topics
       when: ansible_hostname == 'hgssh1'
 
     - name: create kafka topics
       command: /opt/kafka/bin/kafka-topics.sh --zookeeper {{ kafka_zookeeper_connect }} --create --topic {{ item.topic }} --partitions {{ item.partitions }} --replication-factor {{ kafka_replication_factor }} --config min.insync.replicas={{ kafka_min_insync_replicas }} --config unclean.leader.election.enable=false --config max.message.bytes=104857600
-      when: "ansible_hostname == 'hgssh1' and '{{ item.topic }}' not in kafka_topics.stdout_lines"
+      when: ansible_hostname == 'hgssh1' and item.topic not in kafka_topics.stdout_lines
       with_items:
         - { topic: pushdata, partitions: 8 }
         - { topic: pushlog, partitions: 1 }
         # copy of messages from "pushdata" once they are acknowledged by mirrors
         - { topic: replicatedpushdatapending, partitions: 1 }
         - { topic: replicatedpushdata, partitions: 1 }
 
     - name: record deployment of this changeset
--- a/ansible/roles/hg-ssh/meta/main.yml
+++ b/ansible/roles/hg-ssh/meta/main.yml
@@ -1,9 +1,9 @@
 ---
 dependencies:
   - hg-ssh-server
   - {
       role: kafka-broker,
       kafka_host_name: "{{ inventory_hostname }}",
       kafka_broker_id: "{{ zk_servers[inventory_hostname] }}",
-      when: "{{ inventory_hostname in zk_servers }}",
+      when: inventory_hostname in zk_servers,
     }
--- a/ansible/roles/hg-web/meta/main.yml
+++ b/ansible/roles/hg-web/meta/main.yml
@@ -1,10 +1,10 @@
 ---
 dependencies:
   - ius-repo
   - mercurial-yum
   - {
       role: kafka-broker,
       kafka_host_name: "{{ inventory_hostname }}",
       kafka_broker_id: "{{ zk_servers[inventory_hostname] }}",
-      when: "{{ inventory_hostname in zk_servers }}",
+      when: inventory_hostname in zk_servers,
     }
--- a/ansible/roles/kafka-broker/tasks/main.yml
+++ b/ansible/roles/kafka-broker/tasks/main.yml
@@ -28,17 +28,17 @@
     - { src: zookeeper-3.4.11.tar.gz, creates: zookeeper-3.4.11 }
     - { src: kafka_2.11-1.1.0.tgz, creates: kafka_2.11-1.1.0 }
 
 - user: name=zookeeper
         uid=2321
         shell=/bin/bash
         createhome=no
         home=/var/run/zookeeper
-  when: "{{ inventory_hostname not in ignore_zookeeper_user | default([]) }}"
+  when: inventory_hostname not in ignore_zookeeper_user | default([])
 
 - name: create config directories for Kafka and ZooKeeper
   file: path={{ item }}
         state=directory
         owner=root
         group=root
         mode=0755
   with_items: