-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
- name: Create the /var/lib/rancher/rke2 config dir | ||
ansible.builtin.file: | ||
path: /var/lib/rancher/rke2 | ||
state: directory | ||
recurse: yes | ||
|
||
- name: Add config file | ||
vars: | ||
file_contents: "{{ lookup('file', kube_api_authn_webhook_file_path) }}" | ||
ansible.builtin.template: | ||
src: ansible_header.j2 | ||
dest: "/var/lib/rancher/rke2/kube-api-authn-webhook.yaml" | ||
mode: '0640' | ||
owner: root | ||
group: root | ||
when: | ||
- kube_api_authn_webhook_file_path is defined | ||
- kube_api_authn_webhook_file_path|length != 0 | ||
notify: Restart rke2-server | ||
|
||
- name: Remove config file | ||
when: | ||
- kube_api_authn_webhook_file_path is not defined or kube_api_authn_webhook_file_path|length == 0 | ||
block: | ||
- name: Check that the config file exists | ||
ansible.builtin.stat: | ||
path: "/var/lib/rancher/rke2/kube-api-authn-webhook.yaml" | ||
register: stat_result | ||
|
||
- name: "Check that the config file has ansible managed comments" | ||
ansible.builtin.lineinfile: | ||
name: "/var/lib/rancher/rke2/kube-api-authn-webhook.yaml" | ||
line: '## This is an Ansible managed file, contents will be overwritten ##' | ||
state: present | ||
check_mode: yes | ||
register: ansible_managed_check | ||
when: stat_result.stat.exists | bool is true | ||
|
||
- name: Remove the config file if exists and has ansible managed comments | ||
ansible.builtin.file: | ||
path: "/var/lib/rancher/rke2/kube-api-authn-webhook.yaml" | ||
state: absent | ||
when: | ||
- ansible_managed_check.changed | bool is false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Config | ||
clusters: | ||
- name: Default | ||
Check failure on line 5 in sample_files/kube-api-authn-webhook.yaml GitHub Actions / Lint for push
Check failure on line 5 in sample_files/kube-api-authn-webhook.yaml GitHub Actions / Lint for PR
|
||
cluster: | ||
insecure-skip-tls-verify: true | ||
server: http://127.0.0.1:6440/v1/authenticate | ||
users: | ||
- name: Default | ||
Check failure on line 10 in sample_files/kube-api-authn-webhook.yaml GitHub Actions / Lint for push
Check failure on line 10 in sample_files/kube-api-authn-webhook.yaml GitHub Actions / Lint for PR
|
||
user: | ||
insecure-skip-tls-verify: true | ||
current-context: webhook | ||
contexts: | ||
- name: webhook | ||
Check failure on line 15 in sample_files/kube-api-authn-webhook.yaml GitHub Actions / Lint for push
Check failure on line 15 in sample_files/kube-api-authn-webhook.yaml GitHub Actions / Lint for PR
|
||
context: | ||
user: Default | ||
cluster: Default |