Commit ac4b4bb8 authored by Nick Busey's avatar Nick Busey

Real initial commit, adding ansible files.

parent 94cf86af
......@@ -18,3 +18,12 @@ Make it easy for anyone to own all their data in an easy and secure way, without
* Gogs - Git Hosting
* NextCloud - Private Cloud Storage, Calendar, Contacts, LDAP, etc.
* uTorrent - Torrent Downloader
## Installation
Install Ubuntu 18.04
Create a user with passwordless sudo access and ssh key based access.
Run `ansible-playbook -i hosts homelabos.yml`
---
- name: Update apt cache
apt: update_cache=yes
tags:
- dependencies
- name: Upgrade all dist packages
apt: upgrade=dist
tags:
- dependencies
- name: Install necessities and nice-to-haves
apt: pkg={{ item }} state=present
with_items:
- apt-transport-https
- git
- htop
- iftop
- iotop
- mosh
- screen
- sudo
- unattended-upgrades
- vim
- zsh
- docker-compose
tags:
- dependencies
- name: timezone - configure /etc/timezone
copy:
content: "{{ common_timezone | regex_replace('$', '\n') }}"
dest: /etc/timezone
owner: root
group: root
mode: 0644
register: common_timezone_config
- name: timezone - Set localtime to UTC
file: src=/usr/share/zoneinfo/Etc/UTC dest=/etc/localtime
when: common_timezone_config.changed
- name: timezone - reconfigure tzdata
command: dpkg-reconfigure --frontend noninteractive tzdata
when: common_timezone_config.changed
- name: Ensure locale en_US.UTF-8 locale is present
locale_gen:
name: en_US.UTF-8
state: present
main_user_name: nick
ansible_ssh_user: nick
common_timezone: 'Etc/UTC'
---
# This is the top-level playbook that defines our entire infrastructure.
- hosts: all
become: True
gather_facts: True
tags: docker
roles:
- docker
- hosts: all
become: True
gather_facts: True
tags: homelabos
roles:
- homelabos
This source diff could not be displayed because it is too large. You can view the blob instead.
---
- name: Make HomelabOS data directories.
file:
path: "/var/homelabos/{{ item }}"
state: directory
loop:
- docker
- emby
- grafana
- homeassistant
- influxdb
- nextcloud
- nextcloud_db
- telegraf
- traefik
- name: Copy HomelabOS docker-compose.yml file into place.
template:
src: docker-compose.yml
dest: /var/homelabos/docker/docker-compose.yml
- name: Pull latest HomelabOS service docker images.
command: docker-compose -f /var/homelabos/docker/docker-compose.yml pull
- name: Configure Telegraf.
copy: src=telegraf.conf dest=/var/homelabos/telegraf/telegraf.conf
- name: Configure HomelabOS systemd service.
template: src=homelabos.service dest=/etc/systemd/system/homelabos.service
- name: Restart HomelabOS service.
systemd:
name: homelabos
enabled: yes
daemon-reload: yes
state: restarted
version: '3'
services:
homeassistant:
image: homeassistant/home-assistant
volumes:
- /var/homelabos/homeassistant:/config
- /etc/localtime:/etc/localtime:ro
- /etc/letsencrypt:/etc/letsencrypt
restart: always
ports:
- 8123:8123
- 1883:1883
- 8080:8080
- 51827:51827
links:
- influxdb
emby:
image: emby/embyserver:latest
network_mode: host
restart: always
volumes:
- /var/homelabos/emby:/config
influxdb:
image: influxdb
volumes:
- /var/homelabos/influxdb:/var/lib/influxdb
ports:
- 8086:8086
chronograf:
image: chronograf
links:
- influxdb
ports:
- 8888:8888
grafana:
image: grafana/grafana
links:
- influxdb
ports:
- 3000:3000
volumes:
- /var/homelabos/grafana:/var/lib/grafana
environment:
- GF_INSTALL_PLUGINS=grafana-clock-panel,natel-discrete-panel,petrslavotinek-carpetplot-panel,vonage-status-panel
telegraf:
image: telegraf
volumes:
- /var/homelabos/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf
- /var/run/docker.sock:/var/run/docker.sock
links:
- influxdb
[Unit]
Description=HomelabOS Service
After=docker.service
Requires=docker.service
[Service]
TimeoutSec=infinity
Restart=always
RestartSec=3
ExecStartPre=/usr/bin/docker-compose -f /var/homelabos/docker/docker-compose.yml -p homelabos down
ExecStart=/usr/bin/docker-compose -f /var/homelabos/docker/docker-compose.yml -p homelabos up
ExecStop=/usr/bin/docker-compose -f /var/homelabos/docker/docker-compose.yml -p homelabos stop
[Install]
WantedBy=multi-user.target
\ No newline at end of file
[homelabos]
192.168.1.167
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment