chore(make)!: task commands easier and ansible.cfg
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
8 files changed
+47
-144
No files matched your search
+10
-14
@@ -14,7 +14,8 @@ tasks:
|
||||
desc: Upgrade Ansible galaxy deps
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
- "ansible-galaxy install -r requirements.yml --force"
|
||||
- "ansible-galaxy install -r requirements.yml --roles-path ~/.ansible/roles --force"
|
||||
- "ansible-galaxy collection install -r requirements.yml --collections-path ~/.ansible/collections --force"
|
||||
|
||||
list:
|
||||
desc: List all the hosts
|
||||
@@ -22,49 +23,44 @@ tasks:
|
||||
cmds:
|
||||
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --list-hosts"
|
||||
|
||||
playbook:ubuntu-prepare:
|
||||
prepare:
|
||||
desc: Prepare all the k8s nodes for running k3s
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/ubuntu-prepare.yml"
|
||||
|
||||
playbook:ubuntu-upgrade:
|
||||
desc: Upgrade all the k8s nodes operating system
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/ubuntu-upgrade.yml"
|
||||
|
||||
playbook:k3s-install:
|
||||
install:
|
||||
desc: Install Kubernetes on the nodes
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-install.yml"
|
||||
|
||||
playbook:k3s-nuke:
|
||||
nuke:
|
||||
desc: Uninstall Kubernetes on the nodes
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-nuke.yml"
|
||||
- "ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml -a '/usr/bin/systemctl reboot' --become"
|
||||
|
||||
adhoc:ping:
|
||||
ping:
|
||||
desc: Ping all the hosts
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --one-line -m 'ping'"
|
||||
|
||||
adhoc:uptime:
|
||||
uptime:
|
||||
desc: Uptime of all the hosts
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
- ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --one-line -a 'uptime'
|
||||
|
||||
adhoc:reboot:
|
||||
reboot:
|
||||
desc: Reboot all the k8s nodes
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
- "ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml -a '/usr/bin/systemctl reboot' --become"
|
||||
|
||||
adhoc:poweroff:
|
||||
poweroff:
|
||||
desc: Shutdown all the k8s nodes
|
||||
dir: provision/ansible
|
||||
cmds:
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
version: "3"
|
||||
|
||||
tasks:
|
||||
sync:
|
||||
desc: Sync flux-system with the Git Repository
|
||||
cmds:
|
||||
- flux reconcile source git flux-system
|
||||
silent: true
|
||||
@@ -1,33 +0,0 @@
|
||||
---
|
||||
version: "3"
|
||||
|
||||
tasks:
|
||||
all:
|
||||
- task: markdown
|
||||
- task: yaml
|
||||
markdown:
|
||||
desc: Format Markdown
|
||||
cmds:
|
||||
- >-
|
||||
prettier
|
||||
--ignore-path '.github/linters/.prettierignore'
|
||||
--config '.github/linters/.prettierrc.yaml'
|
||||
--list-different
|
||||
--ignore-unknown
|
||||
--parser=markdown
|
||||
--write '*.md' '**/*.md'
|
||||
ignore_error: true
|
||||
yaml:
|
||||
desc: Format YAML
|
||||
cmds:
|
||||
- >-
|
||||
prettier
|
||||
--ignore-path '.github/linters/.prettierignore'
|
||||
--config
|
||||
'.github/linters/.prettierrc.yaml'
|
||||
--list-different
|
||||
--ignore-unknown
|
||||
--parser=yaml
|
||||
--write '*.y*ml'
|
||||
'**/*.y*ml'
|
||||
ignore_error: true
|
||||
@@ -1,26 +0,0 @@
|
||||
---
|
||||
version: "3"
|
||||
|
||||
tasks:
|
||||
all:
|
||||
- task: markdown
|
||||
- task: yaml
|
||||
- task: format
|
||||
|
||||
markdown:
|
||||
desc: Lint Markdown
|
||||
cmds:
|
||||
- markdownlint -c '.github/linters/.markdownlint.yaml' *.md **/*.md
|
||||
ignore_errors: true
|
||||
|
||||
yaml:
|
||||
desc: Lint YAML
|
||||
cmds:
|
||||
- yamllint -c '.github/linters/.yamllint.yaml' .
|
||||
ignore_errors: true
|
||||
|
||||
format:
|
||||
desc: Lint general formatting
|
||||
cmds:
|
||||
- prettier --ignore-path '.github/linters/.prettierignore' --config '.github/linters/.prettierrc.yaml' --check .
|
||||
ignore_errors: true
|
||||
@@ -3,19 +3,19 @@ version: "3"
|
||||
|
||||
tasks:
|
||||
|
||||
init:cloudflare:
|
||||
init:
|
||||
desc: Initialize terraform
|
||||
dir: provision/terraform/cloudflare
|
||||
cmds:
|
||||
- "terraform init"
|
||||
|
||||
plan:cloudflare:
|
||||
plan:
|
||||
desc: Prepare all the k8s nodes for running k3s
|
||||
dir: provision/terraform/cloudflare
|
||||
cmds:
|
||||
- "terraform plan"
|
||||
|
||||
apply:cloudflare:
|
||||
apply:
|
||||
desc: Prepare all the k8s nodes for running k3s
|
||||
dir: provision/terraform/cloudflare
|
||||
cmds:
|
||||
|
||||
@@ -38,7 +38,7 @@ For provisioning the following tools will be used:
|
||||
|
||||
- [Ubuntu](https://ubuntu.com/download/server) - this is a pretty universal operating system that supports running all kinds of home related workloads in Kubernetes
|
||||
- [Ansible](https://www.ansible.com) - this will be used to provision the Ubuntu operating system to be ready for Kubernetes and also to install k3s
|
||||
- [Terraform](https://www.terraform.io) - in order to help with the DNS settings this will be used to provision an already existing Cloudflare domain and DNS settings
|
||||
- [Terraform](https://www.terraform.io) - in order to help with the DNS settings this will be used to provision an already existing Cloudflare domain and certain DNS settings
|
||||
|
||||
## 📝 Prerequisites
|
||||
|
||||
@@ -208,9 +208,9 @@ In order to use Terraform and `cert-manager` with the Cloudflare DNS challenge y
|
||||
|
||||
3. Verify Ansible can view your config by running `task ansible:list`
|
||||
|
||||
4. Verify Ansible can ping your nodes by running `task ansible:adhoc:ping`
|
||||
4. Verify Ansible can ping your nodes by running `task ansible:ping`
|
||||
|
||||
5. Finally, run the Ubuntu Prepare playbook by running `task ansible:playbook:ubuntu-prepare`
|
||||
5. Finally, run the Ubuntu Prepare playbook by running `task ansible:prepare`
|
||||
|
||||
6. If everything goes as planned you should see Ansible running the Ubuntu Prepare Playbook against your nodes.
|
||||
|
||||
@@ -220,9 +220,9 @@ In order to use Terraform and `cert-manager` with the Cloudflare DNS challenge y
|
||||
|
||||
1. Verify Ansible can view your config by running `task ansible:list`
|
||||
|
||||
2. Verify Ansible can ping your nodes by running `task ansible:adhoc:ping`
|
||||
2. Verify Ansible can ping your nodes by running `task ansible:ping`
|
||||
|
||||
3. Run the k3s install playbook by running `task ansible:playbook:k3s-install`
|
||||
3. Run the k3s install playbook by running `task ansible:install`
|
||||
|
||||
4. If everything goes as planned you should see Ansible running the k3s install Playbook against your nodes.
|
||||
|
||||
@@ -239,11 +239,11 @@ In order to use Terraform and `cert-manager` with the Cloudflare DNS challenge y
|
||||
|
||||
📍 Review the Terraform scripts under `./provision/terraform/cloudflare/` and make sure you understand what it's doing (no really review it). If your domain already has existing DNS records **be sure to export those DNS settings before you continue**.
|
||||
|
||||
1. Pull in the Terraform deps by running `task terraform:init:cloudflare`
|
||||
1. Pull in the Terraform deps by running `task terraform:init`
|
||||
|
||||
2. Review the changes Terraform will make to your Cloudflare domain by running `task terraform:plan:cloudflare`
|
||||
2. Review the changes Terraform will make to your Cloudflare domain by running `task terraform:plan`
|
||||
|
||||
3. Finally have Terraform execute the task by running `task terraform:apply:cloudflare`
|
||||
3. Finally have Terraform execute the task by running `task terraform:apply`
|
||||
|
||||
If Terraform was ran successfully you can log into Cloudflare and validate the DNS records are present. The cluster application `external-dns` will be managing the rest of the DNS records you will need.
|
||||
|
||||
@@ -404,6 +404,6 @@ Our Check out our [wiki](https://github.com/k8s-at-home/template-cluster-k3s/wik
|
||||
|
||||
Big shout out to all the authors and contributors to the projects that we are using in this repository.
|
||||
|
||||
Community member @Whazor created [this website](https://whazor.github.io/k8s-at-home-search/) as a means to search Helm Releases across GitHub. You may use it as a means to get ideas on how to configure an applications' Helm values.
|
||||
Community member @Whazor created [this website](https://whazor.github.io/k8s-at-home-search/) as a creative way to search Helm Releases across GitHub. You may use it as a means to get ideas on how to configure an applications' Helm values.
|
||||
|
||||
Many people have shared their awesome repositories over at [awesome-home-kubernetes](https://github.com/k8s-at-home/awesome-home-kubernetes).
|
||||
@@ -13,8 +13,5 @@ env:
|
||||
|
||||
includes:
|
||||
ansible: .taskfiles/ansible.yml
|
||||
flux: .taskfiles/flux.yml
|
||||
format: .taskfiles/format.yml
|
||||
lint: .taskfiles/lint.yml
|
||||
pre-commit: .taskfiles/pre-commit.yml
|
||||
terraform: .taskfiles/terraform.yml
|
||||
+25
-47
@@ -1,57 +1,35 @@
|
||||
[defaults]
|
||||
|
||||
#--- General settings
|
||||
# General settings
|
||||
nocows = True
|
||||
forks = 8
|
||||
module_name = command
|
||||
deprecation_warnings = True
|
||||
executable = /bin/bash
|
||||
stdout_callback = yaml
|
||||
|
||||
#--- Files/Directory settings
|
||||
log_path = ~/ansible.log
|
||||
inventory = ./provision/ansible/inventory
|
||||
library = /usr/share/my_modules
|
||||
remote_tmp = /tmp/.ansible/tmp
|
||||
local_tmp = /tmp/.ansible/tmp
|
||||
roles_path = ./provision/ansible/roles
|
||||
retry_files_enabled = False
|
||||
|
||||
#--- Fact Caching settings
|
||||
fact_caching = jsonfile
|
||||
fact_caching_connection = ~/.ansible/facts_cache
|
||||
fact_caching_timeout = 7200
|
||||
|
||||
#--- SSH settings
|
||||
remote_port = 22
|
||||
timeout = 60
|
||||
host_key_checking = False
|
||||
ssh_executable = /usr/bin/ssh
|
||||
private_key_file = ~/.ssh/id_rsa
|
||||
|
||||
force_valid_group_names = ignore
|
||||
|
||||
#--- Speed
|
||||
callback_enabled = true
|
||||
internal_poll_interval = 0.001
|
||||
|
||||
#--- Plugin settings
|
||||
vars_plugins_enabled = host_group_vars,community.sops.sops
|
||||
force_valid_group_names = ignore
|
||||
# File/Directory settings
|
||||
log_path = ~/.ansible/ansible.log
|
||||
inventory = ./inventory
|
||||
roles_path = ~/.ansible/roles:./roles
|
||||
collections_path = ~/.ansible/collections
|
||||
remote_tmp = /tmp/.ansible/tmp
|
||||
local_tmp = ~/.ansible/tmp
|
||||
# Fact Caching settings
|
||||
fact_caching = jsonfile
|
||||
fact_caching_connection = ~/.ansible/facts_cache
|
||||
# SSH settings
|
||||
remote_port = 22
|
||||
timeout = 60
|
||||
host_key_checking = False
|
||||
# Plugin settings
|
||||
vars_plugins_enabled = host_group_vars,community.sops.sops
|
||||
|
||||
[inventory]
|
||||
unparsed_is_failed = true
|
||||
unparsed_is_failed = true
|
||||
|
||||
[privilege_escalation]
|
||||
become = True
|
||||
become_method = sudo
|
||||
become_user = root
|
||||
become_ask_pass = False
|
||||
become = True
|
||||
|
||||
[ssh_connection]
|
||||
scp_if_ssh = smart
|
||||
transfer_method = smart
|
||||
retries = 3
|
||||
timeout = 10
|
||||
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o Compression=yes -o ServerAliveInterval=15s
|
||||
pipelining = True
|
||||
control_path = %(directory)s/%%h-%%r
|
||||
scp_if_ssh = smart
|
||||
retries = 3
|
||||
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o Compression=yes -o ServerAliveInterval=15s
|
||||
pipelining = True
|
||||
control_path = %(directory)s/%%h-%%r
|
||||
Reference in new issue
Block a user