forked from erwstx/websemtower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_couchbase.yml
77 lines (64 loc) · 2.16 KB
/
deploy_couchbase.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
- name: Deploy Couchbase on 1-node
hosts: all
tasks:
- name: Launch download of Couchbase 5.0.1 EE
get_url:
url: http://packages.couchbase.com/releases/5.0.1/couchbase-server-enterprise-5.0.1-centos7.x86_64.rpm
dest: /tmp
async: 3600
poll: 0
register: download_couchbase
- name: Configure Hostname
hostname:
name: "{{ inventory_hostname }}"
- name: Fail if memory not enough
fail:
msg: "Memory is not enough. ansible_memory_mb.real.total: {{ ansible_memory_mb.real.total }}. ansible_memory_mb.real.used: {{ ansible_memory_mb.real.used }}"
when: ansible_memory_mb.real.total < 3584 or ansible_memory_mb.real.used > 1000
- name: Fail if diskspace is not enough or fstype is wrong
fail:
msg: "Diskspace is not enough or fstype is wrong"
loop: "{{ ansible_mounts }}"
when: item.mount == "/" and ( item.size_available < 9000000000 or item.fstype != "xfs" )
- name: Disable swapiness
#copy:
# content: "0"
# dest: /proc/sys/vm/swappiness
# owner: root
# group: root
# mode: 0755
shell: echo 0 > /proc/sys/vm/swappiness
- name: Disable swapiness permanently
blockinfile:
path: /etc/sysctl.conf
block: |
# Set swappiness to 0 to avoid swapping
vm.swappiness = 0
- name: Install firewalld
yum: name=firewalld state=present
- name: Enable and start firewalld
service: name=firewalld state=started enabled=yes
- name: Allow 8091 TCP port
firewalld:
port: 8091/tcp
state: enabled
permanent: yes
immediate: yes
- name: Disable Transparent Huge Pages
shell: echo never > "{{ item }}"
loop:
- /sys/kernel/mm/transparent_hugepage/enabled
- /sys/kernel/mm/transparent_hugepage/defrag
- name: Wait for Couchbase download to finish
async_status:
jid: "{{ download_couchbase.ansible_job_id }}"
register: job_result
until: job_result.finished
retries: 30
- name: Install Couchbase
yum:
name: /tmp/couchbase-server-enterprise-5.0.1-centos7.x86_64.rpm
state: present
- name: Show state of couchbase-server service
shell: systemctl status couchbase-server