Skip to content

Commit

Permalink
Merge pull request #8 from lorengordon/local-exec
Browse files Browse the repository at this point in the history
Uses local utilities/resources to mirror salt repo
  • Loading branch information
lorengordon authored May 15, 2018
2 parents 6774f74 + df14e02 commit 651fe6a
Show file tree
Hide file tree
Showing 15 changed files with 352 additions and 767 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.0
current_version = 2.0.0
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ terraform.tfstate.d
*.tfstate.backup
*.tfvars

# Additional project exclusions
.filecache

# Windows image file caches
Thumbs.db
Expand Down Expand Up @@ -49,8 +51,3 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk


# =========================
# My local exclusions
# =========================
15 changes: 0 additions & 15 deletions Makefile

This file was deleted.

74 changes: 13 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,25 @@ them to S3.
## Usage

```
<PARAM>=<arg> make <target>
terraform init
terraform plan -var bucket_name=<BUCKET> -var salt_version="SALT_VERSION" -out tfplan
terraform apply -var bucket_name=<BUCKET> -var salt_version="SALT_VERSION" tfplan
```

See the section **Targets** for a description of the supported make targets.

See the section **Environment Variables** for a description of the supported env
parameters.

## Prerequisites

1. The `aws` CLI must be installed and available in the PATH.
2. An AWS credential with get/put permissions to the S3 bucket must be pre-
configured. Any method supported by the `aws` CLI may be used to configure the
credential.

## Example

```
git clone https://github.com/plus3it/salt-reposync.git && cd salt-reposync
REPOSYNC_SALT_VERSION="2016.3.4" \
REPOSYNC_HTTP_URL="https://s3.amazonaws.com/examplebucket/linux/saltstack/salt" \
make sync.s3
```

The above example will use rsync to download all packages required for salt
version 2016.3.4 from the upstream salt yum repo, construct yum repo
definitions based on the `REPOSYNC_HTTP_URL` parameter, and push the repos and
the repo definitions to the S3 bucket named "_examplebucket_". The repos will
be located in the S3 bucket at the path "_linux/saltstack/salt_".

## Targets

- `help`
- Show this help message
- `deps`
- Install rpm dependencies (E.g. `zip`)
- `sync.s3`
- Run `make deps` and then download salt repos, create yum repos
definitions, and push the repos to s3. This target supports setting script
parameters via environment variables. Will return an error if any of the
required environment variables are unset. See the help section "Environment
Variables".

## Environment Variables

- `REPOSYNC_HTTP_URL`
- **(Required)** URL where the salt repos will be re-hosted
- `REPOSYNC_SALT_VERSION`
- **(Required)** Salt version to download
- `REPOSYNC_SALT_RSYNC_URL`
- **(Optional)** Source rsync url to the salt file list. Defaults to
"`rsync://repo.saltstack.com/saltstack_pkgrepo_rhel`".
- `REPOSYNC_STAGING_DIR`
- **(Optional)** Target directory for rsync. Defaults to
"`/tmp/salt-reposync`".

## CloudFormation
configured. Any method supported by the `aws` CLI may be used to configure
the credential.
3. `rsync` must be installed and available and in the PATH.

This project also provides a CloudFormation template that can be used to
execute salt-reposync. The template requires an IAM instance role with the
necessary permissions to the S3 bucket, as described in the **Prerequisites**
section.
## Submodules

In addition, the AMI must have the `aws` CLI utility pre-installed and in the
PATH of the root user (the context in which userdata executes). The Amazon
Linux AMIs all meet this requirement, but any AMI configured similarly may also
be used.
* `repo` - Uses `rsync` to create a local copy of the salt yum repo for the
salt versions specified by `var.salt_version` and `var.extra_salt_versions`.
The `aws` utility is used to sync the local copy to the S3 bucket specified
by `var.bucket_name`.

- `salt-reposync.template.json`
* `defs` - Templates the yum repo definition files and uses the `aws` utility
to sync them to the S3 bucket specified by `var.bucket_name`.
117 changes: 0 additions & 117 deletions bin/prep-salt-repos.sh

This file was deleted.

81 changes: 0 additions & 81 deletions bin/pull-salt-repos.sh

This file was deleted.

Loading

0 comments on commit 651fe6a

Please sign in to comment.