57 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
| ---
 | |
| - name: Configure Podman driver for all Nomad client nodes
 | |
|   hosts: target_nodes
 | |
|   become: yes
 | |
|   
 | |
|   tasks:
 | |
|     - name: Stop Nomad service
 | |
|       systemd:
 | |
|         name: nomad
 | |
|         state: stopped
 | |
|         
 | |
|     - name: Install Podman if not present
 | |
|       package:
 | |
|         name: podman
 | |
|         state: present
 | |
|       ignore_errors: yes
 | |
|         
 | |
|     - name: Enable Podman socket
 | |
|       systemd:
 | |
|         name: podman.socket
 | |
|         enabled: yes
 | |
|         state: started
 | |
|       ignore_errors: yes
 | |
|         
 | |
|     - name: Update Nomad configuration to use Podman
 | |
|       lineinfile:
 | |
|         path: /etc/nomad.d/nomad.hcl
 | |
|         regexp: '^plugin "docker"'
 | |
|         line: 'plugin "podman" {'
 | |
|         state: present
 | |
|         
 | |
|     - name: Add Podman plugin configuration
 | |
|       blockinfile:
 | |
|         path: /etc/nomad.d/nomad.hcl
 | |
|         marker: "# {mark} PODMAN PLUGIN CONFIG"
 | |
|         block: |
 | |
|           plugin "podman" {
 | |
|             config {
 | |
|               socket_path = "unix:///run/podman/podman.sock"
 | |
|               volumes {
 | |
|                 enabled = true
 | |
|               }
 | |
|             }
 | |
|           }          
 | |
|         insertafter: 'client {'
 | |
|         
 | |
|     - name: Start Nomad service
 | |
|       systemd:
 | |
|         name: nomad
 | |
|         state: started
 | |
|         
 | |
|     - name: Wait for Nomad to be ready
 | |
|       wait_for:
 | |
|         port: 4646
 | |
|         host: localhost
 | |
|         delay: 5
 | |
|         timeout: 30 |