Compare commits
	
		
			2 Commits
		
	
	
		
			5b4a440cb4
			...
			e183055282
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e183055282 | |||
| 514909fc8d | 
@ -1,5 +1,5 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
- name: Setup bare metal requirements for nomad
 | 
					- name: Setup bare metal requirements
 | 
				
			||||||
  hosts: nigel.local
 | 
					  hosts: nigel.local
 | 
				
			||||||
  remote_user: nigel
 | 
					  remote_user: nigel
 | 
				
			||||||
  tasks:
 | 
					  tasks:
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										8
									
								
								ansible/roles/base/tasks/k3s.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ansible/roles/base/tasks/k3s.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					- name: Download the setup script
 | 
				
			||||||
 | 
					  ansible.builtin.get_url:
 | 
				
			||||||
 | 
					    url: https://get.k3s.io
 | 
				
			||||||
 | 
					    dest: /tmp/k3s.sh
 | 
				
			||||||
 | 
					    mode: "0644"
 | 
				
			||||||
 | 
					- name: Run installation script
 | 
				
			||||||
 | 
					  ansible.builtin.command:
 | 
				
			||||||
 | 
					    cmd: bash /tmp/k3s.sh
 | 
				
			||||||
@ -1,54 +0,0 @@
 | 
				
			|||||||
- name: Ensure prerequisite packages are installed
 | 
					 | 
				
			||||||
  ansible.builtin.apt:
 | 
					 | 
				
			||||||
    pkg:
 | 
					 | 
				
			||||||
      - wget
 | 
					 | 
				
			||||||
      - gpg
 | 
					 | 
				
			||||||
      - coreutils
 | 
					 | 
				
			||||||
    update_cache: true
 | 
					 | 
				
			||||||
- name: Hashicorp repo setup
 | 
					 | 
				
			||||||
  vars:
 | 
					 | 
				
			||||||
    keypath: /usr/share/keyrings/hashicorp-archive-keyring.gpg
 | 
					 | 
				
			||||||
    gpgpath: /tmp/hashicorp.gpg
 | 
					 | 
				
			||||||
  block:
 | 
					 | 
				
			||||||
    - name: Download the hashicorp GPG Key
 | 
					 | 
				
			||||||
      ansible.builtin.get_url:
 | 
					 | 
				
			||||||
        url: https://apt.releases.hashicorp.com/gpg
 | 
					 | 
				
			||||||
        dest: "{{ gpgpath }}"
 | 
					 | 
				
			||||||
        mode: "0755"
 | 
					 | 
				
			||||||
    - name: Dearmor the hashicorp gpg key
 | 
					 | 
				
			||||||
      ansible.builtin.command:
 | 
					 | 
				
			||||||
        cmd: "gpg --dearmor --yes -o {{ keypath }} {{ gpgpath }}"
 | 
					 | 
				
			||||||
      register: gpg
 | 
					 | 
				
			||||||
      changed_when: gpg.rc == 0
 | 
					 | 
				
			||||||
    - name: Add the hashicorp linux repo
 | 
					 | 
				
			||||||
      vars:
 | 
					 | 
				
			||||||
        keyfile: "{{ keypath }}"
 | 
					 | 
				
			||||||
      ansible.builtin.template:
 | 
					 | 
				
			||||||
        src: hashicorp.list
 | 
					 | 
				
			||||||
        dest: /etc/apt/sources.list.d/hashicorp.list
 | 
					 | 
				
			||||||
        mode: "0644"
 | 
					 | 
				
			||||||
    - name: Update apt repo cache
 | 
					 | 
				
			||||||
      ansible.builtin.apt:
 | 
					 | 
				
			||||||
        update_cache: true
 | 
					 | 
				
			||||||
- name: Install consul
 | 
					 | 
				
			||||||
  ansible.builtin.apt:
 | 
					 | 
				
			||||||
    name: consul
 | 
					 | 
				
			||||||
    state: absent
 | 
					 | 
				
			||||||
- name: Install nomad package
 | 
					 | 
				
			||||||
  ansible.builtin.apt:
 | 
					 | 
				
			||||||
    pkg: nomad
 | 
					 | 
				
			||||||
    state: absent
 | 
					 | 
				
			||||||
- name: Remove the bare metal consul template
 | 
					 | 
				
			||||||
  ansible.builtin.file:
 | 
					 | 
				
			||||||
    path: /etc/consul.d/consul.hcl
 | 
					 | 
				
			||||||
    state: absent
 | 
					 | 
				
			||||||
- name: Start nomad
 | 
					 | 
				
			||||||
  ansible.builtin.systemd_service:
 | 
					 | 
				
			||||||
    name: nomad
 | 
					 | 
				
			||||||
    state: stopped
 | 
					 | 
				
			||||||
    enabled: false
 | 
					 | 
				
			||||||
- name: Make sure the consul service is NOT available
 | 
					 | 
				
			||||||
  ansible.builtin.systemd_service:
 | 
					 | 
				
			||||||
    name: consul
 | 
					 | 
				
			||||||
    state: stopped
 | 
					 | 
				
			||||||
    enabled: false
 | 
					 | 
				
			||||||
							
								
								
									
										34
									
								
								infra/nigel-nomad/nfs.nomad.hcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								infra/nigel-nomad/nfs.nomad.hcl
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					# Nigel's NFS that we use for rando stuff
 | 
				
			||||||
 | 
					job "nfs" {
 | 
				
			||||||
 | 
					  type = "service"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  group "nfs" {
 | 
				
			||||||
 | 
					    count = 1
 | 
				
			||||||
 | 
					    network {
 | 
				
			||||||
 | 
					      port "v4" {
 | 
				
			||||||
 | 
					        static = 2049
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    service {
 | 
				
			||||||
 | 
					      name = "nfs"
 | 
				
			||||||
 | 
					      port = "v4"
 | 
				
			||||||
 | 
					      provider = "nomad"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    volume "nfs_files" {
 | 
				
			||||||
 | 
					      type      = "host"
 | 
				
			||||||
 | 
					      read_only = false
 | 
				
			||||||
 | 
					      source    = "nfs"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    task "nfs" {
 | 
				
			||||||
 | 
					      driver = "docker"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      config {
 | 
				
			||||||
 | 
					        image = "erichough/nfs-server"
 | 
				
			||||||
 | 
					        ports = [ "v4" ]
 | 
				
			||||||
 | 
					        args = ["--cap-add", "SYS_ADMIN"]
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user