Ansible_workstation/roles/user/tasks/main.yml

46 lines
1.1 KiB
YAML
Raw Normal View History

---
# tasks file for user
- name: users -- Ensure wheel group exists
group:
name: wheel
state: present
- name: create users
ansible.builtin.user:
name: "{{ user.username }}"
update_password: on_create
password: "{{ user.password | password_hash('sha512')}}"
group: "{{ user.group | default('users') }}"
groups: "{{ user.groups | default('') }}"
shell: "{{ user.shell | default('/bin/bash') }}"
state: present
system: "{{ user.system | default('no') }}"
- name: Install for arch
import_tasks: arch.yml
when: ansible_os_family == "Archlinux"
- name: Install for debian
import_tasks: debian.yml
when: ansible_os_family == "Debian"
- name: Clone dotfiles
ansible.builtin.git:
repo: "{{ user.config.giturl }}"
dest: "/home/{{ user.username }}/.dotfiles"
become: yes
- name: user owns its dotfiles
ansible.builtin.file:
path: "/home/{{ user.username }}/.dotfiles"
owner: "{{ user.username }}"
become: yes
- name: stow configs
ansible.builtin.command:
cmd: stow {{ item }}
chdir: "/home/{{ user.username }}/.dotfiles"
with_items: "{{ user.config.stowing }}"
become: yes