community.general.cloud_init_data_facts (8.5.0) — module

Retrieve facts of cloud-init

Authors: René Moser (@resmo)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Gathers facts by reading the status.json and result.json of cloud-init.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather all facts of cloud init
  community.general.cloud_init_data_facts:
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- ansible.builtin.debug:
    var: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Wait for cloud init to finish
  community.general.cloud_init_data_facts:
    filter: status
  register: res
  until: "res.cloud_init_data_facts.status.v1.stage is defined and not res.cloud_init_data_facts.status.v1.stage"
  retries: 50
  delay: 5

Inputs

    
filter:
    choices:
    - status
    - result
    description:
    - Filter facts
    type: str

Outputs

cloud_init_data_facts:
  description: Facts of result and status.
  returned: success
  sample: '{ "status": { "v1": { "datasource": "DataSourceCloudStack", "errors": []
    }, "result": { "v1": { "datasource": "DataSourceCloudStack", "init": { "errors":
    [], "finished": 1522066377.0185432, "start": 1522066375.2648022 }, "init-local":
    { "errors": [], "finished": 1522066373.70919, "start": 1522066373.4726632 }, "modules-config":
    { "errors": [], "finished": 1522066380.9097016, "start": 1522066379.0011985 },
    "modules-final": { "errors": [], "finished": 1522066383.56594, "start": 1522066382.3449218
    }, "stage": null } }'
  type: dict