Refactor Freyfile
This commit is contained in:
parent
373001127c
commit
68ed4ebcf0
|
@ -1,5 +1,6 @@
|
||||||
[global]
|
[global]
|
||||||
appname = "infra-tusd"
|
appname = "infra-tusd"
|
||||||
|
approot = "/srv/tusd"
|
||||||
|
|
||||||
[global.ssh]
|
[global.ssh]
|
||||||
key_dir = "./ssh"
|
key_dir = "./ssh"
|
||||||
|
@ -8,7 +9,7 @@
|
||||||
become = true
|
become = true
|
||||||
|
|
||||||
[global.ansiblecfg.defaults]
|
[global.ansiblecfg.defaults]
|
||||||
host_key_checking = "False"
|
host_key_checking = false
|
||||||
|
|
||||||
[infra.provider.aws]
|
[infra.provider.aws]
|
||||||
access_key = "${var.FREY_AWS_ACCESS_KEY}"
|
access_key = "${var.FREY_AWS_ACCESS_KEY}"
|
||||||
|
@ -36,36 +37,36 @@
|
||||||
value = "http://${aws_route53_record.www.name}:80/"
|
value = "http://${aws_route53_record.www.name}:80/"
|
||||||
|
|
||||||
[infra.resource.aws_instance.infra-tusd-server]
|
[infra.resource.aws_instance.infra-tusd-server]
|
||||||
ami = "${lookup(var.ami, var.region)}"
|
ami = "${lookup(var.ami, var.region)}"
|
||||||
instance_type = "c3.large"
|
instance_type = "c3.large"
|
||||||
key_name = "infra-tusd"
|
key_name = "infra-tusd"
|
||||||
security_groups = ["fw-infra-tusd-main"]
|
security_groups = ["fw-infra-tusd-main"]
|
||||||
[infra.resource.aws_instance.infra-tusd-server.connection]
|
[infra.resource.aws_instance.infra-tusd-server.connection]
|
||||||
key_file = "{{{config.global.ssh.privatekey_file}}}"
|
key_file = "{{{config.global.ssh.privatekey_file}}}"
|
||||||
user = "{{{config.global.ssh.user}}}"
|
user = "{{{config.global.ssh.user}}}"
|
||||||
[infra.resource.aws_instance.infra-tusd-server.tags]
|
[infra.resource.aws_instance.infra-tusd-server.tags]
|
||||||
Name = "${var.FREY_DOMAIN}"
|
Name = "${var.FREY_DOMAIN}"
|
||||||
|
|
||||||
[infra.resource.aws_route53_record.www]
|
[infra.resource.aws_route53_record.www]
|
||||||
name = "${var.FREY_DOMAIN}"
|
name = "${var.FREY_DOMAIN}"
|
||||||
records = ["${aws_instance.infra-tusd-server.public_dns}"]
|
records = ["${aws_instance.infra-tusd-server.public_dns}"]
|
||||||
ttl = "300"
|
ttl = "300"
|
||||||
type = "CNAME"
|
type = "CNAME"
|
||||||
zone_id = "${var.FREY_AWS_ZONE_ID}"
|
zone_id = "${var.FREY_AWS_ZONE_ID}"
|
||||||
|
|
||||||
[infra.resource.aws_security_group.fw-infra-tusd-main]
|
[infra.resource.aws_security_group.fw-infra-tusd-main]
|
||||||
description = "Infra tusd"
|
description = "Infra tusd"
|
||||||
name = "fw-infra-tusd-main"
|
name = "fw-infra-tusd-main"
|
||||||
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
||||||
cidr_blocks = ["${var.ip_all}"]
|
cidr_blocks = ["${var.ip_all}"]
|
||||||
from_port = 8080
|
from_port = 8080
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
to_port = 8080
|
to_port = 8080
|
||||||
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
||||||
cidr_blocks = ["${var.ip_all}"]
|
cidr_blocks = ["${var.ip_all}"]
|
||||||
from_port = 80
|
from_port = 80
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
to_port = 80
|
to_port = 80
|
||||||
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
||||||
cidr_blocks = [
|
cidr_blocks = [
|
||||||
"${var.ip_kevin}",
|
"${var.ip_kevin}",
|
||||||
|
@ -73,16 +74,15 @@
|
||||||
"${var.ip_tim}",
|
"${var.ip_tim}",
|
||||||
]
|
]
|
||||||
from_port = 22
|
from_port = 22
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
to_port = 22
|
to_port = 22
|
||||||
|
|
||||||
[[install.playbooks]]
|
[[install.playbooks]]
|
||||||
hosts = "infra-tusd-server"
|
hosts = "infra-tusd-server"
|
||||||
name = "Install infra-tusd-server"
|
name = "Install infra-tusd-server"
|
||||||
roles = [
|
|
||||||
"{{{init.paths.roles_dir}}}/apt/v1.0.0",
|
[[install.playbooks.roles]]
|
||||||
]
|
role = "{{{init.paths.roles_dir}}}/apt/v1.0.0"
|
||||||
[install.playbooks.vars]
|
|
||||||
apt_packages = [
|
apt_packages = [
|
||||||
"apg",
|
"apg",
|
||||||
"build-essential",
|
"build-essential",
|
||||||
|
@ -101,19 +101,37 @@
|
||||||
]
|
]
|
||||||
|
|
||||||
[[install.playbooks.tasks]]
|
[[install.playbooks.tasks]]
|
||||||
action = "lineinfile dest=/home/ubuntu/.bashrc line=\"alias wtf='sudo tail -f /var/log/*{log,err} /var/log/{dmesg,messages,*{,/*}{log,err}}'\""
|
lineinfile = "dest=/home/{{{config.global.ssh.user}}}/.bashrc line=\"alias wtf='sudo tail -f /var/log/*{log,err} /var/log/{dmesg,messages,*{,/*}{log,err}}'\" owner={{{config.global.ssh.user}}} group={{{config.global.ssh.user}}} mode=0644 backup=yes"
|
||||||
name = "Common | Add convenience shortcut wtf"
|
name = "Common | Add convenience shortcut wtf"
|
||||||
|
|
||||||
|
[[install.playbooks.tasks]]
|
||||||
|
lineinfile = "dest=/home/{{{config.global.ssh.user}}}/.bashrc line=\"cd {{{config.global.approot}}}/current || true\" owner={{{config.global.ssh.user}}} group={{{config.global.ssh.user}}} mode=0644 backup=yes"
|
||||||
|
name = "Common | Install login"
|
||||||
|
|
||||||
|
[[install.playbooks.tasks]]
|
||||||
|
name = "Common | Set motd"
|
||||||
|
copy = "content='Welcome to {{lookup('env', 'FREY_DOMAIN')}}' dest=/etc/motd owner=root group=root mode=0644 backup=yes"
|
||||||
|
|
||||||
|
[[install.playbooks.tasks]]
|
||||||
|
name = "Common | Set timezone variables"
|
||||||
|
copy = "content='Etc/UTC' dest=/etc/timezone owner=root group=root mode=0644 backup=yes"
|
||||||
|
notify = [ "Common | Update timezone" ]
|
||||||
|
|
||||||
|
[[install.playbooks.handlers]]
|
||||||
|
name = "Common | Update timezone"
|
||||||
|
command = "dpkg-reconfigure --frontend noninteractive tzdata"
|
||||||
|
|
||||||
|
|
||||||
[[setup.playbooks]]
|
[[setup.playbooks]]
|
||||||
hosts = "infra-tusd-server"
|
hosts = "infra-tusd-server"
|
||||||
name = "Setup infra-tusd"
|
name = "Setup infra-tusd"
|
||||||
|
|
||||||
[[setup.playbooks.tasks]]
|
[[setup.playbooks.roles]]
|
||||||
hostname = "name={{lookup('env', 'FREY_DOMAIN')}}"
|
role = "{{{init.paths.roles_dir}}}/fqdn/v1.0.0"
|
||||||
name = "infra-tusd | Set hostname"
|
fqdn = "{{lookup('env', 'FREY_DOMAIN')}}"
|
||||||
|
|
||||||
[[setup.playbooks.tasks]]
|
[[setup.playbooks.tasks]]
|
||||||
file = "path=/srv/tusd/shared/logs state=directory owner=www-data group=www-data mode=0755 recurse=yes"
|
file = "path={{{config.global.approot}}}/shared/logs state=directory owner=www-data group=www-data mode=0755 recurse=yes"
|
||||||
name = "infra-tusd | Create shared log dir"
|
name = "infra-tusd | Create shared log dir"
|
||||||
|
|
||||||
[[setup.playbooks.tasks]]
|
[[setup.playbooks.tasks]]
|
||||||
|
@ -127,24 +145,20 @@
|
||||||
[[deploy.playbooks]]
|
[[deploy.playbooks]]
|
||||||
hosts = "infra-tusd-server"
|
hosts = "infra-tusd-server"
|
||||||
name = "Deploy infra-tusd"
|
name = "Deploy infra-tusd"
|
||||||
roles = [
|
|
||||||
"{{{init.paths.roles_dir}}}/deploy/v1.4.0",
|
[[deploy.playbooks.roles]]
|
||||||
]
|
role = "{{{init.paths.roles_dir}}}/deploy/v1.4.0"
|
||||||
[deploy.playbooks.vars]
|
|
||||||
ansistrano_get_url = "https://github.com/tus/tusd/releases/download/0.1.2/tusd_linux_amd64.tar.gz"
|
ansistrano_get_url = "https://github.com/tus/tusd/releases/download/0.1.2/tusd_linux_amd64.tar.gz"
|
||||||
ansistrano_deploy_to = "/srv/tusd"
|
ansistrano_deploy_to = "{{{config.global.approot}}}"
|
||||||
ansistrano_deploy_via = "download_unarchive"
|
ansistrano_deploy_via = "download_unarchive"
|
||||||
ansistrano_npm = no
|
|
||||||
ansistrano_owner = "www-data"
|
|
||||||
ansistrano_group = "www-data"
|
|
||||||
|
|
||||||
[[deploy.playbooks.tasks]]
|
[[deploy.playbooks.tasks]]
|
||||||
copy = "src=../env.sh dest=/srv/tusd/current/env.sh mode=0600 owner=root group=root"
|
copy = "src=../env.sh dest={{{config.global.approot}}}/current/env.sh mode=0600 owner=root group=root"
|
||||||
name = "infra-tusd | Upload environment"
|
name = "infra-tusd | Upload environment"
|
||||||
|
|
||||||
[[deploy.playbooks.tasks]]
|
[[deploy.playbooks.tasks]]
|
||||||
name = "tusd | Set file attributes"
|
name = "tusd | Set file attributes"
|
||||||
file = "path=/srv/tusd/current/tusd_linux_amd64/tusd mode=0755 owner=www-data group=www-data"
|
file = "path={{{config.global.approot}}}/current/tusd_linux_amd64/tusd mode=0755 owner=www-data group=www-data"
|
||||||
|
|
||||||
[[restart.playbooks]]
|
[[restart.playbooks]]
|
||||||
hosts = "infra-tusd-server"
|
hosts = "infra-tusd-server"
|
||||||
|
|
Loading…
Reference in New Issue