Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dhcpd to work in shared network (#77) #78

Merged
merged 1 commit into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions playbooks/roles/ocp-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Role Variables
| chronyconfig.enabled | no | true | Set to true to enable chrony configuration on the bastion node during installation. This also configure the bastion as a NTP server for the cluster. |
| chronyconfig.content | no | "" | List of time NTP servers and options pair (see chronyconfig examples). If empty, bastion will try sync with some default ntp server (internet) AND local HW clock (with higher stratum). |
| chronyconfig.allow | no | "" | List of network cidr (X.X.X.X/Y) allowed to sync with bastion configured as NTP server |
| dhcp_shared_network | no | | Flag to update DHCP server work on a shared network. (Neither ACK nor NACK unknown clients) |

*chronyconfig variable example *

Expand Down
24 changes: 24 additions & 0 deletions playbooks/roles/ocp-config/tasks/dhcpd_update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# Update dhcpd config to not deny unknown clients and use only static entries
- name: Find DHCP pool block
shell: grep 'pool {' /etc/dhcp/dhcpd.conf
ignore_errors: yes
register: dhcp_pool

- name: Update DHCP server config
when: dhcp_pool.rc == 0
block:
- name: Remove pool, range and deny statements
shell: |
sed -i.bak '/pool {/d' /etc/dhcp/dhcpd.conf
sed -i '/range /d' /etc/dhcp/dhcpd.conf
sed -i '$d' /etc/dhcp/dhcpd.conf
sed -i 's/deny unknown-clients/#deny unknown-clients/' /etc/dhcp/dhcpd.conf
args:
warn: false

- name: restart dhcpd
service:
name: dhcpd
state: restarted
enabled: yes
4 changes: 4 additions & 0 deletions playbooks/roles/ocp-config/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
# tasks file for ocp4 config

- name: Update DHCP server config for shared network
import_tasks: dhcpd_update.yaml
when: dhcp_shared_network is defined and dhcp_shared_network

- name: Setup Squid proxy server
import_tasks: squid.yaml
when: setup_squid_proxy
Expand Down