Trex KPI are not collected due to rabbitmq user 85/64085/2
authorStepan Andrushko <stepanx.andrushko@intel.com>
Thu, 18 Oct 2018 18:16:09 +0000 (21:16 +0300)
committerAbhijit Sinha <abhijit.sinha@intel.com>
Sat, 27 Oct 2018 11:29:56 +0000 (11:29 +0000)
Changed the way rabbitmq-server user is created. Fix is needed to
collect KPIs from Trex.

JIRA: YARDSTICK-1479

Change-Id: I54369535fdb7af6af76de30f758227736f83db78
Signed-off-by: Stepan Andrushko <stepanx.andrushko@intel.com>
(cherry picked from commit d06e6da19db545dfcc6fdfdc706b9cccdb75c498)

ansible/roles/configure_rabbitmq/tasks/main.yml
ansible/roles/configure_rabbitmq/templates/rabbitmq.config.j2 [new file with mode: 0644]
ansible/roles/configure_rabbitmq/templates/user_definitions.json.j2 [new file with mode: 0644]

index 3ad60c1..4ff4222 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ---
+- name: Create rabbitmq configuration
+  template:
+    src: rabbitmq.config.j2
+    dest: /etc/rabbitmq/rabbitmq.config
+
+- name: Define user definitions file
+  template:
+    src: user_definitions.json.j2
+    dest: /etc/rabbitmq/definitions.json
+
 - name: Restart rabbitmq
   service:
     name: rabbitmq-server
 - name: rabbitmqctl start_app
   shell: rabbitmqctl start_app
 
-- name: Configure rabbitmq
-  rabbitmq_user:
-    user: yardstick
-    password: yardstick
-    configure_priv: .*
-    read_priv: .*
-    write_priv: .*
-    state: present
+- name: Enable management plugin
+  shell: rabbitmq-plugins enable rabbitmq_management
diff --git a/ansible/roles/configure_rabbitmq/templates/rabbitmq.config.j2 b/ansible/roles/configure_rabbitmq/templates/rabbitmq.config.j2
new file mode 100644 (file)
index 0000000..8f07edf
--- /dev/null
@@ -0,0 +1,5 @@
+ [\r
+    {rabbitmq_management, [\r
+       {load_definitions, "/etc/rabbitmq/definitions.json"}\r
+    ]}\r
+].
\ No newline at end of file
diff --git a/ansible/roles/configure_rabbitmq/templates/user_definitions.json.j2 b/ansible/roles/configure_rabbitmq/templates/user_definitions.json.j2
new file mode 100644 (file)
index 0000000..831675f
--- /dev/null
@@ -0,0 +1,23 @@
+ {\r
+    "users": [{\r
+        "name": "yardstick",\r
+        "password_hash": "{{  }}",\r
+        "hashing_algorithm": "rabbit_password_hashing_sha256",\r
+        "tags": ""\r
+    }],\r
+    "vhosts": [{\r
+        "name": "/"\r
+    }],\r
+    "permissions": [{\r
+        "user": "yardstick",\r
+        "vhost": "/",\r
+        "configure": ".*",\r
+        "write": ".*",\r
+        "read": ".*"\r
+    }],\r
+    "parameters": [],\r
+    "policies": [],\r
+    "queues": [],\r
+    "exchanges": [],\r
+    "bindings": []\r
+}\r