refactor(system_setup): rename bare 'password' var to user_password
The bare 'password' variable in user.yml could silently collide with any same-named variable elsewhere in scope. Rename to user_password to namespace it alongside username. BREAKING CHANGE: callers passing 'password' to this role must rename it to user_password.
This commit is contained in:
@@ -16,7 +16,7 @@ Performs initial system configuration including user creation, SSH hardening, an
|
|||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
|----------|---------|-------------|
|
|----------|---------|-------------|
|
||||||
| `username` | `admin` | Username for the admin account |
|
| `username` | `admin` | Username for the admin account |
|
||||||
| `password` | *required* | Password for the admin user |
|
| `user_password` | *required* | Password for the admin user |
|
||||||
| `shell` | `/bin/bash` | Default shell for the user |
|
| `shell` | `/bin/bash` | Default shell for the user |
|
||||||
| `passwordless_sudo` | `true` | Allow sudo without password |
|
| `passwordless_sudo` | `true` | Allow sudo without password |
|
||||||
| `ssh_pubkey_file` | *required* | Path to SSH public key file |
|
| `ssh_pubkey_file` | *required* | Path to SSH public key file |
|
||||||
@@ -28,7 +28,7 @@ Performs initial system configuration including user creation, SSH hardening, an
|
|||||||
You must provide these variables when using this role:
|
You must provide these variables when using this role:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
password: "your_secure_password"
|
user_password: "your_secure_password"
|
||||||
ssh_pubkey_file: "/path/to/your/public/key.pub"
|
ssh_pubkey_file: "/path/to/your/public/key.pub"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ ssh_pubkey_file: "/path/to/your/public/key.pub"
|
|||||||
include_role:
|
include_role:
|
||||||
name: system_setup
|
name: system_setup
|
||||||
vars:
|
vars:
|
||||||
password: "{{ admin_password }}"
|
user_password: "{{ admin_password }}"
|
||||||
ssh_pubkey_file: "~/.ssh/id_rsa.pub"
|
ssh_pubkey_file: "~/.ssh/id_rsa.pub"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ ssh_pubkey_file: "/path/to/your/public/key.pub"
|
|||||||
name: system_setup
|
name: system_setup
|
||||||
vars:
|
vars:
|
||||||
username: myuser
|
username: myuser
|
||||||
password: "{{ user_password }}"
|
user_password: "{{ vault_myuser_password }}"
|
||||||
shell: /bin/zsh
|
shell: /bin/zsh
|
||||||
ssh_pubkey_file: "keys/mykey.pub"
|
ssh_pubkey_file: "keys/mykey.pub"
|
||||||
passwordless_sudo: false
|
passwordless_sudo: false
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
- name: "Create a new user {{ username }}"
|
- name: "Create a new user {{ username }}"
|
||||||
user:
|
user:
|
||||||
name: "{{ username }}"
|
name: "{{ username }}"
|
||||||
password: "{{ password | password_hash('sha512') }}"
|
password: "{{ user_password | password_hash('sha512') }}"
|
||||||
groups:
|
groups:
|
||||||
- sudo
|
- sudo
|
||||||
shell: "{{ shell }}"
|
shell: "{{ shell }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user