Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Beta Release #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MAAS_ADMIN_USER="ptg-user"
MAAS_ADMIN_PASSWORD="ChangeMeNow!"
MAAS_ADMIN_EMAIL="user@localnet"
MAAS_ADMIN_SSHKEY=""
TERRAFORM_ENABLE="0"
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/penguincloud/core:v5.0.0 AS BUILD
FROM ghcr.io/penguincloud/core:v5.0.1 AS BUILD
LABEL company="Penguin Tech Group LLC"
LABEL org.opencontainers.image.authors="info@penguintech.group"
LABEL license="GNU AGPL3"
Expand All @@ -10,12 +10,21 @@ WORKDIR /opt/manager

# PUT YER ARGS in here
ARG APP_TITLE="PTGAPP" # Change this to actual title for Default
ARG MAAS_REPO="ppa:maas/2.9"
ARG MAAS_ADMIN_USER="ptg-admin"
ARG MAAS_ADMIN_PASSWORD="ChangeMeNow!"
ARG MAAS_ADMIN_EMAIL="admin@localnet"
ARG MAAS_ADMIN_SSHKEY=""

# BUILD IT!
RUN ansible-playbook build.yml -c local

# PUT YER ENVS in here
ENV HELLO="WORLD"
ENV MAAS_ADMIN_USER="ptg-user"
ENV MAAS_ADMIN_PASSWORD="ChangeMeNow!"
ENV MAAS_ADMIN_EMAIL="user@localnet"
ENV MAAS_ADMIN_SSHKEY=""
ENV TERRAFORM_ENABLE="0"

# Switch to non-root user
USER ptg-user
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@


# Project Overview
<< This is a template. Copy this templated repository to make new projects. Once done, add a 1 paragraph introduction / elevator speech about your project.
>>
Our rock image is a combined Ubuntu MaaS and Hashicorp Terraform built into a single image designed to spin up MaaS and initiate Terraform runs.

# Why this image vs others
## Built in self testing and healing
All PTG builds have unit and dynamic tests as part of the build of their images, as well as during runtime to ensure the system keeps running as expected. If the system falls out of bounds of the test, the images have some self healing capabilities fix common minor problems.

Our image also allows you to quickly get servers provisioned and start building out your infrastructure in no time!

## Secured... even if the software isn'template
All PTG images under go a 8 stage security check to ensure not only is the PTG portion of the code secure, but to also identify and help remediate the underlying libraries and software security.

## Updated daily
All of our images are checked daily for updates from upstream sources.
Our containers are ran as non-root images, ensuring even more protection between your standard build.

## Updated As Much as you want
Our nightly images are built daily for updates from upstream sources. We will perform minor release updates at least monthly and major release updates as needed.

## Designed for air-gapped or for internet facing
All PTG images are designed to be ran inside of air gapped environments with no internet, allowing datacenters to use a local cache as well saving bandwidth.
Expand Down
1 change: 0 additions & 1 deletion build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@
include_tasks:
file: jobs/build/build.yml


14 changes: 12 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
---
version: "2.4"
services:
app:
image: penguintech/core-ansible
rock:
build: .
image: rock
ports:
- 5240:5240
- 127.0.0.1:5241-5247:5241-5247
- 5248:5248
- 5250-5270:5250-5270
restart: on-error
env_file: .env
volumes:
- /opt/manager/data
31 changes: 31 additions & 0 deletions jobs/build/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: Install MaaS PPA
ansible.builtin.apt-repository"
repo: "{{ maas.repo }}"
- name: Validate nodetype number
debug:
msg: "Invalid Rock nodetype! must be 1 or 2, see docs!"
when: maas.nodetype < 1
- name: Run install based on nodetype
block:
- name: Install Region Controller
ansible.apt.builtin:
pkg:
- maas-rack-controller
when: maas.nodetype == 1
- name: Install Region Controller
ansible.apt.builtin:
pkg:
- maas-region-controller
when: maas.nodetype == 2
- name: Create admin user
no_log: true
ansible.builtin.expect:
command: "maas createadmin --username={{ maas.admin.user }} --password={{ maas.admin.user }} --email={{maas.admin.email }}"
responses:
(?i)Import: "{{ maas.admin.sshkey}}"
when: maas.nodetype > 0

- name: Install Terraform
include_tasks:
file: jobs/build/terraform.yml
12 changes: 12 additions & 0 deletions jobs/build/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Install Terraform requirements
ansible.builtin.apt:
pkg:
- software-properties-common
- gnupg2
- curl
- name: Install hashicorp gpg
ansible.built.apt_repository:
url: https://apt.releases.hashicorp.com/gpg
keyring: /etc/apt/trusted.gpg.d/terraform.gpg

17 changes: 17 additions & 0 deletions jobs/run/run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: Create admin user
no_log: true
ansible.builtin.expect:
command: "maas createadmin --username={{ maas.admin.user }} --password={{ maas.admin.user }} --email={{maas.admin.email }}"
responses:
(?i)Import: "{{ maas.admin.sshkey}}"
- name: Get TF Files
ansible.builtin.find:
paths: "/opt/manager/data"
recurse: yes
pattterns: '*.tf'
register: tf_files
- name: Execute TF files
community.general.terraform:
project_path: "/opt/manager/data"
when: terraform.enable == 1
12 changes: 11 additions & 1 deletion vars/base.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
run:
user: ptg-user
app:
title: "{{ lookup('ansible.builtin.env', 'APP_TILE') }}"
title: "{{ lookup('ansible.builtin.env', 'APP_TITLE') }}"
maas:
repo: "{{ lookup('ansbile.builtin.env', 'MAAS_REPO' )}}"
admin:
user: "{{ lookup('ansbile.builtin.env', 'MAAS_ADMIN_USER')}}"
password: "{{ lookup('ansbile.builtin.env', 'MAAS_ADMIN_PASSWORD')}}"
email: "{{ lookup('ansbile.builtin.env', 'MAAS_ADMIN_EMAIL')}}"
sshkey: "{{ lookup('ansbile.builtin.env', 'MAAS_ADMIN_SSHKEY')}}"
nodetype: "{{ lookup('ansbile.builtin.env', 'MAAS_NODETYPE')}}"
terraform:
enable: "{{ lookup('ansbile.builtin.env', 'TERRAFORM_ENABLE')}}