Skip to content

Commit

Permalink
Use collection namespace in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
odyssey4me committed Aug 18, 2020
1 parent c7bc422 commit b309373
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion plugins/connection/libvirt_lxc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

DOCUMENTATION = '''
author: Michael Scherer <[email protected]>
connection: libvirt_lxc
connection: community.libvirt.libvirt_lxc
short_description: Run tasks in lxc containers via libvirt
description:
- Run commands or put/fetch files to an existing lxc container using libvirt
Expand Down
14 changes: 7 additions & 7 deletions plugins/modules/virt.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

EXAMPLES = '''
# a playbook task line:
- virt:
- community.libvirt.virt:
name: alpha
state: running
Expand All @@ -75,37 +75,37 @@
# defining and launching an LXC guest
- name: define vm
virt:
community.libvirt.virt:
command: define
xml: "{{ lookup('template', 'container-template.xml.j2') }}"
uri: 'lxc:///'
- name: start vm
virt:
community.libvirt.virt:
name: foo
state: running
uri: 'lxc:///'
# setting autostart on a qemu VM (default uri)
- name: set autostart for a VM
virt:
community.libvirt.virt:
name: foo
autostart: yes
# Defining a VM and making is autostart with host. VM will be off after this task
- name: define vm from xml and set autostart
virt:
community.libvirt.virt:
command: define
xml: "{{ lookup('template', 'vm_template.xml.j2') }}"
autostart: yes
# Listing VMs
- name: list all VMs
virt:
community.libvirt.virt:
command: list_vms
register: all_vms
- name: list only running VMs
virt:
community.libvirt.virt:
command: list_vms
state: running
register: running_vms
Expand Down
26 changes: 13 additions & 13 deletions plugins/modules/virt_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,69 +68,69 @@

EXAMPLES = '''
# Define a new network
- virt_net:
- community.libvirt.virt_net:
command: define
name: br_nat
xml: '{{ lookup("template", "network/bridge.xml.j2") }}'
# Start a network
- virt_net:
- community.libvirt.virt_net:
command: create
name: br_nat
# List available networks
- virt_net:
- community.libvirt.virt_net:
command: list_nets
# Get XML data of a specified network
- virt_net:
- community.libvirt.virt_net:
command: get_xml
name: br_nat
# Stop a network
- virt_net:
- community.libvirt.virt_net:
command: destroy
name: br_nat
# Undefine a network
- virt_net:
- community.libvirt.virt_net:
command: undefine
name: br_nat
# Gather facts about networks
# Facts will be available as 'ansible_libvirt_networks'
- virt_net:
- community.libvirt.virt_net:
command: facts
# Gather information about network managed by 'libvirt' remotely using uri
- virt_net:
- community.libvirt.virt_net:
command: info
uri: '{{ item }}'
with_items: '{{ libvirt_uris }}'
register: networks
# Ensure that a network is active (needs to be defined and built first)
- virt_net:
- community.libvirt.virt_net:
state: active
name: br_nat
# Ensure that a network is inactive
- virt_net:
- community.libvirt.virt_net:
state: inactive
name: br_nat
# Ensure that a given network will be started at boot
- virt_net:
- community.libvirt.virt_net:
autostart: yes
name: br_nat
# Disable autostart for a given network
- virt_net:
- community.libvirt.virt_net:
autostart: no
name: br_nat
# Add a new host in the dhcp pool
- virt_net:
- community.libvirt.virt_net:
name: br_nat
command: modify
xml: "<host mac='FC:C2:33:00:6c:3c' name='my_vm' ip='192.168.122.30'/>"
Expand Down
28 changes: 14 additions & 14 deletions plugins/modules/virt_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,74 +74,74 @@

EXAMPLES = '''
# Define a new storage pool
- virt_pool:
- community.libvirt.virt_pool:
command: define
name: vms
xml: '{{ lookup("template", "pool/dir.xml.j2") }}'
# Build a storage pool if it does not exist
- virt_pool:
- community.libvirt.virt_pool:
command: build
name: vms
# Start a storage pool
- virt_pool:
- community.libvirt.virt_pool:
command: create
name: vms
# List available pools
- virt_pool:
- community.libvirt.virt_pool:
command: list_pools
# Get XML data of a specified pool
- virt_pool:
- community.libvirt.virt_pool:
command: get_xml
name: vms
# Stop a storage pool
- virt_pool:
- community.libvirt.virt_pool:
command: destroy
name: vms
# Delete a storage pool (destroys contents)
- virt_pool:
- community.libvirt.virt_pool:
command: delete
name: vms
# Undefine a storage pool
- virt_pool:
- community.libvirt.virt_pool:
command: undefine
name: vms
# Gather facts about storage pools
# Facts will be available as 'ansible_libvirt_pools'
- virt_pool:
- community.libvirt.virt_pool:
command: facts
# Gather information about pools managed by 'libvirt' remotely using uri
- virt_pool:
- community.libvirt.virt_pool:
command: info
uri: '{{ item }}'
with_items: '{{ libvirt_uris }}'
register: storage_pools
# Ensure that a pool is active (needs to be defined and built first)
- virt_pool:
- community.libvirt.virt_pool:
state: active
name: vms
# Ensure that a pool is inactive
- virt_pool:
- community.libvirt.virt_pool:
state: inactive
name: vms
# Ensure that a given pool will be started at boot
- virt_pool:
- community.libvirt.virt_pool:
autostart: yes
name: vms
# Disable autostart for a given pool
- virt_pool:
- community.libvirt.virt_pool:
autostart: no
name: vms
'''
Expand Down

0 comments on commit b309373

Please sign in to comment.