Skip to content

Commit

Permalink
playbooks: seperate cluster_machines and standalone_machines
Browse files Browse the repository at this point in the history
As it was done in the debian branch, use cluster_machines and
standalone_machines in Ansible hosts.

cluster_machines: is for SEAPATH machines which take part of a cluster
    (hypervisors and observers).
standalone_machines: is for SEAPATH machines which not take part of a
    cluster (standalone hypervisors and virtual machines).

Signed-off-by: Mathieu Dupré <[email protected]>
  • Loading branch information
dupremathieu authored and eroussy committed May 30, 2023
1 parent 728006c commit 715409b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
5 changes: 4 additions & 1 deletion playbooks/cluster_setup_configure_hosts.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Copyright (C) 2021, RTE (http://www.rte-france.com)
# Copyright (C) 2023 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0
# This Ansible playbook configure cluster machines.
---
- import_playbook: cluster_setup_kernel_params.yaml
- import_playbook: cluster_setup_configure_hugepages.yaml
- name: remove the static ip previously setup
hosts: cluster_machines
hosts:
- cluster_machines
- standalone_machine
tasks:
- name: Remove file /etc/systemd/network/000-static_ip.network
file:
Expand Down
5 changes: 4 additions & 1 deletion playbooks/cluster_setup_kernel_params.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Copyright (C) 2020, RTE (http://www.rte-france.com)
# Copyright (C) 2023 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0

# This Ansible playbook configures the kernel paremeters.
# It is called by the playbook cluster_setup_main.yaml, but can also be called alone.

---
- name: Configure Kernel parameters
hosts: cluster_machines
hosts:
- cluster_machines
- standalone_machine
vars:
config_file: "{{ bootloader_config_file |
default('/boot/EFI/BOOT/grub.cfg') }}"
Expand Down
35 changes: 27 additions & 8 deletions playbooks/cluster_setup_network.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (C) 2020, RTE (http://www.rte-france.com)
# Copyright (C) 2023 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0

# This Ansible playbook configures the networks and defines the hostnames. It
Expand All @@ -25,7 +26,9 @@
command: "/usr/bin/ovs-vsctl -- --if-exists del-port {{ team0_1 }} -- add-port team0 {{ team0_1 }}"

- name: Configure OVS
hosts: cluster_machines
hosts:
- cluster_machines
- standalone_machine
vars:
apply_config: "{{ apply_network_config | default(false) }}"
tasks:
Expand All @@ -50,7 +53,9 @@
- ovs_conf.changed

- name: Configure Network
hosts: cluster_machines
hosts:
- cluster_machines
- standalone_machine
vars_files:
- ../vars/network_vars.yml
roles:
Expand Down Expand Up @@ -87,7 +92,9 @@


- name: Configure PTP ansible.builtin.service
hosts: cluster_machines
hosts:
- cluster_machines
- standalone_machine
vars:
apply_config: "{{ apply_network_config | default(false) }}"
tasks:
Expand All @@ -110,13 +117,19 @@
- ptp_vlan_interface is defined
- ptp_vlan is defined

- name: Configure hosts and hostname
hosts: cluster_machines
- name: Configure hostname
hosts:
- cluster_machines
- standalone_machine
tasks:
- name: Set hostname
hostname:
name: "{{ inventory_hostname }}"
use: systemd

- name: Configure hosts
hosts: cluster_machines
tasks:
- name: Build hosts file
lineinfile:
dest: /etc/hosts
Expand All @@ -133,7 +146,9 @@
when: cluster_ip_addr is defined

- name: Configure NTP
hosts: cluster_machines
hosts:
- cluster_machines
- standalone_machine
tasks:
- name: Set NTP configuration in /etc/systemd/timesyncd.conf
lineinfile:
Expand Down Expand Up @@ -161,7 +176,9 @@
state: restarted

- name: Configure syslog-ng
hosts: cluster_machines
hosts:
- cluster_machines
- standalone_machine
tasks:
- name: Set observer IP address in /etc/syslog-ng/syslog-ng.conf
lineinfile:
Expand Down Expand Up @@ -201,7 +218,9 @@
when: cluster_interface is defined

- name: Restart machine if needed
hosts: cluster_machines
hosts:
- cluster_machines
- standalone_machine
tasks:
- include_tasks: tasks/soft_restart_machine.yaml
when: need_reboot is defined and need_reboot

0 comments on commit 715409b

Please sign in to comment.