Refactor Freyfile

This commit is contained in:
Kevin van Zonneveld 2016-03-29 15:49:46 +02:00
parent 373001127c
commit 68ed4ebcf0
1 changed files with 52 additions and 38 deletions

View File

@ -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}"
@ -79,10 +80,9 @@
[[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"