Compare commits
No commits in common. "e105228eb2b0515b1af5e9048828c5c48491a235" and "87135056cf02f471f41648fda756953912863809" have entirely different histories.
e105228eb2
...
87135056cf
81
Makefile
Normal file
81
Makefile
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
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,6 +7,7 @@ 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:
|
||||||
@ -23,36 +24,18 @@ tasks:
|
|||||||
--list-tags
|
--list-tags
|
||||||
ansible/configuration.yml
|
ansible/configuration.yml
|
||||||
|
|
||||||
configure:
|
configure-monitoring:
|
||||||
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,4 +1,3 @@
|
|||||||
[defaults]
|
[defaults]
|
||||||
host_key_checking = True
|
|
||||||
vault_password_file = ./ansible-vault-password-file
|
|
||||||
roles_path = ./ansible/galaxy.roles
|
roles_path = ./ansible/galaxy.roles
|
||||||
|
vault_password_file = ./ansible-vault-password-file
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
- import_role:
|
- import_role:
|
||||||
name: netdata
|
name: netdata
|
||||||
vars:
|
vars:
|
||||||
netdata_version: 'v1.43.2'
|
netdata_version: 'v1.43.1'
|
||||||
netdata_exposed_port: '{{ netdata_port }}'
|
netdata_exposed_port: '{{ netdata_port }}'
|
||||||
tags:
|
tags:
|
||||||
- monitoring
|
- monitoring
|
||||||
|
Loading…
Reference in New Issue
Block a user