Add pre-commit and update README
This commit is contained in:
parent
f83402fbfd
commit
0e9de7a409
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/ansible/ansible-lint
|
||||
rev: v6.20.0
|
||||
hooks:
|
||||
- id: ansible-lint
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.7.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
54
README.md
54
README.md
|
@ -1,2 +1,56 @@
|
|||
# ansible-playground
|
||||
|
||||
This collection includes tasks to configure SSH and add local user accounts. It verifies the SSH configuration and creates the specified users with specific attributes.
|
||||
|
||||
## Usage
|
||||
|
||||
### 1. Install the Collection
|
||||
|
||||
```bash
|
||||
ansible-galaxy collection install git+https://git.slc.ar/slococo/ansible-playground.git#/slococo/playground
|
||||
```
|
||||
|
||||
### 2. Create an inventory file
|
||||
|
||||
Create an inventory file (e.g., `inventory`) with the following content:
|
||||
|
||||
```
|
||||
[all]
|
||||
target_host ansible_host=<IP_ADDRESS_OR_HOSTNAME> ansible_user=<USERNAME> ansible_connection=ssh ansible_ssh_private_key_file=<PRIVATE_KEY_PATH>
|
||||
```
|
||||
|
||||
Replace `<IP_ADDRESS_OR_HOSTNAME>` with the IP address or hostname of your target host, `<USERNAME>` with the SSH username, and `<PRIVATE_KEY_PATH>` with the path to the SSH private key file.
|
||||
|
||||
### 3. Run the Playbook
|
||||
|
||||
```bash
|
||||
ansible-playbook -i inventory slococo.playground.main
|
||||
```
|
||||
|
||||
### Expected outcome
|
||||
|
||||
Upon successful execution, the playbook will:
|
||||
|
||||
- Create the users `local_adm` and `local_log` with the specified attributes.
|
||||
- Verify the SSH configuration with the provided settings:
|
||||
- `PasswordAuthentication`: yes
|
||||
- `PermitEmptyPasswords`: no
|
||||
- `PermitRootLogin`: no
|
||||
|
||||
### User configuration
|
||||
|
||||
#### `local_adm`:
|
||||
- Username: `local_adm`
|
||||
- Shell: `/bin/bash`
|
||||
- User ID: `38000087`
|
||||
- Expiry Date: The account should not expire.
|
||||
- Home Directory: `/home/local_adm`
|
||||
- Groups: The user should only belong to its primary group.
|
||||
|
||||
#### `local_log`:
|
||||
- Username: `local_log`
|
||||
- Shell: `/bin/sh`
|
||||
- User ID: `38000088`
|
||||
- Expiry Date: The account should expire at the end of 2024.
|
||||
- Home Directory: `/home/local_log`
|
||||
- Groups: The user should only belong to its primary group.
|
||||
|
|
Loading…
Reference in New Issue