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.

88 lines
1.9 KiB
YAML

---
- name: Install required packages
apt:
state: present
name:
- bmon
- exa
- git
- htop
- httpie
- man
- thefuck
- tmux
- vim
- zsh
- name: Configure sudo insults
copy:
content: |
Defaults insults
dest: "{{ global_sudoers_directory }}/insults"
owner: root
group: root
mode: "o=r,g=r,o="
- 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 ssh configration directory
file:
path: "{{ user_directory }}/.ssh"
state: directory
owner: "{{ username }}"
group: "{{ username }}"
mode: "u=rwx,g=rx,o="
- name: Configure authorized_keys
get_url:
url: "{{ authorized_keys }}"
dest: "{{ user_directory }}/.ssh/authorized_keys"
force: yes
owner: "{{ username }}"
group: "{{ username }}"
mode: "u=rwx,g=rx,o="
ignore_errors: yes
- name: Download oh-my-zsh for user {{ username }}
become_user: "{{ username }}"
git:
repo: https://github.com/robbyrussell/oh-my-zsh.git
version: master
dest: ~/.oh-my-zsh
- name: Configure oh-my-zsh
become_user: "{{ username }}"
template:
src: template.zshrc
dest: ~/.zshrc
force: no
# TODO tmux configuration
# TODO vim configuration