Skip to content

Commit

Permalink
Merge pull request #258 from stackhpc/fix/resolv
Browse files Browse the repository at this point in the history
Re-enable NetworkManager control of resolv.conf after image build
  • Loading branch information
sjpb authored Apr 13, 2023
2 parents f925f93 + a4f4e25 commit dcf2d1d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/fatimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ jobs:
. venv/bin/activate
. environments/.stackhpc/activate
cd packer/
packer init
packer init .
PACKER_LOG=1 packer build -only openstack.openhpc -on-error=ask -var-file=$PKR_VAR_environment_root/builder.pkrvars.hcl openstack.pkr.hcl
- name: Get created image name from manifest
id: manifest
run: |
. venv/bin/activate
IMAGE_ID=$(jq --raw-output '.builds[-1].artifact_id' packer-manifest.json)
IMAGE_ID=$(jq --raw-output '.builds[-1].artifact_id' packer/packer-manifest.json)
while ! openstack image show -f value -c name $IMAGE_ID; do
sleep 30
done
Expand Down
15 changes: 11 additions & 4 deletions ansible/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@
- name: Remove dnf caches
command: dnf clean all

# If image build happens on a Neutron subnet with property dns_namservers defined, then cloud-init
# disables NetworkManager's control of /etc/resolv.conf and appends nameservers itself.
# We don't want network configuration during instance boot to depend on the configuration
# of the network the builder was on, so we reset these aspects.
- name: Delete /etc/resolv.conf
# required as if cloud-init (rather than network manager) controls this on next boot it won't be entirely overrwritten
file:
path: /etc/resolv.conf
state: absent

- name: Delete any injected ssh config for rocky
- name: Reenable NetworkManager control of resolv.conf
file:
path: /home/rocky/.ssh/
path: /etc/NetworkManager/conf.d/99-cloud-init.conf
state: absent

- name: Delete any injected ssh config for ansible_user
file:
path: "/home/{{ ansible_user }}/.ssh/"
state: absent

- name: Run cloud-init cleanup
command: cloud-init clean --logs --seed

2 changes: 2 additions & 0 deletions ansible/fatimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
- name: unpack prometheus binaries
become: false
unarchive:
remote_src: yes
src: "/tmp/prometheus-{{ prometheus_version }}.linux-{{ go_arch }}.tar.gz"
dest: "/tmp"
creates: "/tmp/prometheus-{{ prometheus_version }}.linux-{{ go_arch }}/prometheus"
Expand Down Expand Up @@ -143,6 +144,7 @@
become: yes
gather_facts: no
tasks:
# - meta: end_here
- name: Cleanup image
import_tasks: cleanup.yml

Expand Down
2 changes: 1 addition & 1 deletion environments/.stackhpc/builder.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flavor = "vm.ska.cpu.general.small"
networks = ["a262aabd-e6bf-4440-a155-13dbc1b5db0e"] # WCDC-iLab-60
source_image_name = "openhpc-230221-1226-f5ba2db7.qcow2" # https://github.com/stackhpc/ansible-slurm-appliance/pull/250
source_image_name = "openhpc-230412-1447-e3769af6.qcow2" # https://github.com/stackhpc/ansible-slurm-appliance/pull/258
#source_image_name = "Rocky-8-GenericCloud-Base-8.7-20221130.0.x86_64.qcow2"
ssh_keypair_name = "slurm-app-ci"
security_groups = ["default", "SSH"]
Expand Down
2 changes: 1 addition & 1 deletion environments/.stackhpc/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variable "create_nodes" {
variable "cluster_image" {
description = "single image for all cluster nodes - a convenience for CI"
type = string
default = "openhpc-230221-1226-f5ba2db7.qcow2" # https://github.com/stackhpc/ansible-slurm-appliance/pull/250
default = "openhpc-230412-1447-e3769af6.qcow2" # https://github.com/stackhpc/ansible-slurm-appliance/pull/258
# default = "Rocky-8-GenericCloud-Base-8.7-20221130.0.x86_64.qcow2"
# default = "Rocky-8-GenericCloud-8.6.20220702.0.x86_64.qcow2"
}
Expand Down

0 comments on commit dcf2d1d

Please sign in to comment.