-
Notifications
You must be signed in to change notification settings - Fork 1
/
mrbot-playbook.yml
44 lines (39 loc) · 1.72 KB
/
mrbot-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
- name: Deploy mrbot to remote host
- hosts: mrbot
tasks:
- name: Update repositories cache and install "git" package
apt:
name: git
update_cache: yes
- name: Install "docker-compose", copying file
shell: sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
- name: Install "docker-compose", chmod for docker-compose
shell: sudo chmod +x /usr/local/bin/docker-compose
- name: Install "docker", add pgp key
shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- name: Install "docker", add repo
shell: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- name: Install "docker", update apt-get
shell: sudo apt-get update
- name: Install "docker", install
shell: sudo apt-get install -y docker-ce
- name: Install letsencrypt, Diffie-Hellman
shell: sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
- name: Install letsencrypt, clone letsencrypt
shell: sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
- name: Install letsencrypt, request certificate
shell: sudo /opt/letsencrypt/letsencrypt-auto certonly --agree-tos --standalone --email email -d site
- name: Create user mrbot
shell: useradd mrbot
- name: Add mrbot to docker group
shell: usermod -aG docker mrbot
- name: Switch user to mrbot
shell: su - mrbot
- name: Clone mrbot
shell: git clone https://github.com/adyach/mrbot.git /home/mrbot
- copy:
src: .env
dest: /home/mrbot/.env
- name: Run mrbot
shell: docker-compose -f /home/mrbot/docker-compose-live.yml up -d