From c724c2f23fe6e6ed9146877924a80b909555fec5 Mon Sep 17 00:00:00 2001 From: Xavier2p Date: Mon, 11 Sep 2023 00:27:56 +0200 Subject: [PATCH] update readme and add some useful files for `mandalore` --- .github/README.md | 104 +++++++++++++++++++++++++------------- hosts/eadu/README.md | 0 hosts/mandalore/README.md | 0 hosts/mandalore/main.tf | 8 +++ 4 files changed, 78 insertions(+), 34 deletions(-) create mode 100644 hosts/eadu/README.md create mode 100644 hosts/mandalore/README.md create mode 100644 hosts/mandalore/main.tf diff --git a/.github/README.md b/.github/README.md index bcd3c8b..b40cea4 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,61 +1,97 @@ -# Infrastructure as Code - [Xavier2p](https://github.com/Xavier2p) +# `/forge` - Infrastructure as Code -![GitHub top language](https://img.shields.io/github/languages/top/xavier2p/infra-as-code?style=for-the-badge&logo=terraform&label=terraform&color=%237B42BC) +[![GitHub top language](https://img.shields.io/github/languages/top/xavier2p/infra-as-code?style=for-the-badge&logo=terraform&label=terraform&color=%237B42BC)](https://www.terraform.io/) +![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/xavier2p/infra-as-code/ci.yml?style=for-the-badge&logo=github-actions&label=validation) +[![Website](https://img.shields.io/website?up_message=UP&down_message=DOWN&url=https%3A%2F%2Fxavier2p.fr&style=for-the-badge&logo=mdbook&label=docs) +](https://xavier2p.fr) +[![GitHub](https://img.shields.io/github/license/xavier2p/infra-as-code?style=for-the-badge&logo=github&color=yellow)](../LICENSE.md) -> This repository contains the code of my infrastructure. +> This repository contains the code of `/forge`, my personal infrastructure. ## Hosts -+ [`scariff`](./hosts/scariff): My main server, a Raspberry Pi 4. -+ [`exegol`](./hosts/exegol): My laptop, a MacBook Air M1. -+ [`mandalore`](./hosts/mandalore): My development server, a Dell PowerEdge R710. ++ [`scariff`](../hosts/scariff): My main server, a Raspberry Pi 4. ++ [`exegol`](../hosts/exegol): My laptop, a MacBook Air M1. ++ [`eadu`](../hosts/eadu): A simple Debian VM, used for testing. ++ [`mandalore`](../hosts/mandalore): My development server, a Dell PowerEdge R710 (upcoming...). ## Tools -+ My servers run on [NixOS](https://github.com/Xavier2p/system). ++ My servers run on [`NixOS`](https://github.com/Xavier2p/system). + I use [`Docker`](https://www.docker.com/) to run my services. + For configuration, I use [`Ansible`](https://www.ansible.com/). + For deployment, I use [`Terraform`](https://www.terraform.io/). - - ## Structure -```txt +```bash ./forge +├── ansible # Ansible configuration, pre-deployment ├── hosts # Hosts configuration │   ├── common # Common configuration for all hosts │   ├── exegol +│   ├── eadu │   └── scariff ├── stacks # Stacks of services +│ ├── admin +│ ├── cloud │ ├── monitoring │ ├── media -│ └── cloud +│ └── services +├── hosts.tf # Hosts configuration ├── main.tf # Entry point +├── modules # Terraform modules ├── providers.tf ├── outputs.tf ├── variables.tf -└── forge.tfvars # Private +└── forge.tfvars # Private variables +``` + +## Deployment + +### #1 Clone repository + +```bash +git clone https://github.com/Xavier2p/infra-as-code.git && cd infra-as-code +``` + +### #2 Pre-deploy configuration (using Ansible) + +```bash +# coming soon... +``` + +### #3 Deploy infrastructure (using Terraform) + +```bash +terraform init +terraform apply +``` + +You can use the `-target=module.` option to deploy only a specific module or a specific host. + +## License - MIT + +```txt +MIT License + +Copyright (c) 2023 Xavier2p + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. ``` diff --git a/hosts/eadu/README.md b/hosts/eadu/README.md new file mode 100644 index 0000000..e69de29 diff --git a/hosts/mandalore/README.md b/hosts/mandalore/README.md new file mode 100644 index 0000000..e69de29 diff --git a/hosts/mandalore/main.tf b/hosts/mandalore/main.tf new file mode 100644 index 0000000..a238e2d --- /dev/null +++ b/hosts/mandalore/main.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + docker = { + source = "kreuzwerker/docker" + version = "3.0.2" + } + } +}