-
Notifications
You must be signed in to change notification settings - Fork 0
/
03-rancher-downstream.yml
49 lines (46 loc) · 1.54 KB
/
03-rancher-downstream.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
- name: Deploy Rancher config with Terraform
hosts: localhost
tags: rancher, terraform
tasks:
- name: Bootstrap cluster with Terraform
cloud.terraform.terraform:
project_path: "{{ lookup('env', 'PWD') }}/terraform/rancher"
state: present
force_init: true
variables_files:
- "{{ lookup('env', 'PWD') }}/terraform/rancher/env/vars.tfvars"
variables:
rancher_bootstrap_password: "{{ rancher_bootstrap_password }}"
rancher_users: "{{ terraform_rancher_users | to_json }}"
register: rancher_terraform
- name: Set up downstream clusters
hosts: downstream
tags: downstream, rancher
tasks:
- name: Run node command
become: true
ansible.builtin.shell: |
set -o pipefail
{{ hostvars['localhost']['rancher_terraform']['outputs']['rancher_cluster_node_commands']['value'][rancher_cluster_name] }} \
{{ rancher_node_command_args | default('--etcd --controlplane --worker') }}
args:
creates: /etc/rancher/rke2
executable: /bin/bash
- name: Remove local-path as default storage class
hosts: downstream
tags: downstream, rancher
tasks:
- name: Remove local-path as storage class
become: true
kubernetes.core.k8s:
kubeconfig: "{{ kubeconfig_path }}"
kind: "StorageClass"
api_version: "storage.k8s.io/v1"
name: "local-path"
state: absent
register: local_path_storage_class
until: local_path_storage_class is not failed
retries: 60
delay: 10
...