Metadata-Version: 2.4
Name: cloud-seeder
Version: 0.1.0
Summary: A tool for generating cloud-init configurations and seed ISOs, works with vmware
Home-page: https://github.com/chris17453/cloud-seeder
Author: Chris Watkins
Author-email: Chris Watkins <chris@watkinslabs.com>
Maintainer-email: Chris Watkins <chris@watkinslabs.com>
License: MIT
Project-URL: Homepage, https://github.com/chris17453/cloud-seeder
Project-URL: Documentation, https://github.com/chris17453/cloud-seeder/wiki
Project-URL: Repository, https://github.com/chris17453/cloud-seeder
Project-URL: Bug Tracker, https://github.com/chris17453/cloud-seeder/issues
Keywords: cloud-init,cloud,automation,infrastructure,devops,seed,iso
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: System Administrators
Classifier: Topic :: System :: Systems Administration
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: POSIX :: Linux
Classifier: Environment :: Console
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyYAML>=5.1
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-cov>=2.0; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: flake8>=3.9; extra == "dev"
Requires-Dist: mypy>=0.910; extra == "dev"
Requires-Dist: build>=0.7; extra == "dev"
Requires-Dist: twine>=3.4; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# Cloud Seeder

A production-ready CLI tool for generating cloud-init configurations and seed ISOs from YAML templates.

## Features

- **Generic and Flexible**: Not tied to any specific use case
- **YAML-based Configuration**: Simple, declarative configuration format
- **Multi-node Support**: Define multiple nodes in a single configuration
- **Inheritance Model**: Global settings with node-specific overrides
- **ISO Generation**: Automatically create cloud-init seed ISOs
- **Network Configuration**: Support for both static and DHCP networking
- **Validation**: Configuration validation before generation
- **Clean Output Structure**: Organized directory structure for outputs

## Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/cloud-seeder.git
cd cloud-seeder

# Make the CLI executable
chmod +x cloud_seeder_cli.py

# Install dependencies (if needed)
pip install pyyaml

# For ISO generation, install one of:
sudo dnf install genisoimage    # Fedora/CentOS
sudo apt install genisoimage    # Ubuntu/Debian
```

## Usage

### Basic Usage

```bash
# Generate cloud-init configurations
./cloud_seeder_cli.py config.yaml

# Generate configurations and create ISOs
./cloud_seeder_cli.py config.yaml --iso

# Clean output directory before generating
./cloud_seeder_cli.py config.yaml --clean --iso

# Validate configuration only
./cloud_seeder_cli.py config.yaml --validate-only
```

### Command Line Options

```
positional arguments:
  config                Configuration file (YAML)

optional arguments:
  -h, --help            show this help message and exit
  --output-dir OUTPUT_DIR, -o OUTPUT_DIR
                        Output directory (default: output)
  --iso, -i             Create seed ISOs
  --clean, -c           Clean output directory before generating
  --log-level {DEBUG,INFO,WARNING,ERROR}, -l {DEBUG,INFO,WARNING,ERROR}
                        Logging level
  --validate-only, -v   Only validate configuration without generating files
```

## Configuration Structure

### Global Settings

Global settings apply to all nodes unless overridden:

```yaml
# System settings
timezone: America/New_York
locale: en_US.UTF-8

# Package management
package_management:
  update: true
  upgrade: false
  reboot_if_required: false

# SSH configuration
ssh:
  password_auth: false
  disable_root: true

# Packages for all nodes
packages:
  - vim-enhanced
  - tmux
  - htop

# Users for all nodes
users:
  - name: admin
    groups: ["wheel"]
    ssh_authorized_keys:
      - ssh-rsa AAAAB3...
```

### Node Configuration

Each node can have its own specific configuration:

```yaml
nodes:
  web-server:
    hostname: web01
    fqdn: web01.example.com
    
    network:
      ip_address: 10.0.1.10
      gateway: 10.0.1.1
      dns_servers: [10.0.1.1, 8.8.8.8]
    
    packages:
      - nginx
      - certbot
    
    runcmd:
      - systemctl enable nginx
      - systemctl start nginx
```

## Output Structure

```
output/
├── configs/           # Cloud-init YAML files
│   ├── node1-cloud-init.yaml
│   └── node2-cloud-init.yaml
├── seeds/            # Seed file directories
│   ├── node1/
│   │   ├── meta-data
│   │   ├── user-data
│   │   └── network-config
│   └── node2/
└── images/           # ISO files (if --iso used)
    ├── node1-seed.iso
    └── node2-seed.iso
```

## Examples

### Web Server Farm

```yaml
packages:
  - nginx
  - firewalld

nodes:
  web-01:
    hostname: web01
    network:
      ip_address: 10.0.1.10
      gateway: 10.0.1.1
  
  web-02:
    hostname: web02
    network:
      ip_address: 10.0.1.11
      gateway: 10.0.1.1
```

### Kubernetes Cluster

```yaml
packages:
  - containerd
  - kubeadm
  - kubelet
  - kubectl

nodes:
  master-01:
    hostname: k8s-master-01
    network:
      ip_address: 10.0.2.10
    runcmd:
      - kubeadm init --pod-network-cidr=10.244.0.0/16
  
  worker-01:
    hostname: k8s-worker-01
    network:
      ip_address: 10.0.2.20
```

### Development Environment

```yaml
packages:
  - git
  - python3
  - nodejs
  - podman

users:
  - name: developer
    groups: ["wheel", "podman"]
    passwd: dev123

nodes:
  dev-workstation:
    hostname: devbox
    packages:
      - code
      - firefox
```

## Best Practices

1. **Use YAML anchors** for repeated configurations
2. **Store sensitive data** separately (passwords, keys)
3. **Version control** your configuration files
4. **Test configurations** in a non-production environment first
5. **Use meaningful node names** that reflect their purpose
6. **Document custom configurations** with comments

## Troubleshooting

### ISO Creation Fails

Install one of the ISO creation tools:
```bash
sudo dnf install genisoimage    # Fedora/CentOS
sudo apt install genisoimage    # Ubuntu/Debian
```

### Network Configuration Not Applied

Ensure your cloud provider or hypervisor supports cloud-init network configuration.

### Logs and Debugging

Enable debug logging:
```bash
./cloud_seeder_cli.py config.yaml --log-level DEBUG
```

Check cloud-init logs on the target system:
```bash
sudo journalctl -u cloud-init
sudo cat /var/log/cloud-init.log
```

## License

MIT License - See LICENSE file for details

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

## Support

- Create an issue on GitHub
- Check existing issues for solutions
- Read cloud-init documentation at https://cloud-init.io# cloud-seeder
