Giter VIP home page Giter VIP logo

ansible-dumpall's Introduction

Dumpall

Dump all remote variables and optionally copy the result to a destination on the host.

Based on the excellent work by Lester Wade!

Requirements

None.

Role Variables

dumpall_flat_mode: yes
dumpall_guest_destination: /tmp/ansible.all
dumpall_host_destination: /somewhere/local/

Role Tags

ansible-dumpall
ansible-dumpall-all-vars
ansible-dumpall-retrieve-dumpfile
ansible-dumpall-remove-dumpfile-guest 

Example Playbook

Example without a host_destination will result in a dumpfile /tmp/ansible.all on the guest:

- hosts: servers
  roles:
     - f500.dumpall

Example with a host_destination will result in a dumpfile /examine/ansible.all on the host machine: (the dumpfile on the guest is removed)

- hosts: servers
  roles:
     - { role: f500.dumpall, dumpall_host_destination: /examine/ }

If you also set the flat_mode to false, the local filename will be the entire path of the guest_destination, prepended by the hostname of the current play. See the Ansible fetch module for more information.

License

LGPL

Author Information

Jasper N. Brouwer, [email protected]

Ramon de la Fuente, [email protected]

ansible-dumpall's People

Contributors

ahelal avatar arthurzenika avatar geerlingguy avatar marcoskv avatar ramondelafuente avatar syzn avatar vazhnov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-dumpall's Issues

Exception when running on ansible 2.1.0.0

It worked pre 2.0.

TASK [f500.dumpall : Dump all vars] ********************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleError: Unexpected templating type error occurred on ({{ ansible_managed }}\n\n\nModule Variables (\"vars\"):\n--------------------------------\n{{ vars | to_nice_json }}\n\nEnvironment Variables (\"environment\"):\n--------------------------------\n{{ environment | to_nice_json }}\n\nGROUP NAMES Variables (\"group_names\"):\n--------------------------------\n{{ group_names | to_nice_json }}\n\nGROUPS Variables (\"groups\"):\n--------------------------------\n{{ groups | to_nice_json }}\n\nHOST Variables (\"hostvars\"):\n--------------------------------\n{{ hostvars[inventory_hostname] | to_nice_json }}\n): exceptions must be old-style classes or derived from BaseException, not type"}
---
- hosts: localhost
  connection: local
  gather_facts: False
  roles:
    - { role: f500.dumpall, dumpall_host_destination: /tmp/ansible_vars_dump_prov/ }

Please consider tagging releases without the "v" prefix

Can you tag versions using just the number?

eg,2.0.2 rather than v2.0.2? It's more consistent with how most projects/roles version things and makes the requirements.yml file cleaner... right now I have to do:

- src: f500.dumpall  # from Ansible Galaxy
  version: v2.0.2

New release needed for Ansible Galaxy

It would be great for a new release to be rolled. Specifically, so PR#11 is zipped up and then available to ansible galaxy. This is a handy little role, thanks.

Interested in Changing this to use delegate_to: localhost ?

As written the code works for individual servers. But it's possible to get a report of EVERYTHING on the localhost without ever touching the remote servers to generate the report. If interested I can send a pull request with all the changes. Then we can discuss the implications.

The extensions I've made could also take this from a pure Role to an included playbook. - if desired! - The way I use this to have the following one-liner at the end of all my playbooks:

  • include: roles/dumpvars/dumpvars.pb
    instead of
  • host: localhost
    roles:
    • dumpvars

Two things are needed

  1. use delegate_to: localhost.
  2. to get variables for all hosts you need a bit of extra magic. See below.

"hostvars": {
{% for key in groups["all"] %}
"{{key}}": {{ hostvars[key] |to_nice_json }}
,
{% endfor %}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.