Skip to content
Snippets Groups Projects
Commit 5ddd81ae authored by Bartłomiej Piotrowski's avatar Bartłomiej Piotrowski
Browse files

Use more idiomatic way of checking for variable presence

parent cf935250
No related branches found
No related tags found
No related merge requests found
---
backup_host: "borg@vostok.archlinux.org"
backup_dir: "/backup/{{inventory_hostname}}"
postgres_backup_dir: ''
mysql_backup_dir: ''
mysql_backup_defaults: ''
......@@ -23,7 +23,7 @@
- name: install postgres backup script
template: src=backup-postgres.sh.j2 dest=/usr/local/bin/backup-postgres.sh owner=root group=root mode=0755
when: postgres_backup_dir != ""
when: postgres_backup_dir is defined
- name: check whether postgres user exists
command: getent passwd postgres
......@@ -32,19 +32,19 @@
- name: make postgres backup directory
file: path=/var/lib/postgres/backup owner=postgres group=postgres state=directory
when: check_postgres_user|succeeded and postgres_backup_dir != ""
when: check_postgres_user|succeeded and postgres_backup_dir is defined
- name: install mysql backup script
template: src=backup-mysql.sh.j2 dest=/usr/local/bin/backup-mysql.sh owner=root group=root mode=0755
when: mysql_backup_dir != ""
when: mysql_backup_dir is defined
- name: install mysql backup config
template: src=backup-my.cnf.j2 dest={{mysql_backup_defaults}}
when: mysql_backup_defaults != ""
when: mysql_backup_defaults is defined
- name: create mysql backup directory
file: path={{mysql_backup_dir}} state=directory owner=root group=root
when: mysql_backup_dir != ""
when: mysql_backup_dir is defined
- name: install systemd timers for backup
copy: src={{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644
......
......@@ -2,7 +2,7 @@
- name: create ssl cert
command: certbot certonly --email webmaster@archlinux.org --agree-tos --rsa-key-size 4096 --renew-by-default --webroot -w {{letsencrypt_validation_dir}} -d '{{ matrix_domain }}' creates='/etc/letsencrypt/live/{{ matrix_domain }}/fullchain.pem'
when: 'matrix_domain != ""'
when: 'matrix_domain is defined'
- name: install packages
pacman: name=python2-virtualenv,git,npm
......@@ -133,7 +133,7 @@
template: src=nginx.d.conf.j2 dest=/etc/nginx/nginx.d/matrix.conf owner=root group=root mode=0644
notify:
- reload nginx
when: 'matrix_domain != ""'
when: 'matrix_domain is defined'
- name: install matrix units
copy: src={{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644
......
......@@ -2,7 +2,7 @@
- name: create ssl cert
command: certbot certonly --email webmaster@archlinux.org --agree-tos --rsa-key-size 4096 --renew-by-default --webroot -w {{letsencrypt_validation_dir}} -d '{{ mirror_domain }}' creates='/etc/letsencrypt/live/{{ mirror_domain }}/fullchain.pem'
when: 'mirror_domain != ""'
when: 'mirror_domain is defined'
- name: install rsync
pacman: name=rsync state=present
......@@ -48,4 +48,4 @@
template: src=nginx.d.conf.j2 dest=/etc/nginx/nginx.d/syncrepo.conf owner=root group=root mode=0644
notify:
- reload nginx
when: 'mirror_domain != ""'
when: 'mirror_domain is defined'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment