This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
services:cobbler [2016/03/04 21:25] dgalloway created |
services:cobbler [2022/11/22 11:49] akraitman |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== WIP - Cobbler ====== | + | ====== Cobbler ====== |
+ | ===== Summary ===== | ||
+ | [[https://cobbler.github.io/|Cobbler]] is used to reimage testnodes in the lab. The Cobbler host is ''cobbler.front.sepia.ceph.com'' and is managed by Ansible. It's a bare metal machine that used to be mira065. | ||
+ | |||
+ | Access the Web UI at https://cobbler.front.sepia.ceph.com/cobbler_web/ | ||
+ | |||
+ | ===== Reimaging/Reinstalling a host ===== | ||
+ | See [[:testnodereimage]] | ||
+ | |||
+ | ===== Creating a new user for Web UI access ===== | ||
+ | - In the ''ceph-cm-ansible'' repo, there is a ''tools/cobbler-access.sh'' script. Run it. | ||
+ | - Create a new branch named ''wip-username'' in the ''ceph-sepia-secrets'' repo | ||
+ | - Paste the output under ''%%------ String for cobbler.yml ------%%'' into a new line in ''ansible/inventory/group_vars/cobbler.yml'' under ''users_digest_lines'' | ||
+ | - git commit, git push the branch, and create a Pull Request | ||
+ | - ''%%ansible-playbook cobbler.yml --tags="settings"%%'' | ||
+ | |||
+ | <code> | ||
+ | # Example | ||
+ | $ ~/git/ceph/ceph-cm-ansible/tools/cobbler-access.sh | ||
+ | Enter username: bob | ||
+ | |||
+ | ------ String for cobbler.yml ------ | ||
+ | bob:Cobbler:07a95ca759fd46e9416de672a5e2bb60 | ||
+ | |||
+ | |||
+ | # Add the user to the cobbler.yml secrets group_vars file | ||
+ | dgalloway@w541 ceph-sepia-secrets (wip-bob)$ git diff | ||
+ | diff --git a/ansible/inventory/group_vars/cobbler.yml b/ansible/inventory/group_vars/cobbler.yml | ||
+ | index 758427a..6968689 100644 | ||
+ | --- a/ansible/inventory/group_vars/cobbler.yml | ||
+ | +++ b/ansible/inventory/group_vars/cobbler.yml | ||
+ | @@ -15,6 +15,7 @@ users_digest_lines: | ||
+ | - "yuriw:Cobbler:XXXXX" | ||
+ | - "vasu:Cobbler:XXXXX" | ||
+ | - "dmick:Cobbler:XXXXX" | ||
+ | + - "bob:Cobbler:07a95ca759fd46e9416de672a5e2bb60" | ||
+ | </code> | ||
===== Adding a new Distro ===== | ===== Adding a new Distro ===== | ||
- | //This is just a quick note since I forgot when adding RHEL6.8 to the lab. It'll be reformatted along with the rest of the page eventually.// | + | - Create an entry for the new distro in ceph-cm-ansible's root ''cobbler.yml'' |
- | * add to cobbler.yml | + | - Create the profile |
- | * add dummy to roles/cobbler_profile/defaults/main.yml | + | - **If** the distro's ISO is not publicly accessible (e.g., RHEL/inktank-rescue), |
- | * add to secrets repo | + | - Add a dummy entry (Distro name and blank iso var) to ''roles/cobbler_profile/defaults/main.yml'' |
+ | - Add to ''ansible/inventory/group_vars/cobbler.yml'' in the secrets repo | ||
+ | - **Else if** the distro's ISO **is** public (e.g., CentOS/Ubuntu), just add the iso path, sha256, etc. to ''roles/cobbler_profile/defaults/main.yml'' | ||
+ | - Run ''ansible-playbook cobbler.yml %%--%%tags=%%"%%$NEW_PROFILE_TAG%%"%%'' where $NEW_PROFILE_TAG is the tag created in Step 1 | ||
+ | - In cobbler web UI, go to **Profiles** | ||
+ | - Click **Create New Sub-profile** | ||
+ | - Name it ''$NEW_DISTRO_NAME**-stock**'' | ||
+ | - Set **Parent Profile** to ''$NEW_DISTRO_NAME'' | ||
+ | - **Save** | ||
+ | |||
+ | ==== RHEL in Sepia ==== | ||
+ | Because RHEL ISOs are only available inside the Red Hat firewall, we can't add an ''http'' URL to the secrets repo. To add a RHEL version: | ||
+ | |||
+ | - Find the ISO hosted inside the Red Hat firewall and download it | ||
+ | - Once downloaded, ''scp'' the ISO to ''cobbler.front.sepia.ceph.com:/iso'' | ||
+ | - In the ceph-sepia-secrets repo, set the appropriate ''%%file:///iso/path%%'' | ||
+ | |||
+ | ==== Error adding brand new distro ==== | ||
+ | Cobbler keeps a list of supported distros in ''/var/lib/cobbler/distro_signatures.json'' so it knows what defaults to apply to a distro/profile. | ||
+ | |||
+ | If a distro is brand-spankin' new, you may get an error like "No signature matched in /var/www/cobbler/ks_mirror/Ubuntu-17.10-server-x86_64". | ||
+ | |||
+ | First try running ''cobbler signature update''. If it still doesn't show up in ''cobbler signature report'', you'll have to manually add an entry in the JSON. | ||
+ | |||
+ | - Edit ''/var/lib/cobbler/distro_signatures.json'' | ||
+ | - ''service cobblerd restart'' | ||
+ | |||
+ | ===== Re-importing a Distro ===== | ||
+ | This would typically be done if a newer ISO (minor revision) of an OS is released. For example: if you wanted to import Ubuntu 16.04.3 in place of the original 16.04 image. | ||
+ | |||
+ | - First, you need to make sure no machines in Cobbler are set to use the distro you plan to replace | ||
+ | - ssh to the Cobbler host | ||
+ | - Set the profile for each machine using the distro you wish to replace with something else <code> | ||
+ | # Example: | ||
+ | for host in $(cobbler system find --profile Ubuntu-16.04-server-x86_64); do cobbler system edit --name=$host --profile inktank-rescue; done | ||
+ | </code> | ||
+ | - You may wish to ''cat'' these hosts to a file so you can set the profile back after <code> | ||
+ | cobbler system find --profile Ubuntu-16.04-server-x86_64 > currently_xenial.dgalloway | ||
+ | for host in $(cat currently_xenial.dgalloway); do cobbler system edit --name=$host --profile inktank-rescue; done | ||
+ | # Reimport distro | ||
+ | for host in $(cat currently_xenial.dgalloway); do cobbler system edit --name=$host --profile Ubuntu-16.04-server-x86_64; done | ||
+ | rm currently_xenial.dgalloway | ||
+ | </code> | ||
+ | - Delete all associated profiles under the **Profiles** tab in the Cobbler web UI | ||
+ | - Delete the distro from **Distros** in the web UI | ||
+ | - Proceed with [[services:cobbler#adding_a_new_distro|Re-adding the distro]] |