From 60e83c4c6c86c727b96cf5a6135a6bb227535333 Mon Sep 17 00:00:00 2001 From: nicoo Date: Sat, 24 Nov 2018 23:06:39 +0100 Subject: [PATCH] ansible: Unify default credentials --- ansible/group_vars/all/main.yml | 5 +++++ ansible/host_vars/gnocci0/main.yml | 2 -- ansible/host_vars/gnocci1/main.yml | 2 -- ansible/roles/base/tasks/main.yml | 2 +- ansible/roles/preseed/defaults/main.yml | 1 - ansible/roles/vm/install/meta/main.yml | 3 +-- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ansible/group_vars/all/main.yml b/ansible/group_vars/all/main.yml index 882caa0..1301aef 100644 --- a/ansible/group_vars/all/main.yml +++ b/ansible/group_vars/all/main.yml @@ -3,3 +3,8 @@ global_cache_dir: "{{ inventory_dir }}/.cache/" global_artifacts_dir: "{{ inventory_dir }}/files/" +# Default credentials +## Root password; by default, undefined +root_password: "{{ vault_root_password }}" +## SSH keys for root, default to NOC's +ssh_keys: "{{ noc_ssh_keys }}" diff --git a/ansible/host_vars/gnocci0/main.yml b/ansible/host_vars/gnocci0/main.yml index 6e18bed..21e708c 100644 --- a/ansible/host_vars/gnocci0/main.yml +++ b/ansible/host_vars/gnocci0/main.yml @@ -1,6 +1,4 @@ --- -root_password: "{{ vault_root_password }}" - network: nameservers: - 10.12.0.10 diff --git a/ansible/host_vars/gnocci1/main.yml b/ansible/host_vars/gnocci1/main.yml index 8a8e1a3..20b3247 100644 --- a/ansible/host_vars/gnocci1/main.yml +++ b/ansible/host_vars/gnocci1/main.yml @@ -1,6 +1,4 @@ --- -root_password: "{{ vault_root_password }}" - network: nameservers: - 10.12.0.10 diff --git a/ansible/roles/base/tasks/main.yml b/ansible/roles/base/tasks/main.yml index a0545df..c155be4 100644 --- a/ansible/roles/base/tasks/main.yml +++ b/ansible/roles/base/tasks/main.yml @@ -47,7 +47,7 @@ - name: Set authorized keys for root user authorized_key: user: root - key: "{{ noc_ssh_keys | join('\n') }}" + key: "{{ ssh_keys | join('\n') }}" exclusive: yes - name: disable apt suggests and recommends diff --git a/ansible/roles/preseed/defaults/main.yml b/ansible/roles/preseed/defaults/main.yml index 9b25865..e69de29 100644 --- a/ansible/roles/preseed/defaults/main.yml +++ b/ansible/roles/preseed/defaults/main.yml @@ -1 +0,0 @@ -ssh_keys: "{{ noc_ssh_keys }}" diff --git a/ansible/roles/vm/install/meta/main.yml b/ansible/roles/vm/install/meta/main.yml index 696479f..9d10818 100644 --- a/ansible/roles/vm/install/meta/main.yml +++ b/ansible/roles/vm/install/meta/main.yml @@ -1,6 +1,5 @@ --- dependencies: - role: preseed - # TODO: Find a way to eliminate the duplicate defaults. - ssh_keys: "{{ hostvars[hostname].ssh_keys | default(noc_ssh_keys) }}" + ssh_keys: "{{ hostvars[hostname].ssh_keys }}" install_interface: enp1s1 -- 1.7.10.4