From 5e3952b2410289a0da0b190549f2c7ff3fdea400 Mon Sep 17 00:00:00 2001
From: Baptiste DE RENZO <baptiste.derenzo@ubicast.eu>
Date: Mon, 25 Mar 2024 12:59:25 +0000
Subject: [PATCH] Remove netcapure api.json configuration, Refs #39447

---
 CHANGELOG.md                                      |  4 ++++
 inventories/example/ha/host_vars/ha-misc1.yml     | 10 +---------
 inventories/example/std/host_vars/std-misc1.yml   | 10 +---------
 roles/netcapture/README.md                        |  5 -----
 roles/netcapture/defaults/main.yml                |  3 ---
 roles/netcapture/tasks/configure.yml              |  5 -----
 .../tasks/configure/miris-configure.yml           | 15 ---------------
 roles/netcapture/templates/miris-api.json.j2      |  4 ----
 roles/netcapture/vars/main.yml                    |  3 ---
 9 files changed, 6 insertions(+), 53 deletions(-)
 delete mode 100644 roles/netcapture/tasks/configure/miris-configure.yml
 delete mode 100644 roles/netcapture/templates/miris-api.json.j2

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5f68b592..6bd21f2f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 2024-03-22
+
+* Remove netcapture miris api configuration, api key is now generated by `ubicast-netcapture` package
+
 # 2024-02-16
 
 * Rework roles in 3 distinct stages. Stages can be used with the ansible tags of the same name.
diff --git a/inventories/example/ha/host_vars/ha-misc1.yml b/inventories/example/ha/host_vars/ha-misc1.yml
index c8f184eb..e09039db 100644
--- a/inventories/example/ha/host_vars/ha-misc1.yml
+++ b/inventories/example/ha/host_vars/ha-misc1.yml
@@ -28,14 +28,6 @@ cache_domain: "cache.ubica.st"
 #   Folder used to store the medias
 #netcapture_media_folder: "/data/netcapture/media"
 
-# netcapture:
-#   Activates the authentication for the deployed netcapture miris API
-#netcapture_miris_auth: True
-
-# netcapture:
-#   Password of the deployed netcapture miris API
-netcapture_miris_user_pwd: "my-password"
-
 # netcapture:
 #   Activates the SSL verification when calling the Nudgis Manager
 #netcapture_mm_ssl: True
@@ -131,4 +123,4 @@ tester_tests_ignored:
 #   From fields for email sending (as defined in RFC2822)
 #vault_email_from: "{{ ansible_fqdn }} <backup@{{ ansible_fqdn }}>"
 
-...
\ No newline at end of file
+...
diff --git a/inventories/example/std/host_vars/std-misc1.yml b/inventories/example/std/host_vars/std-misc1.yml
index 449ba571..0bf2e8eb 100644
--- a/inventories/example/std/host_vars/std-misc1.yml
+++ b/inventories/example/std/host_vars/std-misc1.yml
@@ -28,14 +28,6 @@ cache_domain: "cache.ubica.st"
 #   Folder used to store the medias
 #netcapture_media_folder: "/data/netcapture/media"
 
-# netcapture:
-#   Activates the authentication for the deployed netcapture miris API
-#netcapture_miris_auth: True
-
-# netcapture:
-#   Password of the deployed netcapture miris API
-netcapture_miris_user_pwd: "my-password"
-
 # netcapture:
 #   Activates the SSL verification when calling the Nudgis Manager
 #netcapture_mm_ssl: True
@@ -127,4 +119,4 @@ sysuser_ubicast_password: "my-password"
 tester_tests_ignored:
   - uptime.sh
 
-...
\ No newline at end of file
+...
diff --git a/roles/netcapture/README.md b/roles/netcapture/README.md
index e220c492..741d0111 100644
--- a/roles/netcapture/README.md
+++ b/roles/netcapture/README.md
@@ -7,11 +7,6 @@ The netcapture group is used to configure the server which will host UbiCast vir
 
 Available variables are listed below, along with the descriptions and the default values.
 
-`netcapture_miris_user_pwd`: Password of the deployed netcapture miris API
-```
-netcapture_miris_user_pwd: "changeme"
-```
-
 `netcapture_mm_url`: URL of the mirismanager to use for packages
 ```
 netcapture_mm_url: "mirismanager.example.com"
diff --git a/roles/netcapture/defaults/main.yml b/roles/netcapture/defaults/main.yml
index 4ad3190f..99fa7be0 100644
--- a/roles/netcapture/defaults/main.yml
+++ b/roles/netcapture/defaults/main.yml
@@ -1,8 +1,5 @@
 ---
 
-# Password of the deployed netcapture miris API
-netcapture_miris_user_pwd: "changeme"
-
 # URL of the mirismanager to use for packages
 netcapture_mm_url: "mirismanager.example.com"
 
diff --git a/roles/netcapture/tasks/configure.yml b/roles/netcapture/tasks/configure.yml
index 81bf3a24..4abd6f7e 100644
--- a/roles/netcapture/tasks/configure.yml
+++ b/roles/netcapture/tasks/configure.yml
@@ -6,9 +6,4 @@
     - netcapture_mm_url is defined
     - netcapture_mm_ssl is defined
 
-- name: MIRIS API CONFIGURATION FILE
-  ansible.builtin.include_tasks: "configure/miris-configure.yml"
-  when:
-    - netcapture_miris_user_pwd is defined
-
 ...
diff --git a/roles/netcapture/tasks/configure/miris-configure.yml b/roles/netcapture/tasks/configure/miris-configure.yml
deleted file mode 100644
index 11ef6279..00000000
--- a/roles/netcapture/tasks/configure/miris-configure.yml
+++ /dev/null
@@ -1,15 +0,0 @@
----
-
-- name: check if miris api config exists
-  ansible.builtin.stat:
-    path: "{{ netcapture_conf_folder }}/api.json"
-  register: miris_config_file
-
-- name: create netcapture miris api config
-  ansible.builtin.template:
-    src: miris-api.json.j2
-    dest: "{{ netcapture_conf_folder }}/api.json"
-    mode: u=rw,g=r,o=r
-  when: not miris_config_file.stat.exists
-
-...
diff --git a/roles/netcapture/templates/miris-api.json.j2 b/roles/netcapture/templates/miris-api.json.j2
deleted file mode 100644
index 0f00edfa..00000000
--- a/roles/netcapture/templates/miris-api.json.j2
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "auth_user_password": "{{ netcapture_miris_user_pwd }}",
-  "auth_enable": {% if netcapture_miris_auth %}true{% else %}false{% endif %}
-}
diff --git a/roles/netcapture/vars/main.yml b/roles/netcapture/vars/main.yml
index 11c1cf67..c604e639 100644
--- a/roles/netcapture/vars/main.yml
+++ b/roles/netcapture/vars/main.yml
@@ -9,7 +9,4 @@ netcapture_conf_folder: "/etc/miris/conf"
 # Folder used to store the medias
 netcapture_media_folder: "/data/netcapture/media"
 
-# Activates the authentication for the deployed netcapture miris API
-netcapture_miris_auth: True
-
 ...
-- 
GitLab