Merge pull request #3232 from vespian/ansible_provisioner_empty_groups_support
Add empty_groups param to ansible provisioner
This commit is contained in:
commit
da1e9f4976
|
@ -43,6 +43,7 @@ type Config struct {
|
|||
// The main playbook file to execute.
|
||||
PlaybookFile string `mapstructure:"playbook_file"`
|
||||
Groups []string `mapstructure:"groups"`
|
||||
EmptyGroups []string `mapstructure:"empty_groups"`
|
||||
HostAlias string `mapstructure:"host_alias"`
|
||||
LocalPort string `mapstructure:"local_port"`
|
||||
SSHHostKeyFile string `mapstructure:"ssh_host_key_file"`
|
||||
|
@ -213,6 +214,10 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
|||
fmt.Fprintf(w, "[%s]\n%s", group, host)
|
||||
}
|
||||
|
||||
for _, group := range p.config.EmptyGroups {
|
||||
fmt.Fprintf(w, "[%s]\n", group)
|
||||
}
|
||||
|
||||
if err := w.Flush(); err != nil {
|
||||
tf.Close()
|
||||
return fmt.Errorf("Error preparing inventory file: %s", err)
|
||||
|
|
|
@ -51,6 +51,9 @@ Optional Parameters:
|
|||
should be placed. When unspecified, the host is not associated with any
|
||||
groups.
|
||||
|
||||
- `empty_groups` (array of strings) - The groups which should be present in
|
||||
inventory file but remain empty.
|
||||
|
||||
- `host_alias` (string) - The alias by which the Ansible host should be known.
|
||||
Defaults to `default`.
|
||||
|
||||
|
|
Loading…
Reference in New Issue