Skip to content

Commit

Permalink
Move and fix autoyast_lvm
Browse files Browse the repository at this point in the history
Move scenario autoyast_lvm from repo aytest to this repo
and fix it.
  • Loading branch information
jknphy committed Oct 12, 2020
1 parent 18c7e00 commit 90ddcf6
Show file tree
Hide file tree
Showing 9 changed files with 250 additions and 2 deletions.
6 changes: 6 additions & 0 deletions data/autoyast_sle15/autoyast_lvm.list
@@ -0,0 +1,6 @@
lvm.sh # creates lvm partitions
firewall.sh # sets firewall with existing network (keep_install_network) (bnc#897129)
installation_snapshot.sh # snapshot has been created
btrfs_snapshots.sh # creates @/. snapshots on LVM (bnc#935858)
set_passwords.sh # password are set (bsc#973639, bsc#974220, bsc#971804 and bsc#965852)
shrink_partitions.sh # shrink partitions and logical volumes (bsc#1078418)
181 changes: 181 additions & 0 deletions data/autoyast_sle15/autoyast_lvm.xml
@@ -0,0 +1,181 @@
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<general>
<mode>
<confirm config:type="boolean">false</confirm>
</mode>
<signature-handling>
<accept_unsigned_file config:type="boolean">true</accept_unsigned_file>
<accept_file_without_checksum config:type="boolean">true</accept_file_without_checksum>
<accept_verification_failed config:type="boolean">true</accept_verification_failed>
<accept_unknown_gpg_key config:type="boolean">true</accept_unknown_gpg_key>
<import_gpg_key config:type="boolean">true</import_gpg_key>
<accept_non_trusted_gpg_key config:type="boolean">true</accept_non_trusted_gpg_key>
</signature-handling>
</general>
<suse_register>
<do_registration config:type="boolean">true</do_registration>
<email>
</email>
<reg_code>{{SCC_REGCODE}}</reg_code>
<install_updates config:type="boolean">true</install_updates>
<reg_server>{{SCC_URL}}</reg_server>
<addons config:type="list">
<addon>
<name>sle-module-basesystem</name>
<version>{{VERSION}}</version>
<arch>{{ARCH}}</arch>
</addon>
<addon>
<name>sle-module-server-applications</name>
<version>{{VERSION}}</version>
<arch>{{ARCH}}</arch>
</addon>
</addons>
</suse_register>
<scripts>
<post-scripts config:type="list">
<script>
<filename>yast_clone.sh</filename>
<interpreter>shell</interpreter>
<location/>
<feedback config:type="boolean">false</feedback>
<source><![CDATA[#!/bin/sh
rm /run/libstorage-ng/lock
mv /var/run/zypp.pid /var/run/zypp.sav
yast clone_system
mv /var/run/zypp.sav /var/run/zypp.pid
]]></source>
</script>
</post-scripts>
<init-scripts config:type="list">
<script>
<source><![CDATA[
chkconfig sshd on
rcsshd start
]]></source>
</script>
</init-scripts>
</scripts>
<networking>
<keep_install_network config:type="boolean">true</keep_install_network>
</networking>
<firewall>
<FW_CONFIGURATIONS_EXT>apache2 apache2-ssl</FW_CONFIGURATIONS_EXT>
<FW_LOG_DROP_ALL>no</FW_LOG_DROP_ALL>
<FW_SERVICES_EXT_TCP>8080</FW_SERVICES_EXT_TCP>
<FW_SERVICES_EXT_UDP>9090</FW_SERVICES_EXT_UDP>
<enable_firewall config:type="boolean">false</enable_firewall>
<start_firewall config:type="boolean">false</start_firewall>
</firewall>
<report>
<errors>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</errors>
<messages>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</messages>
<warnings>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</warnings>
<yesno_messages>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</yesno_messages>
</report>
<partitioning config:type="list">
<drive>
<partitions config:type="list">
<partition>
<partition_nr config:type="integer">1</partition_nr>
<lvm_group>system</lvm_group>
<partition_type>primary</partition_type>
<size>250G</size>
</partition>
<partition>
<partition_nr config:type="integer">2</partition_nr>
<lvm_group>system</lvm_group>
<partition_type>primary</partition_type>
<size>250G</size>
</partition>
</partitions>
<use>all</use>
</drive>
<drive>
<device>/dev/system</device>
<initialize config:type="boolean">true</initialize>
<type t="symbol">CT_LVM</type>
<is_lvm_vg config:type="boolean">true</is_lvm_vg>
<partitions config:type="list">
<partition>
<lv_name>root_lv</lv_name>
<mount>/</mount>
<size>300G</size>
</partition>
<partition>
<lv_name>opt_lv</lv_name>
<mount>/opt</mount>
<size>200G</size>
</partition>
<partition>
<filesystem config:type="symbol">swap</filesystem>
<lv_name>swap_lv</lv_name>
<mount>swap</mount>
<size>auto</size>
</partition>
</partitions>
<pesize>4M</pesize>
<use>all</use>
</drive>
</partitioning>
<software>
<patterns config:type="list">
<pattern>base</pattern>
<pattern>basesystem</pattern>
<pattern>minimal_base</pattern>
</patterns>
<packages config:type="list">
<package>sudo</package>
<package>yast2-ntp-client</package>
<package>apache2</package>
<package>apache2-prefork</package>
<package>firewalld</package>
</packages>
<remove-packages config:type="list">
<package>zsh</package>
</remove-packages>
<products config:type="list">
<product>SLES</product>
</products>
</software>
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<fullname>vagrant</fullname>
<gid>100</gid>
<home>/home/vagrant</home>
<shell>/bin/bash</shell>
<uid>1000</uid>
<user_password>nots3cr3t</user_password>
<username>vagrant</username>
</user>
<user>
<encrypted config:type="boolean">false</encrypted>
<fullname>root</fullname>
<gid>0</gid>
<home>/root</home>
<shell>/bin/bash</shell>
<uid>0</uid>
<user_password>nots3cr3t</user_password>
<username>root</username>
</user>
</users>
</profile>
15 changes: 15 additions & 0 deletions data/autoyast_sle15/btrfs_snapshots.sh
@@ -0,0 +1,15 @@
#!/bin/bash

set -e -x

# See more at bsc#935858

btrfs subvolume list / | grep '@/.snapshots' && SUBVOLUME_EXISTS=1

grep '/\.snapshots .*subvol=/@/\.snapshots' /etc/fstab && SUBVOLUME_IN_FSTAB=1

if [ "${SUBVOLUME_EXISTS}" == "1" ] && [ "${SUBVOLUME_IN_FSTAB}" == "1" ]; then
echo "AUTOYAST OK"
else
echo "SCRIPT FAILURE: Subvolumes not configured"
fi
8 changes: 8 additions & 0 deletions data/autoyast_sle15/firewall.sh
@@ -0,0 +1,8 @@
#!/bin/bash

set -e -x

SERVICES=`firewall-offline-cmd --zone=external --list-services`
test "$SERVICES" == 'http https' || echo 'Services are not configured properly, expected http https'

echo "AUTOYAST OK"
7 changes: 7 additions & 0 deletions data/autoyast_sle15/installation_snapshot.sh
@@ -0,0 +1,7 @@
#!/bin/bash

set -e -x

# It is enough to check the return value in order to check if
# snapper has been set up correctly.
snapper list && echo "AUTOYAST OK"
11 changes: 11 additions & 0 deletions data/autoyast_sle15/lvm.sh
@@ -0,0 +1,11 @@
#!/bin/bash

set -e -x

lvs
pvs
vgs

mount

mount |grep -i "root_lv on /" && echo "AUTOYAST OK"
9 changes: 9 additions & 0 deletions data/autoyast_sle15/set_passwords.sh
@@ -0,0 +1,9 @@
#!/bin/bash

# Check if all users has some value in the password field
# (bsc#973639, bsc#974220, bsc#971804 and bsc#965852)

set -e -x

# It's OK if we DO NOT find a blank password.
getent shadow | grep --extended-regexp "^[^:]+::" || echo "AUTOYAST OK"
8 changes: 8 additions & 0 deletions data/autoyast_sle15/shrink_partitions.sh
@@ -0,0 +1,8 @@
#!/bin/bash

set -e -x

# Check if AutoYaST displayed a warning about shrinking partitions to make them
# fit (bsc#1078418).
zgrep "Some additional space" /var/log/YaST2/y2log*.gz
echo "AUTOYAST OK"
7 changes: 5 additions & 2 deletions schedule/yast/autoyast/autoyast_lvm.yaml
Expand Up @@ -7,9 +7,12 @@ description: >
- Firewall configuration
- Subvolumes configuration
- Passwords are set for the users in the profile
vars:
AUTOYAST: autoyast_sle15/autoyast_lvm.xml
AUTOYAST_VERIFY: autoyast_sle15/autoyast_lvm.list
schedule:
- installation/isosize
- boot/boot_from_pxe
- autoyast/prepare_profile
- installation/bootloader_start
- autoyast/installation
- autoyast/console
- autoyast/login
Expand Down

0 comments on commit 90ddcf6

Please sign in to comment.