ansible-playground/slococo/playground
Santiago Lo Coco 70f2ed5162 Refactor 2024-04-14 18:44:36 +02:00
..
meta Update local_accounts 2024-04-12 21:10:59 +00:00
playbooks Refactor 2024-04-14 18:44:36 +02:00
roles Refactor 2024-04-14 18:44:36 +02:00
LICENSE.md Add roles 2024-04-12 20:40:15 +00:00
README.md Update README.md 2024-04-12 21:11:16 +00:00
galaxy.yml Refactor 2024-04-14 18:44:36 +02:00

README.md

Ansible Collection - slococo.playground

Overview

This Ansible collection contains two roles: local_accounts and ssh_config. These roles are designed to automate the configuration of local user accounts and SSH daemon settings on target hosts.

Requirements

  • Ansible version supporting collections (ansible-core > 2.12)

Role: local_accounts

Description

This role configures multiple local user accounts on the target host as specified in a list of dictionaries variable.

Variables

  • local_users: List of dictionaries defining each local user account with the following fields:
    • name: Username
    • shell: Login shell for the user
    • userid: User ID
    • expiry_date: Expiry date for the account (optional)
    • home: Path for the home directory (optional)
    • groups: List of groups the user belongs to (optional)

Usage

Include the local_accounts role in your playbook and define the local_users variable accordingly.

- name: Configure local accounts
  hosts: target_hosts
  roles:
    - role: slococo.playground.local_accounts
      vars:
        local_accounts_list:
          - name: local_adm
            shell: /bin/bash
            userid: 38000087
            expiry_date: null
            home: /home/local_adm
            groups: [primary_group]
          - name: local_log
            shell: /bin/sh
            userid: 38000088
            expiry_date: "2024-12-31"
            home: /home/local_log
            groups: [primary_group]

Role: ssh_config

Description

This role ensures the SSH daemon on the target host has specific options configured.

Variables

No additional variables required.

Usage

Include the ssh_config role in your playbook.

- name: Configure SSH
  hosts: target_hosts
  roles:
    - role: slococo.playground.ssh_config

SSH Configuration

The role ensures the following SSH options are configured with the specified values:

  • PasswordAuthentication: yes
  • PermitEmptyPasswords: no
  • PermitRootLogin: no