Преглед изворни кода

Uchiwa dahsboard to accept multiple user credentials (#18)

* Add 'become: False' for local_action

* Uchiwa dahsboard to accept multiple user credentials
Yuri Lukyanov пре 9 година
родитељ
комит
35730d4b35

+ 1 - 2
README.md

@@ -113,8 +113,7 @@ sensu_ssl_server_key: "{{ sensu_ssl_tool_base_path }}/server/key.pem"
 | `uchiwa_dc_name` | _undefined_ | Datacenter name for Uchiwa instance |
 | `uchiwa_path` | `/opt/uchiwa` | Path to the Uchiwa configuration directory |
 | `uchiwa_redis_use_ssl` | `false` | Determines whether to use SSL for redis communication |
-| `uchiwa_user_name`| admin | The user-name to log into Uchiwa |
-| `uchiwa_password` | admin | The password to log into Uchiwa |
+| `uchiwa_users`| [{username: admin, password: admin}] | The users to log into Uchiwa |
 | `uchiwa_port` | 3000 | The TCP port to bind the Uchiwa web service to |
 | `uchiwa_refresh` | 5 | The interval to pull the Sensu APIs in seconds |
 | `uchiwa_pkg_download_sha256sum` | _undefined_ | The SHA256 hash sum to use for verification of the Uchiwa package being fetched (specific to Linux systems) |

+ 3 - 2
defaults/main.yml

@@ -59,8 +59,9 @@ sensu_ssl_tool_version: "0.23"
 uchiwa_dc_name: ~
 uchiwa_path: /opt/uchiwa
 uchiwa_redis_use_ssl: false
-uchiwa_user_name: admin
-uchiwa_password: admin
+uchiwa_users:
+  - username: admin
+    password: admin
 uchiwa_port: 3000
 uchiwa_refresh: 5
 uchiwa_pkg_download_sha256sum: ~

+ 1 - 2
docs/role_variables.md

@@ -72,8 +72,7 @@ sensu_ssl_server_key: "{{ sensu_ssl_tool_base_path }}/server/key.pem"
 | `uchiwa_dc_name` | _undefined_ | Datacenter name for Uchiwa instance |
 | `uchiwa_path` | `/opt/uchiwa` | Path to the Uchiwa configuration directory |
 | `uchiwa_redis_use_ssl` | `false` | Determines whether to use SSL for redis communication |
-| `uchiwa_user_name`| admin | The user-name to log into Uchiwa |
-| `uchiwa_password` | admin | The password to log into Uchiwa |
+| `uchiwa_users`| [{username: admin, password: admin}] | The users to log into Uchiwa |
 | `uchiwa_port` | 3000 | The TCP port to bind the Uchiwa web service to |
 | `uchiwa_refresh` | 5 | The interval to pull the Sensu APIs in seconds |
 | `uchiwa_pkg_download_sha256sum` | _undefined_ | The SHA256 hash sum to use for verification of the Uchiwa package being fetched (specific to Linux systems) |

+ 6 - 4
docs/sensitive_info.md

@@ -14,8 +14,9 @@ As mentioned already throughout this documentation: Ansible really is quite vers
 Let's say we want to set the Uchiwa username and password for the node we have acting as the dashboard for our Sensu setup.
 If it were a host called `uchiwa.cmacr.ae`, we could set the following in `host_vars/uchiwa.cmacr.ae.yml`:
 ``` yaml
-uchiwa_user_name: mordecai
-uchiwa_password: rigby
+uchiwa_users:
+  - username: mordecai
+    password: rigby
 ```
 Then, using `ansible-vault` we can encrypt this file: `$ ansible-vault encrypt host_vars/uchiwa.cmacr.ae.yml`
 
@@ -33,8 +34,9 @@ You don't have to set these variables directly in specific a node's variables.
 These could also be defined in, say, `vars/sensitive.yml` at the top of your Ansible codebase:
 
 ``` yaml
-uchiwa_user_name: mordecai
-uchiwa_password: rigby
+uchiwa_users:
+  - username: mordecai
+    password: rigby
 sensu_api_user_name: muscleman
 sensu_api_password: highfiveghost
 ```

+ 1 - 2
templates/uchiwa_config.json.j2

@@ -12,8 +12,7 @@
    }
  ],
  "uchiwa": {
-   "user": "{{ uchiwa_user_name }}",
-   "pass": "{{ uchiwa_password }}",
+   "users": {{ uchiwa_users | to_nice_json }},
    "port": {{ uchiwa_port }},
    "refresh": {{ uchiwa_refresh }}
   }

+ 1 - 2
tests/vms/Vagrantfile.centos7

@@ -35,8 +35,7 @@ Vagrant.configure(2) do | config |
         sensu_include_dashboard: true,
         sensu_master: true,
         uchiwa_dc_name: "vagrant",
-        uchiwa_user_name: "admin",
-        uchiwa_password: "admin",
+        uchiwa_users: [{"username": "admin", "password": "admin"}]
       }
 
       ansible.sudo = true

+ 1 - 2
tests/vms/Vagrantfile.debian8

@@ -35,8 +35,7 @@ Vagrant.configure(2) do | config |
         sensu_include_dashboard: true,
         sensu_master: true,
         uchiwa_dc_name: "vagrant",
-        uchiwa_user_name: "admin",
-        uchiwa_password: "admin",
+        uchiwa_users: [{"username": "admin", "password": "admin"}]
       }
 
       ansible.sudo = true

+ 1 - 2
tests/vms/Vagrantfile.freebsd10

@@ -43,8 +43,7 @@ Vagrant.configure(2) do | config |
       sensu_include_dashboard: true,
       sensu_master: true,
       uchiwa_dc_name: "vagrant",
-      uchiwa_user_name: "admin",
-      uchiwa_password: "admin",
+      uchiwa_users: [{"username": "admin", "password": "admin"}]
     }
 
     ansible.sudo = true

+ 1 - 2
tests/vms/Vagrantfile.ubuntu15

@@ -35,8 +35,7 @@ Vagrant.configure(2) do | config |
         sensu_include_dashboard: true,
         sensu_master: true,
         uchiwa_dc_name: "vagrant",
-        uchiwa_user_name: "admin",
-        uchiwa_password: "admin",
+        uchiwa_users: [{"username": "admin", "password": "admin"}]
       }
 
       ansible.sudo = true