Add the ability to create groups
Change-Id: Ia3afd1751bf822a7efd706aa029dbed079e7c026
diff --git a/defaults/main.yml b/defaults/main.yml
index a79f112..51fcd90 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -7,3 +7,5 @@
userlist: []
users_sudoers: []
+
+users_groups: []
diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml
index d20d847..3338c00 100644
--- a/molecule/default/converge.yml
+++ b/molecule/default/converge.yml
@@ -18,6 +18,7 @@
ssh_key: false
extra_groups:
- "users"
+ - "extragroup"
- username: ghopper
fullname: "Grace Hopper"
bcrypt: "$2b$16$k2u18U6LQCBHa.KarY5Kb.RP7Q/A4HsKBdTd7j57pBm.9aPwdKpQe"
@@ -26,6 +27,8 @@
sudoer: true
users_sudoers:
- "%users ALL=(ghopper) NOPASSWD: ALL"
+ users_groups:
+ - "extragroup"
tasks:
- name: "Include users"
include_role:
diff --git a/tasks/main.yml b/tasks/main.yml
index c0b2b39..befc0dc 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -10,6 +10,11 @@
- name: include OS-specific tasks
include_tasks: "{{ ansible_os_family }}.yml"
+- name: Create groups
+ group:
+ name: "{{ item }}"
+ with_items: "{{ users_groups }}"
+
- name: Create user accounts
user:
name: "{{ item.username }}"