如何使用Augeas和Puppet将导出语句添加到bash_概要文件

如何使用Augeas和Puppet将导出语句添加到bash_概要文件,puppet,augeas,Puppet,Augeas,我让Puppet+Augeas在bash_配置文件中分配变量值,但是我没有找到从文件中导出变量的方法 augeas { "bash_profile-${user}-${name}": incl => "/home/${user}/.bash_profile", lens => 'Shellvars.lns', changes => "set ${variable_name} '\"${literal_value}\"'", } 结果

我让Puppet+Augeas在bash_配置文件中分配变量值,但是我没有找到从文件中导出变量的方法

  augeas { "bash_profile-${user}-${name}":
    incl    => "/home/${user}/.bash_profile",
    lens    => 'Shellvars.lns',
    changes => "set ${variable_name} '\"${literal_value}\"'",
  }
结果:

# .bash_profile 
variable="value"
但我需要的是:

# .bash_profile 
export variable="value"
# or
variable="value"
export variable

这似乎应该指向正确的方向,但我不知道如何编写导出语句这似乎起到了作用:

  augeas { "bash_profile-${user}-${name}":
    incl    => "/home/${user}/.bash_profile",
    lens    => 'Shellvars.lns',
    changes => [
      "set ${variable_name} '\"${literal_value}\"'",
      "set ${variable_name}/export ''",
      ],
  }
该项目具有以下特点:

shellvar { "bash_profile-${user}-${name}":
  ensure   => exported,
  target   => "/home/${user}/.bash_profile",
  variable => $variable_name,
  value    => $literal_value,
}

还有管理引用或数组值的选项。

您是否考虑过直接使用
.erb
提供内容来管理文件?我会的,但我不想覆盖现有内容-我下次会查看这些内容