Fix linting issues
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
---
|
---
|
||||||
default_home_root: /home
|
users_default_home_root: /home
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Get user info from /etc/passwd"
|
- name: "Get user info from /etc/passwd"
|
||||||
register: etc_passwd
|
register: users_etc_passwd
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail; cat /etc/passwd | grep user
|
cmd: set -o pipefail; cat /etc/passwd | grep user
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
- name: "Get user info from /etc/shadow"
|
- name: "Get user info from /etc/shadow"
|
||||||
register: etc_shadow
|
register: users_etc_shadow
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail; cat /etc/shadow | grep user
|
cmd: set -o pipefail; cat /etc/shadow | grep user
|
||||||
@@ -30,21 +30,21 @@
|
|||||||
- "user1:x:1002:1002:User One:/home/user1:/bin/sh"
|
- "user1:x:1002:1002:User One:/home/user1:/bin/sh"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- etc_passwd.stdout_lines == expected_passwd
|
- users_etc_passwd.stdout_lines == expected_passwd
|
||||||
- etc_shadow.stdout_lines == expected_shadow
|
- users_etc_shadow.stdout_lines == expected_shadow
|
||||||
|
|
||||||
- name: "Get SSH key contents for user1"
|
- name: "Get SSH key contents for user1"
|
||||||
register: user1_ssh_key
|
register: users_user1_ssh_key
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: cat /home/user1/.ssh/id_ed25519.pub
|
cmd: cat /home/user1/.ssh/id_ed25519.pub
|
||||||
|
|
||||||
- name: "Verify the SSH key contents for user1"
|
- name: "Verify the SSH key contents for user1"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: "'user1@ubuntu' in user1_ssh_key.stdout"
|
that: "'user1@ubuntu' in users_user1_ssh_key.stdout"
|
||||||
|
|
||||||
- name: "Get the user slice drop-in for user0"
|
- name: "Get the user slice drop-in for user0"
|
||||||
register: user0_slice_dropin
|
register: users_user0_slice_dropin
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: cat /etc/systemd/system/user-1001.slice.d/50-limits.conf
|
cmd: cat /etc/systemd/system/user-1001.slice.d/50-limits.conf
|
||||||
@@ -59,6 +59,6 @@
|
|||||||
- "CPUAccounting=1"
|
- "CPUAccounting=1"
|
||||||
- "CPUQuota=100%"
|
- "CPUQuota=100%"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: "user0_slice_dropin.stdout_lines == expected"
|
that: "users_user0_slice_dropin.stdout_lines == expected"
|
||||||
success_msg: "Got the expected limits slice drop-in"
|
success_msg: "Got the expected limits slice drop-in"
|
||||||
fail_msg: "Unexpected limits slice drop-in contents"
|
fail_msg: "Unexpected limits slice drop-in contents"
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Get user info from /etc/passwd"
|
- name: "Get user info from /etc/passwd"
|
||||||
register: etc_passwd
|
register: users_etc_passwd
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail; cat /etc/passwd | grep user
|
cmd: set -o pipefail; cat /etc/passwd | grep user
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
- name: "Get user info from /etc/shadow"
|
- name: "Get user info from /etc/shadow"
|
||||||
register: etc_shadow
|
register: users_etc_shadow
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: set -o pipefail; cat /etc/shadow | grep user
|
cmd: set -o pipefail; cat /etc/shadow | grep user
|
||||||
@@ -30,21 +30,21 @@
|
|||||||
- "user1:x:1002:1002:User One:/home/user1:/bin/sh"
|
- "user1:x:1002:1002:User One:/home/user1:/bin/sh"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- etc_passwd.stdout_lines == expected_passwd
|
- users_etc_passwd.stdout_lines == expected_passwd
|
||||||
- etc_shadow.stdout_lines == expected_shadow
|
- users_etc_shadow.stdout_lines == expected_shadow
|
||||||
|
|
||||||
- name: "Get SSH key contents for user1"
|
- name: "Get SSH key contents for user1"
|
||||||
register: user1_ssh_key
|
register: users_user1_ssh_key
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: cat /home/user1/.ssh/id_ed25519.pub
|
cmd: cat /home/user1/.ssh/id_ed25519.pub
|
||||||
|
|
||||||
- name: "Verify the SSH key contents for user1"
|
- name: "Verify the SSH key contents for user1"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: "'user1@ubuntu' in user1_ssh_key.stdout"
|
that: "'user1@ubuntu' in users_user1_ssh_key.stdout"
|
||||||
|
|
||||||
- name: "Get the user slice drop-in for user0"
|
- name: "Get the user slice drop-in for user0"
|
||||||
register: user0_slice_dropin
|
register: users_user0_slice_dropin
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: cat /etc/systemd/system/user-1001.slice.d/50-limits.conf
|
cmd: cat /etc/systemd/system/user-1001.slice.d/50-limits.conf
|
||||||
@@ -59,6 +59,6 @@
|
|||||||
- "CPUAccounting=1"
|
- "CPUAccounting=1"
|
||||||
- "CPUQuota=100%"
|
- "CPUQuota=100%"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: "user0_slice_dropin.stdout_lines == expected"
|
that: "users_user0_slice_dropin.stdout_lines == expected"
|
||||||
success_msg: "Got the expected limits slice drop-in"
|
success_msg: "Got the expected limits slice drop-in"
|
||||||
fail_msg: "Unexpected limits slice drop-in contents"
|
fail_msg: "Unexpected limits slice drop-in contents"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
- name: "Create | Create user account ('{{ user.name }}')"
|
- name: "Create | Create user account ('{{ user.name }}')"
|
||||||
vars:
|
vars:
|
||||||
home_root: "{{ user.home_root is defined | ternary(user.home_root, default_home_root) }}"
|
home_root: "{{ user.home_root is defined | ternary(user.home_root, users_default_home_root) }}"
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ user.name }}"
|
name: "{{ user.name }}"
|
||||||
state: "{{ user.state }}"
|
state: "{{ user.state }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user