summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-10-10 14:17:23 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-10 14:17:23 +0300
commit0bc3546ef3192b30eb1290873a40327176dfd526 (patch)
tree1de785fcf66bcc97c424f3b32019e453a247098e /roles
parent2c23d4fbbbaece4c162c95efdf1baf088b58f9c0 (diff)
downloaddebian-ansible-0bc3546ef3192b30eb1290873a40327176dfd526.tar.gz
feat(unix_users): user MUST declare compat version they want
Diffstat (limited to 'roles')
-rw-r--r--roles/unix_users/defaults/main.yml6
-rw-r--r--roles/unix_users/subplot.md2
-rw-r--r--roles/unix_users/tasks/main.yml5
3 files changed, 13 insertions, 0 deletions
diff --git a/roles/unix_users/defaults/main.yml b/roles/unix_users/defaults/main.yml
index ea33fc9..8982001 100644
--- a/roles/unix_users/defaults/main.yml
+++ b/roles/unix_users/defaults/main.yml
@@ -1,3 +1,9 @@
+# The user of the role MUST define the version they want to use. If
+# it's not what the version of unix_users being used actually
+# provides, the role will fail.
+unix_users_version: null
+
+
# List of system users to create. Value a list of dicts with keys:
#
# username -- the username of the new user
diff --git a/roles/unix_users/subplot.md b/roles/unix_users/subplot.md
index 9bd5f6e..f0acf36 100644
--- a/roles/unix_users/subplot.md
+++ b/roles/unix_users/subplot.md
@@ -17,6 +17,8 @@ and the user foo on host has authorized_keys containing "ssh-rsa"
~~~
~~~{#foo.yml .file .yaml}
+unix_users_version: 0
+
unix_users:
- username: foo
comment: Foo Bar
diff --git a/roles/unix_users/tasks/main.yml b/roles/unix_users/tasks/main.yml
index 00c49fd..7681632 100644
--- a/roles/unix_users/tasks/main.yml
+++ b/roles/unix_users/tasks/main.yml
@@ -1,3 +1,8 @@
+- name: "check unix_users_version"
+ shell: |
+ [ "{{ unix_users_version }}" = "0" ] || \
+ (echo "Unexpected version {{ unix_users_version }}" 1>&2; exit 1)
+
- name: create system users
with_items: "{{ unix_users }}"
user: