I am hoping that someone might be able to help me. I have a puppet script with some bash code inside it. I am trying to get the output of some echo commands to show in the puppet output so that I can see the order that the bash script is running.
The script looks like this:
# Add an XFRM interface
$xfrm_config = @("xfrm-config")
#!/usr/bin/env bash
set -x
# Only configure `xfrm0` on the event that `eth0` has been configured
if [ "${IFACE}" = "eth0" ] && [ "${STATE}" = "routable" ] && [ "${AdministrativeState}" = "configured" ] && [ "${OperationalState}" = "routable" ]; then
# Remove the adapter if it already exists
if ip link show xfrm0 > /dev/null 2>&1; then
ip link delete xfrm0
echo "step 1"
fi
# Add and activate the adapter, IP, and route
ip link add xfrm0 type xfrm dev eth0 if_id 0xabcd
echo "step 2"
ip address add ${host_server_net_mesh_vpn_ipv4_address}/32 dev xfrm0
echo "step 3"
ip link set xfrm0 up
echo "step 4"
ip route add ${peer_server_net_mesh_vpn_ipv4_address}/32 dev xfrm0
echo "step 5"
fi
| xfrm-config
file { $xfrm_config_path:
ensure => file,
owner => 'root',
group => 'root',
mode => '0755',
content => $xfrm_config,
}
~> exec { 'add-xfrm-interface':
command => $xfrm_config_path,
path => '/usr/bin',
provider => 'shell',
environment => ['IFACE=eth0', 'STATE=routable', 'AdministrativeState=configured', 'OperationalState=routable'],
logoutput => true,
}
If anyone has any ideas on how I can get the echos commands and the bash debug to show when I am running the puppet command to run this script it would be greatly appreciated. Thank you.
4