diff --git a/confluent_osdeploy/suse15/profiles/hpc/ansible/firstboot.d/README.txt b/confluent_osdeploy/suse15/profiles/hpc/ansible/firstboot.d/README.txt new file mode 100644 index 00000000..97e5f506 --- /dev/null +++ b/confluent_osdeploy/suse15/profiles/hpc/ansible/firstboot.d/README.txt @@ -0,0 +1,25 @@ +Ansible playbooks ending in .yml or .yaml that are placed into this directory will be executed at the +appropriate phase of the install process. + +The 'hosts' may be omitted, and if included will be ignored, replaced with the host that is specifically +requesting the playbooks be executed. + +Also, the playbooks will be executed on the deployment server. Hence it may be slower in aggregate than +running content under scripts/ which ask much less of the deployment server + +Here is an example of what a playbook would look like broadly: + +- name: Example + gather_facts: no + tasks: + - name: Example1 + lineinfile: + path: /etc/hosts + line: 1.2.3.4 test1 + create: yes + - name: Example2 + lineinfile: + path: /etc/hosts + line: 1.2.3.5 test2 + create: yes + diff --git a/confluent_osdeploy/suse15/profiles/hpc/ansible/post.d/README.txt b/confluent_osdeploy/suse15/profiles/hpc/ansible/post.d/README.txt new file mode 100644 index 00000000..97e5f506 --- /dev/null +++ b/confluent_osdeploy/suse15/profiles/hpc/ansible/post.d/README.txt @@ -0,0 +1,25 @@ +Ansible playbooks ending in .yml or .yaml that are placed into this directory will be executed at the +appropriate phase of the install process. + +The 'hosts' may be omitted, and if included will be ignored, replaced with the host that is specifically +requesting the playbooks be executed. + +Also, the playbooks will be executed on the deployment server. Hence it may be slower in aggregate than +running content under scripts/ which ask much less of the deployment server + +Here is an example of what a playbook would look like broadly: + +- name: Example + gather_facts: no + tasks: + - name: Example1 + lineinfile: + path: /etc/hosts + line: 1.2.3.4 test1 + create: yes + - name: Example2 + lineinfile: + path: /etc/hosts + line: 1.2.3.5 test2 + create: yes + diff --git a/confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh b/confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh index 333f2e4a..b0297b03 100644 --- a/confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh +++ b/confluent_osdeploy/suse15/profiles/hpc/scripts/firstboot.sh @@ -10,4 +10,11 @@ apikey=$(cat /etc/confluent/confluent.apikey) . /etc/confluent/functions run_remote firstboot.custom + +# Firstboot scripts may be placed into firstboot.d, e.g. firstboot.d/01-firstaction.sh, firstboot.d/02-secondaction.sh +run_remote_parts firstboot + +# Induce execution of remote configuration, e.g. ansible plays in ansible/firstboot.d/ +run_remote_config firstboot + curl --capath /etc/confluent/tls -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $apikey" -f -X POST -d "status: complete" https://$mgr/confluent-api/self/updatestatus diff --git a/confluent_osdeploy/suse15/profiles/hpc/scripts/functions b/confluent_osdeploy/suse15/profiles/hpc/scripts/functions index 42e5c79a..bcbbeed4 100644 --- a/confluent_osdeploy/suse15/profiles/hpc/scripts/functions +++ b/confluent_osdeploy/suse15/profiles/hpc/scripts/functions @@ -33,3 +33,20 @@ run_remote_python() { cd - > /dev/null return $retcode } + +run_remote_config() { + echo + set_confluent_vars + apiclient=/opt/confluent/bin/apiclient + if [ -f /etc/confluent/apiclient ]; then + apiclient=/etc/confluent/apiclient + fi + echo '---------------------------------------------------------------------------' + echo Requesting to run remote configuration for "'$*'" from $mgr under profile $profile + /usr/libexec/platform-python $apiclient /confluent-api/self/remoteconfig/"$*" -d {} + /usr/libexec/platform-python $apiclient /confluent-api/self/remoteconfig/status -w 204 + echo + echo 'Completed remote configuration + echo '---------------------------------------------------------------------------' + return +} diff --git a/confluent_osdeploy/suse15/profiles/hpc/scripts/post.sh b/confluent_osdeploy/suse15/profiles/hpc/scripts/post.sh index 7111d781..19cc051b 100644 --- a/confluent_osdeploy/suse15/profiles/hpc/scripts/post.sh +++ b/confluent_osdeploy/suse15/profiles/hpc/scripts/post.sh @@ -23,5 +23,11 @@ export mgr profile nodename run_remote post.custom +# Also, scripts may be placed into 'post.d', e.g. post.d/01-runfirst.sh, post.d/02-runsecond.sh +run_remote_parts post + +# Induce execution of remote configuration, e.g. ansible plays in ansible/post.d/ +run_remote_config post + curl -X POST -d 'status: staged' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $apikey" https://$mgr/confluent-api/self/updatestatus