types

package
v2.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasMoreThanOneTrue

func HasMoreThanOneTrue(vals ...bool) bool

HasMoreThanOneTrue checks if a list of booleans contains more than one true value.

func NewAnsibleSSHSettingsSchema

func NewAnsibleSSHSettingsSchema() *schema.Schema

NewAnsibleSSHSettingsSchema returns a new AnsibleSSHSettings schema.

func NewDefaultsSchema

func NewDefaultsSchema() *schema.Schema

NewDefaultsSchema returns a new defaults schema.

func NewGalaxyInstallSchema

func NewGalaxyInstallSchema() *schema.Schema

NewGalaxyInstallSchema returns a new Ansible Galaxy schema for the install operation.

func NewModuleSchema

func NewModuleSchema() *schema.Schema

NewModuleSchema return a new Ansible module schema.

func NewPlaySchema

func NewPlaySchema() *schema.Schema

NewPlaySchema returns a new play schema.

func NewPlaybookSchema

func NewPlaybookSchema() *schema.Schema

NewPlaybookSchema returns a new Ansible playbook schema.

func NewRemoteSchema

func NewRemoteSchema() *schema.Schema

NewRemoteSchema returns a new remote schema.

func ResolveDirectory

func ResolveDirectory(path string) (string, error)

ResolveDirectory checks if a path exists and is a directory.

func ResolvePath

func ResolvePath(path string) (string, error)

ResolvePath checks if a path exists.

func VfPathDirectory

func VfPathDirectory(val interface{}, key string) (warns []string, errs []error)

VfPathDirectory validates existence of a path and that the path is a directory.

Types

type AnsibleSSHSettings

type AnsibleSSHSettings struct {
	// contains filtered or unexported fields
}

AnsibleSSHSettings represents Ansible process SSH settings.

func NewAnsibleSSHSettingsFromInterface

func NewAnsibleSSHSettingsFromInterface(i interface{}, ok bool) *AnsibleSSHSettings

NewAnsibleSSHSettingsFromInterface reads AnsibleSSHSettings configuration from Terraform schema.

func (*AnsibleSSHSettings) BastionUserKnownHostsFile

func (v *AnsibleSSHSettings) BastionUserKnownHostsFile() string

BastionUserKnownHostsFile returns a path to the user known hosts file for the bastion host.

func (*AnsibleSSHSettings) ConnectAttempts

func (v *AnsibleSSHSettings) ConnectAttempts() int

ConnectAttempts reutrn Ansible process SSH connection attempt count.

func (*AnsibleSSHSettings) ConnectTimeoutSeconds

func (v *AnsibleSSHSettings) ConnectTimeoutSeconds() int

ConnectTimeoutSeconds reutrn Ansible process SSH connection timeout.

func (*AnsibleSSHSettings) InsecureBastionNoStrictHostKeyChecking

func (v *AnsibleSSHSettings) InsecureBastionNoStrictHostKeyChecking() bool

InsecureBastionNoStrictHostKeyChecking if true, SSH to the bastion host uses -o StrictHostKeyChecking=no.

func (*AnsibleSSHSettings) InsecureNoStrictHostKeyChecking

func (v *AnsibleSSHSettings) InsecureNoStrictHostKeyChecking() bool

InsecureNoStrictHostKeyChecking if true, SSH to the target host uses -o StrictHostKeyChecking=no.

func (*AnsibleSSHSettings) SSHKeyscanSeconds

func (v *AnsibleSSHSettings) SSHKeyscanSeconds() int

SSHKeyscanSeconds reutrn Ansible process SSH keyscan timeout.

func (*AnsibleSSHSettings) SetOverrideStrictHostKeyChecking

func (v *AnsibleSSHSettings) SetOverrideStrictHostKeyChecking()

SetOverrideStrictHostKeyChecking is used by the provisioner when attached to a null_resource

func (*AnsibleSSHSettings) UserKnownHostsFile

func (v *AnsibleSSHSettings) UserKnownHostsFile() string

UserKnownHostsFile returns a path to the user known hosts file for the target host.

type Defaults

type Defaults struct {
	// contains filtered or unexported fields
}

Defaults represents default settings for each consequent play.

func NewDefaultsFromInterface

func NewDefaultsFromInterface(i interface{}, ok bool) *Defaults

NewDefaultsFromInterface reads Defaults configuration from Terraform schema.

func NewDefaultsFromMapInterface

func NewDefaultsFromMapInterface(vals map[string]interface{}, ok bool) *Defaults

NewDefaultsFromMapInterface reads Defaults configuration from a map.

func (*Defaults) BecomeMethod

func (v *Defaults) BecomeMethod() string

BecomeMethod returns become method.

func (*Defaults) BecomeUser

func (v *Defaults) BecomeUser() string

BecomeUser returns become user.

func (*Defaults) Hosts

func (v *Defaults) Hosts() []string

Hosts returns default hosts.

type GalaxyInstall

type GalaxyInstall struct {
	// contains filtered or unexported fields
}

GalaxyInstall represents ansible-galaxy settings.

func NewGalaxyInstallFromInterface

func NewGalaxyInstallFromInterface(i interface{}) *GalaxyInstall

NewGalaxyInstallFromInterface reads Ansible Galaxy install configuration from Terraform schema.

func (*GalaxyInstall) Force

func (v *GalaxyInstall) Force() bool

Force is the ansible-galaxy install --force flag.

func (*GalaxyInstall) IgnoreCerts

func (v *GalaxyInstall) IgnoreCerts() bool

IgnoreCerts is the ansible-galaxy --ignore-certs flag.

func (*GalaxyInstall) IgnoreErrors

func (v *GalaxyInstall) IgnoreErrors() bool

IgnoreErrors is the ansible-galaxy install --ignore-errors flag.

func (*GalaxyInstall) KeepScmMeta

func (v *GalaxyInstall) KeepScmMeta() bool

KeepScmMeta is the ansible-galaxy install --keep-scm-meta flag.

func (*GalaxyInstall) NoDeps

func (v *GalaxyInstall) NoDeps() bool

NoDeps is the ansible-galaxy install --no-deps flag.

func (*GalaxyInstall) RoleFile

func (v *GalaxyInstall) RoleFile() string

RoleFile ansible-galaxy install --role-file.

func (*GalaxyInstall) RolesPath

func (v *GalaxyInstall) RolesPath() string

RolesPath ansible-galaxy install --roles-path.

func (*GalaxyInstall) Server

func (v *GalaxyInstall) Server() string

Server is the ansible-galaxy --server.

func (*GalaxyInstall) SetRoleFile

func (v *GalaxyInstall) SetRoleFile(p string)

SetRoleFile is used by the remote provisioner to set calculated role file path.

func (*GalaxyInstall) SetRolesPath

func (v *GalaxyInstall) SetRolesPath(p string)

SetRolesPath is used by the remote provisioner to set calculated roles path.

func (*GalaxyInstall) Verbose

func (v *GalaxyInstall) Verbose() bool

Verbose is the ansible-galaxy --verbose flag.

type LocalModeAnsibleArgs

type LocalModeAnsibleArgs struct {
	Username              string
	Port                  int
	PemFile               string
	KnownHostsFile        string
	BastionKnownHostsFile string
	BastionUsername       string
	BastionHost           string
	BastionPort           int
	BastionPemFile        string
}

LocalModeAnsibleArgs is used by the local provisioner to feed Ansible with correct connection setup data.

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module represents module settings.

func NewModuleFromInterface

func NewModuleFromInterface(i interface{}) *Module

NewModuleFromInterface reads Module configuration from Terraform schema.

func (*Module) Args

func (v *Module) Args() map[string]interface{}

Args represent Ansible --args flag.

func (*Module) Background

func (v *Module) Background() int

Background represents Ansible --background flag.

func (*Module) HostPattern

func (v *Module) HostPattern() string

HostPattern represents Ansible host pattern argument.

func (*Module) Module

func (v *Module) Module() string

Module returns a module name to run.

func (*Module) OneLine

func (v *Module) OneLine() bool

OneLine represents Ansible --one-line flag.

func (*Module) Poll

func (v *Module) Poll() int

Poll represents Ansible --poll flag.

type Play

type Play struct {
	// contains filtered or unexported fields
}

Play return a new Ansible item to play.

func NewPlayFromInterface

func NewPlayFromInterface(i interface{}, defaults *Defaults) *Play

NewPlayFromInterface reads Play configuration from Terraform schema.

func NewPlayFromMapInterface

func NewPlayFromMapInterface(vals map[string]interface{}, defaults *Defaults) *Play

NewPlayFromMapInterface reads Play configuration from a map.

func (*Play) Become

func (v *Play) Become() bool

Become represents Ansible --become flag.

func (*Play) BecomeMethod

func (v *Play) BecomeMethod() string

BecomeMethod represents Ansible --become-method flag.

func (*Play) BecomeUser

func (v *Play) BecomeUser() string

BecomeUser represents Ansible --become-user flag.

func (*Play) Check

func (v *Play) Check() bool

Check represents Ansible --check flag.

func (*Play) Diff

func (v *Play) Diff() bool

Diff represents Ansible --diff flag.

func (*Play) Enabled

func (v *Play) Enabled() bool

Enabled controls the execution of a play. Play will be skipped if this value is false.

func (*Play) Entity

func (v *Play) Entity() interface{}

Entity to run. A Playbook or Module.

func (*Play) ExtraVars

func (v *Play) ExtraVars() map[string]interface{}

ExtraVars represents Ansible --extra-vars flag.

func (*Play) Forks

func (v *Play) Forks() int

Forks represents Ansible --forks flag.

func (*Play) Groups

func (v *Play) Groups() []string

Groups to include in the auto-generated inventory file.

func (*Play) Hosts

func (v *Play) Hosts() []string

Hosts to include in the auto-generated inventory file.

func (*Play) InventoryFile

func (v *Play) InventoryFile() string

InventoryFile represents Ansible --inventory-file flag.

func (*Play) Limit

func (v *Play) Limit() string

Limit represents Ansible --limit flag.

func (*Play) SetOverrideInventoryFile

func (v *Play) SetOverrideInventoryFile(path string)

SetOverrideInventoryFile is used by the provisioner in the following cases: - remote provisioner not given an inventory_file, a generated temporary file used - local mode always writes a temporary inventory file, such file has to be removed after provisioning

func (*Play) SetOverrideVaultID

func (v *Play) SetOverrideVaultID(paths []string)

SetOverrideVaultID is used by remote provisioner when vault id files are defined. After uploading the files to the machine, the paths are updated to the remote paths, such that Ansible can be given correct remote locations.

func (*Play) SetOverrideVaultPasswordPath

func (v *Play) SetOverrideVaultPasswordPath(path string)

SetOverrideVaultPasswordPath is used by remote provisioner when a vault password file is defined. After uploading the file to the machine, the path is updated to the remote path, such that Ansible can be given the correct remote location.

func (*Play) ToCommand

func (v *Play) ToCommand(ansibleArgs LocalModeAnsibleArgs) (string, error)

ToCommand serializes the play to an executable Ansible command.

func (*Play) ToLocalCommand

func (v *Play) ToLocalCommand(ansibleArgs LocalModeAnsibleArgs, ansibleSSHSettings *AnsibleSSHSettings) (string, error)

ToLocalCommand serializes the play to an executable local provisioning Ansible command.

func (*Play) VaultID

func (v *Play) VaultID() []string

VaultID represents Ansible --vault-id flag.

func (*Play) VaultPasswordFile

func (v *Play) VaultPasswordFile() string

VaultPasswordFile represents Ansible --vault-password-file flag.

func (*Play) Verbose

func (v *Play) Verbose() bool

Verbose represents Ansible --verbose flag.

type Playbook

type Playbook struct {
	// contains filtered or unexported fields
}

Playbook represents playbook settings.

func NewPlaybookFromInterface

func NewPlaybookFromInterface(i interface{}) *Playbook

NewPlaybookFromInterface reads Playbook configuration from Terraform schema.

func (*Playbook) FilePath

func (v *Playbook) FilePath() string

FilePath represents a path to the Ansible playbook to be executed.

func (*Playbook) ForceHandlers

func (v *Playbook) ForceHandlers() bool

ForceHandlers represents Ansible Playbook --force-handlers flag.

func (*Playbook) RolesPath

func (v *Playbook) RolesPath() []string

RolesPath appends role directories to ANSIBLE_ROLES_PATH environment variable, as documented in https://docs.ansible.com/ansible/2.5/reference_appendices/config.html#envvar-ANSIBLE_ROLES_PATH

func (*Playbook) SetOverrideFilePath

func (v *Playbook) SetOverrideFilePath(path string)

SetOverrideFilePath is used by the remote provisioner to reference the correct playbook location after the upload to the provisioned machine.

func (*Playbook) SetOverrideRolesPath

func (v *Playbook) SetOverrideRolesPath(path []string)

SetOverrideRolesPath is used by the remote provisioner to reference the correct role locations after the upload to the provisioned machine.

func (*Playbook) SkipTags

func (v *Playbook) SkipTags() []string

SkipTags represents Ansible Playbook --skip-tags flag.

func (*Playbook) StartAtTask

func (v *Playbook) StartAtTask() string

StartAtTask represents Ansible Playbook --start-at-task flag.

func (*Playbook) Tags

func (v *Playbook) Tags() []string

Tags represents Ansible Playbook --tags flag.

type RemoteSettings

type RemoteSettings struct {
	// contains filtered or unexported fields
}

RemoteSettings represents remote settings.

func NewRemoteSettingsFromInterface

func NewRemoteSettingsFromInterface(i interface{}, ok bool) *RemoteSettings

NewRemoteSettingsFromInterface reads Remote configuration from Terraform schema.

func NewRemoteSettingsFromMapInterface

func NewRemoteSettingsFromMapInterface(vals map[string]interface{}, ok bool) *RemoteSettings

NewRemoteSettingsFromMapInterface reads Remote configuration from a map.

func (*RemoteSettings) BootstrapDirectory

func (v *RemoteSettings) BootstrapDirectory() string

BootstrapDirectory returns a path to where the playbooks, roles, inventory fiels, vault password / ID files and such are uploded to.

func (*RemoteSettings) InstallVersion

func (v *RemoteSettings) InstallVersion() string

InstallVersion returns Ansible version to install, empty string means latest.

func (*RemoteSettings) IsRemoteInUse

func (v *RemoteSettings) IsRemoteInUse() bool

IsRemoteInUse returns true remote provisioning is in use.

func (*RemoteSettings) LocalInstallerPath

func (v *RemoteSettings) LocalInstallerPath() string

LocalInstallerPath returns a path to the custom Ansible installer.

func (*RemoteSettings) RemoteInstallerPath

func (v *RemoteSettings) RemoteInstallerPath() string

RemoteInstallerPath returns a path to the where the Ansible installer script in uploaded to and executed from. This is essentially remote_installer_directory with /ansible-installer appended.

func (*RemoteSettings) SkipCleanup

func (v *RemoteSettings) SkipCleanup() bool

SkipCleanup returns true is Ansible installation should be cleaned up during remote provisioning, false otherwise.

func (*RemoteSettings) SkipInstall

func (v *RemoteSettings) SkipInstall() bool

SkipInstall returns true is Ansible installation should be skipped during remote provisioning, false otherwise.

func (*RemoteSettings) UseSudo

func (v *RemoteSettings) UseSudo() bool

UseSudo returns true is sudo should be use, false otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL