From 94d4a10e70135b9bde633bf77e9b11eaa8b9556e Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Fri, 10 Apr 2020 21:28:19 +0300
Subject: [PATCH] Scaffolding.

- Inventory.
- Config.
- README.
- License.
- gitignore.
- pre-commit.
---
 .gitignore              | 52 +++++++++++++++++++++++++++++++++++++++++
 .pre-commit-config.yaml | 31 ++++++++++++++++++++++++
 LICENSE.txt             | 21 +++++++++++++++++
 README.md               | 33 ++++++++++++++++++++++++++
 ansible.cfg             | 23 ++++++++++++++++++
 hosts/all.yaml          | 19 +++++++++++++++
 6 files changed, 179 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .pre-commit-config.yaml
 create mode 100644 LICENSE.txt
 create mode 100644 README.md
 create mode 100644 ansible.cfg
 create mode 100644 hosts/all.yaml

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7dda69c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,52 @@
+~*
+*~
+*.sw[op]
+*.py[cod]
+.DS_Store
+__pycache__/
+.vagrant/
+vendor/
+Thumbs.db
+*.retry
+.svn/
+.sass-cache/
+*.log
+*.out
+*.so
+node_modules/
+.npm/
+nbproject/
+*.ipynb
+.idea/
+*.egg-info/
+*.[ao]
+.classpath
+.cache/
+bower_components/
+*.class
+*.[ewj]ar
+secring.*
+.*.kate-swp
+.swp.*
+.directory
+.Trash-*
+build/
+_build/
+dist/
+.tox/
+*.pdf
+*.exe
+*.dll
+*.gz
+*.tgz
+*.tar
+*.rar
+*.zip
+*.pid
+*.lock
+*.env
+.bundle/
+!Pipfile.lock
+site.*
+mail.*
+account.*
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..65a0fd4
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,31 @@
+---
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v2.5.0
+    hooks:
+      - id: check-added-large-files
+      - id: check-executables-have-shebangs
+      - id: check-merge-conflict
+      - id: check-symlinks
+      - id: check-yaml
+      - id: detect-private-key
+      - id: trailing-whitespace
+  - repo: https://github.com/adarnimrod/ansible-pre-commit.git
+    rev: v0.9.0
+    hooks:
+      - id: ansible-syntax-check
+        files: bootstrap\.yaml|router\.yaml
+        types: [yaml]
+  - repo: https://github.com/willthames/ansible-lint
+    rev: v4.3.0a0
+    hooks:
+      - id: ansible-lint
+  - repo: https://github.com/adrienverge/yamllint
+    rev: v1.21.0
+    hooks:
+      - id: yamllint
+  - repo: https://github.com/amperser/proselint/
+    rev: 0.10.2
+    hooks:
+      - id: proselint
+        types: [markdown]
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..37cee3f
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020 Adar Nimrod
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1bafc74
--- /dev/null
+++ b/README.md
@@ -0,0 +1,33 @@
+# Homelab
+
+> My homelab setup using Ansible.
+
+## Background
+
+I used to maintain quite a few Ansible roles with proper CI and whatnot. But as
+time moved on a few things changed. Firstly, my homelab was stable and I
+didn't have to manage it. My work changed and I used Ansible less and Docker
+more. [Molecule](https://molecule.readthedocs.io/) 2.0 came out and I had to
+redo all of the CI setup. Also, I reached the time limit with TravisCI with some
+of the more complex roles which casued them to fail although they were
+completely working.
+
+With this in mind, this is a new take on my homelab setup. I'm not going to do
+CI (more than [pre-commit](pre-commit.com/) checks) for the foreseeable future.
+There isn't going to be a dev environment using Vagrant. Also, no reusable
+Ansible roles. Lastly, the scope for Ansible is much reduced. I'm going to use
+it to manage the OpenBSD router, the OpenWRT access point, the base aspects of
+the other hosts. Anything that I can do with Docker and Docker Compose, I'm
+going to use that. My point here is to allow me to easily update hosts with
+minimal downtime to new releases and to do what I can't do with Docker.
+
+## License
+
+This software is licensed under the MIT license (see `LICENSE.txt`).
+
+## Author Information
+
+Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](
+https://www.shore.co.il/). Patches are welcome via [`git send-email`](
+http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located
+at: <https://www.shore.co.il/git/>.
diff --git a/ansible.cfg b/ansible.cfg
new file mode 100644
index 0000000..778a07e
--- /dev/null
+++ b/ansible.cfg
@@ -0,0 +1,23 @@
+[defaults]
+callback_whitelist = profile_tasks, timer
+command_warnings = True
+deprecation_warnings = True
+fact_caching = jsonfile
+fact_caching_connection = ~/.ansible/facts
+force_handlers = True
+interpreter_python = auto
+inventory = hosts
+gathering = smart
+pipelining = True
+retry_files_save_path = /tmp/
+system_warnings = True
+unparsed_is_failed = True
+verbosity = 2
+
+[inventory]
+enable_plugins = yaml
+
+[privilege_escalation]
+become = True
+become_user = root
+become_ask_pass = False
diff --git a/hosts/all.yaml b/hosts/all.yaml
new file mode 100644
index 0000000..e4e3e83
--- /dev/null
+++ b/hosts/all.yaml
@@ -0,0 +1,19 @@
+---
+all:
+  hosts:
+    ns1:
+      ansible_host: ns1.shore.co.il
+      ansible_become_method: doas
+    ns4:
+      ansible_host: ns4.shore.co.il
+    kodi:
+      ansible_host: kodi.shore.co.il
+    ea6350:
+      # We already log in as root.
+      ansible_become: false
+      ansible_host: ea6350.shore.co.il
+    host01:
+      ansible_host: host01.shore.co.il
+  vars:
+    # Force usage of Python3.
+    ansible_python_interpreter: python3
-- 
GitLab