Skip to content

Commit b257275

Browse files
committed
Tidy up of the code for the infrastructure deployment.
1 parent 6b8eb6f commit b257275

17 files changed

+10
-697
lines changed

group_vars/openstack.yml

-14
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,4 @@ terraform_project_path: "{{ playbook_dir }}"
2323
# Valid values are 'present' and 'absent'
2424
terraform_state: "{{ cluster_state | default('present') }}"
2525

26-
# The user that should be used to SSH to the cluster hosts
27-
cluster_ssh_user: "{{ 'cloud-user' if multinode_image == 'rocky9-lvm' else 'ubuntu' }}"
28-
ssh_user: "{{ 'cloud-user' if multinode_image == 'rocky9-lvm' else 'ubuntu' }}"
2926

30-
tf_files: []
31-
#- outputs.tf
32-
#- variables.tf
33-
# - authentication.tf
34-
# - compute_instances.tf
35-
# - data.tf
36-
# - versions.tf
37-
# - volumes.tf
38-
# - terraform.tfvars
39-
40-
# Assign the ansible ssh public key from the ansible runner's generated ssh key

multinode-infra-app.yml

+7-44
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@
1616
src: "{{ playbook_dir }}/templates/userdata.cfg.tpl.j2"
1717
dest: "{{ playbook_dir }}/templates/userdata.cfg.tpl"
1818

19-
# Provision the infrastructure
20-
# The CaaS puts hosts for accessing the OpenStack API into the 'openstack' group
19+
# Provision the infrastructure The CaaS puts hosts for accessing the OpenStack
20+
# API into the 'openstack' group
2121
- hosts: openstack
2222
roles:
2323
- cluster_infra
2424

2525
- hosts: localhost
2626
tasks:
27-
# Check whether an ans_vlt_pwd variable is defined and if so, save it into a file called '~/vault.password'. If it doesn't exist, create a the '~/vault.password' file with ans_vlt_pwd = "password_not_set" as the password.
27+
# Check whether an ans_vlt_pwd variable is defined and if so, save it into a
28+
# file called '~/vault.password'. If it doesn't exist, create a the
29+
# '~/vault.password' file with ans_vlt_pwd = "password_not_set" as the
30+
# password.
2831
- name: Create vault password file
2932
vars:
3033
ans_dflt: 'default_password'
@@ -33,37 +36,6 @@
3336
dest: "~/vault.password"
3437
mode: 0600
3538

36-
# - block:
37-
# # Install the ansible requirements
38-
# - name: Install ansible posix
39-
# command: ansible-galaxy collection install ansible.posix
40-
41-
# # Install the ansible requirements
42-
# - name: Install ansible community general
43-
# command: ansible-galaxy collection install community.general
44-
45-
# # Install the ansible requirements
46-
# - name: Install ansible requirements
47-
# command: ansible-galaxy install -r ansible/requirements.yml
48-
49-
50-
# - name: Deploy ansible playbook manually
51-
# command: ansible-playbook -i ansible/inventory.yml ansible/configure-hosts.yml
52-
# vars:
53-
# terraform_binary_directory: "{{ playbook_dir }}/../bin"
54-
# terraform_binary_path: "{{ terraform_binary_directory }}/../terraform"
55-
# terraform_project_path: "{{ playbook_dir }}"
56-
57-
# - debug: var=outputs
58-
# vars:
59-
# outputs:
60-
# cluster_access_ip: "{{ hostvars[groups['openstack'][0]].cluster_gateway_ip }}"
61-
62-
# - name: Debug groups
63-
# debug:
64-
# msg: "{{ groups | to_yaml }}"
65-
# when: cluster_state != "absent"
66-
6739
# If openstack_deploy is true then continue if not end the playbook.
6840

6941
# Import the playbook to start configuring the multi-node hosts.
@@ -82,16 +54,7 @@
8254
cmd: "bash ~/deploy-openstack.sh"
8355
when: openstack_deploy == true
8456

85-
86-
# - hosts: ansible_control
87-
# vars:
88-
# ansible_pipelining: true
89-
# ansible_ssh_pipelining: true
90-
# tasks:
91-
# - name: Deploy OpenStack.
92-
# ansible.builtin.shell:
93-
# cmd: "./deploy-openstack.sh"
94-
57+
# This is to get the ip of the ansible-controller host.
9558
- hosts: localhost
9659
tasks:
9760
- debug: var=outputs

outputs.tf

+2-19
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,6 @@ resource "local_file" "admin_networks" {
5353
file_permission = "0644"
5454
}
5555

56-
# output "cluster_nodes" {
57-
# description = "A list of the cluster nodes and their IP addresses which will be used by the Ansible inventory"
58-
# value = [{
59-
# name = openstack_compute_instance_v2.ansible_control.name
60-
# ip = openstack_compute_instance_v2.ansible_control.access_ip_v4
61-
# groups = ["multinode_ansible_control"]
62-
# }]
63-
# }
64-
65-
# flatten([
66-
# for node in openstack_compute_instance_v2.compute: {
67-
# name = node.name
68-
# ip = node.access_ip_v4
69-
# groups = ["compute"]
70-
# }
71-
# ])
72-
# }
73-
7456
resource "local_file" "openstack_inventory" {
7557
content = templatefile(
7658
"${path.module}/templates/openstack-inventory.tpl",
@@ -151,7 +133,8 @@ output "cluster_nodes" {
151133
)
152134
}
153135

154-
# For Backup
136+
# Template of all the hosts' configuration which can be used to generate Ansible varables.
137+
155138
# resource "ansible_host" "control_host" {
156139
# name = openstack_compute_instance_v2.ansible_control.access_ip_v4
157140
# groups = ["ansible_control"]

roles/cluster_infra/tasks/main.yml

-12
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@
3737
- cluster_upgrade_system_packages is not defined or not cluster_upgrade_system_packages
3838

3939

40-
- name: Template Terraform files into project directory
41-
template:
42-
src: "{{ item }}.j2"
43-
dest: "{{ terraform_project_path }}/{{ item }}"
44-
loop: "{{ tf_files }}"
45-
46-
#- name: Copy Terraform files into project directory
47-
# ansible.builtin.copy:
48-
# src: "{{ item }}.tf"
49-
# dest: "{{ terraform_project_path }}/{{ item }}.tf"
50-
# loop: "{{ query('fileglob', '../../../*') }}"
51-
5240
- name: Provision infrastructure
5341
include_role:
5442
name: stackhpc.terraform.infra

roles/cluster_infra/templates/authentication.tf.j2

-4
This file was deleted.

roles/cluster_infra/templates/compute_instances.tf.j2

-160
This file was deleted.

roles/cluster_infra/templates/data.tf.j2

-8
This file was deleted.

0 commit comments

Comments
 (0)