Skip to content

Commit 0856624

Browse files
authored
Merge pull request #237 from stackhpc/feat/remove-cloud-init
Remove cloud_init role
2 parents f47c982 + a43f8b7 commit 0856624

File tree

16 files changed

+53
-142
lines changed

16 files changed

+53
-142
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/bootstrap.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,8 @@
1818
tags: etc_hosts
1919
become: yes
2020
tasks:
21-
- name: Template /etc/hosts
22-
copy:
23-
content: "{{ etc_hosts_template }}"
24-
dest: /etc/hosts
25-
owner: root
26-
group: root
27-
mode: u=rw,og=r
21+
- import_role:
22+
name: etc_hosts
2823

2924
- hosts: cluster
3025
gather_facts: false

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.

ansible/roles/etc_hosts/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# etc_hosts
22

3-
This role provides documentation only.
3+
Hosts in the `etc_hosts` groups have `/etc/hosts` created. The generated file defines all hosts in this group using `ansible_host` as the IP address and `inventory_hostname` as the canonical hostname. This may need overriding for multi-homed hosts. See `environments/common/inventory/group_vars/all/cloud_init.yml` for configuration.
44

5-
Hosts in the `etc_hosts` groups get `/etc/hosts` created via `cloud-init`. The generated file defines all hosts in this group using `ansible_host` as the IP address and `inventory_hostname` as the canonical hostname. This may need overriding for multi-homed hosts. See `environments/common/inventory/group_vars/all/cloud_init.yml` for configuration.
5+
# Variables:
6+
7+
- `etc_hosts_template`: Template file to use. Default uses in-role template.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
etc_hosts_template: hosts.j2
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- name: Template out /etc/hosts
2+
template:
3+
src: "{{ etc_hosts_template }}"
4+
dest: /etc/hosts
5+
owner: root
6+
group: root
7+
mode: 0644
8+
become: yes
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
2+
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
3+
4+
{% for hostname in groups['etc_hosts'] | sort -%}
5+
{{ hostvars[hostname]['ansible_host'] }} {{ hostname }}
6+
{% endfor -%}

environments/arcus/terraform/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,7 @@ module "cluster" {
5757
create_nodes = var.create_nodes
5858

5959
environment_root = var.environment_root
60+
# Can reduce volume size a lot for short-lived CI clusters:
61+
state_volume_size = 10
62+
home_volume_size = 20
6063
}

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

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

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

Lines changed: 0 additions & 24 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: ${var.state_volume_device_path}
118+
partition: auto
119+
- label: home
120+
filesystem: ext4
121+
device: ${var.home_volume_device_path}
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

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ variable "environment_root" {
4949
description = "Path to environment root, automatically set by activate script"
5050
}
5151

52+
variable "state_volume_device_path" {
53+
type = string
54+
description = "Path to block device for state"
55+
default = "/dev/sdb"
56+
}
57+
58+
variable "home_volume_device_path" {
59+
type = string
60+
description = "Path to block device name for home directories"
61+
default = "/dev/sdc"
62+
}
63+
5264
variable "state_dir" {
5365
type = string
5466
description = "Path to state directory on control node"

0 commit comments

Comments
 (0)