-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathprovision_server.yml
75 lines (60 loc) · 2.53 KB
/
provision_server.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
- name: install apt sources.list
template: src=common/apt/sources.list dest=/etc/apt/sources.list mode=0644 backup=yes
register: apt_sources_list
- name: update apt cache
apt: update_cache=yes
when: apt_sources_list is changed
- name: install required packages
apt:
state: latest
package:
- dnsmasq
- resolvconf # to manage /etc/resolv.conf
- nginx-light
- pxelinux
# this package has modules necessary for pxelinux to boot
- syslinux-common
- rsync
- name: install some packages for convenient work
apt:
state: latest
package:
- bash-completion
- tmux
- mc
- vim-tiny
- name: disable and stop systemd-resolved conflicting with dnsmasq
service: name=systemd-resolved enabled=no state=stopped
# dnsmasq fails to start if tftp directory /vagrant/build is not ready yet
- name: create directory /vagrant/build
file: path=/vagrant/build state=directory owner=vagrant group=vagrant mode=0755
- name: install dnsmasq configs
template: src=server/dnsmasq/dnsmasq.conf dest=/etc/dnsmasq.conf mode=0644
# dnsmasq fails to start if tftp directory /vagrant/build is not ready yet
# - name: create dnsmasq systemd config directories
# file: path=/etc/systemd/system/dnsmasq.service.d state=directory recurse=yes
# # try starting dnsmasq infinitely
# - name: install dnsmasq systemd config override
# template: src=server/{{ item }} dest=/etc/{{ item }} mode=0640
# with_items:
# - systemd/system/dnsmasq.service.d/override.conf
# notify: systemctl daemon-reload
- name: start dnsmasq service
service: name=dnsmasq enabled=yes state=started
- name: create build directory
file: path=/vagrant/build state=directory mode=0755
- name: copy pxelinux loader
copy: src={{ item.src }} dest={{ item.dest }} remote_src=yes mode=0644
loop:
- { dest: '/vagrant/build/pxelinux.0', src: '/usr/lib/PXELINUX/pxelinux.0' }
- { dest: '/vagrant/build/ldlinux.c32', src: '/usr/lib/syslinux/modules/bios/ldlinux.c32' }
- name: install nginx default site config
template: src=server/nginx/sites-available/default dest=/etc/nginx/sites-available/default mode=0644
notify: restart nginx
- name: enable nginx default site
file: path=/etc/nginx/sites-enabled/default state=link src=/etc/nginx/sites-available/default
notify: restart nginx
- name: create pxelinux.cfg directory
file: path=/vagrant/build/pxelinux.cfg state=directory mode=0755
- name: copy pxelinux default configs
copy: src=server/pxelinux.cfg/default dest=/vagrant/build/pxelinux.cfg/default mode=0644