ansible: common: move root user logic to users.yml
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 5 Jun 2023 19:01:50 +0000 (15:01 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Wed, 7 Jun 2023 21:08:17 +0000 (17:08 -0400)
Change-Id: I3d723d81fe25993a18736b5eea619987edd7c7e4
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
automation/ansible/roles/common/tasks/main.yml
automation/ansible/roles/common/tasks/users.yml

index d901cf034f5d0094d27502c9cc852d106decf34c..105eb40d0958e50f70ebfdefe353abc09893b9eb 100644 (file)
   when: ansible_os_family == 'Suse'
 
 - include: setup-Windows.yml
-  when: ansible_os_family == "Windows"
+  when: ansible_os_family == 'Windows'
 
-- name: Set up authorized_keys for the root user
-  authorized_key:
-    user: 'root'
-    key: "{% for key in query('fileglob', 'public_keys/*.pub') %}{{ lookup('file', key) ~ '\n'}}{% endfor %}\n{% for key in lookup('vars', 'extra_root_ssh_authorized_keys', default=[]) %}{{ key ~ '\n' }}{% endfor %}"
-    exclusive: true
+# Setup user accounts
+- include: users.yml
   when: ansible_os_family != 'Windows'
 
 - include: users-Windows.yml
-  when: ansible_os_family == "Windows"
-
-- include: users.yml
-  when: ansible_os_family != "Windows"
+  when: ansible_os_family == 'Windows'
index f5065bd69ec95cd9b203f04bc47e7b238a683d56..d4c05ecd25bc6b5889514e7472c8515b449b8ada 100644 (file)
@@ -1,4 +1,10 @@
 ---
+- name: Set up authorized_keys for the root user
+  authorized_key:
+    user: 'root'
+    key: "{% for key in query('fileglob', 'public_keys/*.pub') %}{{ lookup('file', key) ~ '\n'}}{% endfor %}\n{% for key in lookup('vars', 'extra_root_ssh_authorized_keys', default=[]) %}{{ key ~ '\n' }}{% endfor %}"
+    exclusive: true
+
 - name: Remove ubuntu user
   user:
     name: ubuntu
This page took 0.023437 seconds and 4 git commands to generate.