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
|
desc: Upgrade Ansible galaxy deps
|
||||||
dir: provision/ansible
|
dir: provision/ansible
|
||||||
cmds:
|
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:
|
list:
|
||||||
desc: List all the hosts
|
desc: List all the hosts
|
||||||
@@ -22,49 +23,44 @@ tasks:
|
|||||||
cmds:
|
cmds:
|
||||||
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --list-hosts"
|
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --list-hosts"
|
||||||
|
|
||||||
playbook:ubuntu-prepare:
|
prepare:
|
||||||
desc: Prepare all the k8s nodes for running k3s
|
desc: Prepare all the k8s nodes for running k3s
|
||||||
dir: provision/ansible
|
dir: provision/ansible
|
||||||
cmds:
|
cmds:
|
||||||
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/ubuntu-prepare.yml"
|
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/ubuntu-prepare.yml"
|
||||||
|
|
||||||
playbook:ubuntu-upgrade:
|
install:
|
||||||
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:
|
|
||||||
desc: Install Kubernetes on the nodes
|
desc: Install Kubernetes on the nodes
|
||||||
dir: provision/ansible
|
dir: provision/ansible
|
||||||
cmds:
|
cmds:
|
||||||
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-install.yml"
|
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-install.yml"
|
||||||
|
|
||||||
playbook:k3s-nuke:
|
nuke:
|
||||||
desc: Uninstall Kubernetes on the nodes
|
desc: Uninstall Kubernetes on the nodes
|
||||||
dir: provision/ansible
|
dir: provision/ansible
|
||||||
cmds:
|
cmds:
|
||||||
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-nuke.yml"
|
- "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
|
desc: Ping all the hosts
|
||||||
dir: provision/ansible
|
dir: provision/ansible
|
||||||
cmds:
|
cmds:
|
||||||
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --one-line -m 'ping'"
|
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --one-line -m 'ping'"
|
||||||
|
|
||||||
adhoc:uptime:
|
uptime:
|
||||||
desc: Uptime of all the hosts
|
desc: Uptime of all the hosts
|
||||||
dir: provision/ansible
|
dir: provision/ansible
|
||||||
cmds:
|
cmds:
|
||||||
- ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --one-line -a 'uptime'
|
- ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --one-line -a 'uptime'
|
||||||
|
|
||||||
adhoc:reboot:
|
reboot:
|
||||||
desc: Reboot all the k8s nodes
|
desc: Reboot all the k8s nodes
|
||||||
dir: provision/ansible
|
dir: provision/ansible
|
||||||
cmds:
|
cmds:
|
||||||
- "ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml -a '/usr/bin/systemctl reboot' --become"
|
- "ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml -a '/usr/bin/systemctl reboot' --become"
|
||||||
|
|
||||||
adhoc:poweroff:
|
poweroff:
|
||||||
desc: Shutdown all the k8s nodes
|
desc: Shutdown all the k8s nodes
|
||||||
dir: provision/ansible
|
dir: provision/ansible
|
||||||
cmds:
|
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:
|
tasks:
|
||||||
|
|
||||||
init:cloudflare:
|
init:
|
||||||
desc: Initialize terraform
|
desc: Initialize terraform
|
||||||
dir: provision/terraform/cloudflare
|
dir: provision/terraform/cloudflare
|
||||||
cmds:
|
cmds:
|
||||||
- "terraform init"
|
- "terraform init"
|
||||||
|
|
||||||
plan:cloudflare:
|
plan:
|
||||||
desc: Prepare all the k8s nodes for running k3s
|
desc: Prepare all the k8s nodes for running k3s
|
||||||
dir: provision/terraform/cloudflare
|
dir: provision/terraform/cloudflare
|
||||||
cmds:
|
cmds:
|
||||||
- "terraform plan"
|
- "terraform plan"
|
||||||
|
|
||||||
apply:cloudflare:
|
apply:
|
||||||
desc: Prepare all the k8s nodes for running k3s
|
desc: Prepare all the k8s nodes for running k3s
|
||||||
dir: provision/terraform/cloudflare
|
dir: provision/terraform/cloudflare
|
||||||
cmds:
|
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
|
- [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
|
- [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
|
## 📝 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`
|
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.
|
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`
|
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.
|
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**.
|
📍 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.
|
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.
|
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).
|
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:
|
includes:
|
||||||
ansible: .taskfiles/ansible.yml
|
ansible: .taskfiles/ansible.yml
|
||||||
flux: .taskfiles/flux.yml
|
|
||||||
format: .taskfiles/format.yml
|
|
||||||
lint: .taskfiles/lint.yml
|
|
||||||
pre-commit: .taskfiles/pre-commit.yml
|
pre-commit: .taskfiles/pre-commit.yml
|
||||||
terraform: .taskfiles/terraform.yml
|
terraform: .taskfiles/terraform.yml
|
||||||
+25
-47
@@ -1,57 +1,35 @@
|
|||||||
[defaults]
|
[defaults]
|
||||||
|
# General settings
|
||||||
#--- General settings
|
|
||||||
nocows = True
|
nocows = True
|
||||||
forks = 8
|
|
||||||
module_name = command
|
|
||||||
deprecation_warnings = True
|
|
||||||
executable = /bin/bash
|
executable = /bin/bash
|
||||||
stdout_callback = yaml
|
stdout_callback = yaml
|
||||||
|
force_valid_group_names = ignore
|
||||||
#--- Files/Directory settings
|
# File/Directory settings
|
||||||
log_path = ~/ansible.log
|
log_path = ~/.ansible/ansible.log
|
||||||
inventory = ./provision/ansible/inventory
|
inventory = ./inventory
|
||||||
library = /usr/share/my_modules
|
roles_path = ~/.ansible/roles:./roles
|
||||||
remote_tmp = /tmp/.ansible/tmp
|
collections_path = ~/.ansible/collections
|
||||||
local_tmp = /tmp/.ansible/tmp
|
remote_tmp = /tmp/.ansible/tmp
|
||||||
roles_path = ./provision/ansible/roles
|
local_tmp = ~/.ansible/tmp
|
||||||
retry_files_enabled = False
|
# Fact Caching settings
|
||||||
|
fact_caching = jsonfile
|
||||||
#--- Fact Caching settings
|
fact_caching_connection = ~/.ansible/facts_cache
|
||||||
fact_caching = jsonfile
|
# SSH settings
|
||||||
fact_caching_connection = ~/.ansible/facts_cache
|
remote_port = 22
|
||||||
fact_caching_timeout = 7200
|
timeout = 60
|
||||||
|
host_key_checking = False
|
||||||
#--- SSH settings
|
# Plugin settings
|
||||||
remote_port = 22
|
vars_plugins_enabled = host_group_vars,community.sops.sops
|
||||||
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
|
|
||||||
|
|
||||||
[inventory]
|
[inventory]
|
||||||
unparsed_is_failed = true
|
unparsed_is_failed = true
|
||||||
|
|
||||||
[privilege_escalation]
|
[privilege_escalation]
|
||||||
become = True
|
become = True
|
||||||
become_method = sudo
|
|
||||||
become_user = root
|
|
||||||
become_ask_pass = False
|
|
||||||
|
|
||||||
[ssh_connection]
|
[ssh_connection]
|
||||||
scp_if_ssh = smart
|
scp_if_ssh = smart
|
||||||
transfer_method = smart
|
retries = 3
|
||||||
retries = 3
|
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o Compression=yes -o ServerAliveInterval=15s
|
||||||
timeout = 10
|
pipelining = True
|
||||||
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o Compression=yes -o ServerAliveInterval=15s
|
control_path = %(directory)s/%%h-%%r
|
||||||
pipelining = True
|
|
||||||
control_path = %(directory)s/%%h-%%r
|
|
||||||
Reference in new issue
Block a user