Getting Started
You want to tailor-make your own Linux client for you, your company or someone else? Potos can be your framework.
Here you will find some instructions on how to set up your own Linux client based on Potos. But the best way of getting to know Potos is simply by try it yourself. Don't be scared by the unknown territory 😉
Specs Repository
For your custom client you need your own "Specs" Repository. This repository defines all the basics of how your client will look. It defines what Ansible roles should be applied, in what frequence, and with what variables.
The only other source for some very limited parameters is with the iso image generation.
You can read everything about this "Specs" repository here.
Iso Build
For the iso generation, the main thing you need is a config directory with a config.yml file. This file defines the most basic things for the iso, such as how the client should be named or where to look for the "Specs Repository".
Sample Client build - Tutorial
Unchanged Potos Vanilla Client
- Ensure you have
git
,docker
and possibility to run a virtual machine (e.g. kvm, virtualbox, vmware, etc) installed
git --version
docker version
- Create a local work environment, e.g.
~/potosSampleClient
mkdir -p ~/potosSampleClient
cd ~/potosSampleClient
- Clone the
potos-iso-builder
to get the scaffolding and change into this directory
git clone https://github.com/projectpotos/potos-iso-builder.git
cd potos-iso-builder
- In further tries at this step you would adjust the files in the
config
, but for this tutorial we leave everything at default - Build the image by runningSELinux may prevent access to
docker run -it -v $(pwd)/config:/config -v $(pwd)/output:/output ghcr.io/projectpotos/potos-iso-builder:latest
config
andoutput
. (PermissionError: [Errno 13] Permission denied: '/config/config.yml'
.) Add:z
to each mapped volume:docker run -it -v $(pwd)/config:/config:z -v $(pwd)/output:/output:z ghcr.io/projectpotos/potos-iso-builder:latest
- Create a new VM using the iso in the
output
directory - Just follow the setup dialog on first boot
- Enjoy a Linux Client based on Ubuntu 22.04 LTS, with a potos wallpaper that is regularly enforced.
Changing client
- As a next step you probably want your own Specs Repository for this you need
- Go to github.com/projectpotos/ansible-specs-potos and click on
Use this template
>Create a new repository
to create your own specs repository. - Select where you want that repository.
- Adjust in
config/config.yml
the following values to your new locationspecs: url: "https://github.com/projectpotos/" repo: "ansible-specs-potos" branch: "main"
- You may also want to adjust other values in
config/config.yml
such asclient_name
- While developing you may want to enable debugging with
environment: "develop"
, but his may leak confidential informations to the enduser, so ensure to change back before deploying an image. - Go back to build the image and test your changes. Your "Design - Build - Test - Learn" Cycle has just started 😃
- Go to github.com/projectpotos/ansible-specs-potos and click on
- For more information, have a look at the following resources
Custom role - Development Example - Tutorial
Due to the nature of such Linux clients, Potos has a lot of different parts that need to work together. So we recommend you read the different parts of Write your own role. How ever this quick tutorial should help you getting started with a custom role.
Role Development Environment
- Have a Linux Client running, on where you can write some Ansible but also directly run and apply the changes. If you don't have your own client yet, we recommend the Vanilla Client from above.
- Create yourself a working directory
mkdir ~/potos-development
to workingcd ~/potos-development
- Create a directory for roles in that dir
mkdir roles
- Clone the role template
git clone https://github.com/projectpotos/ansible-role-potos_template roles/my_role
- Create a short playbook
test.yml
(you can add/remove roles you want to test at the end)
---
- name: Test Role playboo
hosts: all
gather_facts: yes
vars:
potos_variables_you_want_set: "potos"
tasks:
- name: run roles
ansible.builtin.include_role:
name: "{{ item }}"
loop:
- my_role
- Now you can edit, test and run the role with
ansible-playbook test.yml
or to get more verboseansible-playbook test,yml --diff -vv
Minimal Role >>> Full Role
- Write the Ansible task that should happen to
tasks/main.yml
.
- If you want/need to parameterize anything you can use
defaults/main.yml
- For templates just use the
templates
directory - When you need files withoutu templating, you may create a directory
files
and store the files in there
- Once your role works, adjust all the files around it:
README.md
CODEOWNERS.md
meta/main.yml
meta/argument_specs.yml
- Write testing for the role with Molecule: see here