-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpi-kickstart-local.sample.yaml
146 lines (146 loc) · 5.16 KB
/
rpi-kickstart-local.sample.yaml
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
---
- name: Local kickstart configuration
gather_facts: True
hosts: localhost
connection: local
tasks:
- name: Install rsync (deb)
when: ansible_os_family == "Debian"
apt:
name: rsync
state: present
- name: Install rsync (yum)
when: ansible_os_family == "RedHat"
yum:
name: rsync
state: latest
- name: Install wget (deb)
when: ansible_os_family == "Debian"
apt:
name: wget
state: present
- name: Install wget (yum)
when: ansible_os_family == "RedHat"
yum:
name: wget
state: latest
- name: Populate github SSH Keys
authorized_key:
user: root
state: present
key: https://github.com/username.keys
- name: Send mirrors.repo.com through our cache locally
lineinfile:
dest: /etc/hosts
line: "192.168.42.1 mirrors.repo.com"
create: yes
- name: Add github.com known_hosts line
lineinfile:
dest: /root/.ssh/known_hosts
line: "github.com,192.30.253.113 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
create: yes
- name: Add kickstart dnsmasq address line
lineinfile:
dest: /etc/dnsmasq.d/kickstart.mydomain.net.conf
line: "address=/kickstart.mydomain.net/192.168.42.1"
create: yes
notify: Restart dnsmasq
- name: Add mirrors.repo.com dnsmasq address line
lineinfile:
dest: /etc/dnsmasq.d/mirrors.repo.com.conf
line: "address=/mirrors.repo.com/192.168.42.1"
create: yes
notify: Restart dnsmasq
- name: Create /home/kickstart
file:
path: /home/kickstart
state: directory
mode: 0755
owner: root
group: root
- name: Create /home/kickstart/configs
file:
path: /home/kickstart/configs
state: directory
mode: 0755
owner: root
group: root
- name: Populate /usr/src/kickstart-configs
git:
repo: [email protected]:username/kickstart-configs.git
dest: /usr/src/kickstart-configs
version: master
- name: Make getpxeimages executable
file:
path: /usr/src/kickstart-configs/getpxeimages
state: file
mode: 0755
owner: root
group: root
- name: Create /root/bin
file:
path: /root/bin
state: directory
mode: 0755
owner: root
group: root
- name: Create getpxeimages link
file:
src: /usr/src/kickstart-configs/getpxeimages
dest: /root/bin/getpxeimages
state: link
- name: Copy nginx main config (deb)
when: ansible_os_family == "Debian"
copy:
src: /usr/src/kickstart-configs/nginx/nginx.conf.deb
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: 0644
notify: Restart nginx
- name: Copy nginx main config (redhat)
when: ansible_os_family == "RedHat"
copy:
src: /usr/src/kickstart-configs/nginx/nginx.conf.rh
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: 0644
notify: Restart nginx
- name: Copy nginx kickstart config
copy:
src: /usr/src/kickstart-configs/nginx/kickstart.conf
dest: /etc/nginx/conf.d/kickstart.conf
owner: root
group: root
mode: 0644
notify: Restart nginx
- name: Copy nginx cache config
copy:
src: /usr/src/kickstart-configs/nginx/cache.conf
dest: /etc/nginx/conf.d/cache.conf
owner: root
group: root
mode: 0644
notify: Restart nginx
- name: Sync HTTP configs
command: /usr/bin/rsync -avHlx /usr/src/kickstart-configs/http/ /home/kickstart/configs/ --delete
- name: Sync PXE menu
command: /usr/bin/rsync -avHlx /usr/src/kickstart-configs/pxe/ /tftproot/menu/ --delete
- name: Create PXE default menu link
file:
src: /tftproot/menu/default
dest: /tftproot/pxelinux.cfg/default
state: link
- name: Run getpxeimages
command: /root/bin/getpxeimages
ignore_errors: yes
handlers:
- name: Restart dnsmasq
service:
name: dnsmasq
state: restarted
- name: Restart nginx
service:
name: nginx
state: restarted