-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu-playbook.yml
84 lines (65 loc) · 2.25 KB
/
ubuntu-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
- hosts: all
become: true
vars:
create_containers: 4
default_container_name: docker
default_container_image: ubuntu
default_container_command: sleep 1d
tasks:
- name: Install aptitude using apt
apt: name=aptitude state=latest update_cache=yes force_apt_get=yes
- name: Install required system packages
apt: name={{ item }} state=latest update_cache=yes
loop: [ 'apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common', 'python3-pip', 'virtualenv', 'python3-setuptools']
- name: Install snap
apt:
name: snap
state: present
- name: install microk8s via snap
command: snap install microk8s --classic
- name: install helm via snap
command: snap install helm --classic
- name: install kubectl
command: snap install kubectl --classic
- name: install microk8s addons
command: microk8s enable helm
- name: microk8s enable storage
command: microk8s enable storage
- name: microk8s enable dns
command: microk8s enable dns
- name: microk8s enable ingress
command: microk8s enable ingress
- name: microk8s enable registry
command: microk8s enable registry
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu xenial stable
state: present
- name: Update apt and install docker-ce
apt: update_cache=yes name=docker-ce state=latest
- name: Install Docker Module for Python
pip:
name: docker
- name: Add user
ansible.builtin.user:
name: vagrant
shell: /bin/bash
groups: docker,microk8s
state: present
append: yes
- name: Pull default Docker image
docker_image:
name: "{{ default_container_image }}"
source: pull
- name: Create default containers
docker_container:
name: "{{ default_container_name }}{{ item }}"
image: "{{ default_container_image }}"
command: "{{ default_container_command }}"
state: present
with_sequence: count={{ create_containers }}