# Getting Started

# Introduction to the Netos NetOps Project

### Introduction

Our goal with our Sempahore projects is to deliver a framework that makes it simple and fast to deploy and manage open-source enterprise networking applications and tools.

- Quickly spin up an enterprise grade application stack (in minutes).
- Deal with all the critical yet time consuming platform engineering at the click of a button.
- Deal with the boring but important stuff like backups, restores, and maintenance.
- Fast track to the interesting stuff like playing with the tools and dev/test.

Over time we will publish more projects with associated playbooks. Currently available is:

- **Netos NetOps** - A simple wrapper project for managing the underlying Semaphore instance.
- **[Netos NetBox](https://docs.netos.io/books/semaphore-netbox)** - Contains all the playbooks to deploy and operate NetBox.

### Ansible Semaphore

[Semaphore UI](https://semaphoreui.com/) is a simple and easy to use alternative to Ansible AWX. Netos have used it for over a year without issues to run thousands of playbooks and manage all of our infrastructure.

> It is convenient and easy to use - user friendly web interface for executing Ansible playbooks, Terraform, OpenTofu, Pulumi code and Bash scripts. It is designed to make your automation tasks easier and more enjoyable.

#### Playbooks

At a click of a button you can perform complex installations, like installing NetBox, and a lot more.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/71wbyiHjGjGkxAhG-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/71wbyiHjGjGkxAhG-image.png)

#### Views

Views group together different playbooks, for example, below you can the tasks that deploy NetBox:

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/5DfcRO8DDl2Pk2i3-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/5DfcRO8DDl2Pk2i3-image.png)



#### Semaphore Projects

Finally, we group everything together into different projects.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/12zAWmNZGSmMfglI-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/12zAWmNZGSmMfglI-image.png)

# Key Semaphore Principles

### Introduction

The following diagram illustrates the purpose of each menu item in Semaphore, in the context of the Netos deployment.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/HsqofGpIRr8fw65U-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/HsqofGpIRr8fw65U-image.png)

### Environments

Environments pass variables into Ansible (or other scripts such as Python or Bash).

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/BpTQ5eMfBu6W176R-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/BpTQ5eMfBu6W176R-image.png)

For example, in this environment file we pass through variables from the Semaphore Environment, but also set default variables where applicable in the `/vars/` files in the Ansible project.

```json
CERT_CONTENT: "{{ lookup('env', 'CERT_CONTENT') | default('must-be-set-in-semaphore-variable') }}"
CERT_DIR: "{{ lookup('env', 'CERT_DIR') | default('/netos/certs/netbox') }}"
DOMAIN: "{{ lookup('env', 'DOMAIN') | default('netos.dev') }}"
NETBOX_DB_NAME: "{{ lookup('env', 'NETBOX_DB_NAME') | default('netbox') }}"
```

Semaphore also supports encrypted secrets as variables. We decided to use this feature throughout rather than Ansible Vault because it ensures that all data is in one place, rather than being split across different vaults and environments.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/l59CqsLFf3piANkB-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/l59CqsLFf3piANkB-image.png)

<p class="callout warning">There is a bug in Semaphore where updates to Secrets are not saved. [Problem: not possible to edit secret name · Issue #2293 · semaphoreui/semaphore (github.com)](https://github.com/semaphoreui/semaphore/issues/2293)</p>

### Repositories

Repositories are linked to Templates (e.g. an Ansible playbook) and in general point to a Git repository. In the case of all Netos projects, we instead point to a local file system, and instead have a per-project task to pull the repository from [Netos Networks (github.com)](https://github.com/netos-networks).

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/CfCx4001PxPKHUHt-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/CfCx4001PxPKHUHt-image.png)

### Templates

Everything above is pulled together into a Template.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/PxblblZuJZeMf4WQ-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/PxblblZuJZeMf4WQ-image.png)

### Scheduling

Templates can then be scheduled for repetitive tasks, such as backup and housekeeping tasks.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/0j2AHYWNWBfF62N5-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/0j2AHYWNWBfF62N5-image.png)

### Tracking Tasks

You can globally track the status of all tasks, as well as within the logs of each Template.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/KNCNcHVV2XWBGPHX-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/KNCNcHVV2XWBGPHX-image.png)

# Users, Accounts & Tokens

## Introduction

We have set default tokens and passwords to get a test/lab environment up and running quickly. In a production deployment you should replace all the tokens and passwords. We don't suggest changing any directories.

## Default Login Values

The default accounts to login to systems following deployment from Semaphore are as follows. The endpoints (URLs) are set in Semaphore environments, and you will need [deploy and configure NGINX](https://docs.netos.io/books/semaphore-netops/page/deploying-nginx-certificates).

<table border="1" id="bkmrk-system-username-pass" style="border-collapse: collapse; width: 100%; height: 178.168px;"><colgroup><col style="width: 13.3483%;"></col><col style="width: 16.3146%;"></col><col style="width: 16.0798%;"></col><col style="width: 54.1225%;"></col></colgroup><tbody><tr style="height: 29.6946px;"><td style="background-color: rgb(236, 240, 241); height: 29.6946px;">**System**</td><td style="background-color: rgb(236, 240, 241); height: 29.6946px;">**Username**</td><td style="background-color: rgb(236, 240, 241); height: 29.6946px;">**Password**</td><td style="background-color: rgb(236, 240, 241); height: 29.6946px;">**Endpoint Settings**</td></tr><tr style="height: 29.6946px;"><td style="height: 29.6946px;">Semaphore</td><td style="height: 29.6946px;">`admin`</td><td style="height: 29.6946px;">`admin`</td><td style="height: 29.6946px;">Set in Semaphore environment "Semaphore Global Settings"</td></tr><tr style="height: 29.6946px;"><td style="height: 29.6946px;">NetBox</td><td style="height: 29.6946px;">`admin`</td><td style="height: 29.6946px;">`ohp8toef7Jee`</td><td style="height: 29.6946px;">Set in Semaphore environment "NetBox Global Settings"</td></tr></tbody></table>

## Var Files

There are different Ansible Variable files located in each project, for example:

- [https://github.com/netos-networks/netos-netops/tree/main/vars](https://github.com/netos-networks/netos-netops/tree/main/vars)
- [https://github.com/netos-networks/netos-netbox/tree/main/vars](https://github.com/netos-networks/netos-netbox/tree/main/vars)

Here is an example `vars_file` from the `netos-netbox` repository. The "lookup" value is taken from.

```yaml
CERT_CONTENT: "{{ lookup('env', 'CERT_CONTENT') | default('must-be-set-in-semaphore-variable') }}"
CERT_DIR: "{{ lookup('env', 'CERT_DIR') | default('/netos/certs/netbox') }}"
DOMAIN: "{{ lookup('env', 'DOMAIN') | default('netos.dev') }}"
NETBOX_DB_NAME: "{{ lookup('env', 'NETBOX_DB_NAME') | default('netbox') }}"
NETBOX_DB_PASSWORD: "{{ lookup('env', 'NETBOX_DB_PASSWORD') | default('VxW6EnnKRrkxCzcnDnWT8Fz9q') }}"
NETBOX_DB_USER: "{{ lookup('env', 'NETBOX_DB_USER') | default('netbox') }}"
NETBOX_HOSTNAME: "{{ lookup('env', 'NETBOX_HOSTNAME') | default('netbox') }}"
NETBOX_INSTALL_DIR: "{{ lookup('env', 'NETBOX_INSTALL_DIR') | default('/opt/netbox') }}"
NETBOX_REPO: "{{ lookup('env', 'NETBOX_REPO') | default('https://github.com/netbox-community/netbox.git') }}"
NETBOX_TOKEN: "{{ lookup('env', 'NETBOX_TOKEN') | default('d4c5b00f7053317be2ce8993dd74caa14ca53ca8') }}"
ORG_NAME: "{{ lookup('env', 'ORG_NAME') | default('Netos Networks') }}"
PLUGIN_ADD_TAG: "{{ lookup('env', 'PLUGIN_ADD_TAG') | default('') }}"
POSTGRES_USER_PASSWORD: "{{ lookup('env', 'POSTGRES_USER_PASSWORD') | default('3SqtYWH8iy0Y1alOIj2I') }}"
PRIVATE_CERT_CONTENT: "{{ lookup('env', 'PRIVATE_CERT_CONTENT') | default('must-be-set-in-semaphore-variable') }}"
SECRET_KEY: "{{ lookup('env', 'SECRET_KEY') | default('ahz3ool4teiNgo7moh6fiehiuTh6zei5achae2eeshae9vaiYe') }}"
SUPER_USER_EMAIL: "{{ lookup('env', 'SUPER_USER_EMAIL') | default('netbox@netos.dev') }}"
SUPER_USER_PASSWORD: "{{ lookup('env', 'SUPER_USER_PASSWORD') | default('ohp8toef7Jee') }}"
SUPER_USER_USERNAME: "{{ lookup('env', 'SUPER_USER_USERNAME') | default('admin') }}"
AIRFLOW_API_USER_USERNAME: "{{ lookup('env', 'AIRFLOW_API_USER_USERNAME') | default('airflow_api') }}"
AIRFLOW_API_USER_PASSWORD: "{{ lookup('env', 'AIRFLOW_API_USER_PASSWORD') | default('a17baa2b642565b1d7be4d6d52a7fc23a2c6c41a') }}"
AIRFLOW_API_TOKEN: "{{ lookup('env', 'AIRFLOW_API_TOKEN') | default('d6d52a7fc23a2c6c41aa17baa2b642565b1d7be4') }}"
```

## Semaphore Variables

Variables and Secrets are set in Environments which are passed as variables via the `lookup` command above. Check the [Key Semaphore Principles](https://docs.netos.io/books/semaphore-netops/page/key-semaphore-principles) guide for more information about Semaphore.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-10/scaled-1680-/zeeJjFPpRJKEaM69-image.png)](https://docs.netos.io/uploads/images/gallery/2024-10/zeeJjFPpRJKEaM69-image.png)

<p class="callout warning">The variable must be configured in Semaphore if it is referenced in a variable file. If it isn't you will get an error when running the playbook.</p>

<p class="callout warning">In a production system, double check all accounts after setting them. I.e. ensure you can manually authenticate to databases, APIs, applications, etc.</p>