Skip to content

Commit da54345

Browse files
committed
create cloudinit userdata directly in terraform
1 parent edd67e1 commit da54345

File tree

9 files changed

+17
-110
lines changed

9 files changed

+17
-110
lines changed

.github/workflows/stackhpc.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,13 @@ jobs:
5353
shell: bash
5454
env:
5555
arcus_CLOUDS_YAML: ${{ secrets.ARCUS_CLOUDS_YAML }}
56-
57-
- name: Provision ports, inventory and other infrastructure apart from nodes
58-
run: |
59-
. venv/bin/activate
60-
. environments/${{ matrix.cloud }}/activate
61-
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
62-
TF_VAR_create_nodes=false terraform apply -auto-approve
63-
56+
6457
- name: Setup environment-specific inventory/terraform inputs
6558
run: |
6659
. venv/bin/activate
6760
. environments/${{ matrix.cloud }}/activate
6861
ansible-playbook ansible/adhoc/generate-passwords.yml
6962
echo vault_testuser_password: "$TESTUSER_PASSWORD" > $APPLIANCES_ENVIRONMENT_ROOT/inventory/group_vars/all/test_user.yml
70-
ansible-playbook ansible/adhoc/template-cloud-init.yml
7163
env:
7264
TESTUSER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
7365

ansible/roles/cloud_init/README.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

ansible/roles/cloud_init/defaults/main.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

ansible/roles/cloud_init/tasks/template.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

ansible/roles/cloud_init/templates/userdata.yml.j2

Lines changed: 0 additions & 13 deletions
This file was deleted.

environments/common/inventory/group_vars/all/cloud_init.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

environments/skeleton/{{cookiecutter.environment}}/inventory/group_vars/all/cloud_init.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

environments/skeleton/{{cookiecutter.environment}}/terraform/control.userdata.tpl

Lines changed: 0 additions & 14 deletions
This file was deleted.

environments/skeleton/{{cookiecutter.environment}}/terraform/nodes.tf

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,26 @@ resource "openstack_compute_instance_v2" "control" {
109109
environment_root = var.environment_root
110110
}
111111

112-
user_data = fileexists(format(local.user_data_path, "control")) ? file(format(local.user_data_path, "control")) : null
112+
user_data = <<-EOF
113+
#cloud-config
114+
fs_setup:
115+
- label: state
116+
filesystem: ext4
117+
device: /dev/vdb
118+
partition: auto
119+
- label: home
120+
filesystem: ext4
121+
device: /dev/vdc
122+
partition: auto
123+
124+
mounts:
125+
- [LABEL=state, ${var.state_dir}]
126+
- [LABEL=home, /exports/home, auto, "x-systemd.required-by=nfs-server.service,x-systemd.before=nfs-server.service"]
127+
EOF
113128

114129
lifecycle{
115130
ignore_changes = [
116131
image_name,
117-
user_data,
118132
]
119133
}
120134

@@ -138,12 +152,9 @@ resource "openstack_compute_instance_v2" "login" {
138152
environment_root = var.environment_root
139153
}
140154

141-
user_data = fileexists(format(local.user_data_path, each.key)) ? file(format(local.user_data_path, each.key)) : null
142-
143155
lifecycle{
144156
ignore_changes = [
145157
image_name,
146-
user_data,
147158
]
148159
}
149160

@@ -167,12 +178,9 @@ resource "openstack_compute_instance_v2" "compute" {
167178
environment_root = var.environment_root
168179
}
169180

170-
user_data = fileexists(format(local.user_data_path, each.key)) ? file(format(local.user_data_path, each.key)) : null
171-
172181
lifecycle{
173182
ignore_changes = [
174183
image_name,
175-
user_data,
176184
]
177185
}
178186

0 commit comments

Comments
 (0)