]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
Sync playbooks from other @David's repo 801/head
authorJitendra-Sahu <Jitendra.Sahu@ibm.com>
Tue, 9 Dec 2025 11:52:58 +0000 (17:22 +0530)
committerJitendra-Sahu <Jitendra.Sahu@ibm.com>
Thu, 19 Feb 2026 06:38:11 +0000 (12:08 +0530)
amend

Removed updated tools/jenkins-builder-disk.yml

tools/ovirt-guest-agent.yml [new file with mode: 0644]
tools/rhev-1tb-ssd.yml [new file with mode: 0644]
tools/roles/ovirt-guest-agent/files/ovirt-guest-agent.list [new file with mode: 0644]
tools/roles/ovirt-guest-agent/tasks/main.yml [new file with mode: 0644]
tools/roles/ovirt-guest-agent/tasks/rpm.yml [new file with mode: 0644]
tools/roles/ovirt-guest-agent/tasks/ubuntu_14.yml [new file with mode: 0644]
tools/roles/ovirt-guest-agent/tasks/ubuntu_16.yml [new file with mode: 0644]
tools/smithi-jenkins-slave.yml [new file with mode: 0644]

diff --git a/tools/ovirt-guest-agent.yml b/tools/ovirt-guest-agent.yml
new file mode 100644 (file)
index 0000000..eb1ced3
--- /dev/null
@@ -0,0 +1,5 @@
+---
+- hosts: all
+  roles:
+    - ovirt-guest-agent
+  become: true
diff --git a/tools/rhev-1tb-ssd.yml b/tools/rhev-1tb-ssd.yml
new file mode 100644 (file)
index 0000000..3c1758a
--- /dev/null
@@ -0,0 +1,104 @@
+---
+### This playbook is useful for setting up a baremetal hosts (irvingi or senta)
+### as a RHEL Hypervisor to serve Jenkins VMs.  Expects a RHEL7 image
+### already subscribed to RHSM and had ceph-cm-ansible common role
+### ran against it.
+
+- hosts:
+    - irvingi
+    - senta
+  vars:
+    # Default to configure /vms disk
+    configure_disk: true
+  vars_prompt:
+    # Forcefully reconfigure disk even if it's already mounted
+    - name: "force_configure_disk"
+      prompt: "\nWARNING: You will lose data if you enter \"y\"\nDo you want to forcefully reconfigure the VMs disk even if it's already set up? (y|n)"
+      default: "n"
+  become: true
+  tasks:
+
+  - name: Enable rhev-mgmt repo
+    command: "subscription-manager repos --enable=rhel-7-server-rhev-mgmt-agent-rpms"
+
+  - name: Install packages
+    yum:
+      name: "{{ item }}"
+      state: latest
+      enablerepo: epel
+    with_items:
+      - gdisk
+      - parted
+      - vdsm
+
+  - name: Find 1TB SSD
+    set_fact:
+      vm_ssd: "{{ item.key }}"
+    with_dict: "{{ ansible_devices }}"
+    when: item.value.model == "Samsung SSD 850"
+
+  # This is where the RHEV virtual machines will reside
+  - name: Make /vms dir and set permissions
+    file:
+      state: directory
+      path: /vms
+      owner: vdsm
+      group: kvm
+
+  # Unmount /vms so configure_disk is set to true
+  - name: Unmount 1TB SSD if we're forcefully reconfiguring
+    mount:
+      name: /vms
+      state: unmounted
+    when: force_configure_disk == "y"
+
+  - name: Update ansible_mounts
+    setup:
+      filter: ansible_mounts
+    when: force_configure_disk == "y"
+
+  # Check if the 1TB SSD is already mounted at the /vms mountpoint.
+  # This is the ONLY way the playbook checks if the host is already configured
+  - name: Check if /vms already mounted
+    set_fact:
+      configure_disk: false
+    with_items: "{{ ansible_mounts }}"
+    when: '"/vms" in item.mount'
+
+  - debug: var=configure_disk
+
+  - name: Zap 1TB SSD
+    command: sgdisk -Z "/dev/{{ vm_ssd }}"
+    when: configure_disk == true
+
+  - name: Create partition table
+    command: "parted -s /dev/{{ vm_ssd }} mktable msdos"
+    when: configure_disk == true
+
+  - name: Create partition
+    command: "parted /dev/{{ vm_ssd }} unit '%' mkpart primary 0 100"
+    when: configure_disk == true
+
+  - name: Create filesystem
+    filesystem:
+      fstype: xfs
+      dev: "/dev/{{ vm_ssd }}1"
+      force: yes
+    when: configure_disk == true
+
+  - name: Find VM partition UUID
+    command: "lsblk -n -o uuid /dev/{{ vm_ssd }}1"
+    register: vm_uuid
+
+  - name: Mount 1TB SSD to /vms
+    mount:
+      name: /vms
+      src: "UUID={{ vm_uuid.stdout }}"
+      fstype: xfs
+      opts: defaults
+      state: mounted
+
+  - name: Copy RHEV SSH key to root's authorized_keys
+    authorized_key:
+      user: root
+      key: http://mgr01.front.sepia.ceph.com/engine.ssh.key.txt
diff --git a/tools/roles/ovirt-guest-agent/files/ovirt-guest-agent.list b/tools/roles/ovirt-guest-agent/files/ovirt-guest-agent.list
new file mode 100644 (file)
index 0000000..e8a9123
--- /dev/null
@@ -0,0 +1 @@
+deb http://download.opensuse.org/repositories/home:/evilissimo:/ubuntu:/14.04/xUbuntu_14.04/ /
diff --git a/tools/roles/ovirt-guest-agent/tasks/main.yml b/tools/roles/ovirt-guest-agent/tasks/main.yml
new file mode 100644 (file)
index 0000000..251536e
--- /dev/null
@@ -0,0 +1,12 @@
+---
+- include: ubuntu_16.yml
+  when: ansible_distribution == "Ubuntu" and
+        ansible_distribution_major_version == "16"
+
+- include: ubuntu_14.yml
+  when: ansible_distribution == "Ubuntu" and
+        ansible_distribution_major_version == "14"
+
+- include: rpm.yml
+  when: ansible_distribution == "CentOS" or
+        ansible_distribution == "RedHat"
diff --git a/tools/roles/ovirt-guest-agent/tasks/rpm.yml b/tools/roles/ovirt-guest-agent/tasks/rpm.yml
new file mode 100644 (file)
index 0000000..dbcd62e
--- /dev/null
@@ -0,0 +1,12 @@
+---
+- name: Install ovirt-guest-agent
+  yum:
+    name: ovirt-guest-agent
+    enablerepo: epel
+    state: latest
+
+- name: Enable and start ovirt-guest-agent service
+  service:
+    name: ovirt-guest-agent
+    enabled: yes
+    state: started
diff --git a/tools/roles/ovirt-guest-agent/tasks/ubuntu_14.yml b/tools/roles/ovirt-guest-agent/tasks/ubuntu_14.yml
new file mode 100644 (file)
index 0000000..9738aa5
--- /dev/null
@@ -0,0 +1,16 @@
+---
+- name: Install ovirt-guest-agent repo
+  file:
+    src: ovirt-guest-agent.list
+    path: /etc/apt/sources.list.d/ovirt-guest-agent.list
+
+- name: Install ovirt-guest-agent repo key
+  apt_key:
+    url: "http://download.opensuse.org/repositories/home:/evilissimo:/ubuntu:/14.04/xUbuntu_14.04//Release.key"
+    state: present
+
+- name: Install ovirt-guest-agent
+  apt:
+    name: ovirt-guest-agent
+    state: latest
+    update_cache: yes
diff --git a/tools/roles/ovirt-guest-agent/tasks/ubuntu_16.yml b/tools/roles/ovirt-guest-agent/tasks/ubuntu_16.yml
new file mode 100644 (file)
index 0000000..a70492d
--- /dev/null
@@ -0,0 +1,19 @@
+---
+- name: Install ovirt-guest-agent
+  apt:
+    name: ovirt-guest-agent
+    state: latest
+
+# https://bugs.launchpad.net/ubuntu/+source/ovirt-guest-agent/+bug/1609130
+- name: Create logfile and set permissions
+  file:
+    path: /var/log/ovirt-guest-agent/ovirt-guest-agent.log
+    owner: ovirtagent
+    group: ovirtagent
+    state: touch
+
+- name: Enable and start ovirt-guest-agent service
+  service:
+    name: ovirt-guest-agent
+    enabled: yes
+    state: started
diff --git a/tools/smithi-jenkins-slave.yml b/tools/smithi-jenkins-slave.yml
new file mode 100644 (file)
index 0000000..281bd1b
--- /dev/null
@@ -0,0 +1,59 @@
+---
+### This playbook is useful for setting up a smithi as Jenkins slave
+### for use with 2.jenkins.ceph.com.
+### Primarily, this just sets up the NVMe device to be mounted at {{ mount_dir }}
+### NOTE: Not idempotent!  This will erase any data at {{ mount_dir }}
+
+- hosts:
+    - smithi
+  become: true
+  vars:
+    mount_dir: "/var/lib/libvirt/images"
+  tasks:
+
+  - name: Remove all non-admin users
+    user:
+      name: "{{ item.name }}"
+      state: absent
+      remove: yes
+    with_items: "{{ lab_users }} + [{'name': 'ubuntu'}]"
+
+  - name: Install deps
+    package:
+      state: latest
+      name: "{{ item }}"
+    with_items:
+      - xfsprogs
+
+  - name: Stop Jenkins slave service in case it's running
+    service:
+      name: jenkins
+      state: stopped
+    failed_when: false
+
+  - name: "Unmount /dev/nvme0n1"
+    mount:
+      path: "{{ item.mount }}"
+      state: unmounted
+    with_items: "{{ ansible_mounts }}"
+    when: item.device == "/dev/nvme0n1"
+
+  - name: Zap NVMe disk
+    command: "sgdisk -Z /dev/nvme0n1"
+
+  - name: Make filesystem on NVMe disk
+    filesystem:
+      fstype: xfs
+      dev: "/dev/nvme0n1"
+
+  - name: "Make {{ mount_dir }} dir"
+    file:
+      path: "{{ mount_dir }}"
+      state: directory
+
+  - name: Mount NVMe disk
+    mount:
+      path: "{{ mount_dir }}"
+      src: "/dev/nvme0n1"
+      fstype: xfs
+      state: mounted