REFACTOR: files fixed according to ansible-lint

This commit is contained in:
2026-07-12 15:36:55 +00:00
parent 9a9bfa7e23
commit d1568586e9
8 changed files with 69 additions and 58 deletions
@@ -1,7 +1,7 @@
---
- name: Create a new user with a password, set shell
remote_user: ansible
user:
ansible.builtin.user:
name: max
groups: sshusers,sudo
password: "{{ user_passwd_hash }}"
@@ -12,12 +12,12 @@
ansible.posix.authorized_key:
user: max
state: present
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/ansible_key.pub') }}"
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
ansible.builtin.copy:
src: "{{ role_path }}/files/install_omz.sh"
dest: /home/max/install_omz.sh
owner: max
group: max
@@ -26,13 +26,14 @@
# WARNING: UNPRIVILEGED USER (not ansible) COMMANDS
- name: Install oh my zsh
remote_user: max
become: no
command: /home/max/install_omz.sh
become: false
ansible.builtin.command: /home/max/install_omz.sh
changed_when: true
- name: Configure oh my zsh, by pushing the config file
remote_user: ansible
copy:
src: ../files/.zshrc
ansible.builtin.copy:
src: "{{ role_path }}/files/.zshrc"
dest: /home/max/.zshrc
owner: max
group: max
@@ -40,8 +41,8 @@
- name: Configure vim, by pushing the config
remote_user: ansible
copy:
src: ../files/.vimrc
ansible.builtin.copy:
src: "{{ role_path }}/files/.vimrc"
dest: /home/max/.vimrc
owner: max
group: max
@@ -55,11 +56,11 @@
ansible.posix.authorized_key:
user: max
state: absent
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/ansible_key.pub') }}"
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') }}"
key: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/max_regular_key.pub') }}"