The following command does a test orchestration run of
states/orch/web_host.sls
:
sudo salt-run state.orchestrate orch.web_host \
pillar='{"tgt_hst":"SERVERNAME", "tgt_pod":"core", "tgt_loc":"us-east-2"}' \
saltenv=timidrobot test=True
pillar=
is required- Infrastructure creation is targeted with CLI pillar
(
pillar='{"tgt_hst":"SERVERNAME", "tgt_pod":"core", "tgt_loc":"us-east-2"}'
)
- Infrastructure creation is targeted with CLI pillar
(
saltenv=
is optional- The command above uses Pillars and States from a development environment
(
saltenv=timidrobot
). Remove or change tobase
to use production environment.
- The command above uses Pillars and States from a development environment
(
test=
is optional- The command above performs a dry run (
test=True
). Remove or changed toFalse
to apply changes.
- The command above performs a dry run (
The following command shows how the SLS is rendered and outputs it as YAML:
states/orch/aws/ec2_instance_web.sls
:
sudo salt-call --local --out=yaml state.show_sls orch.aws.ec2_instance_web \
pillar='{"tgt_hst":"SERVERNAME", "tgt_pod":"core", "tgt_loc":"us-east-2"}' \
saltenv=timidrobot
The following command does a local test apply of
states/orch/aws/ec2_instance_web.sls
:
sudo salt-call --local --log-level=debug --log-file-level=warning \
state.apply orch.aws.ec2_instance_web \
pillar='{"tgt_hst":"SERVERNAME", "tgt_pod":"core", "tgt_loc":"us-east-2"}' \
saltenv=timidrobot test=True
- Using
salt-call
to run individual states can aid in the troubleshooting of orchestration. Thesalt-call
command above is very verbose and allows errors to be seen in the compiled pillar and state files.
Per Debugging salt-ssh - Salt SSH, to see errors from a
salt-ssh
state or command line invocation:
- Assuming that
orch.bootstrap install salt on minion
failed - Apply the states manually with trace level logging:
sudo salt-ssh index__stage__us-east-2 -l trace --log-file-level=warning --sudo state.apply salt
- Search output for
SALT_ARGV
- SSH into target machine from
salt-prime
(replaceTARGET_IP
with appropriate IP address):sudo ssh -i /root/.ssh/saltstack_rsa_provisioning_20181221 admin@TARGET_IP
- Execute
SALT_ARGV
command from step 2 without'--out json
and-l quiet
- See
WordPress.md
See ../README.md
for information on SaltStack versions and
Best Practices.
AWS orchestration (including bootstrap) makes use of the boto/boto3 state modules:
- An example of a complex, multi-host Salt Orchestrate state that performs status checks as it goes (2017-08-11)
- Dynamic Test Servers with Salt | Lincoln Loop (2017-09-12)
- SaltStack as an Alternative to Terraform for AWS Orchestration (2017-08-30, Salt 2017.7.1 was stable version)
- Running Salt States Using Amazon EC2 Systems Manager | AWS Management Tools Blog (2017-07-16, Salt 2016.11.5 was stable version)
Using Salt to boss your clouds around – Anthony Shaw – Medium (2017-05-02, Salt 2016.11.4 was stable version)- Uses salt-cloud, which has far fewer features than the state boto modules
How to Build AWS VPCs with SaltStack Formulas — Six Feet Up (2017-09-19, Salt 2017.7.1 was stable version)- Uses saltstack-formulas/aws-formula, which only adds a layer above a few salt boto state modules.