Skip to content

Commit

Permalink
Use AIO TF conf
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Welsh committed Mar 28, 2024
1 parent 9fb349f commit 84ef351
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 179 deletions.
49 changes: 29 additions & 20 deletions .github/workflows/overcloud-host-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ jobs:
with:
apt: git unzip nodejs python3-pip python3-venv openssh-server openssh-client jq

- name: Start the SSH service
run: |
sudo /etc/init.d/ssh start
continue-on-error: true
# - name: Start the SSH service
# run: |
# sudo /etc/init.d/ssh start
# continue-on-error: true

- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -101,29 +101,38 @@ jobs:

- name: Initialise terraform
run: terraform init
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/host-image-builder
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio

- name: Generate SSH keypair
run: ssh-keygen -f id_rsa -N ''
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/host-image-builder
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio

- name: Generate clouds.yaml
run: |
cat << EOF > clouds.yaml
${{ secrets.CLOUDS_YAML }}
EOF
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/host-image-builder

- name: Add tags to tfvars file
run: |
echo -e '\nhost_image_builder_tags = ${{ env.VM_TAGS }}' >> terraform.tfvars
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/host-image-builder
env:
VM_TAGS: '["skc-host-image-build", "ref=${{ github.ref_name }}"]'
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio

- name: Generate terraform.tfvars
run: |
cat << EOF > terraform.tfvars
ssh_public_key = "id_rsa.pub"
ssh_username = "rocky"
aio_vm_name = "skc-host-image-builder"
# Must be a Rocky Linux 9 host to successfully build all images
# This MUST NOT be an LVM image. It can cause confusing conficts with the built image.
aio_vm_image = "Rocky-9-GenericCloud-Base-9.3-20231113.0.x86_64.qcow2"
aio_vm_flavor = "en1.medium"
aio_vm_network = "stackhpc-ci"
aio_vm_subnet = "stackhpc-ci"
aio_vm_interface = "eth0"
EOF
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio

- name: Terraform Plan
run: terraform plan
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/host-image-builder
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio
env:
OS_CLOUD: "openstack"
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
Expand All @@ -143,7 +152,7 @@ jobs:
done
echo "Failed to create infrastructure after $attempt attempts"
exit 1
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/host-image-builder
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio
env:
OS_CLOUD: "openstack"
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
Expand All @@ -153,7 +162,7 @@ jobs:
id: tf_outputs
run: |
terraform output -json
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/host-image-builder
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio

- name: Write Terraform outputs
run: |
Expand Down Expand Up @@ -182,8 +191,8 @@ jobs:
run: |
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
cat src/kayobe-config/terraform/host-image-builder/id_rsa.pub >> ~/.ssh/authorized_keys
cp src/kayobe-config/terraform/host-image-builder/id_rsa* ~/.ssh/
cat src/kayobe-config/terraform/aio/id_rsa.pub >> ~/.ssh/authorized_keys
cp src/kayobe-config/terraform/aio/id_rsa* ~/.ssh/
- name: Bootstrap the control host
run: |
Expand Down Expand Up @@ -501,7 +510,7 @@ jobs:

- name: Destroy
run: terraform destroy -auto-approve
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/host-image-builder
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio
env:
OS_CLOUD: openstack
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
Expand Down
9 changes: 0 additions & 9 deletions terraform/host-image-builder/README.rst

This file was deleted.

7 changes: 0 additions & 7 deletions terraform/host-image-builder/outputs.tf

This file was deleted.

14 changes: 0 additions & 14 deletions terraform/host-image-builder/provider.tf

This file was deleted.

21 changes: 0 additions & 21 deletions terraform/host-image-builder/templates/userdata.cfg.tpl

This file was deleted.

10 changes: 0 additions & 10 deletions terraform/host-image-builder/terraform.tfvars

This file was deleted.

98 changes: 0 additions & 98 deletions terraform/host-image-builder/vm.tf

This file was deleted.

0 comments on commit 84ef351

Please sign in to comment.