Skip to content

Commit

Permalink
first pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Leiner committed May 22, 2024
1 parent 68f362a commit 158bf17
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 12 deletions.
8 changes: 8 additions & 0 deletions inventory/sample/group_vars/rke2_servers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ rke2_config: {}
# See https://docs.rke2.io/helm/#automatically-deploying-manifests-and-helm-charts
# Add manifest files by specifying the directory path on the control host
# manifest_config_file_path: "{{ playbook_dir }}/sample_files/manifest/"

# Configure RKE2 utilites such as kubectl, ctr, and crictl via symlinks.
# configure_utilities: true

# If configure_utilites, and you want Helm installed
# helm_url: https://get.helm.sh/helm-v3.15.0-linux-amd64.tar.gz
# or
# helm_binary_path: /path/to/helm
28 changes: 16 additions & 12 deletions roles/rke2_server/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
---

- name: RKE2 agent and server tasks
vars:
rke2_common_caller_role_name: server
ansible.builtin.include_role:
name: rke2_common
tasks_from: main
# - name: RKE2 agent and server tasks
# vars:
# rke2_common_caller_role_name: server
# ansible.builtin.include_role:
# name: rke2_common
# tasks_from: main

- name: Setup initial server
ansible.builtin.include_tasks: first_server.yml
when: inventory_hostname in groups['rke2_servers'][0]
# - name: Setup initial server
# ansible.builtin.include_tasks: first_server.yml
# when: inventory_hostname in groups['rke2_servers'][0]

- name: Setup other servers
ansible.builtin.include_tasks: other_servers.yml
when: inventory_hostname in groups['rke2_servers'][1:]
# - name: Setup other servers
# ansible.builtin.include_tasks: other_servers.yml
# when: inventory_hostname in groups['rke2_servers'][1:]

- name: Configure Utilities
ansible.builtin.include_tasks: utilities.yml
when: configure_utilites | bool

Check failure on line 20 in roles/rke2_server/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint for push

20:34 [new-line-at-end-of-file] no new line character at the end of file
82 changes: 82 additions & 0 deletions roles/rke2_server/tasks/utilities.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# - name: Symlink crictl to /usr/local/bin
# ansible.builtin.file:
# src: "/var/lib/rancher/rke2/bin/crictl"
# dest: "/usr/local/bin/crictl"
# state: link

# - name: Symlink crictl config to /etc/crictl.yaml
# ansible.builtin.file:
# src: "/var/lib/rancher/rke2/agent/etc/crictl.yaml"
# dest: "/etc/crictl.yaml"
# state: link

# - name: Symlink ctr to /usr/local/bin
# ansible.builtin.file:
# src: "/var/lib/rancher/rke2/bin/ctr"
# dest: "/usr/local/bin/ctr"
# state: link

Check failure on line 18 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

18:1 [trailing-spaces] trailing spaces
# - name: Symlink kubectl to /usr/local/bin
# ansible.builtin.file:
# src: "/var/lib/rancher/rke2/bin/kubectl"
# dest: "/usr/local/bin/kubectl"
# state: link

Check failure on line 24 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

24:1 [trailing-spaces] trailing spaces
# - name: Create .kube directory in /root
# ansible.builtin.file:
# path: /root/.kube
# state: directory
# mode: '0750'

# - name: Symlink kubectl config to /root/.kube/config
# ansible.builtin.file:
# src: "/etc/rancher/rke2/rke2.yaml"
# dest: "/root/.kube/config"
# state: link

# - name: Check if Helm is installed
# stat:
# path: "/usr/local/bin/helm"
# register: helm_installed
# when:

Check failure on line 41 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

41:10 [trailing-spaces] trailing spaces
# - helm_tar_url is defined
# - helm_tar_url | length > 0

# - name: Get Helm version
# command: "/usr/local/bin/helm version"
# changed_when: false
# register: helm_installed_version
# when: helm_installed.stat.exists

- name: Install Helm Tar from URL

Check warning on line 51 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

51:1 [document-start] missing document start "---"
ansible.builtin.unarchive:
remote_src: yes #allow file to be pulled via https

Check warning on line 53 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

53:21 [comments] too few spaces before comment

Check warning on line 53 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

53:22 [comments] missing starting space in comment
src: "{{ helm_tar_url }}"
dest: "/usr/local/bin"
extra_opts:
- --strip=1
- --wildcards
- '*/helm'
when:

Check failure on line 60 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

60:8 [trailing-spaces] trailing spaces
# - not helm_installed.stat.exists
- helm_tar_url is defined
- helm_tar_url | length > 0

- name: Install Helm Binary from file
ansible.builtin.copy:
src: "{{ helm_binary_path }}"
dest: "/usr/local/bin/helm"
when:
- helm_binary_path is defined
- helm_binary_path | length > 0

- name: Set Helm permissions
ansible.builtin.file:
path: /usr/local/bin/helm
owner: root
group: root
mode: '0755'
when:
- (helm_tar_url is defined and helm_tar_url | length > 0) or
(helm_binary_path is defined and helm_binary_path | length > 0)

Check failure on line 82 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

82:3 [new-line-at-end-of-file] no new line character at the end of file

Check failure on line 82 in roles/rke2_server/tasks/utilities.yml

View workflow job for this annotation

GitHub Actions / Lint for push

82:1 [trailing-spaces] trailing spaces

0 comments on commit 158bf17

Please sign in to comment.