66 lines
1.6 KiB
YAML
66 lines
1.6 KiB
YAML
---
|
|
- name: Create a new user with a password, set shell
|
|
remote_user: ansible
|
|
user:
|
|
name: max
|
|
groups: sshusers,sudo
|
|
password: "{{ user_passwd_hash }}"
|
|
shell: /bin/zsh
|
|
|
|
- name: Set authorized key taken from file
|
|
remote_user: ansible
|
|
ansible.posix.authorized_key:
|
|
user: max
|
|
state: present
|
|
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/ansible_key.pub') }}"
|
|
|
|
- name: Copy omz installation wrapper script to the target machine
|
|
remote_user: ansible
|
|
copy:
|
|
src: ../files/install_omz.sh
|
|
dest: /home/max/install_omz.sh
|
|
owner: max
|
|
group: max
|
|
mode: u=rwx,g=r,o-rwx
|
|
|
|
# WARNING: UNPRIVILEGED USER (not ansible) COMMANDS
|
|
- name: Install oh my zsh
|
|
remote_user: max
|
|
become: no
|
|
command: /home/max/install_omz.sh
|
|
|
|
- name: Configure oh my zsh, by pushing the config file
|
|
remote_user: ansible
|
|
copy:
|
|
src: ../files/.zshrc
|
|
dest: /home/max/.zshrc
|
|
owner: max
|
|
group: max
|
|
mode: u=rw,g=r,o-rwx
|
|
|
|
- name: Configure vim, by pushing the config
|
|
remote_user: ansible
|
|
copy:
|
|
src: ../files/.vimrc
|
|
dest: /home/max/.vimrc
|
|
owner: max
|
|
group: max
|
|
mode: u=rw,g=r,o-rwx
|
|
|
|
|
|
# WARNING: we've finished with the initial setup, drop ansible key
|
|
# Push regular user key
|
|
- name: Set authorized key taken from file
|
|
remote_user: ansible
|
|
ansible.posix.authorized_key:
|
|
user: max
|
|
state: absent
|
|
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/ansible_key.pub') }}"
|
|
|
|
- name: Set authorized key taken from file
|
|
remote_user: ansible
|
|
ansible.posix.authorized_key:
|
|
user: max
|
|
state: present
|
|
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/max_regular_key.pub') }}"
|