Giter VIP home page Giter VIP logo

endlessubuntuos's Introduction

EndlessUbuntuOS (Based on: ubuntu-dev-playbook)

Ansible Playbook to configure my children's laptops with safe settings and educational software

I was able to find a Linux version of software called EndlessOS however this software will not run on the hardware I have available (e.g. Macbook Pro Retina Late 2012). The goal is to create a safe and secure OS for kiddos to use and learn about computers. I decided to use Ansible to setup the system so that I can reproduce it in case it crashes and always have a clean record of what software is installed on the system. This is a work in progress and several things require manual configuration at this point so do not expect to use this out of the box and expect a polished and clean OS like EndlessOS. I am leveraging the work found from Ian Cleary which is a robust framework to configure a Linux OS although I will use about 2 percent of this framework there is a huge amount of additional capability which may be leveraged and used in the future.

Thanks to all those who contributed to the prior efforts to develop this framework. See the Authors section below for a full list on contributors to open source framework.

Dependencies Before Starting Install

  • Download the latest Desktop version of the Ubuntu LTS branch for the architecture you are working with
  • Select Minimal Desktop Version during install
  • I am running a Macbook and the WiFi drivers require the the proprietery option to be checked. It is on the same installer tab as the Minimal Version Selection
  • See New Desktop Setup, New Terminal/Server Setup, or Existing Machine setup options below for

Supported Ubuntu LTS Versions

I am only using LTS versions and there are no plans to support non-LTS versions.

LTS Last Supported Branch/Tag
Ubuntu 20.04.03 main

Use Cases


I've disabled most of the tags and roles in the default_config.yml but left them all there for future use. See source repo for all available roles and tasks available in this framework

Shell

  • zsh and oh-my-zsh
  • colorls: A Ruby script that colorizes the ls output with color and icons.

Desktop

Integrated Development Environment

Application Base

  • Flatpak,
  • Snap,

Utilities

  • Flatseal: Manage flatpak permissions

Music

  • Spotify,

Notes


New Machine Install Steps

For a new machine, I run the following command to set up my computer:

Please make sure you adjust your hostname as Ansible keys off this variable. I like to do this during the initial configuration of the machine.

This will prompt you for your sudo password for the bash script and then once later for ansible's "BECOME PASSWORD" prompt.

Voila! ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

New Terminal/Server Setup

wget -qO- \
https://github.com/seadogger/EndlessUbuntuOS/raw/main/run_terminal.sh | \
bash
cd ~Personal\EndlessUbuntuOS
make install
sudo reboot now

New Desktop Setup

wget -qO- \
https://github.com/seadogger/EndlessUbuntuOS/raw/main/run_desktop.sh | \
bash
cd ~Personal\EndlessUbuntuOS
make install
sudo reboot now

Existing Machine Install

On an existing machine, I run the following bash command, to ensure I am consistent with my playbook

Make All

make all

This target runs four other targets in series:

  • bootstrap
  • bootstrap-check
  • install
  • non-ansible

Let's go through each.

Make bootstrap

This installs several packages with apt and python packages per the requirements-ansible.txt file.

This includes Ansible, using Python3.

This also moves the home-local-bin.sh file to the /etc/profile.d/ folder as described above.

The yarn roles does a similar operation, except with Ansible instead of bash.

Make bootstrap-check

This is to confirm both the ansible and psutil Python3 packages are installed and on the $PATH.

If the pip installation falls back to using the --user flag, packages will be located in the following directory under $HOME:

Goal: export PATH="$HOME/.local/bin:$PATH" without duplication!

#/etc/profile.d/home-local-bin.sh

addToPATH() {
  case ":$PATH:" in
    *":$1:"*) :;; # already there
    *) PATH="$1:$PATH";; # or PATH="$PATH:$1"
  esac
}

# Important for python pip packages installed with --user
addToPATH "$HOME/.local/bin"

make bootstrap will set this up for you!

Source: duplicate-entries-in-path-a-problem

Make install

This runs the playbook.yml Ansible playbook.

The following two commands yield the same bash command:

make install
ansible-playbook playbook.yml \
-i inventory \
--ask-become-pass \
-e '{"users": [{"username": "$(shell whoami)"}]}'

Note: $(shell whoami) in a Makefile translates to $(whoami) in bash.

The "-e" is for extra variable and is from my Ansible Galaxy role iancleary/ansible-role-zsh#example-playbook

Make non-ansible

This the targets that I found easier to maintain with bash or Makefile scripts.

# configure Flameshot with gsettings to bind to PrtScr
make flameshot-keybindings

# Ubuntu 20.04 defaults
make python-three-eight-install
make python-three-eight-supporting

...

Naming Convention for Make Targets

make check and make install are two of the standard Makefile targets for this repo.


Overriding Defaults

Not everyone's development environment and preferred software configuration is the same.

You can override any of the defaults configured in default.config.yml by creating a config.yml file and setting the overrides in that file. For example, you can customize the installed packages and apps with something like:

    nodejs_version: "14.x"
    nodejs_npm_global_packages:
      - name: "@vue/cli"
      - name: "nativefier"
      - name: "markdownlint-cli"
      - name: "carbon-now-cli"

Any variable can be overridden in config.yml; see the supporting roles' documentation for a complete list of available variables.

Order of precedence for variables

  • Any content in the config.yml has the highest precedence (not version controlled; sensitive)
  • The version controlled default.config.yml file.

This allows hostnames to remain private outside of version control, for say secret operations ๐Ÿ•ต๏ธ

Example Using This Repo As Is

For example, a config.yml could contain:

---
nodejs_npm_global_packages:
  - name: "@vue/cli"
  - name: "@gridsome/cli"

Example Forking This Repo

For example, a default.config.yml could contain:

---
nodejs_npm_global_packages:
  - name: "@vue/cli"

Then run make all

Voila (with your edits)! ๐Ÿš€๐Ÿš€๐Ÿš€


Quick Note on /etc/profile.d/

Investigate this folder and your ~/.bashrc, ~/.zshrc, etc. files will become simpler and more maintainable! ๐Ÿš€

Let's stuff a few more lines of configuration into that file, it will be fine ๐Ÿ˜ฌ๐Ÿ˜ฌ๐Ÿ˜ฌ๐Ÿ˜ฌ.

Tl;dr is that most shells source all files in that folder, similar to source ~/.bashrc on a fresh Ubuntu install. The main advantage for using the /etc/profile.d/ folder is that it is modular and maintainable.

Fast forward to your using that folder as it was intended.

A zen like calm washes over you now that there is a single file per application and use case!

Your messy filing cabinet of assorted patches is no more. ๐Ÿ”ฅ

The . /etc/profile command is used to manually source the `/etc/profile.d/ folder.

Changes

See CHANGELOG for history.

Linting

Linting is performed on common file types:

Requirements_ansible.txt

Notable Ansible Modules Used with regards to dependencies

  • snap
    • This drives the ansible >=2.8.0 requirement

Authors

I benefited from the source work of others, see AUTHORS.md.

My choice to open source my work here is to share back with you.

If you wish to contribute, see CONTRIBUTING.md

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.