Skip to content

Commit

Permalink
Merge pull request #224 from rancherfederal/219-automate-the-configur…
Browse files Browse the repository at this point in the history
…ation-of-kubectlctrcri

219 automate the configuration of kubectlctrcri
  • Loading branch information
aleiner authored May 22, 2024
2 parents 29809a3 + f3e2161 commit 5ebc8e7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions roles/rke2_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
- 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
25 changes: 25 additions & 0 deletions roles/rke2_server/tasks/utilities.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

- name: Add /var/lib/rancher/rke2/bin to PATH
ansible.builtin.lineinfile:
dest: "/root/.bashrc"
line: 'PATH=$PATH:/var/lib/rancher/rke2/bin'
insertafter: EOF

- 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: 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: "/var/lib/rancher/rke2/server/cred/admin.kubeconfig"
dest: "/root/.kube/config"
state: link

0 comments on commit 5ebc8e7

Please sign in to comment.