Refactor Freyfile
This commit is contained in:
parent
373001127c
commit
68ed4ebcf0
|
@ -1,5 +1,6 @@
|
|||
[global]
|
||||
appname = "infra-tusd"
|
||||
approot = "/srv/tusd"
|
||||
|
||||
[global.ssh]
|
||||
key_dir = "./ssh"
|
||||
|
@ -8,7 +9,7 @@
|
|||
become = true
|
||||
|
||||
[global.ansiblecfg.defaults]
|
||||
host_key_checking = "False"
|
||||
host_key_checking = false
|
||||
|
||||
[infra.provider.aws]
|
||||
access_key = "${var.FREY_AWS_ACCESS_KEY}"
|
||||
|
@ -36,36 +37,36 @@
|
|||
value = "http://${aws_route53_record.www.name}:80/"
|
||||
|
||||
[infra.resource.aws_instance.infra-tusd-server]
|
||||
ami = "${lookup(var.ami, var.region)}"
|
||||
instance_type = "c3.large"
|
||||
key_name = "infra-tusd"
|
||||
ami = "${lookup(var.ami, var.region)}"
|
||||
instance_type = "c3.large"
|
||||
key_name = "infra-tusd"
|
||||
security_groups = ["fw-infra-tusd-main"]
|
||||
[infra.resource.aws_instance.infra-tusd-server.connection]
|
||||
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]
|
||||
Name = "${var.FREY_DOMAIN}"
|
||||
|
||||
[infra.resource.aws_route53_record.www]
|
||||
name = "${var.FREY_DOMAIN}"
|
||||
name = "${var.FREY_DOMAIN}"
|
||||
records = ["${aws_instance.infra-tusd-server.public_dns}"]
|
||||
ttl = "300"
|
||||
type = "CNAME"
|
||||
ttl = "300"
|
||||
type = "CNAME"
|
||||
zone_id = "${var.FREY_AWS_ZONE_ID}"
|
||||
|
||||
[infra.resource.aws_security_group.fw-infra-tusd-main]
|
||||
description = "Infra tusd"
|
||||
name = "fw-infra-tusd-main"
|
||||
name = "fw-infra-tusd-main"
|
||||
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
||||
cidr_blocks = ["${var.ip_all}"]
|
||||
from_port = 8080
|
||||
protocol = "tcp"
|
||||
to_port = 8080
|
||||
from_port = 8080
|
||||
protocol = "tcp"
|
||||
to_port = 8080
|
||||
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
||||
cidr_blocks = ["${var.ip_all}"]
|
||||
from_port = 80
|
||||
protocol = "tcp"
|
||||
to_port = 80
|
||||
from_port = 80
|
||||
protocol = "tcp"
|
||||
to_port = 80
|
||||
[[infra.resource.aws_security_group.fw-infra-tusd-main.ingress]]
|
||||
cidr_blocks = [
|
||||
"${var.ip_kevin}",
|
||||
|
@ -73,16 +74,15 @@
|
|||
"${var.ip_tim}",
|
||||
]
|
||||
from_port = 22
|
||||
protocol = "tcp"
|
||||
to_port = 22
|
||||
protocol = "tcp"
|
||||
to_port = 22
|
||||
|
||||
[[install.playbooks]]
|
||||
hosts = "infra-tusd-server"
|
||||
name = "Install infra-tusd-server"
|
||||
roles = [
|
||||
"{{{init.paths.roles_dir}}}/apt/v1.0.0",
|
||||
]
|
||||
[install.playbooks.vars]
|
||||
name = "Install infra-tusd-server"
|
||||
|
||||
[[install.playbooks.roles]]
|
||||
role = "{{{init.paths.roles_dir}}}/apt/v1.0.0"
|
||||
apt_packages = [
|
||||
"apg",
|
||||
"build-essential",
|
||||
|
@ -101,19 +101,37 @@
|
|||
]
|
||||
|
||||
[[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}}'\""
|
||||
name = "Common | Add convenience shortcut wtf"
|
||||
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"
|
||||
|
||||
[[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]]
|
||||
hosts = "infra-tusd-server"
|
||||
name = "Setup infra-tusd"
|
||||
|
||||
[[setup.playbooks.tasks]]
|
||||
hostname = "name={{lookup('env', 'FREY_DOMAIN')}}"
|
||||
name = "infra-tusd | Set hostname"
|
||||
[[setup.playbooks.roles]]
|
||||
role = "{{{init.paths.roles_dir}}}/fqdn/v1.0.0"
|
||||
fqdn = "{{lookup('env', 'FREY_DOMAIN')}}"
|
||||
|
||||
[[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"
|
||||
|
||||
[[setup.playbooks.tasks]]
|
||||
|
@ -127,24 +145,20 @@
|
|||
[[deploy.playbooks]]
|
||||
hosts = "infra-tusd-server"
|
||||
name = "Deploy infra-tusd"
|
||||
roles = [
|
||||
"{{{init.paths.roles_dir}}}/deploy/v1.4.0",
|
||||
]
|
||||
[deploy.playbooks.vars]
|
||||
|
||||
[[deploy.playbooks.roles]]
|
||||
role = "{{{init.paths.roles_dir}}}/deploy/v1.4.0"
|
||||
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_npm = no
|
||||
ansistrano_owner = "www-data"
|
||||
ansistrano_group = "www-data"
|
||||
|
||||
[[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"
|
||||
|
||||
[[deploy.playbooks.tasks]]
|
||||
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]]
|
||||
hosts = "infra-tusd-server"
|
||||
|
|
Loading…
Reference in New Issue