-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbootstrap.yml
More file actions
83 lines (78 loc) · 1.98 KB
/
bootstrap.yml
File metadata and controls
83 lines (78 loc) · 1.98 KB
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
78
79
80
81
82
83
---
- hosts: '*'
become: yes
vars:
host_key_checking: False
vars_files:
- vars/vars.yml
- vars/secrets.yml
tasks:
- include_vars: vars/vars.yml
- block:
- name: update apt cache [ubuntu]
apt: upgrade=dist update_cache=yes
- name: install packages [ubuntu]
apt:
name:
- python3-pip
- git
- htop
- vim
- nfs-common
state: present
when: ansible_distribution == "Ubuntu"
- block:
- name: enable epel [centos]
yum: name=epel-release state=present
- name: update system [centos]
yum: name='*' state=latest
- name: install packages [centos]
yum:
name:
- python-pip
- git
- htop
state: latest
when: ansible_distribution == 'CentOS'
- name: install ansible
pip:
name: ansible
state: absent
- name: add correct hostname
add_hosts_entry:
file: /etc/hosts
hosts: ["{{ ansible_hostname }}"]
ips: ["{{ ansible_ssh_host }}"]
append: true
- name: load inventory
include_vars:
file: inventory.yml
name: inventory
- name: patch /etc/hosts with stage 2
add_hosts_entry:
file: /etc/hosts
hosts: "{{ [item.key] }}"
ips: "{{ [item.value.ansible_ssh_host] }}"
append: true
with_dict: "{{ inventory.all.hosts }}"
- name: copy inventory
copy:
dest: /root/inventory.yml
src: inventory.yml
mode: 0600
roles:
- { role: apt-get-upgrade }
- { role: base }
- { role: format-mount-volume }
- hosts: SwarmSlave
become: yes
vars:
host_key_checking: False
vars_files:
- vars/vars.yml
- vars/secrets.yml
tasks:
- include_vars: vars/vars.yml
##########################################
roles:
- { role: glusterfs, volname: "{{ gluster_volname }}", server_list: "{{ allslaves_ips }}", volmnt: "{{ gluster_volmnt }}", replicas: "{{ gluster_replicas }}", brickmnt: "{{ gluster_brickmnt }}" }