State ‘git.latest’ was not found in SLS ‘foobar’

You will need to yum install -y git for the git module to be available.

Advertisements

terraform iterate over string

ingress = “22:192.168.0.0/24:tcp,80:172.16.120.0/16:tcp,8080:0.0.0.0/0:tcp”
egress = “22:192.168.0.0/24:tcp,80:172.16.120.0/16:tcp,8081:127.0.0.0/0:udp”

resource “openstack_compute_secgroup_v2” “secgroup_1” {
name = “secgroup”
description = “my security group”

count = “${length(split(“,”,var.ingress))}”
rule {
from_port = “${element(split(“:”,element(split(“,”,var.ingress),count.index)), 0)}”
to_port = “${element(split(“:”,element(split(“,”,var.ingress),count.index)), 0)}”
ip_protocol = “${element(split(“:”,element(split(“,”,var.ingress),count.index)), 2)}”
cidr = “${element(split(“:”,element(split(“,”,var.ingress),count.index)), 1)}”
}
}

Note: This will create multiple security groups if you want single security group and multiple rules use following code:

resource “openstack_networking_secgroup_v2” “secgroup” {
name = “secgroup”
description = “My neutron security group”
}

 

resource “openstack_networking_secgroup_rule_v2” “secgroup_rule_ingress” {

count = “${length(split(“,”,var.ingress))}”
direction = “ingress”
ethertype = “IPv4”
protocol = “${element(split(“:”,element(split(“,”,var.ingress),count.index)), 2)}”
port_range_min = “${element(split(“:”,element(split(“,”,var.ingress),count.index)), 0)}”
port_range_max = “${element(split(“:”,element(split(“,”,var.ingress),count.index)), 0)}”
remote_ip_prefix = “${element(split(“:”,element(split(“,”,var.ingress),count.index)), 1)}”
security_group_id = “${openstack_networking_secgroup_v2.secgroup_1.id}”
}

resource “openstack_networking_secgroup_rule_v2” “secgroup_rule_egress” {

count = “${length(split(“,”,var.egress))}”
direction = “egress”
ethertype = “IPv4”
protocol = “${element(split(“:”,element(split(“,”,var.egress),count.index)), 2)}”
port_range_min = “${element(split(“:”,element(split(“,”,var.egress),count.index)), 0)}”
port_range_max = “${element(split(“:”,element(split(“,”,var.egress),count.index)), 0)}”
remote_ip_prefix = “${element(split(“:”,element(split(“,”,var.egress),count.index)), 1)}”
security_group_id = “${openstack_networking_secgroup_v2.secgroup_1.id}”
}

 

Jenkins – Publish Over SSH Plugin: How to copy directory

Problem:

I’m trying to use Jenkins’ Publish Over SSH plugin to copy all files AND sub-directories of some given directory, but so far, I’ve only able to copy files and NOT directory.

I have a directory named foo in my workspace, and during the build, I want to copy everything in this directory to a remote server. I’ve tried this pattern foo/**, but it doesn’t copy all sub-directories.

Solution:

For recursive copy of directory you should give

foo/**/*

Jenkins: publish over ssh does not put files to remote server

Problem:

I have strange issue on the latest Jenkins 1.634.
Publish over ssh writes to log that it puts correctly file but nothing appears on remote server.
e.g. I have logs
SSH: cd [var/www/data-fb-localtest]
SSH: OK
SSH: put [asm.js]
SSH: OK
SSH: put [asm.js.gz]
SSH: OK
SSH: put [hero.data]
SSH: OK
SSH: put [hero_main.js]
SSH: OK
SSH: cd [/home/dev]
SSH: OK
SSH: cd [var/www/data-fb-localtest/]
SSH: OK
SSH: put [achievements.exm]
SSH: OK
SSH: put [ai.exm]
SSH: OK
SSH: put [atlas0.atlas]
SSH: OK
SSH: put [atlas0.rgbz]
SSH: OK
but nothing appears in var/www/data-fb-localtest

 

Solution:

I found the issue. I do not set root remote directory and in publish task use absolute path. But plugin does use not absolute path but path relative to my user’s home directory