-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevops.yml
executable file
·155 lines (135 loc) · 4.16 KB
/
devops.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
#!/usr/bin/env ansible-playbook
---
- hosts: backend
tasks:
- name: include version vars
include_vars:
file: devops-vars.yml
- name: Install awscli
pip:
name: awscli
state: present
become: yes
- name: Ensure the ~/.aws directory exists
file:
dest: '{{ ansible_env.HOME }}/.aws'
state: directory
- name: Download and install EKS authenticator
get_url:
url: 'https://amazon-eks.s3-us-west-2.amazonaws.com/{{ eks_authenticator }}/bin/linux/amd64/aws-iam-authenticator'
dest: /usr/local/bin/aws-iam-authenticator
mode: 0755
become: yes
- name: Download and install Skaffold
get_url:
url: 'https://storage.googleapis.com/skaffold/releases/{{ skaffold }}/skaffold-linux-amd64'
dest: /usr/local/bin/skaffold
mode: 0755
become: yes
- name: Install dependencies
apt:
name: [unzip]
state: present
# update_cache: yes
become: yes
- name: Check for vault
stat:
path: /usr/local/bin/vault
register: st
- name: Download hashicorp vault
get_url:
url: 'https://releases.hashicorp.com/vault/{{ vault }}/vault_{{ vault }}_linux_amd64.zip'
dest: /tmp
when: st.stat.exists == false
- name: Install hashicorp vault
unarchive:
src: '/tmp/vault_{{ vault }}_linux_amd64.zip'
dest: /usr/local/bin
remote_src: yes
become: yes
when: st.stat.exists == false
- name: Check for terraform
stat:
path: /usr/local/bin/terraform
register: st
- name: Download hashicorp terraform
get_url:
url: 'https://releases.hashicorp.com/terraform/{{ terraform }}/terraform_{{ terraform }}_linux_amd64.zip'
dest: /tmp
when: st.stat.exists == false
- name: Install hashicorp terraform
unarchive:
src: '/tmp/terraform_{{ terraform }}_linux_amd64.zip'
dest: /usr/local/bin
remote_src: yes
become: yes
when: st.stat.exists == false
# when: false
- name: Get Helm
unarchive:
src: 'https://storage.googleapis.com/kubernetes-helm/helm-v{{ helm }}-linux-amd64.tar.gz'
dest: '{{ bin_dir }}'
remote_src: yes
creates: '{{ bin_dir }}/helm'
exclude: [LICENSE, README.md]
become: yes
- name: Move binary to path
command: 'mv linux-amd64/helm {{ bin_dir }}'
args:
chdir: '{{ bin_dir }}'
creates: '{{ bin_dir }}/helm'
become: yes
- name: Init Helm
command: 'helm init --client-only'
- name: Install Helm Incubator repo
command: 'helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator'
- name: Add ros helm repo
command: 'helm repo add ros https://rails-on-services.github.io/helm-charts'
- name: 'Remove linux'
file:
path: '{{ bin_dir }}/linux-amd64'
state: absent
become: yes
- name: Insert aliases
include_role:
name: aliases
vars:
aliases_marker: k8s-helm
aliases_block: |
source <(helm completion bash)
- name: Add google apt signing key
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
become: yes
- name: Add kubectl apt repo
apt_repository:
repo: deb https://apt.kubernetes.io/ kubernetes-xenial main
state: present
filename: kubernetes
become: yes
- name: Add gcloud sdk apt repo
apt_repository:
repo: deb https://packages.cloud.google.com/apt cloud-sdk main
state: present
filename: google-cloud-sdk
become: yes
- name: Install kubectl and google-cloud-sdk
apt:
name: [kubectl, google-cloud-sdk]
state: present
update_cache: yes
become: yes
- name: Insert aliases
include_role:
name: aliases
vars:
aliases_marker: k8s-kubectl
aliases_block: |
source <(kubectl completion bash)
- name: Install ruby
import_role:
name: ruby
vars:
role_spec:
versions: '{{ ruby_versions }}'