-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathservices-playbook.yml
51 lines (42 loc) · 1.4 KB
/
services-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
45
46
47
48
49
50
51
---
- name: Deploy services
hosts: services
# become: true
vars:
services_destination_folder: "/root/services/"
tasks:
- name: Create services_destination_folder if it doesn't exist
file:
path: "{{ services_destination_folder }}"
state: directory
mode: '0755'
recurse: yes
owner: root
group: root
setype: s0
- name: Read services to install
command: "cat {{ playbook_dir }}/services2install.txt"
register: services_to_install
delegate_to: localhost
- name: Copy service subfolders
copy:
src: "{{ item }}/service/"
dest: "{{ services_destination_folder }}{{ item }}"
loop: "{{ services_to_install.stdout_lines }}"
- name: Make script executable
shell: chmod +x {{ services_destination_folder }}{{ item }}/run_{{ item }}.sh
loop: "{{ services_to_install.stdout_lines }}"
- name: Install Docker Compose and Docker.io
apt:
name:
- docker-compose
- docker.io
state: present
- name: Execute run script
shell: export SERVICES_PATH={{ services_destination_folder }} && {{ services_destination_folder }}{{ item }}/run_{{ item }}.sh
loop: "{{ services_to_install.stdout_lines }}"
- name: Remove services folder
file:
path: "{{ services_destination_folder }}"
state: absent
# Add more tasks as needed