-
Notifications
You must be signed in to change notification settings - Fork 2
/
outputs.tf
70 lines (64 loc) · 2.88 KB
/
outputs.tf
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
output "ansible_control_access_ip_v4" {
value = var.add_ansible_control_fip ? openstack_networking_floatingip_v2.ansible_control_fip[0].address : openstack_compute_instance_v2.ansible_control.access_ip_v4
}
output "seed_access_ip_v4" {
value = openstack_compute_instance_v2.seed.access_ip_v4
}
output "ssh_user" {
value = var.ssh_user
}
resource "local_file" "hosts" {
content = templatefile(
"${path.module}/templates/hosts.tpl",
{
compute_hostname = openstack_compute_instance_v2.compute.*.name
controller_hostname = openstack_compute_instance_v2.controller.*.name
ansible_control_hostname = openstack_compute_instance_v2.ansible_control.name
storage_hostname = openstack_compute_instance_v2.storage.*.name
seed_hostname = openstack_compute_instance_v2.seed.name
wazuh_manager_hostname = openstack_compute_instance_v2.wazuh_manager.*.name
}
)
filename = "ansible/files/hosts"
file_permission = "0644"
}
resource "local_file" "admin_networks" {
content = templatefile(
"${path.module}/templates/admin-oc-networks.tpl",
{
access_cidr = data.openstack_networking_subnet_v2.network.cidr
compute_hostname = openstack_compute_instance_v2.compute.*.name
controller_hostname = openstack_compute_instance_v2.controller.*.name
ansible_control_hostname = openstack_compute_instance_v2.ansible_control.name
ansible_control = openstack_compute_instance_v2.ansible_control.access_ip_v4
compute = openstack_compute_instance_v2.compute.*.access_ip_v4
controllers = openstack_compute_instance_v2.controller.*.access_ip_v4
storage_hostname = openstack_compute_instance_v2.storage.*.name
storage = openstack_compute_instance_v2.storage.*.access_ip_v4
seed_hostname = openstack_compute_instance_v2.seed.name
seed = openstack_compute_instance_v2.seed.access_ip_v4
wazuh_manager_hostname = openstack_compute_instance_v2.wazuh_manager.*.name
wazuh_manager = openstack_compute_instance_v2.wazuh_manager.*.access_ip_v4
}
)
filename = "ansible/files/admin-oc-networks.yml"
file_permission = "0644"
}
resource "local_file" "openstack_inventory" {
content = templatefile(
"${path.module}/templates/openstack-inventory.tpl",
{
seed_addr = openstack_compute_instance_v2.seed.access_ip_v4,
ssh_user = var.ssh_user
}
)
filename = "ansible/files/openstack-inventory"
file_permission = "0644"
}
resource "ansible_host" "control_host" {
name = var.add_ansible_control_fip ? openstack_networking_floatingip_v2.ansible_control_fip[0].address : openstack_compute_instance_v2.ansible_control.access_ip_v4
groups = ["ansible_control"]
variables = {
ansible_user = var.ssh_user
}
}