File tree Expand file tree Collapse file tree 6 files changed +40
-23
lines changed Expand file tree Collapse file tree 6 files changed +40
-23
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,10 @@ rke2_etcd_snapshot_file: ""
207207# Etcd snapshot location
208208rke2_etcd_snapshot_destination_dir : " {{ rke2_data_path }}/server/db/snapshots"
209209
210+ # (Optional) Etcd snapshot schedule
211+ # The schedule is in cron format, e.g. "0 */12 * * *"
212+ # rke2_etcd_snapshot_schedule: "0 */12 * * *"
213+
210214# Etcd snapshot s3 options
211215# Set either all these values or `rke2_etcd_snapshot_file` and `rke2_etcd_snapshot_source_dir`
212216
Original file line number Diff line number Diff line change @@ -315,6 +315,11 @@ argument_specs:
315315 default : " {{ rke2_data_path }}/server/db/snapshots"
316316 description : " Etcd snapshot location"
317317
318+ rke2_etcd_snapshot_schedule :
319+ type : str
320+ default : " 0 */6 * * *"
321+ description : " Etcd snapshot schedule in cron format"
322+
318323 rke2_etcd_snapshot_s3_options :
319324 type : dict
320325 required : false
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Download RKE2 kubeconfig to localhost
3+ ansible.builtin.fetch :
4+ src : /etc/rancher/rke2/rke2.yaml
5+ dest : " {{ rke2_download_kubeconf_path }}/{{ rke2_download_kubeconf_file_name }}"
6+ flat : yes
7+ when :
8+ - rke2_download_kubeconf | bool
9+ - inventory_hostname == groups[rke2_servers_group_name].0
10+
11+ - name : Replace loopback IP by master server IP
12+ ansible.builtin.replace :
13+ path : " {{ rke2_download_kubeconf_path }}/{{ rke2_download_kubeconf_file_name }}"
14+ mode : ' 0600'
15+ regexp : ' 127\.0\.0\.1|\[::1\]'
16+ replace : " {{ rke2_api_ip | default(hostvars[groups[rke2_servers_group_name].0].ansible_host) | ansible.utils.ipwrap }}"
17+ delegate_to : localhost
18+ become : false
19+ when :
20+ - not ansible_check_mode
21+ - rke2_download_kubeconf | bool
22+ - inventory_hostname == groups[rke2_servers_group_name].0
Original file line number Diff line number Diff line change 5858 - inventory_hostname == active_server or inventory_hostname == groups[rke2_servers_group_name].0
5959 - do_etcd_restore is defined or do_etcd_restore_from_s3 is defined
6060
61+ - name : Download kubeconfig to ansible localhost
62+ ansible.builtin.include_tasks : download_kubeconfig.yaml
63+ when :
64+ - rke2_download_kubeconf | bool
65+ - inventory_hostname == groups[rke2_servers_group_name].0
66+
6167- name : Prepare and join remaining nodes of the cluster
6268 ansible.builtin.include_tasks : remaining_nodes.yml
6369 when :
Original file line number Diff line number Diff line change 11---
2-
3- - name : Download RKE2 kubeconfig to localhost
4- ansible.builtin.fetch :
5- src : /etc/rancher/rke2/rke2.yaml
6- dest : " {{ rke2_download_kubeconf_path }}/{{ rke2_download_kubeconf_file_name }}"
7- flat : yes
8- when :
9- - rke2_download_kubeconf | bool
10- - inventory_hostname == groups[rke2_servers_group_name].0
11-
12- - name : Replace loopback IP by master server IP
13- ansible.builtin.replace :
14- path : " {{ rke2_download_kubeconf_path }}/{{ rke2_download_kubeconf_file_name }}"
15- mode : ' 0600'
16- regexp : ' 127\.0\.0\.1|\[::1\]'
17- replace : " {{ rke2_api_ip | default(hostvars[groups[rke2_servers_group_name].0].ansible_host) | ansible.utils.ipwrap }}"
18- delegate_to : localhost
19- become : false
20- when :
21- - not ansible_check_mode
22- - rke2_download_kubeconf | bool
23- - inventory_hostname == groups[rke2_servers_group_name].0
24-
252- name : Summary
263 when : inventory_hostname == groups[rke2_servers_group_name].0
274 block :
Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ node-label:
4444{% endfor %}
4545{% endif %}
4646snapshotter: {{ rke2_snapshotter }}
47+ {% if rke 2_etcd_snapshot_schedule is defined %}
48+ etcd-snapshot-schedule-cron: "{{ rke2_etcd_snapshot_schedule }}"
49+ {% endif %}
4750node-name: {{ rke2_node_name }}
4851{% if ( disable_kube_proxy | bool ) %}
4952disable-kube-proxy: true
You can’t perform that action at this time.
0 commit comments