-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ability to configure ACE in downstream / #104
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
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
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Config | ||
clusters: | ||
- name: Default | ||
cluster: | ||
insecure-skip-tls-verify: true | ||
server: http://127.0.0.1:6440/v1/authenticate | ||
users: | ||
- name: Default | ||
user: | ||
insecure-skip-tls-verify: true | ||
current-context: webhook | ||
contexts: | ||
- name: webhook | ||
context: | ||
user: Default | ||
cluster: Default |
3619026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the kube-api-authn-webhook.yaml file something a user will ever have to change? if it's a static file, why not bake it in as a content so that a user doesn't have to either reference the sample file or copy it to their config directory?