Compare commits
5 Commits
6b9686d689
...
21969992cc
Author | SHA1 | Date | |
---|---|---|---|
21969992cc | |||
adf511a35f | |||
ce9572631d | |||
ee8e3928f0 | |||
99c963e0ed |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
*.sw[pon]
|
||||
*.retry
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "ansible-gpg-vault"]
|
||||
path = ansible-gpg-vault
|
||||
url = https://git.finallycoffee.eu/finallycoffee.eu/ansible-gpg-vault.git
|
1
ansible-gpg-vault
Submodule
1
ansible-gpg-vault
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 6b06b795cc769033fbb913167c88a7c41da30ebd
|
1
ansible-gpg-vault-store/gpg_ids.list
Normal file
1
ansible-gpg-vault-store/gpg_ids.list
Normal file
@ -0,0 +1 @@
|
||||
johanna.reichmann@delta-industries.de
|
21
ansible-gpg-vault-store/vault_passphrase.gpg
Normal file
21
ansible-gpg-vault-store/vault_passphrase.gpg
Normal file
@ -0,0 +1,21 @@
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
hQIMAxEs7W/4x4lxARAAgTCcvterbx3jrmfTbaWrh+AVBzwHIpuGROfzcl2BgM2Q
|
||||
VMAyDmCA/Da0Q6llkJSA7GtBaXtJi9wDkIZlM9iaXsdo/7lcUwq+Fu8Rkxt5DgC+
|
||||
pPJegUouQKSmXA177G+Ow2ypc/kAgdCZmOWB6GDLAMCbIZHU9Q3W1VM3EIYsKOq4
|
||||
eyiSlHCCvBvKfv7UPZIImXSQQoD+JIfH56Xj6hxb8/GpN+k3ZdDCTFcHDzYHvijQ
|
||||
wg5vd7V/BkTmumTeQvFf0AeJ4f1u6s10fVY9tf8UIZMbbFzMjcqVRNk3bMdIaVw/
|
||||
F3u7q86IOEv0L13T6mS5xFfMreKMpjgvfMQo+wexyvYvpxkwmPFS5ayIwLnrRi5U
|
||||
hF5AMcpghGAmU5t6kGovWoisCiUXD8QJtEDU2F6lI3O1zogdYBjeZ+fnZcYTWsxX
|
||||
jUGkgUYu0BFkVftt9RjOvFdlLmXIKp/Ygmn9oBc6u7P7wdKUd2ly7o8L2qeuylQF
|
||||
OqpfgpdVMcXeTG/9e9TEPrWJ/VflgGd3O0fTnY6/1lhe5Bs98TtqF4+q1iRxwPim
|
||||
RAbnp9htykapPoAx1CVvmB55bxKOwGhCiqK8QZEYw7GE9NvGmqlir8A0M/6p0Tta
|
||||
pmbPs+16xUN/B/MDyzHKwU/QD7OYZZrb/hVLNAiL2uPBqKLkaqnjkfO0ddJdEGjS
|
||||
wC8BUAusLSl121aCnlEF+3HZlTRAc4WjnGWNSIVA6pk/2aTjlmhcFih/Lzn25wiD
|
||||
yehW6hMQ+JcUg+nHVbryEQ22wjcQGcUyiJ8dwQ04U1mCV36vvZoBD01irmIeQPzw
|
||||
Wl3cc+ohHBwTqMRSoTAE6M557MFoKwttzinkhhQC/bdOP11RzdHYlQYV1gdONX2u
|
||||
6tCe6fYEvYlsu17oznQjFF1RsdNIKlIYMwttBV6MQOd1fO8/JUkw+u6xnZb9sGgP
|
||||
z+4Je7mZv5Gk0PHXT8+wXez/nMlkJseJ5LMx8c4SNkfXde6abt5XfjA/GVbE6TZa
|
||||
vw==
|
||||
=w0Xj
|
||||
-----END PGP MESSAGE-----
|
4
ansible.cfg
Normal file
4
ansible.cfg
Normal file
@ -0,0 +1,4 @@
|
||||
[defaults]
|
||||
|
||||
vault_password_file = ansible-gpg-vault/vault.sh
|
||||
|
8
dhcp_server.yml
Normal file
8
dhcp_server.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
|
||||
- name: "Setup ISC-DHCP for the internal network"
|
||||
hosts: dhcp_server
|
||||
become: true
|
||||
roles:
|
||||
- dhcp
|
||||
|
113
group_vars/dhcp_server.yml
Normal file
113
group_vars/dhcp_server.yml
Normal file
@ -0,0 +1,113 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
61333561323462653438393134646233623262633131356233336462386231343062333861356165
|
||||
3663376463343239646530306438396238643835353239660a393735653331656364353637636437
|
||||
33653533613433653735326561313463626361396262313133343638346335656239346435383835
|
||||
3465326339313765380a363535396561373962326336616665303166623763343064663265366634
|
||||
37646662653137356634656538666134643365303439393762633430303466376132316530643062
|
||||
38656266366338643135356536633466343964653333323137663937646562663663326135656134
|
||||
30643463653035613164336233303161666236303530323538616237363030323161363162346133
|
||||
65653837646364633334306431373565303732316362313564316235306435386236616566343265
|
||||
39353832393662636132343162303338356666656164323362616165343136336333373563326165
|
||||
35323663363566613666373933393264613063636366353465393863616635356332383635366634
|
||||
35376430393738663935353238613831346131646338356265653032353965383861653939613838
|
||||
36396562323037633961313435323764646335646162626532623365366164376164336231363563
|
||||
39633933333935333230643338343266656663623739613639613139383036333937346266663939
|
||||
66633030326462393232316164333430356333626539356338313761306238366264623039653834
|
||||
39353130383837353463633631383630383161646137346237663266663030303831333336303163
|
||||
31646236313136633364363662616637363038613065333035623038616338316334393237393565
|
||||
30303539356636343436343738373165326461383638356634353965373864633531303136663166
|
||||
36343761633666326435366535316465656531396238373265663739653464343863316635396166
|
||||
64383665646533313366663937636466383863316165656534323837306437373963336134346364
|
||||
38326361313962643736386238346137336132383132613638303066323439396165313335336336
|
||||
38633339623662663835323136646165613564373932663833333363656535386463623463383337
|
||||
35333663646232323966383962346436346539656363363432396262366633313530356161613361
|
||||
64363466643838323639626437333334346533313131346331363765313365373236616462323337
|
||||
32336563343162633534626539613162653063313937376561306330386165653631663735323166
|
||||
65313935636633663863646563373339633937613761663536653235613564653633373063633465
|
||||
31393665616331386665646135616636663564346461353739653163323830313464363063613932
|
||||
31663438386664623033623061626264303838316637313663383465303266323138343762396133
|
||||
64353562616235383164666663393561393566363332343530623764333831386137313662313934
|
||||
65343039323231323233376135303736373338366265626164353136356339333837623932323365
|
||||
31396233636462323439363761663931363562643565353764336131313466653337303861373937
|
||||
63396139633533323032633263636461663433623739393764386332353738306538383837373636
|
||||
61393532663161383465336137373330626566646163333930333466373535386266383039663661
|
||||
64323435643964393933666437616439353064643364323834623338626562346539656238633962
|
||||
64363438386364656635336539303332626233343364376630303164666263663135623261613061
|
||||
38643330393266333334643866333133306330613537336233323731653061346435313864393966
|
||||
38376339343535636235663435646264356461303765313965363535363139636537313836346638
|
||||
61383534653330396564633961643166613663643366333563383964666365626666383839653332
|
||||
38343335633830626362636631613839373836306138396364633835333837323333653365333036
|
||||
64366162303462343537326461323236656433363239656439313033313736363133303436386634
|
||||
33366533376665336161616632393433383038396664616337323962366137313635633235656633
|
||||
35363636343939393363356164373463643838346663663264363361363233323661343430353363
|
||||
65666337653433363864653032623134313738663733646434653639373532353365373439393637
|
||||
39663034343039666238653539343561393036626563363664303633313338366431313730626131
|
||||
33623435396661373739306266346162653436663132306330303830633938623564653937336138
|
||||
30313035353966336333626130333865313733383032396231323136656364616265613630393665
|
||||
33636530373663376161333333353632616337326337336537643135333836353634643333623630
|
||||
61653339303166643231623530646561353430326134366337323561353736616232656562343036
|
||||
30666363393937326438643466396564393535613431663562323634616232643135333933353364
|
||||
32643734333665353339633236313562333534313263616264346562333238633234386666386430
|
||||
38323565316436653062366562356334363739323837656164313963366666373462616661623265
|
||||
62363735373931323965383662313561333464663632336437613930323066343236363931363930
|
||||
37636363343534643332356235316633623437366133663532616334656263326438333330343435
|
||||
33393132346235393838353831656237396331623966343262393564396635656566616335373666
|
||||
64313838616636323539343163633365623263613932663739383939363130666532353965373561
|
||||
66643030356130393732356161363436383563323232373363663966343239646261663633336332
|
||||
36633365363338373065386436333934623939626362653836666136346130623138346630323262
|
||||
35366661616338656430383036343539366637363462636264346435353539663463373066323764
|
||||
64326561333438623835353130323465616635356133343330333266376562346161303761663639
|
||||
31653866383336383134333234356235333165376361613130656265613830306239303532613837
|
||||
61663536613361363965383331323634666631383131393431333565633131386463646230626632
|
||||
32656238333930653939636434366138626636646238356435636537656561326430336366303334
|
||||
39313633373563663162313066663264613430313734643962656635356135613561393536646465
|
||||
37633631666633383332396330383065376433343066333633343532323036313239313835633333
|
||||
66363265373132643733356636343033313535653433356564366630623438363237346166613634
|
||||
63663733626462383333636330643465393565653563636265386662636662366530666535653433
|
||||
30613463633664343239653636393863346233623738306437373930386135363435633237353761
|
||||
61636366643138356336393931343539306639643331353964313636323362643432643031323935
|
||||
33393764633639313863316130356434376666633332353166386333646238303061333861653538
|
||||
30306463376235333632613361363934643734373237383432336630343963666231636162336631
|
||||
63323539323038363563346435313337363636666462316639386435373437343933633730376132
|
||||
31323435646361393834343331306134353735326634343266353734353266366463383133656566
|
||||
33393864323237616235343866376234306362393531316261613735386438323665373338653764
|
||||
65633462626565393937633737396465326532303039663062383832303563336438366238663666
|
||||
65613932323362643738323234303434613561326261653665333330383536373433613236393430
|
||||
37396433363537323562303433613636386261356465613533356261363239353563626636323938
|
||||
31333539323438653663343566333563363630663766326464353033623032386534396563653064
|
||||
31333864343064613765373764663131316337643330366635326536386266613165333132373335
|
||||
35633739663562623230393532656663303831376661343433393630663238656433393237326135
|
||||
32616332633039336134323931653032323837396261633735363464393738363663313662383336
|
||||
62363936336266383861373166373338616238366437633031303632306462346462616138366337
|
||||
39386461313134666263396137353963336263393232633964303663623961623139376363633234
|
||||
33326334373766396461353631666661393932346336336332336536623865383431373230353666
|
||||
64343361373038623963623431646564303065633763376165313135313961663433643764653366
|
||||
36373735646437303361626465626631643330336431643939343562336635363063383965346439
|
||||
34383462643238396332653335623438326530326634393165333834666264306265656165306331
|
||||
66303339366339633134393762633738643661333535633337336466363763666234386337663738
|
||||
30626630393937393139353064373463616261633536626164643232383033343531323663386461
|
||||
32616230313364303439623438353363613337396161303964653538613031353237386262383962
|
||||
37393636393433653831666162336465383835623030643430363635626631396462323363306334
|
||||
31303139393666336131653931356461356162393437386630643233396635633162306230666365
|
||||
32646331303538663133336437623535636230336334353938346338616334613433646565343535
|
||||
36656435363165666566313239656234366436363762653539643030353734663738383334616234
|
||||
32353166613337316333623930333865333865386662393438303033323434363539613862393733
|
||||
30373864663636353466376230656231666165316632353136653738303363366333643931363565
|
||||
38333366366365313536313865386339643339643733353466643731316631646138623334306666
|
||||
39626133666139313835653730643761316331386637636562313138316231303032613639366433
|
||||
31376166376337373664626238316639633237343136616132303762633234316132323631646261
|
||||
31303363636239333332613234636635623732323338313132613837666363393063346464346162
|
||||
65383334663639353735623130373833313034336463383764623565616331333464326665336261
|
||||
39316663386663323338356562393562383632316262313633376234633731346338373435363337
|
||||
31636663653866386230663838353066386230383966396462346565633861616134666363613166
|
||||
39386137656232376266663435653137353566623839633230326533383662396661636239316565
|
||||
35346335326533666462613635323464353139666365646533356265653766653231613439666135
|
||||
33373936373762323866626132636464326166656337636632313838343333313339386233613263
|
||||
39323966626163643839663263663066663739623837313030623763346164313336646531326433
|
||||
64323866323631363965336631376462633563333635656636306362336535316363626461653833
|
||||
35653733393763323261353631613838326663376464333035653961383236356565373430393064
|
||||
33666463316630373261616334623165306238643961316465313330326134326233653164663731
|
||||
62343436306263393030616233616534643231323235303733613432346333623264306261316165
|
||||
37336562313666656136613035636536373561346666333235666338346564363765393536653532
|
||||
35653435663565363038633935396535373337636564346665626433336662363633323330623131
|
||||
31396164383939623331
|
20
production
Normal file
20
production
Normal file
@ -0,0 +1,20 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
66616638623836373665333538653738323730616561393137636339393466353237306433303938
|
||||
3135396139633865656162626161393632386161356135370a363936663034623562653930303164
|
||||
62653561626238333234386366366437613662626336633366656236323462646661303630353834
|
||||
3761646561366565300a383831303361346231383639303233376664386534313266356130653962
|
||||
61363362626536366532653861616166613337356264396334323037653332633435336532373930
|
||||
35646364636461323461306135393464303331616163323732393539383036363438663835323866
|
||||
62376362656262316364633437383937336633373466373162623732383538663562383331333635
|
||||
30623634323062323932656433353836316161313132643332633566363765306364313031343337
|
||||
64636462656163323335653237636662383635383061663365633461613438643732613033313666
|
||||
33303634363931336432656130626364353063666135663061316339383064336639623936646364
|
||||
64353866656265346561393337646162653635666465633733353433396233646236656563396138
|
||||
32326563313537323730613233626565326138303466653332663135616361353563376431653536
|
||||
63306364663864313637333333616364333430616264386132383864626561303762616433666532
|
||||
37313634613737613439656165396430313434343438333733376662343936663064626465643939
|
||||
63363537323538653063656239343038323432373165633738316232343932636436343639326134
|
||||
31626330643961653364353331356137363263623465313337383639396631373735633064333535
|
||||
64653866646334393233366365633232643063363266373531363930336638333730386435376131
|
||||
32393933356534623161666638303037306634326336376430386139623565313630323730393665
|
||||
646131663034656133356662323338663638
|
35
roles/dhcp/defaults/main.yml
Normal file
35
roles/dhcp/defaults/main.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
|
||||
dhcp_server_package_name: "dhcp-server"
|
||||
dhcp_server_configfile_path: "/etc/dhcp/dhcpd.test.conf"
|
||||
dhcp_server_systemd_unit: "dhcpd.service"
|
||||
|
||||
# Default lease time in seconds: 1 day = 60*60*24
|
||||
dhcp_default_lease_time: 86400
|
||||
# Max lease time in seconds: 1 week = 60*60*24*7
|
||||
dhcp_max_lease_time: 604800
|
||||
# domain-name and name-servers common across all networks the dhcp-server controls
|
||||
dhcp_common_domain_name: "example.org"
|
||||
dhcp_common_name_servers:
|
||||
- "ns1.example.org"
|
||||
- "ns2.example.org"
|
||||
dhcp_is_authorative: True
|
||||
|
||||
dhcp_subnets:
|
||||
- net: 192.168.167.0
|
||||
netmask: 255.255.255.0
|
||||
routers: 192.168.167.2
|
||||
broadcast: 192.168.167.255
|
||||
domain_name: "int.example.org"
|
||||
domain_name_servers:
|
||||
- "ns1.int.example.org"
|
||||
domain_search:
|
||||
- "int.example.org"
|
||||
range_start: 192.168.167.10
|
||||
range_end: 192.168.167.20
|
||||
allow_unknown: True
|
||||
hosts:
|
||||
- name: server
|
||||
mac: "00:00:00:00:00:00"
|
||||
ip: 192.168.167.45
|
||||
|
25
roles/dhcp/tasks/main.yml
Normal file
25
roles/dhcp/tasks/main.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
|
||||
- name: Ensure ISC-DHCP installed
|
||||
package:
|
||||
name: "{{ dhcp_server_package_name }}"
|
||||
state: present
|
||||
|
||||
- name: Template DHCP-server configuration
|
||||
template:
|
||||
src: dhcpd.conf.j2
|
||||
dest: "{{ dhcp_server_configfile_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
setype: dhcp_etc_t
|
||||
validate: dhcpd -t
|
||||
|
||||
- name: Restart & enable DHCP-server
|
||||
systemd:
|
||||
name: "{{ dhcp_server_systemd_unit }}"
|
||||
enabled: yes
|
||||
state: restarted
|
||||
daemon_reload: yes
|
||||
|
||||
|
56
roles/dhcp/templates/dhcpd.conf.j2
Normal file
56
roles/dhcp/templates/dhcpd.conf.j2
Normal file
@ -0,0 +1,56 @@
|
||||
# dhcpd.conf
|
||||
|
||||
{% if dhcp_is_authorative is defined and dhcp_is_authorative is sameas true %}
|
||||
authoritative;
|
||||
{% endif %}
|
||||
|
||||
# Global settings for DHCP lease times
|
||||
default-lease-time {{ dhcp_default_lease_time }};
|
||||
max-lease-time {{ dhcp_max_lease_time }};
|
||||
|
||||
# Global domain names and servers for all supported networks
|
||||
{% if dhcp_common_domain_name is not none %}
|
||||
option domain-name "{{ dhcp_common_domain_name }}";
|
||||
{% endif %}
|
||||
{% if dhcp_common_name_servers is not none %}
|
||||
option domain-name-servers {{ dhcp_common_name_servers|join(', ') }};
|
||||
{% endif %}
|
||||
|
||||
# Use this to send dhcp log messages to a different log file (you also
|
||||
# have to hack syslog.conf to complete the redirection).
|
||||
log-facility local7;
|
||||
|
||||
# Subnet definitions
|
||||
|
||||
{% for subnet in dhcp_subnets %}
|
||||
subnet {{ subnet.net }} netmask {{ subnet.netmask }} {
|
||||
option routers {{ subnet.routers }};
|
||||
option broadcast-address {{ subnet.broadcast }};
|
||||
option domain-name "{{ subnet.domain_name }}";
|
||||
option domain-name-servers {{ subnet.domain_name_servers|join(', ') }};
|
||||
{% if subnet.domain_search is defined and subnet.domain_search|length > 0 %}
|
||||
option domain-search {{ subnet.domain_search | map('regex_replace', '^(.*)$', '\"\\1\"') | join(', ') }};
|
||||
{% endif %}
|
||||
|
||||
{% if subnet.range_start is defined and subnet.range_end is defined %}
|
||||
range {{ subnet.range_start }} {{ subnet.range_end }};
|
||||
{% endif %}
|
||||
|
||||
{% if subnet.allow_unknown is defined and subnet.allow_unknown is sameas false %}
|
||||
deny unknown-clients;
|
||||
{% else %}
|
||||
allow unknown-clients;
|
||||
{% endif %}
|
||||
|
||||
{% for host in subnet.hosts %}
|
||||
host {{ host.name }} {
|
||||
hardware ethernet {{ host.mac }};
|
||||
{% if host.ip is defined %}
|
||||
fixed-address {{ host.ip }};
|
||||
{% endif %}
|
||||
}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user