You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.5 KiB
YAML

---
- name: Install required packages
apt:
state: present
name:
- bmon
- exa
- git
- htop
- httpie
- man
- thefuck
- tmux
- vim
- zsh
- zsh-antigen
- name: Configure sudo insults
copy:
content: |
Defaults insults
dest: "{{ global_sudoers_directory }}/insults"
owner: root
group: root
mode: u=r,g=r,o=
validate: "{{ global_validate_sudoers_file }}"
- name: Configure user account {{ username }}
user:
name: "{{ username }}"
home: "{{ user_directory }}"
create_home: yes
move_home: yes
shell: /bin/zsh
groups:
- "{{ sudo | ternary('sudo', '') }}"
append: yes
password: "{{ password | password_hash('sha512', LOCAL_SALT) }}"
update_password: on_create
generate_ssh_key: yes
ssh_key_type: ed25519
ssh_key_file: .ssh/id_ed25519
ssh_key_passphrase: "{{ password }}"
ssh_key_comment: "{{ username }}@{{ inventory_hostname }} {{ ansible_date_time.date }}"
- name: Configure home directory
file:
path: "{{ user_directory }}"
state: directory
owner: "{{ username }}"
group: "{{ username }}"
mode: "u=rwx,g=rx,o="
- name: Configure authorized_keys
authorized_key:
state: present
user: "{{ username }}"
key: "{{ authorized_keys }}"
- name: Configure zsh
become_user: "{{ username }}"
template:
src: template.zshrc
dest: ~/.zshrc
force: no
# TODO tmux configuration
# TODO vim configuration