From d7c219f2a8ddd744c830cc04722930afa33d5b96 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 24 Jul 2020 10:59:15 -0400 Subject: [PATCH] Add a new strategy for custom content This allows a profile to more easily isolate customizations from the base profile --- confluent_osdeploy/el8/profiles/default/kickstart | 7 +++++++ confluent_osdeploy/el8/profiles/default/kickstart.custom | 4 ++++ .../el8/profiles/default/scripts/firstboot.custom | 4 ++++ .../el8/profiles/default/scripts/firstboot.sh | 4 +--- .../el8/profiles/default/scripts/post.custom | 4 ++++ confluent_osdeploy/el8/profiles/default/scripts/post.sh | 5 ++++- confluent_osdeploy/el8/profiles/default/scripts/pre.custom | 4 ++++ confluent_osdeploy/el8/profiles/default/scripts/pre.sh | 2 ++ .../el8/profiles/default/scripts/pre.sh.custom | 0 9 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 confluent_osdeploy/el8/profiles/default/kickstart.custom create mode 100644 confluent_osdeploy/el8/profiles/default/scripts/firstboot.custom create mode 100644 confluent_osdeploy/el8/profiles/default/scripts/post.custom create mode 100644 confluent_osdeploy/el8/profiles/default/scripts/pre.custom create mode 100644 confluent_osdeploy/el8/profiles/default/scripts/pre.sh.custom diff --git a/confluent_osdeploy/el8/profiles/default/kickstart b/confluent_osdeploy/el8/profiles/default/kickstart index 09222e97..f0b65579 100644 --- a/confluent_osdeploy/el8/profiles/default/kickstart +++ b/confluent_osdeploy/el8/profiles/default/kickstart @@ -40,6 +40,13 @@ python3 %include /tmp/cryptpkglist %end +# A kickstart.custom file is provided to enable easily adding +# kickstart content without modifying the stock file. +# While the stock file may be safely modified, using the .custom +# files may allow for more easily rebasing custom profiles to newer +# stock profiles +%include /tmp/kickstart.custom + %pre profile=$(grep ^profile: /etc/confluent/confluent.deploycfg |awk '{print $2}') mgr=$(grep deploy_server /etc/confluent/confluent.deploycfg |awk '{print $2}') diff --git a/confluent_osdeploy/el8/profiles/default/kickstart.custom b/confluent_osdeploy/el8/profiles/default/kickstart.custom new file mode 100644 index 00000000..2b627e73 --- /dev/null +++ b/confluent_osdeploy/el8/profiles/default/kickstart.custom @@ -0,0 +1,4 @@ +# Any custom kickstart additions may go here. It may be required to +# modify base kickstart file to change certain portions, but adding +# custom content to this file allows for most convenient way to +# refresh to a newer base profile if desired. diff --git a/confluent_osdeploy/el8/profiles/default/scripts/firstboot.custom b/confluent_osdeploy/el8/profiles/default/scripts/firstboot.custom new file mode 100644 index 00000000..9cf0900e --- /dev/null +++ b/confluent_osdeploy/el8/profiles/default/scripts/firstboot.custom @@ -0,0 +1,4 @@ +. /tmp/functions +# This is a convenient place to keep customizations separate from modifying the stock scripts +# While modification of the stock scripts is fine, it may be easier to rebase to a newer +# stock profile if the '.custom' files are used. diff --git a/confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh b/confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh index 986ef719..3fe06efc 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh +++ b/confluent_osdeploy/el8/profiles/default/scripts/firstboot.sh @@ -14,9 +14,7 @@ export nodename mgr profile . /etc/confluent/functions -# Here is the most appropriate place to customize, for example: -#run_remote script.sh -#run_remote_python script.py +run_remote firstboot.custom curl -X POST -d 'status: complete' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $apikey" https://$mgr/confluent-api/self/updatestatus diff --git a/confluent_osdeploy/el8/profiles/default/scripts/post.custom b/confluent_osdeploy/el8/profiles/default/scripts/post.custom new file mode 100644 index 00000000..9cf0900e --- /dev/null +++ b/confluent_osdeploy/el8/profiles/default/scripts/post.custom @@ -0,0 +1,4 @@ +. /tmp/functions +# This is a convenient place to keep customizations separate from modifying the stock scripts +# While modification of the stock scripts is fine, it may be easier to rebase to a newer +# stock profile if the '.custom' files are used. diff --git a/confluent_osdeploy/el8/profiles/default/scripts/post.sh b/confluent_osdeploy/el8/profiles/default/scripts/post.sh index 9bfe52b8..b4d975c8 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/post.sh +++ b/confluent_osdeploy/el8/profiles/default/scripts/post.sh @@ -22,7 +22,10 @@ fi # run_remote will download and execute from /var/lib/confluent/public//scripts/ directory # run_remote_python will use the appropriate python interpreter path to run the specified script +# A post.custom is provided to more conveniently hold customizations, see the post.custom file. -# Add content as below: # run_remote example.sh # run_remote_python example.py +run_remote post.custom + + diff --git a/confluent_osdeploy/el8/profiles/default/scripts/pre.custom b/confluent_osdeploy/el8/profiles/default/scripts/pre.custom new file mode 100644 index 00000000..9cf0900e --- /dev/null +++ b/confluent_osdeploy/el8/profiles/default/scripts/pre.custom @@ -0,0 +1,4 @@ +. /tmp/functions +# This is a convenient place to keep customizations separate from modifying the stock scripts +# While modification of the stock scripts is fine, it may be easier to rebase to a newer +# stock profile if the '.custom' files are used. diff --git a/confluent_osdeploy/el8/profiles/default/scripts/pre.sh b/confluent_osdeploy/el8/profiles/default/scripts/pre.sh index e36ead25..7ed98f5e 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/pre.sh +++ b/confluent_osdeploy/el8/profiles/default/scripts/pre.sh @@ -63,3 +63,5 @@ if [ -e /tmp/installdisk ]; then echo ignoredisk --only-use $(cat /tmp/installdisk) >> /tmp/partitioning echo autopart --nohome $LUKSPARTY >> /tmp/partitioning fi +curl -f https://$mgr/confluent-public/os/$profile/kickstart.custom > /tmp/kickstart.custom +run_remote pre.custom diff --git a/confluent_osdeploy/el8/profiles/default/scripts/pre.sh.custom b/confluent_osdeploy/el8/profiles/default/scripts/pre.sh.custom new file mode 100644 index 00000000..e69de29b