Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larsks/ansible-toolbox
https://github.com/larsks/ansible-toolbox
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/larsks/ansible-toolbox
- Owner: larsks
- License: gpl-3.0
- Archived: true
- Created: 2015-10-19T19:33:32.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-07-08T18:33:59.000Z (over 5 years ago)
- Last Synced: 2024-09-17T01:43:36.674Z (about 2 months ago)
- Language: Python
- Size: 41 KB
- Stars: 190
- Watchers: 13
- Forks: 38
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
This repository contains a collection of tools that I find useful in
working with [Ansible][].![Build status](https://travis-ci.org/larsks/ansible-toolbox.svg?branch=master)
[ansible]: http://ansible.com/
## Commands
### ansible-role
The `ansible-role` script allows you to run a role from the command line.
For example, if you have a role `roles/testrole`, you can run it like
this:ansible-role testrole
This will target `localhost` by default, but you can use `--inventory`
and `--host` to modify the target of the role.### ansible-task
The `ansible-task` script allows you to run a task list directly from
the command line.If you have a tasklist `mytasks.yml`, you can run it like this:
ansible-task mytasks.yml
### ansible-eval
The `ansible-eval` script will return the result of evaluating a
Jinja2 template with ansible. For example, the result of running:ansible-eval '{{ ansible_eth0.ipv4 }}'
Might look something like:
{"broadcast": "192.168.1.255", "netmask": "255.255.255.0", "network": "192.168.1.0", "address": "192.168.1.74"}
Of course, you can use filters to reformat that:
$ ansible-eval '{{ ansible_eth0.ipv4 | to_nice_json }}'
{
"address": "192.168.1.74",
"broadcast": "192.168.1.255",
"netmask": "255.255.255.0",
"network": "192.168.1.0"
}## Common options
- `--hosts`, `-H` *hosts* -- The value of this argument will be applied
to the `hosts:` line in the generated playbook. Defaults to
`localhost`.
- `--gather`, `-g` -- Enable fact gathering (this is the default)
- `--no-gather`, `-G` -- Disable fact gatheringThe following additional options are simply proxies to the equivalent
`ansible-playbook` options:- `--check`, `-C`
- `--verbose`, `-v`
- `--sudo`, `-s`
- `--become`, `-b`
- `--user`, `-u` *user*
- `--inventory`, `-i` *inventory*
- `--extra-vars`, `-e` *vars*
- `--tags`, `-t` *tags*
- `--skip-tags` *tags*## Installation
You can install `ansible-toolbox` directly from GitHub like this:
pip install git+https://github.com/larsks/ansible-toolbox
If you have a copy of the repository, you can run:
cd ansible-toolbox
pip install .## License
ansible-toolbox, a collection of ansible utilities
Copyright (C) 2017 Lars Kellogg-StedmanThis program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program. If not, see .