<p>The direct answer is "no".</p>

<p>Ansible does not have any database, because it is supposed to be run by different operators from different computers and it's purpose is to be sure that target systems are in the exact state, as specified in playbooks.</p>

<p>There's an option to attach external <a href="http://docs.ansible.com/ansible/latest/playbooks_variables.html#fact-caching" rel="noreferrer">facts cache</a> backends to Ansible. So you can setup redis as your cache, Ansible will populate it with gathered facts during playbook run and you can later query redis for them. But it is very limited solution, because there are not too much facts gathered by Ansible, for example there are no information about installed packages – you will have to gather them yourself an use <code>set_fact</code> with <code>cacheable</code> option to put them into external cache.</p>

CC BY-SA 3.0
2017-12-08T08:36:45.380Z
Thx. I don't understand the "because" in your 2nd paragraph: Puppet would IMO also claim that "it is supposed to be run by different operators from different computers and it's purpose is to be sure that target systems are in the exact state" (only that it would speak of manifests instead of playbooks), yet it uses a database.
Drux
CC BY-SA 3.0
2017-12-08T08:40:08.723Z
I meant "without any central/shared component". So in Ansible you don't have any stateful component except target system.
Konstantin Suvorov
CC BY-SA 3.0
2017-12-08T08:40:54.430Z
I see, that makes sense.
Drux
CC BY-SA 3.0
2017-12-08T08:28:30.763Z
2017-12-08T08:28:30.763Z
Konstantin Suvorov
<p>I know Puppet from (limited) experience and have noticed that in configuration management there is now a strong trend towards Ansible.</p>

<p>On the one hand, I understand that Ansible does not require an agent, because it makes intelligent use of <code>ssh</code>. </p>

<p>On the other hand, these are features have come to like about Puppet:</p>

<ul>
<li>access to system-wide configuration state and history (PuppetDB) via REST API</li>
<li>ability to keep backups of overwritten files (filebuckets)</li>
<li>ability to encrypt part of the Hiera configurations (<code>.eyaml</code>)</li>
</ul>

<p>Among these, PuppetDB seems to me the most important and useful (e.g. for integration with other tools). Therefore my question is this: Does Ansible have something akin to PuppetDB, i.e. a component that offers an API where it could e.g. be asked "What packages are installed on host <em>x</em>?" or "On which hosts is package <em>y</em> installed?"</p>

<p>(This question was migrated over from <a href="https://stackoverflow.com/questions/47688598/does-ansible-have-component-akin-to-puppetdb">StackOverflow</a>).</p>

<p><strong>UPDATE</strong> Significant downside of Puppet it my experience so far: Not so much the fact that it requires an agent (from what I have seen, Ansible's use of Python also introduces an agent of sorts in the form of a Python interpreter ;-), but that it wants its agent to act as <code>root</code> only and always.</p>

CC BY-SA 3.0
2017-12-08T21:30:41.463Z
Curious: how would you expect a tool like Puppet (or Chef, or CFEngine) to be able to do what it does without running as `root`? It replaces the need for a SA to login and do things manually, therefore it must be able to do anything an SA can do.
Gaius
CC BY-SA 3.0
2017-12-08T21:39:06.850Z
@Gaius For one thing, I know a who does not have `root` access rights on a server cluster, but still can use Ansible for managing a large web application there. Besides, there are SAs who do not log in as `root`, but use `sudo` more sparsingly instead.
Drux
CC BY-SA 3.0
2017-12-10T07:07:32.100Z
They do still need to run commands as root then. If the agent running is a dealbreaker for you, then you are mis-applying the tool
Gaius
<ansible><configuration-management><puppet>
Does Ansible have component akin to PuppetDB?
Drux
# Does Ansible have component akin to PuppetDB?

(Asked by: username_0 on 2017-12-08)

I know Puppet from (limited) experience and have noticed that in configuration management there is now a strong trend towards Ansible.

On the one hand, I understand that Ansible does not require an agent, because it makes intelligent use of `ssh`.

On the other hand, these are features have come to like about Puppet:

* access to system-wide configuration state and history (PuppetDB) via REST API
* ability to keep backups of overwritten files (filebuckets)
* ability to encrypt part of the Hiera configurations (`.eyaml`)

Among these, PuppetDB seems to me the most important and useful (e.g. for integration with other tools). Therefore my question is this: Does Ansible have something akin to PuppetDB, i.e. a component that offers an API where it could e.g. be asked "What packages are installed on host *x*?" or "On which hosts is package *y* installed?"

(This question was migrated over from [StackOverflow](https://stackoverflow.com/questions/47688598/does-ansible-have-component-akin-to-puppetdb)).

**UPDATE** Significant downside of Puppet it my experience so far: Not so much the fact that it requires an agent (from what I have seen, Ansible's use of Python also introduces an agent of sorts in the form of a Python interpreter ;-), but that it wants its agent to act as `root` only and always.

**Tags:** ansible, configuration-management, puppet

> **Comments:**
> **username_1**: Curious: how would you expect a tool like Puppet (or Chef, or CFEngine) to be able to do what it does without running as `root`? It replaces the need for a SA to login and do things manually, therefore it must be able to do anything an SA can do.  
> **username_0**: @username_1 For one thing, I know a who does not have `root` access rights on a server cluster, but still can use Ansible for managing a large web application there. Besides, there are SAs who do not log in as `root`, but use `sudo` more sparsingly instead.  
> **username_1**: They do still need to run commands as root then. If the agent running is a dealbreaker for you, then you are mis-applying the tool  

---

## 1 answers

### Answer by username_2 on 2017-12-08. Score: 5 | Accepted answer

The direct answer is "no".

Ansible does not have any database, because it is supposed to be run by different operators from different computers and it's purpose is to be sure that target systems are in the exact state, as specified in playbooks.

There's an option to attach external [facts cache](http://docs.ansible.com/ansible/latest/playbooks_variables.html#fact-caching) backends to Ansible. So you can setup redis as your cache, Ansible will populate it with gathered facts during playbook run and you can later query redis for them. But it is very limited solution, because there are not too much facts gathered by Ansible, for example there are no information about installed packages – you will have to gather them yourself an use `set_fact` with `cacheable` option to put them into external cache.

> **Comments:**
> **username_0**: Thx. I don't understand the "because" in your 2nd paragraph: Puppet would IMO also claim that "it is supposed to be run by different operators from different computers and it's purpose is to be sure that target systems are in the exact state" (only that it would speak of manifests instead of playbooks), yet it uses a database.  
> **username_2**: I meant "without any central/shared component". So in Ansible you don't have any stateful component except target system.  
> **username_0**: I see, that makes sense.  

---

