Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
9cf5c8fd
Commit
9cf5c8fd
authored
May 11, 2014
by
Ross Smith II
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1150 from rsabitov/ansible-dir
Fixes #1000: Uploading the whole ansible playbook directory
parents
7e96187e
ef0c8c49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
provisioner/ansible-local/provisioner.go
provisioner/ansible-local/provisioner.go
+21
-3
website/source/docs/provisioners/ansible-local.html.markdown
website/source/docs/provisioners/ansible-local.html.markdown
+4
-0
No files found.
provisioner/ansible-local/provisioner.go
View file @
9cf5c8fd
...
...
@@ -27,6 +27,9 @@ type Config struct {
// Path to host_vars directory
HostVars
string
`mapstructure:"host_vars"`
// The playbook dir to upload.
PlaybookDir
string
`mapstructure:"playbook_dir"`
// The main playbook file to execute.
PlaybookFile
string
`mapstructure:"playbook_file"`
...
...
@@ -79,6 +82,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
"group_vars"
:
&
p
.
config
.
GroupVars
,
"host_vars"
:
&
p
.
config
.
HostVars
,
"playbook_file"
:
&
p
.
config
.
PlaybookFile
,
"playbook_dir"
:
&
p
.
config
.
PlaybookDir
,
"staging_dir"
:
&
p
.
config
.
StagingDir
,
"inventory_file"
:
&
p
.
config
.
InventoryFile
,
}
...
...
@@ -123,6 +127,13 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
}
}
// Check that the playbook_dir directory exists, if configured
if
len
(
p
.
config
.
PlaybookDir
)
>
0
{
if
err
:=
validateDirConfig
(
p
.
config
.
PlaybookDir
,
"playbook_dir"
);
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
err
)
}
}
// Check that the group_vars directory exists, if configured
if
len
(
p
.
config
.
GroupVars
)
>
0
{
if
err
:=
validateDirConfig
(
p
.
config
.
GroupVars
,
"group_vars"
);
err
!=
nil
{
...
...
@@ -158,9 +169,16 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
func
(
p
*
Provisioner
)
Provision
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
)
error
{
ui
.
Say
(
"Provisioning with Ansible..."
)
ui
.
Message
(
"Creating Ansible staging directory..."
)
if
err
:=
p
.
createDir
(
ui
,
comm
,
p
.
config
.
StagingDir
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating staging directory: %s"
,
err
)
if
len
(
p
.
config
.
PlaybookDir
)
>
0
{
ui
.
Message
(
"Uploading Playbook directory to Ansible staging directory..."
)
if
err
:=
p
.
uploadDir
(
ui
,
comm
,
p
.
config
.
StagingDir
,
p
.
config
.
PlaybookDir
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error uploading playbook_dir directory: %s"
,
err
)
}
}
else
{
ui
.
Message
(
"Creating Ansible staging directory..."
)
if
err
:=
p
.
createDir
(
ui
,
comm
,
p
.
config
.
StagingDir
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating staging directory: %s"
,
err
)
}
}
ui
.
Message
(
"Uploading main Playbook file..."
)
...
...
website/source/docs/provisioners/ansible-local.html.markdown
View file @
9cf5c8fd
...
...
@@ -68,6 +68,10 @@ Optional:
chi-appservers
</pre>
*
`playbook_dir`
(string) - a path to the complete ansible directory
structure on your local system to be copied to the remote machine
as the
`staging_directory`
before all other files and directories.
*
`playbook_paths`
(array of strings) - An array of paths to playbook files on
your local system. These will be uploaded to the remote machine under
`staging_directory`
/playbooks. By default, this is empty.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment