Skip to content

Commit 1f18b32

Browse files
php-codercssru
authored andcommitted
vagrant: add mystamps-backup role.
Addressed to php-coder#399 [ci skip]
1 parent b93a7da commit 1f18b32

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
user_db_password: p@ssword
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
3+
- name: Creating /data/backups
4+
file:
5+
path: /data/backups
6+
owner: mystamps
7+
group: mystamps
8+
mode: '0755'
9+
state: directory
10+
11+
- name: Granting access to the database to mystamps user
12+
template:
13+
src: my.cnf
14+
dest: /data/mystamps/.my.cnf
15+
force: yes
16+
backup: no
17+
owner: mystamps
18+
group: mystamps
19+
mode: '0600'
20+
21+
- name: Creating a cron task for doing database backups
22+
copy:
23+
src: ../../src/main/config/cron/mystamps
24+
dest: /etc/cron.d/mystamps
25+
force: yes
26+
backup: no
27+
owner: root
28+
group: root
29+
mode: '0644'
30+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[client]
2+
user = mystamps
3+
password = {{ user_db_password }}

vagrant/provisioning/vagrant.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- hosts: all
33
gather_facts: no
44
vars:
5+
profile: 'test'
56
# required for Ubuntu 16.04. which installs Python 2.x to a non-standard path
67
ansible_python_interpreter: "/usr/bin/python2.7"
78

@@ -44,3 +45,11 @@
4445
- role: mystamps-nginx
4546
become: yes
4647
become_method: sudo
48+
49+
- {
50+
role: mystamps-backup,
51+
user_db_password: 'q1',
52+
when: profile == 'prod',
53+
become: yes,
54+
become_method: sudo
55+
}

0 commit comments

Comments
 (0)