Last active
September 22, 2020 15:50
-
-
Save AkashRajvanshi/7ea07ebaf4b6c56f568938c72184c816 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Setup Kubernetes with Ansible | |
hosts: cluster | |
become: True | |
tasks: | |
- name: Updating the system | |
apt: update_cache=yes force_apt_get=yes cache_valid_time=3600 | |
- name: Installing Snap | |
apt: name=snapd state=latest | |
- name: Installing MicroK8s Snap Package | |
snap: | |
name: microk8s | |
channel: 1.19 | |
classic: yes | |
- name: Adding vagrant user to microk8s group | |
user: | |
name: "{{ ansible_user }}" | |
groups: microk8s | |
append: yes | |
become: yes | |
- name: Giving vagrant user a permission to ~/.kube directory | |
file: | |
path: ~/.kube | |
owner: "{{ ansible_user }}" | |
group: "{{ ansible_user }}" | |
mode: 0775 | |
state: directory | |
recurse: yes | |
- shell: microk8s.kubectl get nodes | |
register: shell_result | |
- debug: | |
var: shell_result.stdout_lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment