From 2afdc22452741a4aa9f47833e94f22f9a232e020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <Joerg.Sachse@slub-dresden.de> Date: Fri, 3 Sep 2021 11:51:40 +0200 Subject: [PATCH] feat: create user/group for integration tests --- tasks/create_users_groups.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tasks/create_users_groups.yml b/tasks/create_users_groups.yml index 8066269..e2bd00c 100644 --- a/tasks/create_users_groups.yml +++ b/tasks/create_users_groups.yml @@ -6,6 +6,13 @@ state: "{{ item.value.mystate | default('present') }}" with_dict: "{{ vault_groups }}" +- name: create group for integration tests (needs to be done manually, because Ansible doesn't handle non_unique in the group module correctly) + command: "groupadd -g {{ item.gid }} -o {{ item.name }}" + loop: "{{ vault_group_integrationtest }}" + register: integrationtest_group + ignore_errors: true + changed_when: "\"group '{{ item.name }}' already exists\" not in integrationtest_group.stderr" + - name: add HUMAN users to groups user: name: "{{ item }}" @@ -28,7 +35,8 @@ groups: "{{ item.value.groups }}" home: "/home/{{ item.key }}/" name: "{{ item.key }}" - password: "{{ item.value.password | default(omit) }}" + non_unique: "{{ item.value.non_unique | default(false) }}" + password: "{{ lookup('password', '/dev/null length=100 chars=ascii_letters')|password_hash('sha512') | default(omit) }}" shell: "{{ item.value.shell | default('/bin/bash') }}" state: "{{ item.value.state | default('present') }}" uid: "{{ item.value.uid | default(omit) }}" -- GitLab