add dhcp reservation
This commit is contained in:
31
10-sno-hub-cluster/02-dhcp/ip-reservations.yml
Normal file
31
10-sno-hub-cluster/02-dhcp/ip-reservations.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
- name: Set dnsmasq host reservation
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
mac_address: "98:b7:85:1e:c6:f1"
|
||||||
|
ip_address: "10.1.71.10"
|
||||||
|
hostname: "ocp-hub"
|
||||||
|
tasks:
|
||||||
|
- name: Ensure dnsmasq is installed
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: dnsmasq
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
- name: Ensure dnsmasq is installed
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: dnsmasq
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == "RedHat"
|
||||||
|
|
||||||
|
- name: Add host reservation to dnsmasq
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/dnsmasq.d/hosts.conf
|
||||||
|
line: "dhcp-host={{ mac_address }},{{ ip_address }},{{ hostname }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Restart dnsmasq service
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: dnsmasq
|
||||||
|
state: restarted
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Prepare matchbox to install hub cluster
|
||||||
|
|
||||||
|
## Modify config file for OpenShift Automated Installer
|
||||||
|
|
||||||
|
- 03-matchbox/install-config
|
||||||
|
- 03-matchbox/agent-config
|
||||||
|
|
||||||
|
## Install Ansible pre-requisites
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-galaxy collection install -r
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run installation playbook
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-playbook install.yml
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,27 +1,19 @@
|
|||||||
---
|
---
|
||||||
- name: Run all tasks necessary to configure matchbox to install the cluster
|
- name: Run all tasks necessary to configure matchbox to install the cluster
|
||||||
hosts: all
|
hosts: 127.0.0.1
|
||||||
|
connection: local
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
vars_prompt:
|
vars_prompt:
|
||||||
- name: freeipa_password
|
- name: freeipa_password
|
||||||
prompt: FreeIPA password for admin user
|
prompt: FreeIPA password for admin user
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
- name: Install requirements
|
|
||||||
delegate_to: localhost
|
|
||||||
ansible.builtin.command: ansible-galaxy install -r requirements.yml
|
|
||||||
# Other tasks that you run BEFORE the roles
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Set FreeIPA password
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: export TF_VAR_freeipa_password="{{ freeipa_password }}"
|
|
||||||
|
|
||||||
- name: Deploy DNS entries for cluster via Terraform
|
- name: Deploy DNS entries for cluster via Terraform
|
||||||
community.general.terraform:
|
community.general.terraform:
|
||||||
project_path: 01-dns
|
project_path: 01-dns/
|
||||||
|
variables:
|
||||||
|
freeipa_password: "{{ freeipa_password }}"
|
||||||
state: present
|
state: present
|
||||||
# - name: Basic deploy of a service
|
force_init: true
|
||||||
# community.general.terraform:
|
|
||||||
# project_path: '{{ project_dir }}'
|
- include: 02-dhcp/ip-reservations.yml
|
||||||
# state: present
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# requirements.yml
|
# requirements.yml
|
||||||
collections:
|
collections:
|
||||||
- name: ommunity.general
|
- name: community.general
|
||||||
version: 10.4.0
|
version: 10.4.0
|
||||||
|
|||||||
Reference in New Issue
Block a user