mirror of
				https://github.com/xcat2/confluent.git
				synced 2025-10-31 03:12:31 +00:00 
			
		
		
		
	Add firstboot/post ansible play support to SUSE15
This commit is contained in:
		| @@ -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 | ||||
|  | ||||
| @@ -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 | ||||
|  | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user