You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If required, update your **Kiwi** instances in Ansible's inventory.
29
23
30
24
{{< alert color="warning" title="Important" >}}
31
25
Note that for the first-time installation, private IPs from the inventory are to replaced by the servers private ones (or anything in place which allows for bootstrapping machines).
32
26
{{< /alert >}}
33
27
34
-
The instances are now declared to be part of **kiwi** group and Ansible will use **ubuntu** local user account to connect through SSH.
35
-
36
-
Note that doing so, you can now safely:
37
-
38
-
- declare host-specific variables in **ansible/host_vars/10.50.101.{2,3}.yml** files.
39
-
- declare host-specific sensitive variables in **ansible/host_vars/10.50.101.{2,3}.sops.yml** file.
40
-
- declare **kiwi** group-specific variables in **ansible/group_vars/kiwi/main.yml** file.
41
-
- declare **kiwi** group-specific sensitive variables in **ansible/group_vars/kiwi.sops.yml** file.
42
-
- declare any other global variables in **ansible/group_vars/all/main.yml** file.
43
-
- declare any other global sensitive variables in **ansible/group_vars/all.sops.yml** file.
44
-
45
-
Note that Ansible variables precedence will apply:
46
-
47
-
```txt
48
-
role defaults < all vars < group vars < host vars < role vars
49
-
```
28
+
The instances are now declared to be part of **kiwi**, **kiwi_eu_west** and **eu_west** groups.
50
29
51
30
## Network Configuration
52
31
53
32
We'll instruct the Ansible collection to provision network settings through [Netplan](https://netplan.io/). Note that our example is pretty simple, with only a single network interface to be used for private LAN, no link aggregation being used (recommended for enterprise-grade setups).
54
33
55
-
Let's declare the following configuration in **ansible/inventories/host_vars/10.50.101.2.yml** file:
34
+
As the configuration is both instance-specific (private MAC address, IP address ...), region-specific (all **Kiwi** instance will do likely the same), and, as such, repetitive, we'll use some Ansible overlaying.
35
+
36
+
We've already declare quite a few stuff at region level when creating **eu-west** one.
37
+
38
+
Let's now extend the **ansible/inventories/group_vars/kiwi_eu_west/main.yml** file with the following:
You'll need to ensure that the MAC addresses and host and gateway IP addresses are correctly set, depending on your setup. Once done, you can do the same for the alternate **Kiwi** instance in **ansible/inventories/host_vars/10.50.101.2.yml** file.
60
+
As ugly as it looks, this Jinja macro will help us iterate over all the VLAN interfaces we need to create by simply taking a few instance-specific variables into consideration.
61
+
62
+
And that's exactly what we'll define in **ansible/inventories/host_vars/kiwi-eu-west-1** file:
You'll need to ensure that the MAC addresses and host and gateway IP addresses are correctly set, depending on your setup. Once done, you can do the same for the alternate **Kiwi** instance in **ansible/inventories/host_vars/kiwi-eu-west-2.yml** file.
97
75
98
76
Extend the **ansible/inventories/group_vars/kiwi/main.yml** file with the following to ensure generic settings are propagated to all **Kiwi** instances:
Note that setting **kowabunga_netplan_disable_cloud_init** is an optional step. If you'd like to keep whatever configuration cloud-init has previously set, it's all fine (but it's always recommended not to have dual sourc eof truth).
84
+
Note that setting **kowabunga_netplan_disable_cloud_init** is an optional step. If you'd like to keep whatever configuration cloud-init has previously set, it's all fine (but it's always recommended not to have dual source of truth).
107
85
{{< /alert >}}
108
86
109
87
## Network Failover
110
88
111
89
Each **Kiwi** instance configuration is now set to receive host-specific network configuration. But they are meant to work in an HA-cluster, so let's define some redundancy rules. The two instances respectively bind the **.2** and **.3** private IPs from each subnet, but our active router will be **.1**, so let's define network failover configuration for that.
112
90
113
-
Again, extend the **ansible/inventories/group_vars/kiwi/main.yml** file with the following configuration:
91
+
Again, extend the region-global **ansible/inventories/group_vars/kiwi_eu_west/main.yml** file with the following configuration:
Once again, we interate over **kowabunga_region_vlan_id_ranges** variable to create our global configuration for **eu-west** region. After all, both **Kiwi** instances from there will have the very same configuration.
112
+
150
113
This will ensure that VRRP packets flows between the 2 peers so one always ends up being the active router for each virtual network interface.
Let's now reflect these definitions into Kiwi's **ansible/inventories/group_vars/kiwi/main.yml** configuration file:
162
+
Let's now reflect some definitions into Kiwi's **ansible/inventories/group_vars/kiwi_eu_west/main.yml** configuration file:
210
163
211
164
```yaml
212
-
kowabunga_powerdns_locally_managed_zones:
213
-
- "{{ domain_name }}"
214
-
- "{{ admin_domain_name }}"
215
-
- "{{ storage_domain_name }}"
216
-
217
165
kowabunga_powerdns_locally_managed_zone_records:
218
-
- zone: "{{ domain_name }}"
219
-
name: kiwi
220
-
value: 10.50.101.1
221
166
- zone: "{{ storage_domain_name }}"
222
167
name: ceph
223
168
value: 10.50.102.11
@@ -250,7 +195,7 @@ Finally, let's take care of **Kiwi** agent. The agent will establish its secured
250
195
251
196
Now remember that we previously used TF to [register new Kiwi agents](/docs/admin-guide/create-region/#kiwi-instances-and-agents). Once applied, emails were sent for each instance with a set of agent identifier and API key. These values now have to be provided to Ansible, as these are going to be the credentials used by **Kiwi** agent to connect to **Kahuna**.
252
197
253
-
So let's edit each Kiwi instance secrets file in respectively **ansible/inventories/host_vars/10.50.101.{2,3}.sops.yml** files:
198
+
So let's edit each Kiwi instance secrets file in respectively **ansible/inventories/host_vars/kiwi-eu-west-{1,2}.sops.yml** files:
In this example, we've declared our 6 instances (1 global **Kahuna**, 2 **Kiwi** and 3 **Kaktus** from EU-WEST region and their respective associated private IP addresses (used to deploy through SSH).
50
+
51
+
They respectively belong to various groups, and we've also created sub-groups. This is a special Ansible trick which will allow us to inherit variables from group each instance belongs to.
52
+
53
+
In that regard, considering the example of **kaktus-eu-west1**, the instance will be assigned variables from possibly various files. You can then safely:
54
+
55
+
- declare host-specific variables in **ansible/host_vars/kaktus-wu-west-1.yml** file.
56
+
- declare host-specific sensitive variables in **ansible/host_vars/kaktus-eu-west-1.sops.yml** file.
57
+
- declare **kaktus_eu_west** group-specific variables in **ansible/group_vars/kaktus_eu_west/main.yml** file.
58
+
- declare **kaktus_eu_west** group-specific sensitive variables in **ansible/group_vars/kaktus_eu_west.sops.yml** file.
59
+
- declare **kaktus** group-specific variables in **ansible/group_vars/kaktus/main.yml** file.
60
+
- declare **kaktus** group-specific sensitive variables in **ansible/group_vars/kaktus.sops.yml** file.
61
+
- declare **eu_west** group-specific variables in **ansible/group_vars/kaktus/eu_west.yml** file.
62
+
- declare **eu_west** group-specific sensitive variables in **ansible/group_vars/eu_west.sops.yml** file.
63
+
- declare any other global variables in **ansible/group_vars/all/main.yml** file.
64
+
- declare any other global sensitive variables in **ansible/group_vars/all.sops.yml** file.
65
+
66
+
This way, instance can inherit variables from its global type (**kaktus**), its region (**eu_west**), and a mix of both (**kaktus_eu_west**).
67
+
68
+
Note that [Ansible variables precedence](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence) will apply:
69
+
70
+
```txt
71
+
role defaults < all vars < group vars < host vars < role vars
72
+
```
73
+
74
+
Let's take the time to also update the **ansible/inventories/group_vars/all/main.yml** file to update a few settings:
0 commit comments