-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall.yml
162 lines (138 loc) · 4.89 KB
/
install.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
- hosts: all
become: yes
tasks:
- name: Copy ansible directory
copy:
src: ./
dest: /etc/ansible/
remote_src: yes
directory_mode: yes
mode: '0755'
- name: Install ansible galaxy roles
command: "ansible-galaxy install {{ item }} -p /etc/ansible/roles/"
loop: "{{ ansible.galaxy.roles }}"
- name: Install docker
include_role:
name: geerlingguy.docker
- name: Download minio
get_url:
url: https://dl.min.io/server/minio/release/linux-amd64/minio
dest: /usr/local/bin/minio
mode: 'a+x'
- name: Install systemd unit file minio
template: src=minio.service.j2 dest=/etc/systemd/system/minio.service
- name: Install systemd unit files hashistack
template: src={{item}}.service.j2 dest=/etc/systemd/system/{{item}}.service
loop: "{{ hashicorp.daemons }}"
- name: Create /etc/{{item}}.d
file:
path: /etc/{{item}}.d
state: directory
loop: "{{ hashicorp.daemons }}"
- name: Add config.json
template: src={{item}}.hcl.j2 dest=/etc/{{item}}.d/config.hcl
loop: "{{ hashicorp.daemons }}"
- name: Create /etc/nomad.d/policies/ dir
file:
path: /etc/nomad.d/policies/
state: directory
- name: Create /etc/nomad.d/policies/ dir
file:
path: /etc/consul.d/policies/
state: directory
- name: Add nomad policies
copy:
src: "{{item}}"
dest: "/etc/nomad.d/policies/"
with_fileglob:
- "templates/nomad-policies/*"
- name: Add consul policies
copy:
src: "{{item}}"
dest: "/etc/consul.d/policies/"
with_fileglob:
- "templates/consul-policies/*"
- name: systemd reload
systemd: daemon_reload=yes
- name: Create directories for hashistack
file:
path: "{{ item }}"
state: directory
owner: root
group: root
with_items:
- /usr/local/bin/oss
- /usr/local/bin/ent
- name: Install open source hashistack
include_role:
name: hashistack
vars:
software: "{{ item.key }}"
version: "{{ item.value }}"
destination_dir: /usr/local/bin/oss
loop: "{{ query('dict', hashicorp.tools) }}"
- name: Install enterprise hashistack
include_role:
name: hashistack
vars:
software: "{{ item.key }}"
version: "{{ item.value }}"
destination_dir: /usr/local/bin/ent
loop: "{{ query('dict', hashicorp.tools_enterprise) }}"
- name: Update message of the day
template:
src: "{{item}}"
dest: "/etc/update-motd.d/{{ (item | basename | splitext)[0] }}"
mode: "+rx"
with_fileglob:
- templates/update-motd.d/*
- name: CNI - Ensure Dir
file:
path: /opt/cni/bin
state: directory
- name: CNI - Install
unarchive:
src: https://github.com/containernetworking/plugins/releases/download/v0.8.4/cni-plugins-linux-amd64-v0.8.4.tgz
remote_src: true
dest: /opt/cni/bin
- name: CNI - Tune iptables - persist
copy:
dest: "/etc/sysctl.d/cni-iptables"
mode: "+rx"
content: |
net.bridge.bridge-nf-call-arptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
- name: CNI - Tune iptables - run
command: sysctl --system
- name: Install Docker SDK for Python
pip:
name: docker
# Add change to bash.bashrc in order to use environment in vagrant and ansible (non interactive)
- name: Copy .env_default
template:
src: templates/.env_default.j2
dest: /home/vagrant/.env_default
- name: source .env_default .env .env_override
blockinfile:
path: /etc/bash.bashrc
insertbefore: BOF
marker: "# {mark} ANSIBLE MANAGED BLOCK - Define variables that works in non-interactive shell"
block: |
set -a
. /home/vagrant/.env_default
# Read file and match variables starting with lowercase - prepend with TF_VAR_ and export.
while read p || [[ -n $p ]]; do [[ $p =~ ^[[:lower:]].*=.*$ ]] && export TF_VAR_$p; done < /home/vagrant/.env_default
if [[ -f "/vagrant/.env" ]]; then
. /vagrant/.env
# Read file and match variables starting with lowercase - prepend with TF_VAR_ and export.
while read p || [[ -n $p ]]; do [[ $p =~ ^[[:lower:]].*=.*$ ]] && export TF_VAR_$p; done < /vagrant/.env
fi
if [[ -f "/vagrant/.env_override" ]]; then
. /vagrant/.env_override
# Read file and match variables starting with lowercase - prepend with TF_VAR_ and export.
while read p || [[ -n $p ]]; do [[ $p =~ ^[[:lower:]].*=.*$ ]] && export TF_VAR_$p; done < /vagrant/.env_override
fi
unset p
set +a