Skip to content

Commit

Permalink
fix: cleaned up linting
Browse files Browse the repository at this point in the history
Cleaned up warnings from linting.
  • Loading branch information
derekmurawsky committed Feb 18, 2022
1 parent 5de853f commit 4a4c575
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 57 deletions.
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.26.3
hooks:
- id: check-yaml
args: [--unsafe]
- id: yamllint
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.31.1
hooks:
Expand Down
21 changes: 21 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# Based on ansible-lint config
extends: default

rules:
braces: {max-spaces-inside: 1, level: error}
brackets: {max-spaces-inside: 1, level: error}
colons: {max-spaces-after: -1, level: error}
commas: {max-spaces-after: -1, level: error}
comments: disable
comments-indentation: disable
document-start: disable
empty-lines: {max: 3, level: error}
hyphens: {level: error}
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines: {type: unix}
trailing-spaces: disable
truthy: disable
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
# Ansible Collection - derekmurawsky.general

This collection contains some roles and playbooks that I use to set up and maintain my homelab.
[![CI](https://github.com/derekmurawsky/ansible-derekmurawsky-general/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/derekmurawsky/ansible-derekmurawsky-general/actions/workflows/ci.yml)

## Documentation
This collection contains some roles and playbooks that I use to set up and maintain my homelab. It is published to the [Ansible Galaxy](https://galaxy.ansible.com/derekmurawsky/general). More detailed documentation is available on the project's [github page](https://derekmurawsky.github.io/ansible-derekmurawsky-general/).

Documentation is available at [https://derekmurawsky.github.io/ansible-derekmurawsky-general/](https://derekmurawsky.github.io/ansible-derekmurawsky-general/).
## Playbooks

This collection is documented using [MKDocs](https://www.mkdocs.org/) with the [Material](https://squidfunk.github.io/mkdocs-material/) theme and the [MKDocs Monorepo](https://github.com/backstage/mkdocs-monorepo-plugin) plugin.
All playbooks in this bundle target all hosts by default. You can target specific hosts by passing `-e 'target=hostname-or-group'` on the command line to override this behavior.

## Development
### Bootstrap

The easiest way to work with this project is to git clone it and then open it with VSCode. This is a devcontainer enabled repo. Once the devcontainer is built once, it will run much faster in the future.
A *very* simple playbook that will use the collections bootstrap role to bootstrap all targeted hosts for ansible management.

### To build and test locally
### Proxmox

1. Create a `requirements.yml` that points to this module's directory.
A simple playbook that will apply the proxmox roles from this collection to all targeted hosts.

```yaml
---
collections:
- source: derekmurawsky/general
type: dir
```
## Roles

2. Install the collection by running the command `ansible-galaxy collection install -r requirements.yml --force`.
3. Any time you make a change to the code that you want to test, you must re-run the command from step 2
### ansible_bootstrap

<!-- markdownlint-disable-file MD029 -->
A role to help bootstrap a linux server for ansible management. It provisions a user, adds the user to the sudoers group, and configures password-less sudo for that user.

### proxmox_base

A role that does some baseline configuration on a proxmox server. It adds the pve-no-subscription repo, updates the cache, and puts vmbr0 vlan-aware.

### proxmox_nginx

A role that configures nginx as a reverse proxy on the proxmox server. It installs and configures nginx as a reverse proxy pointing to the proxmox server behind it. It utilizes ProxMox's default certificates.
20 changes: 20 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,23 @@ A role that does some baseline configuration on a proxmox server. It adds the pv
### proxmox_nginx

A role that configures nginx as a reverse proxy on the proxmox server. It installs and configures nginx as a reverse proxy pointing to the proxmox server behind it. It utilizes ProxMox's default certificates.

## Development

The easiest way to work with this project is to git clone it and then open it with VSCode. This is a devcontainer enabled repo. Once the devcontainer is built once, it will run much faster in the future.

### To build and test locally

1. Create a `requirements.yml` that points to this module's directory.

```yaml
---
collections:
- source: derekmurawsky/general
type: dir
```
2. Install the collection by running the command `ansible-galaxy collection install -r requirements.yml --force`.
3. Any time you make a change to the code that you want to test, you must re-run the command from step 2

<!-- markdownlint-disable-file MD029 -->
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
requires_ansible: ">=2.1"
requires_ansible: ">=2.10"
7 changes: 5 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ theme:
logo: material/ansible
features:
- navigation.instant
- navigation.expand
- navigation.indexes
repo_url: https://github.com/derekmurawsky/ansible-derekmurawsky-general
nav:
- Home: 'README.md'
- ADRs: "ADRs/README.md"
- ADRs:
- Overview: "ADRs/README.md"
- "0000 Use MADRs": ADRs/0000-use-markdown-architectural-decision-records.md
- "0001 Use MKDocs": ADRs/0001-use-mkdocs-monorepo.md
- MADR Template: ADRs/adr-template.md
- Playbooks:
- Overview: '!include ./playbooks/mkdocs.yml'
- Roles:
Expand Down
34 changes: 1 addition & 33 deletions roles/ansible_bootstrap/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,10 @@
---
galaxy_info:
author: Derek Murawsky
description: A simple, yet flexible, role to bootstrap a server for ansible management

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: MIT

min_ansible_version: 2.1

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
platforms:
- name: Debian

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
1 change: 1 addition & 0 deletions roles/ansible_bootstrap/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
site_name: "DerekMurawsky.General - ansible_bootstrap role"
theme: material

Expand Down
1 change: 1 addition & 0 deletions roles/proxmox_base/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
galaxy_info:
author: Derek Murawsky
description: Basic proxmox bootstrap role
Expand Down
1 change: 1 addition & 0 deletions roles/proxmox_nginx/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
galaxy_info:
author: Derek Murawsky
description: Configures NGINX as a frontend for Proxmox
Expand Down
1 change: 1 addition & 0 deletions roles/proxmox_nginx/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
site_name: "DerekMurawsky.General - proxmox_nginx role"
theme: material

Expand Down
9 changes: 9 additions & 0 deletions roles/proxmox_nginx/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
ansible.builtin.template:
src: nginx.conf.j2
dest: /etc/nginx/conf.d/proxmox.conf
owner: root
group: root
mode: 0644
backup: true
notify:
- Restart nginx
Expand All @@ -21,11 +24,17 @@
- name: Ensures /etc/systemd/system/nginx.service.d/ dir exists
ansible.builtin.file:
path: /etc/systemd/system/nginx.service.d/
owner: root
group: root
mode: 0755
state: directory

- name: Install nginx systemd override
ansible.builtin.template:
src: nginx.service.j2
dest: /etc/systemd/system/nginx.service.d/local.conf
owner: root
group: root
mode: 0644
notify:
- Restart nginx

0 comments on commit 4a4c575

Please sign in to comment.