diff --git a/tasks/create_users_groups.yml b/tasks/create_users_groups.yml index 8066269375410b40e6dab6afef994ec6f4aac163..e2bd00c3757fb9c04b8d152f185b5acbcfc8c7fd 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) }}"