ansible

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 2017 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

View Source
const (
	JOBTYPE_ANSIBLE_JOB = "ansible_job" // A ansible job
	JOBTYPE_UPDATE_JOB  = "update_job"  // A project scm update job

	JOB_LAUNCH_TYPE_MANUAL = "manual"
	JOB_LAUNCH_TYPE_SYSTEM = "system"
)

Job constants

Variables

This section is empty.

Functions

This section is empty.

Types

type AdHocCommand

type AdHocCommand struct {
	ID            bson.ObjectId `bson:"_id" json:"id"`
	ModuleName    string        `bson:"module_name" json:"module_name" binding:"required"`
	Limit         string        `bson:"limit" json:"limit"`
	ModuleArgs    string        `bson:"module_args" json:"module_args"`
	JobType       string        `bson:"job_type" json:"job_type"`
	Forks         uint8         `bson:"forks" json:"forks"`
	Verbosity     uint8         `bson:"verbosity" json:"verbosity"`
	BecomeEnabled bool          `bson:"become_enabled" json:"become_enabled"`
	CredentialID  bson.ObjectId `bson:"credential_id" json:"credential"`
	InventoryID   bson.ObjectId `bson:"inventory_id" json:"inventory"`
	ExtraVars     gin.H         `bson:"extra_vars" json:"extra_vars"`
	CreatedByID   bson.ObjectId `bson:"created_by_id" json:"created_by"`
	ModifiedByID  bson.ObjectId `bson:"modified_by_id" json:"modified_by"`
	Created       time.Time     `bson:"created" json:"created"`
	Modified      time.Time     `bson:"modified" json:"modified"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`
}

type AdHocCommandEvent

type AdHocCommandEvent struct {
	ID             bson.ObjectId `bson:"_id" json:"id"`
	HostName       string        `bson:"host_name" json:"host_name" binding:"required"`
	Event          string        `bson:"event" json:"event"`
	EventData      string        `bson:"event_data" json:"event_data"`
	Failed         bool          `bson:"failed" json:"failed"`
	Changed        bool          `bson:"changed" json:"changed"`
	Counter        uint8         `bson:"counter" json:"counter"`
	HostID         bson.ObjectId `bson:"host_id" json:"host"`
	AdHocCommandID bson.ObjectId `bson:"ad_hoc_command_id" json:"ad_hoc_command_id"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`
}

type Group

type Group struct {
	ID                       bson.ObjectId  `bson:"_id" json:"id"`
	Name                     string         `bson:"name" json:"name" binding:"required,min=1,max=500"`
	Description              string         `bson:"description" json:"description"`
	Variables                string         `bson:"variables" json:"variables"`
	TotalHosts               uint32         `bson:"total_hosts" json:"total_hosts"`
	HasActiveFailures        bool           `bson:"has_active_failures" json:"has_active_failures"`
	HostsWithActiveFailures  uint32         `bson:"hosts_with_active_failures" json:"hosts_with_active_failures"`
	TotalGroups              uint32         `bson:"total_groups" json:"total_groups"`
	GroupsWithActiveFailures uint32         `bson:"groups_with_active_failures" json:"groups_with_active_failures"`
	HasInventorySources      bool           `bson:"has_inventory_sources" json:"has_inventory_sources"`
	InventoryID              bson.ObjectId  `bson:"inventory_id" json:"inventory"`
	ParentGroupID            *bson.ObjectId `bson:"parent_group_id,omitempty" json:"parent_group,omitempty"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Type               string  `bson:"-" json:"type"`
	Children           []Group `bson:"-" json:"children,omitempty"`
	Links              gin.H   `bson:"-" json:"links"`
	Meta               gin.H   `bson:"-" json:"meta"`
	LastJob            gin.H   `bson:"-" json:"last_job"`
	LastJobHostSummary gin.H   `bson:"-" json:"last_job_host_summary"`
}

Group is the model for Group collection

func (Group) GetInventory added in v0.4.0

func (grp Group) GetInventory() (inv Inventory, err error)

func (*Group) GetParent added in v0.4.0

func (group *Group) GetParent() (Group, error)

GetParent returns the parent of the given Group

func (Group) GetType added in v0.4.0

func (Group) GetType() string

func (*Group) GroupExist added in v0.4.0

func (group *Group) GroupExist() bool

func (*Group) InventoryExist added in v0.4.0

func (group *Group) InventoryExist() bool

func (*Group) IsUnique added in v0.4.0

func (group *Group) IsUnique() bool

func (*Group) ParentExist added in v0.4.0

func (group *Group) ParentExist() bool

type Host

type Host struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	// required
	Name        string         `bson:"name" json:"name" binding:"required,iphost"`
	InventoryID bson.ObjectId  `bson:"inventory_id" json:"inventory" binding:"required"`
	Description string         `bson:"description,omitempty" json:"description"`
	GroupID     *bson.ObjectId `bson:"group_id,omitempty" json:"group"`
	InstanceID  string         `bson:"instance_id,omitempty" json:"instance_id"`
	Variables   string         `bson:"variables,omitempty" json:"variables"`
	Enabled     bool           `bson:"enabled,omitempty" json:"enabled"`

	LastJobID            *bson.ObjectId `bson:"last_job_id,omitempty" json:"last_job" binding:"omitempty,naproperty"`
	LastJobHostSummaryID *bson.ObjectId `bson:"last_job_host_summary_id,omitempty" json:"last_job_host_summary" binding:"omitempty,naproperty"`

	HasActiveFailures   bool          `bson:"has_active_failures,omitempty" json:"has_active_failures" binding:"omitempty,naproperty"`
	HasInventorySources bool          `bson:"has_inventory_sources,omitempty" json:"has_inventory_sources" binding:"omitempty,naproperty"`
	CreatedByID         bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID        bson.ObjectId `bson:"modified_by_id" json:"-"`
	Created             time.Time     `bson:"created" json:"created" binding:"omitempty,naproperty"`
	Modified            time.Time     `bson:"modified" json:"modified" binding:"omitempty,naproperty"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`
}

func (Host) GetInventory added in v0.4.0

func (h Host) GetInventory() (Inventory, error)

func (Host) GetType added in v0.4.0

func (Host) GetType() string

func (*Host) GroupExist added in v0.4.0

func (host *Host) GroupExist() bool

func (*Host) InventoryExist added in v0.4.0

func (host *Host) InventoryExist() bool

func (*Host) IsUnique added in v0.4.0

func (host *Host) IsUnique() bool

type Inventory

type Inventory struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`

	// required feilds
	Name           string        `bson:"name" json:"name" binding:"required,min=1,max=500"`
	OrganizationID bson.ObjectId `bson:"organization_id" json:"organization" binding:"required"`
	Description    string        `bson:"description,omitempty" json:"description"`
	Variables      string        `bson:"variables,omitempty" json:"variables"`

	// only output
	TotalHosts                   uint32 `bson:"total_hosts,omitempty" json:"total_hosts" binding:"omitempty,naproperty"`
	HostsWithActiveFailures      uint32 `bson:"hosts_with_active_failures,omitempty" json:"hosts_with_active_failures" binding:"omitempty,naproperty"`
	TotalGroups                  uint32 `bson:"total_groups,omitempty" json:"total_groups" binding:"omitempty,naproperty"`
	GroupsWithActiveFailures     uint32 `bson:"groups_with_active_failures,omitempty" json:"groups_with_active_failures" binding:"omitempty,naproperty"`
	TotalInventorySources        uint32 `bson:"total_inventory_sources,omitempty" json:"total_inventory_sources" binding:"omitempty,naproperty"`
	InventorySourcesWithFailures uint32 `bson:"inventory_sources_with_failures,omitempty" json:"inventory_sources_with_failures" binding:"omitempty,naproperty"`

	HasInventorySources bool `bson:"has_inventory_sources" json:"has_inventory_sources" binding:"omitempty,naproperty"`
	HasActiveFailures   bool `bson:"has_active_failures" json:"has_active_failures" binding:"omitempty,naproperty"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Roles []common.AccessControl `bson:"roles" json:"-"`
}

Inventory is the model for Inventory collection

func (*Inventory) Exist added in v0.4.0

func (inv *Inventory) Exist() bool

func (Inventory) GetRoles added in v0.4.0

func (inv Inventory) GetRoles() []common.AccessControl

func (Inventory) GetType added in v0.4.0

func (Inventory) GetType() string

func (*Inventory) IsUnique added in v0.4.0

func (inv *Inventory) IsUnique() bool

func (*Inventory) OrganizationExist added in v0.4.0

func (inv *Inventory) OrganizationExist() bool

type InventoryScript

type InventoryScript struct {
	ID          bson.ObjectId `bson:"_id" json:"id"`
	Name        string        `bson:"name" json:"name" binding:"required"`
	Description string        `bson:"description" json:"description"`
	Script      string        `bson:"script" json:"script" binding:"required"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`
}

InventoryScript is the model for organization collection

func (InventoryScript) GetType added in v0.4.0

func (InventoryScript) GetType() string

type InventorySource

type InventorySource struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	Source             string        `bson:"source" json:"source"`
	SourcePath         string        `bson:"source_path" json:"source_path"`
	SourceVars         string        `bson:"source_vars" json:"source_regions"`
	SourceRegions      string        `bson:"source_regions" json:"has_active_failures"`
	InstanceFilters    string        `bson:"instance_filters" json:"instance_filters"`
	GroupBy            string        `bson:"group_by" json:"group_by"`
	Overwrite          bool          `bson:"overwrite" json:"overwrite"`
	OverwriteVars      bool          `bson:"overwrite_vars" json:"overwrite_vars"`
	UpdateOnLaunch     bool          `bson:"update_on_launch" json:"update_on_launch"`
	UpdateCacheTimeout uint32        `bson:"update_cache_timeout" json:"update_cache_timeout"`
	CredentialID       bson.ObjectId `bson:"credential_id" json:"credential"`
	GroupID            bson.ObjectId `bson:"group_id" json:"group"`
	InventoryID        bson.ObjectId `bson:"inventory_id" json:"inventory"`
	SourceScriptID     bson.ObjectId `bson:"source_script_id" json:"source_script"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`
}

Inventory is the model for Inventory collection TODO: not implemented

func (InventorySource) GetType added in v0.4.0

func (InventorySource) GetType() string

type Job

type Job struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	Name string `bson:"name" json:"name" binding:"required"`

	Description     string    `bson:"description,omitempty" json:"description"`
	LaunchType      string    `bson:"launch_type" json:"launch_type"`
	CancelFlag      bool      `bson:"cancel_flag" json:"cancel_flag"`
	Status          string    `bson:"status" json:"status"`
	Failed          bool      `bson:"failed" json:"failed"`
	Started         time.Time `bson:"started" json:"started"`
	Finished        time.Time `bson:"finished" json:"finished"`
	Elapsed         uint32    `bson:"elapsed" json:"elapsed"`
	ResultStdout    string    `bson:"result_stdout" json:"result_stdout"`
	ResultTraceback string    `bson:"result_traceback" json:"result_traceback"`
	JobExplanation  string    `bson:"job_explanation" json:"job_explanation"`
	JobType         string    `bson:"job_type" json:"job_type"`

	Playbook          string `bson:"playbook" json:"playbook"`
	Forks             uint8  `bson:"forks" json:"forks"`
	Limit             string `bson:"limit,omitempty" json:"limit"`
	Verbosity         uint8  `bson:"verbosity" json:"verbosity"`
	ExtraVars         gin.H  `bson:"extra_vars,omitempty" json:"extra_vars"`
	JobTags           string `bson:"job_tags,omitempty" json:"job_tags"`
	SkipTags          string `bson:"skip_tags,omitempty" json:"skip_tags"`
	ForceHandlers     bool   `bson:"force_handlers" json:"force_handlers"`
	StartAtTask       string `bson:"start_at_task,omitempty" json:"start_at_task"`
	AllowSimultaneous bool   `bson:"allow_simultaneous,omitempty" json:"allow_simultaneous"`

	InventoryID         bson.ObjectId  `bson:"inventory_id,omitempty" json:"inventory"`
	JobTemplateID       bson.ObjectId  `bson:"job_template_id,omitempty" json:"job_template"`
	ProjectID           bson.ObjectId  `bson:"project_id,omitempty" json:"project"`
	BecomeEnabled       bool           `bson:"become_enabled" json:"become_enabled"`
	SCMCredentialID     bson.ObjectId  `bson:"scm_credential_id,omitempty" json:"scm_credential"`
	NetworkCredentialID *bson.ObjectId `bson:"network_credential_id,omitempty" json:"network_credential"`
	CloudCredentialID   *bson.ObjectId `bson:"cloud_credential_id,omitempty" json:"cloud_credential"`
	MachineCredentialID *bson.ObjectId `bson:"credential_id,omitempty" json:"credential"`

	PromptLimit      bool `bson:"prompt_limit_on_launch" json:"ask_limit_on_launch"`
	PromptInventory  bool `bson:"prompt_inventory" json:"ask_inventory_on_launch"`
	PromptCredential bool `bson:"prompt_credential" json:"ask_credential_on_launch"`
	PromptJobType    bool `bson:"prompt_job_type" json:"ask_job_type_on_launch"`
	PromptTags       bool `bson:"prompt_tags" json:"ask_tags_on_launch"`
	PromptVariables  bool `bson:"prompt_variables" json:"ask_variables_on_launch"`

	// system generated items
	JobCWD  string   `bson:"job_cwd" json:"job_cwd"`
	JobARGS []string `bson:"job_args" json:"job_args"`
	JobENV  []string `bson:"job_env" json:"job_env"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`
}

func (Job) GetJobTemplate added in v0.4.0

func (job Job) GetJobTemplate() (JobTemplate, error)

func (Job) GetType added in v0.4.0

func (Job) GetType() string

type JobTemplate

type JobTemplate struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	// required
	Name        string        `bson:"name" json:"name" binding:"required,min=1,max=500"`
	JobType     string        `bson:"job_type" json:"job_type" binding:"required,jobtype"`
	InventoryID bson.ObjectId `bson:"inventory_id" json:"inventory" binding:"required"`
	ProjectID   bson.ObjectId `bson:"project_id" json:"project" binding:"required"`
	Playbook    string        `bson:"playbook" json:"playbook" binding:"required"`

	Verbosity uint8 `bson:"verbosity,omitempty" json:"verbosity" binding:"omitempty,max=5"`

	Description         string         `bson:"description,omitempty" json:"description"`
	Forks               uint8          `bson:"forks,omitempty" json:"forks"`
	Limit               string         `bson:"limit,omitempty" json:"limit" binding:"max=1024"`
	ExtraVars           gin.H          `bson:"extra_vars,omitempty" json:"extra_vars"`
	JobTags             string         `bson:"job_tags,omitempty" json:"job_tags" binding:"max=1024"`
	SkipTags            string         `bson:"skip_tags,omitempty" json:"skip_tags" binding:"max=1024"`
	StartAtTask         string         `bson:"start_at_task,omitempty" json:"start_at_task"`
	ForceHandlers       bool           `bson:"force_handlers,omitempty" json:"force_handlers"`
	PromptVariables     bool           `bson:"ask_variables_on_launch,omitempty" json:"ask_variables_on_launch"`
	BecomeEnabled       bool           `bson:"become_enabled,omitempty" json:"become_enabled"`
	CloudCredentialID   *bson.ObjectId `bson:"cloud_credential_id,omitempty" json:"cloud_credential"`
	NetworkCredentialID *bson.ObjectId `bson:"network_credential_id,omitempty" json:"network_credential"`
	MachineCredentialID *bson.ObjectId `bson:"credential_id,omitempty" json:"credential"`
	PromptLimit         bool           `bson:"prompt_limit_on_launch,omitempty" json:"ask_limit_on_launch"`
	PromptInventory     bool           `bson:"prompt_inventory,omitempty" json:"ask_inventory_on_launch"`
	PromptCredential    bool           `bson:"prompt_credential,omitempty" json:"ask_credential_on_launch"`
	PromptJobType       bool           `bson:"prompt_job_type,omitempty" json:"ask_job_type_on_launch"`
	PromptTags          bool           `bson:"prompt_tags,omitempty" json:"ask_tags_on_launch"`
	PromptSkipTags      bool           `bson:"prompt_skip_tags,omitempty" json:"ask_skip_tags_on_launch"`
	AllowSimultaneous   bool           `bson:"allow_simultaneous,omitempty" json:"allow_simultaneous"`

	PolymorphicCtypeID *bson.ObjectId `bson:"polymorphic_ctype_id,omitempty" json:"polymorphic_ctype"`

	// output only
	LastJobRun      *time.Time     `bson:"last_job_run,omitempty" json:"last_job_run" binding:"omitempty,naproperty"`
	NextJobRun      *time.Time     `bson:"next_job_run,omitempty" json:"next_job_run" binding:"omitempty,naproperty"`
	Status          string         `bson:"status,omitempty" json:"status" binding:"omitempty,naproperty"`
	CurrentJobID    *bson.ObjectId `bson:"current_job_id,omitempty" json:"current_job" binding:"omitempty,naproperty"`
	CurrentUpdateID *bson.ObjectId `bson:"current_update_id,omitempty" json:"current_update" binding:"omitempty,naproperty"`
	LastJobID       *bson.ObjectId `bson:"last_job_id,omitempty" json:"last_job" binding:"omitempty,naproperty"`
	NextScheduleID  *bson.ObjectId `bson:"next_schedule_id,omitempty" json:"next_schedule" binding:"omitempty,naproperty"`
	LastJobFailed   bool           `bson:"last_job_failed,omitempty" json:"last_job_failed" binding:"omitempty,naproperty"`
	HasSchedules    bool           `bson:"has_schedules,omitempty" json:"has_schedules" binding:"omitempty,naproperty"`

	Kind string `bson:"kind,omitempty" json:"-"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created" binding:"omitempty,naproperty"`
	Modified time.Time `bson:"modified" json:"modified" binding:"omitempty,naproperty"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`

	Roles []common.AccessControl `bson:"roles" json:"-"`
}

func (*JobTemplate) CloudCredentialExist added in v0.4.0

func (jt *JobTemplate) CloudCredentialExist() bool

func (JobTemplate) GetCloudCredential added in v0.4.0

func (h JobTemplate) GetCloudCredential() (common.Credential, error)

func (JobTemplate) GetCredential added in v0.4.0

func (h JobTemplate) GetCredential() (common.Credential, error)

func (JobTemplate) GetNetworkCredential added in v0.4.0

func (h JobTemplate) GetNetworkCredential() (common.Credential, error)

func (JobTemplate) GetOrganizationID added in v0.4.0

func (jt JobTemplate) GetOrganizationID() (bson.ObjectId, error)

func (JobTemplate) GetProjectID added in v0.4.0

func (jt JobTemplate) GetProjectID() (bson.ObjectId, error)

func (JobTemplate) GetRoles added in v0.4.0

func (jt JobTemplate) GetRoles() []common.AccessControl

func (JobTemplate) GetType added in v0.4.0

func (JobTemplate) GetType() string

func (JobTemplate) Inventory added in v0.6.1

func (h JobTemplate) Inventory() (inv Inventory, err error)

func (JobTemplate) InventoryExist added in v0.4.0

func (jt JobTemplate) InventoryExist() bool

func (JobTemplate) IsUnique added in v0.4.0

func (jt JobTemplate) IsUnique() bool

func (*JobTemplate) MachineCredentialExist added in v0.4.0

func (jt *JobTemplate) MachineCredentialExist() bool

func (*JobTemplate) NetworkCredentialExist added in v0.4.0

func (jt *JobTemplate) NetworkCredentialExist() bool

func (JobTemplate) Project added in v0.6.1

func (jt JobTemplate) Project() (prj common.Project, err error)

func (JobTemplate) ProjectExist added in v0.4.0

func (jt JobTemplate) ProjectExist() bool

type Launch

type Launch struct {
	Limit               string        `bson:"limit,omitempty" json:"limit,omitempty" binding:"omitempty,max=1024"`
	ExtraVars           gin.H         `bson:"extra_vars,omitempty" json:"extra_vars,omitempty"`
	JobTags             string        `bson:"job_tags,omitempty" json:"job_tags,omitempty" binding:"omitempty,max=1024"`
	SkipTags            string        `bson:"skip_tags,omitempty" json:"skip_tags,omitempty" binding:"omitempty,max=1024"`
	JobType             string        `bson:"job_type,omitempty" json:"job_type,omitempty" binding:"omitempty,jobtype"`
	InventoryID         bson.ObjectId `bson:"inventory_id,omitempty" json:"inventory,omitempty"`
	MachineCredentialID bson.ObjectId `bson:"credential_id,omitempty" json:"credential,omitempty"`
}

Jump to

Keyboard shortcuts

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