d4c613a07a
Change-Id: Iec6b916bd27a5333d28d1fdc931d4f41165bf50c
99 lines
2.1 KiB
YAML
99 lines
2.1 KiB
YAML
- name: Ensure /etc/lodgeit-compose directory
|
|
file:
|
|
state: directory
|
|
path: /etc/lodgeit-compose
|
|
mode: 0755
|
|
|
|
- name: Put docker-compose file in place
|
|
template:
|
|
src: docker-compose.yaml.j2
|
|
dest: /etc/lodgeit-compose/docker-compose.yaml
|
|
mode: 0644
|
|
|
|
- name: Setup mariadb container
|
|
block:
|
|
- name: Setup db directory
|
|
file:
|
|
state: directory
|
|
path: /var/lib/lodgeit/mariadb
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
|
|
- name: Set up root mariadb conf file
|
|
template:
|
|
src: root.my.cnf.mariadb_container.j2
|
|
dest: /root/.lodgeit_db.cnf
|
|
mode: 0400
|
|
|
|
- name: Install apache2
|
|
apt:
|
|
name:
|
|
- apache2
|
|
- apache2-utils
|
|
state: present
|
|
|
|
- name: Apache modules
|
|
apache2_module:
|
|
state: present
|
|
name: "{{ item }}"
|
|
loop:
|
|
- rewrite
|
|
- proxy
|
|
- proxy_http
|
|
- ssl
|
|
- headers
|
|
|
|
- name: Copy apache config
|
|
template:
|
|
src: paste.vhost.j2
|
|
dest: /etc/apache2/sites-enabled/000-default.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: paste Reload apache2
|
|
|
|
- name: Create www dir
|
|
file:
|
|
state: directory
|
|
path: /var/lib/lodgeit/www
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
|
|
- name: Install robots.txt
|
|
copy:
|
|
src: robots.txt
|
|
dest: /var/lib/lodgeit/www/robots.txt
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
|
|
- name: Run docker-compose pull
|
|
shell:
|
|
cmd: docker-compose pull
|
|
chdir: /etc/lodgeit-compose/
|
|
|
|
- name: Run docker-compose up
|
|
shell:
|
|
cmd: "docker-compose up -d"
|
|
chdir: /etc/lodgeit-compose/
|
|
|
|
- name: Run docker prune to cleanup unneeded images
|
|
shell:
|
|
cmd: docker image prune -f
|
|
|
|
- name: Create backup streaming config dir
|
|
file:
|
|
path: /etc/borg-streams
|
|
state: directory
|
|
|
|
- name: Setup container mariadb backup jobs
|
|
block:
|
|
- name: Create mariadb streaming file
|
|
copy:
|
|
content: >-
|
|
/usr/local/bin/docker-compose -f /etc/lodgeit-compose/docker-compose.yaml exec -T mariadb
|
|
bash -c '/usr/bin/mysqldump --all-databases --skip-extended-insert --single-transaction -uroot -p"$MYSQL_ROOT_PASSWORD"'
|
|
dest: /etc/borg-streams/mariadb
|