Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Fix(update.jenkins.io) add hostname and templatize puppet #17

Merged
merged 8 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions cloudinit-updates-jenkins-io.tftpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#cloud-config
write_files:
# Configuration file for puppet agent on this VM (${hostname})
# Not directly at the destination path as it would get the the puppet package installation stuck (asking to override)
# Also, when writing files, do not use /tmp dir as it races with systemd-tmp. Use /run/<somedir> instead (as per. : https://cloudinit.readthedocs.io/en/latest/topics/modules.html#runcmd)
- path: /run/puppetinstall/puppet.conf
smerle33 marked this conversation as resolved.
Show resolved Hide resolved
owner: root:root
permissions: '0640'
content: |
[main]
server = puppet.jenkins.io
[agent]
certname = ${hostname}
runcmd:
- [ mkdir, -p, /run/puppetinstall ]
- [ wget, "https://apt.puppetlabs.com/puppet6-release-focal.deb", -O, /run/puppetinstall/puppet6-release-focal.deb ]
- [ dpkg, -i, /run/puppetinstall/puppet6-release-focal.deb ]
- [ apt-get, update, -y ]
- [ apt-get, install, "puppet-agent=6.23.0*", --yes, --quiet, --no-install-recommends ]
smerle33 marked this conversation as resolved.
Show resolved Hide resolved
# Pin package version to avoid agent newer than the puppetmaster
- [ apt-mark, hold, puppet-agent]
# see above comment in the "write_files" section
- [ mv, /run/puppetinstall/puppet.conf, /etc/puppetlabs/puppet/puppet.conf]
- [ systemctl, enable, puppet ]
- [ systemctl, start, puppet ]
8 changes: 5 additions & 3 deletions updates.jenkins.io.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
data "oci_core_images" "updates_jenkins_io" {
compartment_id = var.compartment_ocid
operating_system = "Canonical Ubuntu"
operating_system_version = "22.04"
operating_system_version = "20.04"
smerle33 marked this conversation as resolved.
Show resolved Hide resolved
state = "AVAILABLE"
shape = local.updates_jenkins_io_shape
sort_by = "TIMECREATED"
sort_order = "DESC"
}

locals {
updates_jenkins_io_shape = "VM.Standard.A1.Flex" #imply ARM
updates_jenkins_io_shape = "VM.Standard.A1.Flex" #imply ARM
updates_jenkins_io_hostname = "oracle.updates.jenkins.io"
}

resource "oci_core_volume_backup_policy" "updates_jenkins_io" {
Expand Down Expand Up @@ -60,8 +61,9 @@ resource "oci_core_instance" "updates_jenkins_io" {
}
metadata = {
ssh_authorized_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGFrPRIlP8qplANgNa3IO5c1gh0ZqNNj17RZeYcm+Jcb jenkins-infra-team@googlegroups.com"
user_data = base64encode(templatefile("./cloudinit-updates-jenkins-io.tftpl", { hostname = "${local.updates_jenkins_io_hostname}" }))
}
display_name = "Virtual Machine for updates.jenkins.io service"
display_name = local.updates_jenkins_io_hostname
freeform_tags = local.all_tags
}

Expand Down