Compare commits
3 Commits
87135056cf
...
e105228eb2
Author | SHA1 | Date | |
---|---|---|---|
e105228eb2 | |||
b7c722f4ed | |||
11a971ad67 |
81
Makefile
81
Makefile
@ -1,81 +0,0 @@
|
|||||||
PLAYBOOK := ansible/configuration.yml
|
|
||||||
STAGE := vagrant
|
|
||||||
|
|
||||||
ifeq ($(STAGE), prod)
|
|
||||||
ANSIBLE_HOST_KEY_CHECKING := True
|
|
||||||
INVENTORY := ansible/hosts_prod
|
|
||||||
USER_ARGS := --user="major" --become
|
|
||||||
else
|
|
||||||
ANSIBLE_HOST_KEY_CHECKING := False
|
|
||||||
INVENTORY := ansible/hosts_vagrant
|
|
||||||
USER_ARGS := --user="root"
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(TAGS),)
|
|
||||||
TAGS_ARGS := --tags="$(TAGS)"
|
|
||||||
else
|
|
||||||
TAGS_ARGS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Tasks
|
|
||||||
|
|
||||||
install-roles:
|
|
||||||
ansible-galaxy install \
|
|
||||||
--role-file "ansible/requirements.yml" \
|
|
||||||
--force
|
|
||||||
|
|
||||||
rebuild-test-machine:
|
|
||||||
vagrant destroy -f && vagrant up
|
|
||||||
|
|
||||||
edit-vars:
|
|
||||||
EDITOR=micro \
|
|
||||||
ansible-vault edit ansible/vars/vars.yml
|
|
||||||
|
|
||||||
configure:
|
|
||||||
ANSIBLE_HOST_KEY_CHECKING=$(ANSIBLE_HOST_KEY_CHECKING) \
|
|
||||||
ansible-playbook \
|
|
||||||
$(USER_ARGS) \
|
|
||||||
$(TAGS_ARGS) \
|
|
||||||
--inventory="$(INVENTORY)" \
|
|
||||||
--extra-vars='ansible_python_interpreter=/usr/bin/python3' \
|
|
||||||
-vvv \
|
|
||||||
$(PLAYBOOK)
|
|
||||||
|
|
||||||
configure-prod:
|
|
||||||
$(MAKE) configure STAGE="prod"
|
|
||||||
|
|
||||||
configure-monitoring:
|
|
||||||
$(MAKE) configure STAGE="prod" TAGS="monitoring"
|
|
||||||
|
|
||||||
configure-apps:
|
|
||||||
$(MAKE) configure TAGS="webserver,apps,env"
|
|
||||||
|
|
||||||
configure-apps-in-prod:
|
|
||||||
$(MAKE) configure STAGE="prod" TAGS="webserver,apps,env"
|
|
||||||
|
|
||||||
configure-users:
|
|
||||||
$(MAKE) configure TAGS="apps,env"
|
|
||||||
|
|
||||||
dry-run:
|
|
||||||
ANSIBLE_HOST_KEY_CHECKING=$(ANSIBLE_HOST_KEY_CHECKING) \
|
|
||||||
ansible-playbook \
|
|
||||||
$(USER_ARGS) \
|
|
||||||
$(TAGS_ARGS) \
|
|
||||||
--inventory="$(INVENTORY)" \
|
|
||||||
--extra-vars='ansible_python_interpreter=/usr/bin/python3' \
|
|
||||||
--check \
|
|
||||||
--diff -vvv \
|
|
||||||
$(PLAYBOOK)
|
|
||||||
|
|
||||||
list-tags:
|
|
||||||
ansible-playbook \
|
|
||||||
--inventory="$(INVENTORY)" \
|
|
||||||
--list-tags \
|
|
||||||
$(PLAYBOOK)
|
|
||||||
|
|
||||||
lint:
|
|
||||||
ansible-lint "./ansible/configuration.yml" --exclude="./ansible/galaxy.roles/" -v || true
|
|
||||||
ansible-lint "./ansible/roles/ssl-certificate/tasks/main.yml" -v || true
|
|
||||||
|
|
||||||
caddy-hash-password:
|
|
||||||
docker run -it caddy:2.5.2 caddy hash-password --plaintext="$(PASS)"
|
|
23
Taskfile.yml
23
Taskfile.yml
@ -7,7 +7,6 @@ vars:
|
|||||||
sh: id -u
|
sh: id -u
|
||||||
GROUP_ID:
|
GROUP_ID:
|
||||||
sh: id -g
|
sh: id -g
|
||||||
ANSIBLE_HOST_KEY_CHECKING: 'True'
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
edit-vars:
|
edit-vars:
|
||||||
@ -24,18 +23,36 @@ tasks:
|
|||||||
--list-tags
|
--list-tags
|
||||||
ansible/configuration.yml
|
ansible/configuration.yml
|
||||||
|
|
||||||
configure-monitoring:
|
configure:
|
||||||
|
internal: true
|
||||||
|
vars:
|
||||||
|
TAGS: '{{ (empty .TAGS) | ternary "" (list "--tags=\"" .TAGS "\"" | join "") }}'
|
||||||
cmds:
|
cmds:
|
||||||
- >-
|
- >-
|
||||||
ansible-playbook
|
ansible-playbook
|
||||||
--user="major"
|
--user="major"
|
||||||
--become
|
--become
|
||||||
--tags="monitoring"
|
|
||||||
--inventory="ansible/hosts_prod"
|
--inventory="ansible/hosts_prod"
|
||||||
--extra-vars="ansible_python_interpreter=/usr/bin/python3"
|
--extra-vars="ansible_python_interpreter=/usr/bin/python3"
|
||||||
|
{{.TAGS}}
|
||||||
-vvv
|
-vvv
|
||||||
ansible/configuration.yml
|
ansible/configuration.yml
|
||||||
|
|
||||||
|
configure-monitoring:
|
||||||
|
cmds:
|
||||||
|
- task: configure
|
||||||
|
vars: { TAGS: 'monitoring' }
|
||||||
|
|
||||||
|
configure-apps:
|
||||||
|
cmds:
|
||||||
|
- task: configure
|
||||||
|
vars: { TAGS: 'webserver,apps,env' }
|
||||||
|
|
||||||
|
configure-users:
|
||||||
|
cmds:
|
||||||
|
- task: configure
|
||||||
|
vars: { TAGS: 'apps,env' }
|
||||||
|
|
||||||
format-py-files:
|
format-py-files:
|
||||||
cmds:
|
cmds:
|
||||||
- >-
|
- >-
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
[defaults]
|
[defaults]
|
||||||
roles_path = ./ansible/galaxy.roles
|
host_key_checking = True
|
||||||
vault_password_file = ./ansible-vault-password-file
|
vault_password_file = ./ansible-vault-password-file
|
||||||
|
roles_path = ./ansible/galaxy.roles
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
- import_role:
|
- import_role:
|
||||||
name: netdata
|
name: netdata
|
||||||
vars:
|
vars:
|
||||||
netdata_version: 'v1.43.1'
|
netdata_version: 'v1.43.2'
|
||||||
netdata_exposed_port: '{{ netdata_port }}'
|
netdata_exposed_port: '{{ netdata_port }}'
|
||||||
tags:
|
tags:
|
||||||
- monitoring
|
- monitoring
|
||||||
|
Loading…
Reference in New Issue
Block a user