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

Refactor existing roles, put timemaster inside a role #601

Merged
merged 8 commits into from
Sep 3, 2024
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
22 changes: 10 additions & 12 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
url = https://github.com/ceph/ceph-ansible.git
ignore = dirty
branch = stable-6.0
[submodule "src/debian/python3-setup-ovs"]
path = src/debian/python3-setup-ovs
url = https://github.com/seapath/python3-setup-ovs.git
branch = main
[submodule "src/debian/vm_manager"]
path = src/debian/vm_manager
url = https://github.com/seapath/vm_manager.git
branch = main
[submodule "src/cukinia-tests"]
path = src/cukinia-tests
[submodule "roles/deploy_cukinia_tests/cukinia-tests"]
path = roles/deploy_cukinia_tests/cukinia-tests
url = https://github.com/seapath/cukinia-tests.git
branch = main
[submodule "src/cukinia"]
path = src/cukinia
[submodule "roles/deploy_cukinia/files/cukinia"]
path = roles/deploy_cukinia/files/cukinia
url = https://github.com/savoirfairelinux/cukinia.git
branch = master
[submodule "roles/deploy_python3_setup_ovs/files/python3-setup-ovs"]
path = roles/deploy_python3_setup_ovs/files/python3-setup-ovs
url = https://github.com/seapath/python3-setup-ovs.git
[submodule "roles/deploy_vm_manager/files/vm_manager"]
path = roles/deploy_vm_manager/files/vm_manager
url = https://github.com/seapath/vm_manager.git
11 changes: 10 additions & 1 deletion playbooks/ci_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
# SEAPATH.

---
- import_playbook: ./test_deploy_cukinia.yaml

- name: deploy cukinia
hosts:
- cluster_machines
- standalone_machine
- VMs
become: true
roles:
- deploy_cukinia

- import_playbook: ./test_deploy_cukinia_tests.yaml
- import_playbook: ./test_run_cukinia.yaml
4 changes: 2 additions & 2 deletions playbooks/seapath_setup_hardened_debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
vars:
revert: false
roles:
- debian/hardening
- debian_hardening
- name: Add hardened for SEAPATH physical machines
become: true
hosts:
Expand All @@ -20,7 +20,7 @@
vars:
revert: false
roles:
- debian/hardening/physical_machine
- debian_hardening_physical_machine

- name: Reboot to apply hardening
become: true
Expand Down
16 changes: 16 additions & 0 deletions playbooks/seapath_setup_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@

- import_playbook: seapath_setup_network.yaml

- name: Configure timemaster
hosts:
- cluster_machines
- standalone_machine
become: true
roles:
- timemaster

- name: Configure snmp
hosts:
- cluster_machines
- standalone_machine
become: true
roles:
- snmp

- import_playbook: cluster_setup_ceph.yaml
- import_playbook: cluster_setup_libvirt.yaml
- import_playbook: cluster_setup_add_livemigration_user.yaml
Expand Down
98 changes: 2 additions & 96 deletions playbooks/seapath_setup_network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@
# Copyright (C) 2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0

# This Ansible playbook configures the networks and defines the hostnames. It
# can be used on cluster machines and VMs.
# This Ansible playbook configures the networks and defines the hostnames.

---
- name: Get distrebution variables
- name: Get distribution variables
gather_facts: true
hosts:
- cluster_machines
- standalone_machine
- VMs
tasks:
- include_vars: "../vars/{{ ansible_distribution }}_paths.yml"

- name: Network configuration basics
hosts:
- cluster_machines
- standalone_machine
- VMs
become: true
tasks:
- block:
Expand Down Expand Up @@ -63,24 +60,11 @@
- role: systemd_networkd
when: netplan_configurations is not defined

- name: Apply network with systemd-networkd roles on VMs
become: true
hosts:
- VMs
vars_files:
- ../vars/network_vars.yml
vars:
systemd_networkd_apply_config: "true"
roles:
- role: systemd_networkd
when: netplan_configurations is not defined

- name: Apply network config with netplan
become: true
hosts:
- cluster_machines
- standalone_machine
- VMs
tasks:
- block:
- name: Create /etc/netplan directory
Expand Down Expand Up @@ -248,7 +232,6 @@
- name: Configure hosts and hostname
hosts:
- standalone_machine
- VMs
become: true
tasks:
- name: Set hostname
Expand All @@ -270,7 +253,6 @@
hosts:
- cluster_machines
- standalone_machine
- VMs
become: true
tasks:
- block:
Expand Down Expand Up @@ -319,7 +301,6 @@
hosts:
- cluster_machines
- standalone_machine
- VMs
become: true
tasks:
- block:
Expand Down Expand Up @@ -363,7 +344,6 @@
hosts:
- cluster_machines
- standalone_machine
- VMs
become: true
tasks:
- name: Stop and disable systemd-resolved
Expand All @@ -373,72 +353,6 @@
enabled: false
when: dns_servers is not defined

- name: Configure TimeMaster
hosts:
- cluster_machines
- standalone_machine
become: true
vars:
apply_config: "{{ apply_network_config | default(false) }}"
tasks:
- name: Populate service facts
service_facts:
- name: stop and disable systemd-timesyncd if it exists
service:
name: "systemd-timesyncd"
state: stopped
enabled: false
when: "'systemd-timesyncd.service' in services"
- name: Create timemaster configuration
template:
src: ../templates/timemaster.conf.j2
dest: "{{ path_timemaster_conf }}"
register: timemasterconf1
- name: comment pool configuration in chrony.conf
replace:
path: "{{ path_chrony_conf }}"
regexp: '^(pool .*)'
replace: '#\1'
register: timemasterconf2
- name: Create timemaster.service.d directory
file:
path: /etc/systemd/system/timemaster.service.d/
state: directory
owner: root
group: root
mode: 0755
- name: Copy timemaster.service overide
template:
src: ../templates/timemaster.service.j2
dest: /etc/systemd/system/timemaster.service.d/override.conf
register: timemasterconf3
- name: Enable timemaster
service:
name: "timemaster"
enabled: true
- name: restart timemaster if necessary
service:
name: "timemaster"
state: restarted
enabled: true
daemon_reload: true
when:
- timemasterconf1.changed or timemasterconf2.changed or timemasterconf3.changed
- apply_config or need_reboot is not defined or not need_reboot

- name: Stop chrony service
hosts:
- cluster_machines
- standalone_machine
- VMs
become: true
tasks:
- name: stop and disable chrony
service:
name: "{{ service_name_chrony }}"
state: stopped
enabled: false

- name: Configure systemd-networkd-wait-online.service
hosts:
- cluster_machines
Expand Down Expand Up @@ -583,14 +497,6 @@
state: stopped
when: conntrackd_ignore_ip_list is not defined

- name: Configure snmp
hosts:
- cluster_machines
- standalone_machine
become: true
roles:
- snmp

- name: Restart machine if needed
hosts:
- cluster_machines
Expand Down
4 changes: 2 additions & 2 deletions playbooks/seapath_setup_prerequiscentos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
- standalone_machine
become: true
roles:
- centos/physical_machine
- centos_physical_machine
- name: Prerequis hypervisor centos
hosts:
- hypervisors
- standalone_machine
become: true
roles:
- centos/hypervisor
- centos_hypervisor

- name: Add admin user to haclient group
hosts:
Expand Down
4 changes: 2 additions & 2 deletions playbooks/seapath_setup_prerequisdebian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
- standalone_machine
become: true
roles:
- debian/physical_machine
- debian_physical_machine
- name: Prerequis hypervisor debian
hosts:
- hypervisors
- standalone_machine
become: true
roles:
- debian/hypervisor
- debian_hypervisor

- name: Add admin user to haclient group
hosts:
Expand Down
4 changes: 2 additions & 2 deletions playbooks/seapath_setup_unhardened_debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
vars:
revert: true
roles:
- debian/hardening
- debian_hardening
- name: Remove hardened for SEAPATH physical machines
become: true
hosts:
Expand All @@ -20,7 +20,7 @@
vars:
revert: true
roles:
- debian/hardening/physical_machine
- debian_hardening_physical_machine

- name: Reboot to apply hardening revert
become: true
Expand Down
26 changes: 0 additions & 26 deletions playbooks/test_deploy_cukinia.yaml

This file was deleted.

Loading
Loading