Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Wiki Replica
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
TPA
Wiki Replica
Commits
7a14d663
Verified
Commit
7a14d663
authored
5 years ago
by
anarcat
Browse files
Options
Downloads
Patches
Plain Diff
split cumin into its own page
parent
31c621a9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tsa/howto/cumin.mdwn
+66
-0
66 additions, 0 deletions
tsa/howto/cumin.mdwn
tsa/howto/puppet.mdwn
+6
-58
6 additions, 58 deletions
tsa/howto/puppet.mdwn
with
72 additions
and
58 deletions
tsa/howto/cumin.mdwn
0 → 100644
+
66
−
0
View file @
7a14d663
# Cumin
You can use [Cumin][] to operate arbitrary shell commands on Puppet
hosts or a subset of hosts.
[Cumin]: https://doc.wikimedia.org/cumin/master/introduction.html
## Installation
First, install Cumin and setup a tunnel to
connect to the Puppet locally:
virtualenv --python=python3 ~/.virtualenvs/cumin
~/.virtualenvs/cumin/bin/pip3 install cumin
ssh -L8080:localhost:8080 pauli.torproject.org
Notice how Cumin is installed in a [Python virtualenv][]: it is not
yet [in Debian][]. You'll also need a patch to enable plain HTTP
access, see [this bug report][]. You might also want to disable the
[root check][] as well. Then drop the following configuration in
`~/.config/cumin/config.yaml`:
transport: clustershell
puppetdb:
host: localhost
scheme: http
port: 8080
api_version: 4 # Supported versions are v3 and v4. If not specified, v4 will be used.
log_file: cumin.log
default_backend: puppetdb
From here on we'll assume you use the following alias:
alias cumin="~/.virtualenvs/cumin/bin/cumin --config ~/.config/cumin/config.yaml"
## Example commands
This will run the `uptime` command on all hosts:
cumin '*' uptime
To run against only a subset, you need to use the Cumin grammar, which
is [briefly described in the Wikimedia docs][]. For example, this
will run the same command only on physical hosts:
cumin 'F:virtual=physical' uptime
Just check the monitoring server:
cumin 'R:class=roles::monitoring' uptime
Any Puppet fact or class can be queried that way. This also serves as
a ad-hoc interface to query PuppetDB for certain facts, as you don't
have to provide a command. In that case, `cumin` runs in "dry mode"
and will simply show which hosts match the request:
$ cumin 'F:virtual=physical'
16 hosts will be targeted:
[...]
[root check]: https://phabricator.wikimedia.org/T218440
[this bug report]: https://phabricator.wikimedia.org/T218441
[in Debian]: https://bugs.debian.org/924685
[Python virtualenv]: https://virtualenv.pypa.io/
[briefly described in the Wikimedia docs]: https://wikitech.wikimedia.org/wiki/Cumin#PuppetDB_host_selection
[parallel-ssh]: https://code.google.com/archive/p/parallel-ssh/
This diff is collapsed.
Click to expand it.
tsa/howto/puppet.mdwn
+
6
−
58
View file @
7a14d663
...
...
@@ -444,7 +444,7 @@ The currently known values are: `kvm`, `physical`, and `xenu`.
curl -s -G http://localhost:8080/pdb/query/v4/nodes | jq -r 'sort_by(.report_timestamp) | .[] | "\(.certname) \(.report_timestamp)"' | column -s\ -t
* Using [
C
umin]
[], see below
* Using [
[c
umin]
]
* Using LDAP:
...
...
@@ -456,7 +456,6 @@ The currently known values are: `kvm`, `physical`, and `xenu`.
[PuppetDB API]: https://puppet.com/docs/puppetdb/4.3/api/index.html
[fact API]: https://puppet.com/docs/puppetdb/4.3/api/query/v4/facts.html
[Cumin]: https://doc.wikimedia.org/cumin/master/introduction.html
## Batch jobs on all hosts
...
...
@@ -480,64 +479,12 @@ To run batch commands through sudo that requires a password, you will need to fo
You should then type your password then Control-d. Warning: this will
show your password on your terminal and probably in the logs as well.
### Using Cumin
You can also use [Cumin][] to operate arbitrary shell commands on
Puppet hosts or a subset of hosts. First, install Cumin and setup a
tunnel to connect to the Puppet locally:
virtualenv --python=python3 ~/.virtualenvs/cumin
~/.virtualenvs/cumin/bin/pip3 install cumin
ssh -L8080:localhost:8080 pauli.torproject.org
Notice how Cumin is installed in a [Python virtualenv][]: it is not
yet [in Debian][]. You'll also need a patch to enable plain HTTP
access, see [this bug report][]. You might also want to disable the
[root check][] as well. Then drop the following configuration in
`~/.config/cumin/config.yaml`:
transport: clustershell
puppetdb:
host: localhost
scheme: http
port: 8080
api_version: 4 # Supported versions are v3 and v4. If not specified, v4 will be used.
log_file: cumin.log
default_backend: puppetdb
From here on we'll assume you use the following alias:
alias cumin="~/.virtualenvs/cumin/bin/cumin --config ~/.config/cumin/config.yaml"
This will run the `uptime` command on all hosts:
Batch jobs can also be ran on all Puppet hosts with Cumin:
ssh -N -L8080:localhost:8080 pauli.torproject.org &
cumin '*' uptime
To run against only a subset, you need to use the Cumin grammar, which
is [briefly described in the Wikimedia docs][]. For example, this
will run the same command only on physical hosts:
cumin 'F:virtual=physical' uptime
Just check the monitoring server:
cumin 'R:class=roles::monitoring' uptime
Any Puppet fact or class can be queried that way. This also serves as
a ad-hoc interface to query PuppetDB for certain facts, as you don't
have to provide a command. In that case, `cumin` runs in "dry mode"
and will simply show which hosts match the request:
$ cumin 'F:virtual=physical'
16 hosts will be targeted:
[...]
[root check]: https://phabricator.wikimedia.org/T218440
[this bug report]: https://phabricator.wikimedia.org/T218441
[in Debian]: https://bugs.debian.org/924685
[Python virtualenv]: https://virtualenv.pypa.io/
[briefly described in the Wikimedia docs]: https://wikitech.wikimedia.org/wiki/Cumin#PuppetDB_host_selection
[parallel-ssh]: https://code.google.com/archive/p/parallel-ssh/
See [[cumin]] for more examples.
## Generating secrets
...
...
@@ -607,7 +554,8 @@ argument from Hiera. This is how the transition to a managed
5. then this was added to two other hosts, and Puppet was ran there
6. finally, all hosts were checked to see if the file was present on
hosts and had any content:
hosts and had any content, with [[cumin]] (see above for
alternative way of running a command on all hosts):
cumin '*' 'du /etc/apt/sources.list'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment