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

Commit

Permalink
hostname and puppet script as template
Browse files Browse the repository at this point in the history
  • Loading branch information
smerleCB committed Jul 8, 2022
1 parent 49eeeca commit 0ff7e21
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
19 changes: 19 additions & 0 deletions cloudinit-updates-jenkins-io.tftpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#cloud-config
write_files:
- path: /run/puppetinstall/puppet.conf
owner: root:root
permissions: '0755'
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 ]
- [ mv, /run/puppetinstall/puppet.conf, /etc/puppetlabs/puppet/puppet.conf]
- [ systemctl, start, puppet ]
- [ systemctl, enable, puppet ]
7 changes: 5 additions & 2 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"
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 @@ -57,9 +58,11 @@ resource "oci_core_instance" "updates_jenkins_io" {
subnet_id = oci_core_subnet.public_subnet.id
assign_public_ip = false #will assign a non ephemeral one (RESERVED ip)
nsg_ids = [oci_core_network_security_group.updates_jenkins_io.id]
hostname_label = local.updates_jenkins_io_hostname
}
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"
freeform_tags = local.all_tags
Expand Down

0 comments on commit 0ff7e21

Please sign in to comment.