A robust, production-ready script that automatically creates a comprehensive DevOps project directory structure with proper error handling, logging, and validation.
-
Comprehensive Directory Structure: Creates a complete DevOps project layout including:
- Terraform configurations with environment separation
- Ansible playbooks and roles
- Kubernetes manifests and Helm charts
- CI/CD configurations
- Security policies
- Testing frameworks
- Documentation
-
Built-in Safety Features:
- Automatic backup of existing directories
- Basic error handling and logging
- Tool prerequisite checking
-
Simple Logging System:
- Color-coded console output
- Timestamped logs
- Different log levels (INFO, SUCCESS, WARNING, ERROR)
- Log file generation
-
Security Considerations:
- Basic file permissions
- Gitignore templates
- Security policy templates
The script checks for the following tools:
- git
- terraform
- ansible
- kubectl
- helm
Note: The script will warn if tools are missing but can continue with user confirmation.
-
Clone this repository:
git clone https://github.com/sean-njela/Devops_directory_setup.git cd Devops_directory_setup
-
Make the script executable:
chmod +x directory_setup.sh
-
Run the setup script:
./directory_setup.sh
project/
├── ansible/
│ ├── roles/
│ ├── inventories/
│ ├── group_vars/
│ └── host_vars/
├── terraform/
│ ├── environments/
│ │ ├── dev/
│ │ ├── prod/
│ │ └── test/
│ └── modules/
├── kubernetes/
│ ├── manifests/
│ ├── helm-charts/
│ └── environments/
├── security/
│ └── policies/
├── tests/
│ ├── integration/
│ └── unit/
├── docs/
├── ci-cd/
├── scripts/
├── monitoring/
└── config/
The script includes a basic health check tool that verifies:
- Directory structure integrity
- Presence of essential files
- Git repository status
- Empty directory detection
Run the health check:
./scripts/health_check.sh
Logs are stored in the format: setup_YYYYMMDD_HHMMSS.log
The logging system provides:
- Timestamp for each operation
- Operation status (SUCCESS/ERROR/WARNING/INFO)
- Color-coded console output
- Basic
.gitignore
file - Security policy templates
- Simple file handling
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by DevOps best practices
- Built with basic security in mind
- Designed for both small and large-scale projects
For support, please open an issue in the GitHub repository.
Made with ❤️ for the DevOps community