Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,23 @@ If there are connection issues double check that the proxy is running.
...
```

#### Teleport
Teleport (https://goteleport.com/) provides secretless SSH.
`ops` has support for using Teleport as ssh for the following operations: `ssh, tunnel, proxy, ansible play, run and sync`

In order to use Teleport an extra section needs to be added to the cluster config file:
***
```
inventory:
- plugin: cns
args:
teleport_enabled: True -> add this to existing configuration


teleport:
enabled: true -> add this whole block
```

### Play

Run an ansible playbook.
Expand Down Expand Up @@ -762,7 +779,7 @@ env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/

## Running tests

- on your machine: `py.test tests`
- on your machine: `python -m pytest tests` or `build_scripts/run_tests.sh`

# Troubleshooting

Expand Down
2 changes: 2 additions & 0 deletions src/ops/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,7 @@ def configure_common_ansible_args(parser):
parser.add_argument('--noscb', action='store_false', dest='use_scb',
help='Disable use of Shell Control Box (SCB) even if '
'it is enabled in the cluster config')
parser.add_argument('--teleport', action='store_false', dest='use_teleport',
help='Use Teleport for SSH')

return parser
6 changes: 4 additions & 2 deletions src/ops/cli/playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ def __init__(self, ops_config, root_dir, inventory_generator,
def run(self, args, extra_args):
logger.info("Found extra_args %s", extra_args)
inventory_path, ssh_config_paths = self.inventory_generator.generate()
ssh_config_path = SshConfigGenerator.get_ssh_config_path(self.cluster_config,
ssh_config_generator = SshConfigGenerator(self.ops_config.package_dir)
ssh_config_path = ssh_config_generator.get_ssh_config_path(self.cluster_config,
ssh_config_paths,
args.use_scb)
args)

ssh_config = f"ANSIBLE_SSH_ARGS='-F {ssh_config_path}'"

ansible_config = "ANSIBLE_CONFIG=%s" % self.ops_config.ansible_config_path
Expand Down
5 changes: 3 additions & 2 deletions src/ops/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ def run(self, args, extra_args):
logger.info("Found extra_args %s", extra_args)
inventory_path, ssh_config_paths = self.inventory_generator.generate()
limit = args.host_pattern
ssh_config_path = SshConfigGenerator.get_ssh_config_path(self.cluster_config,
ssh_config_generator = SshConfigGenerator(self.ops_config.package_dir)
ssh_config_path = ssh_config_generator.get_ssh_config_path(self.cluster_config,
ssh_config_paths,
args.use_scb)
args)
extra_args = ' '.join(args.extra_args)
command = """cd {root_dir}
ANSIBLE_SSH_ARGS='-F {ssh_config}' ANSIBLE_CONFIG={ansible_config_path} ansible -i {inventory_path} '{limit}' \\
Expand Down
Loading