БН
Size: a a a
БН
MY
DD
A
---
- hosts: lab1:lab2
gather_facts: no
tasks:
- name: "Gather the package facts"
package_facts:
manager: auto
- name: "Print the package facts"
debug:
var: "{{ ansible_facts['lab1']['ansible_facts.packages'] }}"
register: lab1_data
- name: "Print the package facts"
debug:
var: "{{ ansible_facts['lab2']['ansible_facts.packages'] }}"
register: lab2_data
- name: "Create file"
local_action: copy content={{ lab1_data }} dest=lab1.json
- name: "Create file"
local_action: copy content={{ lab2_data }} dest=lab2.json
A
---
- hosts: lab1:lab2
gather_facts: no
tasks:
- name: "Gather the package facts"
package_facts:
manager: auto
- name: "Print the package facts"
debug:
var: ansible_facts.packages
register: data
- name: "Create file"
local_action: copy content={{ data }} dest=ansible_output
A
A
A
ok: [lab1] => {
"ansible_facts.packages": {
"a11y-profile-manager-indicator": [
{
"arch": "amd64",
"category": "misc",
"name": "a11y-profile-manager-indicator",
"origin": "Ubuntu",
"source": "apt",
"version": "0.1.10-0ubuntu3"
}
],
....
ok: [lab2] => {
"ansible_facts.packages": {
"a11y-profile-manager-indicator": [
{
"arch": "amd64",
"category": "misc",
"name": "a11y-profile-manager-indicator",
"origin": "Ubuntu",
"source": "apt",
"version": "0.1.10-0ubuntu3"
}
],
...
TASK [Create file] *************************************************************
changed: [lab1]
changed: [lab2]
ММ
A
- name: "Create file"
local_action: copy content={{ data }} dest={{ inventory_hostname }}
A
A
VP
A
VP
VP
VP
БН
ignore_errors: yes
DD