-
Notifications
You must be signed in to change notification settings - Fork 1
/
playbook.yml
163 lines (143 loc) · 4.4 KB
/
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
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
163
- hosts: localhost
connection: local
tasks:
- name: Ensure Docker requirements are installed
apt:
name: '{{ item }}'
state: latest
update_cache: yes
become: yes
become_method: sudo
loop:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- name: Ensure 'Docker' GPG key is added
become: yes
become_method: sudo
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Ensure 'Docker' APT repository is available
become: yes
become_method: sudo
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu disco stable
state: present
- name: Ensure 'Google Cloud SDK' GPG key is added
become: yes
become_method: sudo
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
- name: Ensure 'Google Cloud SDK' APT repository is available
become: yes
become_method: sudo
apt_repository:
repo: deb https://packages.cloud.google.com/apt cloud-sdk main
state: present
- name: Ensure latest version of Docker CE is installed
become: yes
become_method: sudo
apt:
update_cache: yes
name: docker-ce
state: latest
- name: "Ensure user '{{ lookup('env','USER') }}' is added to group 'docker'"
become: yes
become_method: sudo
user:
name: "{{ lookup('env','USER') }}"
groups: docker
append: yes
- name: Ensure docker-compose is available
apt:
name: '{{ item }}'
state: latest
update_cache: yes
become: yes
become_method: sudo
loop:
- docker-compose
- name: Ensure google-cloud-sdk is available
apt:
name: '{{ item }}'
state: latest
update_cache: yes
become: yes
become_method: sudo
loop:
- google-cloud-sdk
- name: Ensure kubectl is available
apt:
name: '{{ item }}'
state: latest
update_cache: yes
become: yes
become_method: sudo
loop:
- kubectl
- name: Ensure ~/.local/bin exists
file:
path: "/home/{{ lookup('env','USER') }}/.local/bin"
state: directory
mode: '0755'
- name: Ensure ~/.local/bin is part of PATH in ~/.bashrc
lineinfile:
dest: "/home/{{ lookup('env','USER') }}/.bashrc"
state: present
insertafter: EOF
regexp: 'PATH=(["]*)((?!.*?~/.local/bin).*?)(["]*)$'
line: 'export PATH="$PATH:~/.local/bin"'
- name: Test if mdns4 is in nsswitch.conf
shell: "cat /etc/nsswitch.conf | egrep -i 'mdns4$'"
register: test_mdns4_present
ignore_errors: yes
- name: Ensure mdns4 is used during .local domain look-ups
become: yes
become_method: sudo
when: test_mdns4_present.stdout == ''
lineinfile:
dest: "/etc/nsswitch.conf"
state: present
regexp: '^(hosts:.*)'
line: '\1 mdns4'
backrefs: yes
- name: Ensure /etc/mdns.allow exists
become: yes
become_method: sudo
copy:
content: ""
dest: "/etc/mdns.allow"
force: no
group: root
owner: root
mode: '0644'
- name: Ensure multi-level .local domains are accepted
become: yes
become_method: sudo
lineinfile:
dest: "/etc/mdns.allow"
state: present
insertafter: EOF
line: ".local"
- name: Ensure 'MediaCT Docker Compose Development Manager' ('dev') is cloned to ~/.local/lib
git:
repo: https://github.com/mediact/docker-compose-development-manager.git
dest: "/home/{{ lookup('env','USER') }}/.local/lib/docker-compose-development-manager"
- name: Ensure 'dev' is executable
file:
dest: "/home/{{ lookup('env','USER') }}/.local/lib/docker-compose-development-manager/dev"
mode: +x
- name: Ensure 'dev' is available by linking it to ~/.local/bin/dev
file:
src: "/home/{{ lookup('env','USER') }}/.local/lib/docker-compose-development-manager/dev"
dest: "/home/{{ lookup('env','USER') }}/.local/bin/dev"
state: link
- name: Ensure XDebug works from development environments
become: yes
ufw:
rule: allow
proto: tcp
port: '9000'