code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
ansible ansible.utils.to_paths – Flatten a complex object into a dictionary of paths and values ansible.utils.to\_paths – Flatten a complex object into a dictionary of paths and values
========================================================================================
Note
This plugin is part of the [ansible.utils collection](https://galaxy.ansible.com/ansible/utils) (version 2.4.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.utils`.
To use it in a playbook, specify: `ansible.utils.to_paths`.
New in version 1.0.0: of ansible.utils
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Flatten a complex object into a dictionary of paths and values.
* Paths are dot delimited whenever possible.
* Brackets are used for list indices and keys that contain special characters.
* **to\_paths** is also available as a filter plugin.
* Using the parameters below- `lookup('ansible.utils.to_paths', var, prepend, wantlist`)
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **prepend** string | | | Prepend each path entry. Useful to add the initial *var* name. |
| **var** raw / required | | | The value of *var* will be used. |
| **wantlist** boolean | **Choices:*** no
* yes
| | If set to *True*, the return value will always be a list. This can also be accomplished using `query` or **q** instead of `lookup`. [https://docs.ansible.com/ansible/latest/plugins/lookup.html](../../../plugins/lookup)
|
Examples
--------
```
#### Simple examples
- ansible.builtin.set_fact:
a:
b:
c:
d:
- 0
- 1
e:
- True
- False
- ansible.builtin.set_fact:
paths: "{{ lookup('ansible.utils.to_paths', a) }}"
# TASK [ansible.builtin.set_fact] ********************************************
# ok: [nxos101] => changed=false
# ansible_facts:
# paths:
# b.c.d[0]: 0
# b.c.d[1]: 1
# b.c.e[0]: True
# b.c.e[1]: False
- name: Use prepend to add the initial variable name
ansible.builtin.set_fact:
paths: "{{ lookup('ansible.utils.to_paths', a, prepend='a') }}"
# TASK [Use prepend to add the initial variable name] **************************
# ok: [nxos101] => changed=false
# ansible_facts:
# paths:
# a.b.c.d[0]: 0
# a.b.c.d[1]: 1
# a.b.c.e[0]: True
# a.b.c.e[1]: False
#### Using a complex object
- name: Make an API call
ansible.builtin.uri:
url: "https://nxos101/restconf/data/openconfig-interfaces:interfaces"
headers:
accept: "application/yang.data+json"
url_password: password
url_username: admin
validate_certs: False
register: result
delegate_to: localhost
- name: Flatten the complex object
ansible.builtin.set_fact:
paths: "{{ lookup('ansible.utils.to_paths', result.json) }}"
# TASK [Flatten the complex object] ******************************************
# ok: [nxos101] => changed=false
# ansible_facts:
# paths:
# interfaces.interface[0].config.enabled: 'true'
# interfaces.interface[0].config.mtu: '1500'
# interfaces.interface[0].config.name: eth1/71
# interfaces.interface[0].config.type: ethernetCsmacd
# interfaces.interface[0].ethernet.config['auto-negotiate']: 'true'
# interfaces.interface[0].ethernet.state.counters['in-crc-errors']: '0'
# interfaces.interface[0].ethernet.state.counters['in-fragment-frames']: '0'
# interfaces.interface[0].ethernet.state.counters['in-jabber-frames']: '0'
# interfaces.interface[0].ethernet.state.counters['in-mac-control-frames']: '0'
# <...>
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** string | success | A dictionary of key value pairs. The key is the path. The value is the value. |
### Authors
* Bradley Thornton (@cidrblock)
ansible ansible.utils.fact_diff – Find the difference between currently set facts ansible.utils.fact\_diff – Find the difference between currently set facts
==========================================================================
Note
This plugin is part of the [ansible.utils collection](https://galaxy.ansible.com/ansible/utils) (version 2.4.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.utils`.
To use it in a playbook, specify: `ansible.utils.fact_diff`.
New in version 1.0.0: of ansible.utils
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Compare two facts or variables and get a diff.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **after** raw / required | | The second fact to be used in the comparison. |
| **before** raw / required | | The first fact to be used in the comparison. |
| **plugin** dictionary | **Default:**{} | Configure and specify the diff plugin to use |
| | **name** string | **Default:**"ansible.utils.native" | The diff plugin to use, in fully qualified collection name format. |
| | **vars** dictionary | **Default:**{} | Parameters passed to the diff plugin. |
| | | **skip\_lines** list / elements=string | | Skip lines matching these regular expressions. Matches will be removed prior to the diff. If the provided *before* and *after* are a string, they will be split. Each entry in each list will be cast to a string for the comparison |
Examples
--------
```
- ansible.builtin.set_fact:
before:
a:
b:
c:
d:
- 0
- 1
after:
a:
b:
c:
d:
- 2
- 3
- name: Show the difference in json format
ansible.utils.fact_diff:
before: "{{ before }}"
after: "{{ after }}"
# TASK [ansible.utils.fact_diff] **************************************
# --- before
# +++ after
# @@ -3,8 +3,8 @@
# "b": {
# "c": {
# "d": [
# - 0,
# - 1
# + 2,
# + 3
# ]
# }
# }
#
# changed: [localhost]
- name: Show the difference in path format
ansible.utils.fact_diff:
before: "{{ before|ansible.utils.to_paths }}"
after: "{{ after|ansible.utils.to_paths }}"
# TASK [ansible.utils.fact_diff] **************************************
# --- before
# +++ after
# @@ -1,4 +1,4 @@
# {
# - "a.b.c.d[0]": 0,
# - "a.b.c.d[1]": 1
# + "a.b.c.d[0]": 2,
# + "a.b.c.d[1]": 3
# }
#
# changed: [localhost]
- name: Show the difference in yaml format
ansible.utils.fact_diff:
before: "{{ before|to_nice_yaml }}"
after: "{{ after|to_nice_yaml }}"
# TASK [ansible.utils.fact_diff] **************************************
# --- before
# +++ after
# @@ -2,5 +2,5 @@
# b:
# c:
# d:
# - - 0
# - - 1
# + - 2
# + - 3
# changed: [localhost]
#### Show the difference between complex object using restconf
# ansible_connection: ansible.netcommon.httpapi
# ansible_httpapi_use_ssl: True
# ansible_httpapi_validate_certs: False
# ansible_network_os: ansible.netcommon.restconf
- name: Get the current interface config prior to changes
ansible.netcommon.restconf_get:
content: config
path: /data/Cisco-NX-OS-device:System/intf-items/phys-items
register: pre
- name: Update the description of eth1/100
ansible.utils.update_fact:
updates:
- path: "pre['response']['phys-items']['PhysIf-list'][{{ index }}]['descr']"
value: "Configured by ansible {{ 100 | random }}"
vars:
index: "{{ pre['response']['phys-items']['PhysIf-list']|ansible.utils.index_of('eq', 'eth1/100', 'id') }}"
register: updated
- name: Apply the configuration
ansible.netcommon.restconf_config:
path: 'data/Cisco-NX-OS-device:System/intf-items/'
content: "{{ updated.pre.response}}"
method: patch
- name: Get the current interface config after changes
ansible.netcommon.restconf_get:
content: config
path: /data/Cisco-NX-OS-device:System/intf-items/phys-items
register: post
- name: Show the difference
ansible.utils.fact_diff:
before: "{{ pre.response|ansible.utils.to_paths }}"
after: "{{ post.response|ansible.utils.to_paths }}"
# TASK [ansible.utils.fact_diff] *********************************************
# --- before
# +++ after
# @@ -3604,7 +3604,7 @@
# "phys-items['PhysIf-list'][37].bw": "0",
# "phys-items['PhysIf-list'][37].controllerId": "",
# "phys-items['PhysIf-list'][37].delay": "1",
# - "phys-items['PhysIf-list'][37].descr": "Configured by ansible 95",
# + "phys-items['PhysIf-list'][37].descr": "Configured by ansible 20",
# "phys-items['PhysIf-list'][37].dot1qEtherType": "0x8100",
# "phys-items['PhysIf-list'][37].duplex": "auto",
# "phys-items['PhysIf-list'][37].id": "eth1/100",
# changed: [nxos101]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **diff\_lines** list / elements=string | always | The *diff\_text* split into lines. |
| **diff\_text** string | always | The diff in text format. |
### Authors
* Bradley Thornton (@cidrblock)
ansible ansible.utils.update_fact – Update currently set facts ansible.utils.update\_fact – Update currently set facts
=======================================================
Note
This plugin is part of the [ansible.utils collection](https://galaxy.ansible.com/ansible/utils) (version 2.4.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.utils`.
To use it in a playbook, specify: `ansible.utils.update_fact`.
New in version 1.0.0: of ansible.utils
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module allows updating existing variables.
* Variables are updated on a host-by-host basis.
* Variables are not modified in place, instead they are returned by the module.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **updates** list / elements=dictionary / required | | A list of dictionaries, each a desired update to make. |
| | **path** string / required | | The path in a currently set variable to update. The path can be in dot or bracket notation. It should be a valid jinja reference. |
| | **value** raw / required | | The value to be set at the path. Can be a simple or complex data structure. |
Examples
--------
```
# Update an exisitng fact, dot or bracket notation
- name: Set a fact
ansible.builtin.set_fact:
a:
b:
c:
- 1
- 2
- name: Update the fact
ansible.utils.update_fact:
updates:
- path: a.b.c.0
value: 10
- path: "a['b']['c'][1]"
value: 20
register: updated
- debug:
var: updated.a
# updated:
# a:
# b:
# c:
# - 10
# - 20
# changed: true
# Lists can be appended, new keys added to dictionaries
- name: Set a fact
ansible.builtin.set_fact:
a:
b:
b1:
- 1
- 2
- name: Update, add to list, add new key
ansible.utils.update_fact:
updates:
- path: a.b.b1.2
value: 3
- path: a.b.b2
value:
- 10
- 20
- 30
register: updated
- debug:
var: updated.a
# updated:
# a:
# b:
# b1:
# - 1
# - 2
# - 3
# b2:
# - 10
# - 20
# - 30
# changed: true
#####################################################################
# Update every item in a list of dictionaries
# build the update list ahead of time using a loop
# and then apply the changes to the fact
#####################################################################
- name: Set fact
ansible.builtin.set_fact:
addresses:
- raw: 10.1.1.0/255.255.255.0
name: servers
- raw: 192.168.1.0/255.255.255.0
name: printers
- raw: 8.8.8.8
name: dns
- name: Build a list of updates
ansible.builtin.set_fact:
update_list: "{{ update_list + update }}"
loop: "{{ addresses }}"
loop_control:
index_var: idx
vars:
update_list: []
update:
- path: addresses[{{ idx }}].network
value: "{{ item['raw'] | ansible.netcommon.ipaddr('network') }}"
- path: addresses[{{ idx }}].prefix
value: "{{ item['raw'] | ansible.netcommon.ipaddr('prefix') }}"
- debug:
var: update_list
# TASK [debug] *******************
# ok: [localhost] =>
# update_list:
# - path: addresses[0].network
# value: 10.1.1.0
# - path: addresses[0].prefix
# value: '24'
# - path: addresses[1].network
# value: 192.168.1.0
# - path: addresses[1].prefix
# value: '24'
# - path: addresses[2].network
# value: 8.8.8.8
# - path: addresses[2].prefix
# value: '32'
- name: Make the updates
ansible.utils.update_fact:
updates: "{{ update_list }}"
register: updated
- debug:
var: updated
# TASK [debug] ***********************
# ok: [localhost] =>
# updated:
# addresses:
# - name: servers
# network: 10.1.1.0
# prefix: '24'
# raw: 10.1.1.0/255.255.255.0
# - name: printers
# network: 192.168.1.0
# prefix: '24'
# raw: 192.168.1.0/255.255.255.0
# - name: dns
# network: 8.8.8.8
# prefix: '32'
# raw: 8.8.8.8
# changed: true
# failed: false
#####################################################################
# Retrieve, update, and apply interface description change
# use index_of to locate Etherent1/1
#####################################################################
- name: Get the current interface config
cisco.nxos.nxos_interfaces:
state: gathered
register: interfaces
- name: Update the description of Ethernet1/1
ansible.utils.update_fact:
updates:
- path: "interfaces.gathered[{{ index }}].description"
value: "Configured by ansible"
vars:
index: "{{ interfaces.gathered|ansible.utils.index_of('eq', 'Ethernet1/1', 'name') }}"
register: updated
- name: Update the configuration
cisco.nxos.nxos_interfaces:
config: "{{ updated.interfaces.gathered }}"
state: overridden
register: result
- name: Show the commands issued
debug:
msg: "{{ result['commands'] }}"
# TASK [Show the commands issued] *************************************
# ok: [nxos101] => {
# "msg": [
# "interface Ethernet1/1",
# "description Configured by ansible"
# ]
# }
#####################################################################
# Retrieve, update, and apply an ipv4 ACL change
# finding the index of AFI ipv4 acls
# finding the index of the ACL named 'test1'
# finding the index of sequence 10
#####################################################################
- name: Retrieve the current acls
arista.eos.eos_acls:
state: gathered
register: current
- name: Update the source of sequence 10 in the IPv4 ACL named test1
ansible.utils.update_fact:
updates:
- path: current.gathered[{{ afi }}].acls[{{ acl }}].aces[{{ ace }}].source
value:
subnet_address: "192.168.2.0/24"
vars:
afi: "{{ current.gathered|ansible.utils.index_of('eq', 'ipv4', 'afi') }}"
acl: "{{ current.gathered[afi|int].acls|ansible.utils.index_of('eq', 'test1', 'name') }}"
ace: "{{ current.gathered[afi|int].acls[acl|int].aces|ansible.utils.index_of('eq', 10, 'sequence') }}"
register: updated
- name: Apply the changes
arista.eos.eos_acls:
config: "{{ updated.current.gathered }}"
state: overridden
register: changes
- name: Show the commands issued
debug:
msg: "{{ changes['commands'] }}"
# TASK [Show the commands issued] *************************************
# ok: [eos101] => {
# "msg": [
# "ip access-list test1",
# "no 10",
# "10 permit ip 192.168.2.0/24 host 10.1.1.2"
# ]
# }
#####################################################################
# Disable ip redirects on any layer3 interface
# find the layer 3 interfaces
# use each name to find their index in l3 interface
# build an 'update' list and apply the updates
#####################################################################
- name: Get the current interface and L3 interface configuration
cisco.nxos.nxos_facts:
gather_subset: min
gather_network_resources:
- interfaces
- l3_interfaces
- name: Build the list of updates to make
ansible.builtin.set_fact:
updates: "{{ updates + [entry] }}"
vars:
updates: []
entry:
path: "ansible_network_resources.l3_interfaces[{{ item }}].redirects"
value: False
w_mode: "{{ ansible_network_resources.interfaces|selectattr('mode', 'defined') }}"
m_l3: "{{ w_mode|selectattr('mode', 'eq', 'layer3') }}"
names: "{{ m_l3|map(attribute='name')|list }}"
l3_indicies: "{{ ansible_network_resources.l3_interfaces|ansible.utils.index_of('in', names, 'name', wantlist=True) }}"
loop: "{{ l3_indicies }}"
# TASK [Build the list of updates to make] ****************************
# ok: [nxos101] => (item=99) => changed=false
# ansible_facts:
# updates:
# - path: ansible_network_resources.l3_interfaces[99].redirects
# value: false
# ansible_loop_var: item
# item: 99
- name: Update the l3 interfaces
ansible.utils.update_fact:
updates: "{{ updates }}"
register: updated
# TASK [Update the l3 interfaces] *************************************
# changed: [nxos101] => changed=true
# ansible_network_resources:
# l3_interfaces:
# <...>
# - ipv4:
# - address: 10.1.1.1/24
# name: Ethernet1/100
# redirects: false
- name: Apply the configuration changes
cisco.nxos.l3_interfaces:
config: "{{ updated.ansible_network_resources.l3_interfaces }}"
state: overridden
register: changes
# TASK [Apply the configuration changes] ******************************
# changed: [nxos101] => changed=true
# commands:
# - interface Ethernet1/100
# - no ip redirects
```
### Authors
* Bradley Thornton (@cidrblock)
ansible ansible.utils.cli_parse – Parse cli output or text using a variety of parsers ansible.utils.cli\_parse – Parse cli output or text using a variety of parsers
==============================================================================
Note
This plugin is part of the [ansible.utils collection](https://galaxy.ansible.com/ansible/utils) (version 2.4.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.utils`.
To use it in a playbook, specify: `ansible.utils.cli_parse`.
New in version 1.0.0: of ansible.utils
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Parse cli output or text using a variety of parsers
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **command** string | | The command to run on the host |
| **parser** dictionary / required | | Parser specific parameters |
| | **command** string | | The command used to locate the parser's template |
| | **name** string / required | | The name of the parser to use |
| | **os** string | | Provide an operating system value to the parser For `ntc\_templates` parser, this should be in the supported `<vendor>\_<os>` format. |
| | **template\_path** string | | Path of the parser template on the Ansible controller This can be a relative or an absolute path |
| | **vars** dictionary | | Additional parser specific parameters See the cli\_parse user guide for examples of parser specific variables [https://docs.ansible.com/ansible/latest/network/user\_guide/cli\_parsing.html](../../../network/user_guide/cli_parsing) |
| **set\_fact** string | | Set the resulting parsed data as a fact |
| **text** string | | Text to be parsed |
Notes
-----
Note
* The default search path for a parser template is templates/{{ short\_os }}\_{{ command }}.{{ extension }}
* => short\_os derived from ansible\_network\_os or ansible\_distribution and set to lower case
* => command is the command passed to the module with spaces replaced with \_
* => extension is specific to the parser used (native=yaml, textfsm=textfsm, ttp=ttp)
* The default Ansible search path for the templates directory is used for parser templates as well
* Some parsers may have additional configuration options available. See the parsers/vars key and the parser’s documentation
* Some parsers require third-party python libraries be installed on the Ansible control node and a specific python version
* example Pyats requires pyats and genie and requires Python 3
* example ntc\_templates requires ntc\_templates
* example textfsm requires textfsm
* example ttp requires ttp
* example xml requires xml\_to\_dict
* Support of 3rd party python libraries is limited to the use of their public APIs as documented
* Additional information and examples can be found in the parsing user guide:
* [https://docs.ansible.com/ansible/latest/network/user\_guide/cli\_parsing.html](../../../network/user_guide/cli_parsing)
Examples
--------
```
# Using the native parser
# -------------
# templates/nxos_show_interface.yaml
# - example: Ethernet1/1 is up
# getval: '(?P<name>\S+) is (?P<oper_state>\S+)'
# result:
# "{{ name }}":
# name: "{{ name }}"
# state:
# operating: "{{ oper_state }}"
# shared: True
#
# - example: admin state is up, Dedicated Interface
# getval: 'admin state is (?P<admin_state>\S+)'
# result:
# "{{ name }}":
# name: "{{ name }}"
# state:
# admin: "{{ admin_state }}"
#
# - example: " Hardware: Ethernet, address: 0000.5E00.5301 (bia 0000.5E00.5301)"
# getval: '\s+Hardware: (?P<hardware>.*), address: (?P<mac>\S+)'
# result:
# "{{ name }}":
# hardware: "{{ hardware }}"
# mac_address: "{{ mac }}"
- name: Run command and parse with native
ansible.utils.cli_parse:
command: "show interface"
parser:
name: ansible.netcommon.native
set_fact: interfaces_fact
- name: Pass text and template_path
ansible.utils.cli_parse:
text: "{{ previous_command['stdout'] }}"
parser:
name: ansible.netcommon.native
template_path: "{{ role_path }}/templates/nxos_show_interface.yaml"
# Using the ntc_templates parser
# -------------
# The ntc_templates use 'vendor_platform' for the file name
# it will be derived from ansible_network_os if not provided
# example cisco.ios.ios => cisco_ios
- name: Run command and parse with ntc_templates
ansible.utils.cli_parse:
command: "show interface"
parser:
name: ansible.netcommon.ntc_templates
register: parser_output
- name: Pass text and command
ansible.utils.cli_parse:
text: "{{ previous_command['stdout'] }}"
parser:
name: ansible.netcommon.ntc_templates
command: show interface
register: parser_output
# Using the pyats parser
# -------------
# The pyats parser uses 'os' to locate the appropriate parser
# it will be derived from ansible_network_os if not provided
# in the case of pyats: cisco.ios.ios => iosxe
- name: Run command and parse with pyats
ansible.utils.cli_parse:
command: "show interface"
parser:
name: ansible.netcommon.pyats
register: parser_output
- name: Pass text and command
ansible.utils.cli_parse:
text: "{{ previous_command['stdout'] }}"
parser:
name: ansible.netcommon.pyats
command: show interface
register: parser_output
- name: Provide an OS to pyats to use an ios parser
ansible.utils.cli_parse:
text: "{{ previous_command['stdout'] }}"
parser:
name: ansible.netcommon.pyats
command: show interface
os: ios
register: parser_output
# Using the textfsm parser
# -------------
# templates/nxos_show_version.textfsm
#
# Value UPTIME ((\d+\s\w+.s.,?\s?){4})
# Value LAST_REBOOT_REASON (.+)
# Value OS (\d+.\d+(.+)?)
# Value BOOT_IMAGE (.*)
# Value PLATFORM (\w+)
#
# Start
# ^\s+(NXOS: version|system:\s+version)\s+${OS}\s*$$
# ^\s+(NXOS|kickstart)\s+image\s+file\s+is:\s+${BOOT_IMAGE}\s*$$
# ^\s+cisco\s+${PLATFORM}\s+[cC]hassis
# ^\s+cisco\s+Nexus\d+\s+${PLATFORM}
# # Cisco N5K platform
# ^\s+cisco\s+Nexus\s+${PLATFORM}\s+[cC]hassis
# ^\s+cisco\s+.+-${PLATFORM}\s*
# ^Kernel\s+uptime\s+is\s+${UPTIME}
# ^\s+Reason:\s${LAST_REBOOT_REASON} -> Record
- name: Run command and parse with textfsm
ansible.utils.cli_parse:
command: "show version"
parser:
name: ansible.utils.textfsm
register: parser_output
- name: Pass text and command
ansible.utils.cli_parse:
text: "{{ previous_command['stdout'] }}"
parser:
name: ansible.utils.textfsm
command: show version
register: parser_output
# Using the ttp parser
# -------------
# templates/nxos_show_interface.ttp
#
# {{ interface }} is {{ state }}
# admin state is {{ admin_state }}{{ ignore(".*") }}
- name: Run command and parse with ttp
ansible.utils.cli_parse:
command: "show interface"
parser:
name: ansible.utils.ttp
set_fact: new_fact_key
- name: Pass text and template_path
ansible.utils.cli_parse:
text: "{{ previous_command['stdout'] }}"
parser:
name: ansible.utils.ttp
template_path: "{{ role_path }}/templates/nxos_show_interface.ttp"
register: parser_output
# Using the XML parser
# -------------
- name: Run command and parse with xml
ansible.utils.cli_parse:
command: "show interface | xml"
parser:
name: ansible.utils.xml
register: parser_output
- name: Pass text and parse with xml
ansible.utils.cli_parse:
text: "{{ previous_command['stdout'] }}"
parser:
name: ansible.utils.xml
register: parser_output
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **parsed** dictionary | always | The structured data resulting from the parsing of the text |
| **stdout** string | when provided a command | The output from the command run |
| **stdout\_lines** list / elements=string | when provided a command | The output of the command run split into lines |
### Authors
* Bradley Thornton (@cidrblock)
| programming_docs |
ansible ansible.utils.validate – Validate data with provided criteria ansible.utils.validate – Validate data with provided criteria
=============================================================
Note
This plugin is part of the [ansible.utils collection](https://galaxy.ansible.com/ansible/utils) (version 2.4.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.utils`.
To use it in a playbook, specify: `ansible.utils.validate`.
New in version 1.0.0: of ansible.utils
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Validate data with provided criteria based on the validation engine.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **criteria** raw / required | | The criteria used for validation of *data*. For the type of criteria refer to the documentation of individual validate plugins. |
| **data** raw / required | | Data that will be validated against *criteria*. For the type of data refer to the documentation of individual validate plugins. |
| **engine** string | **Default:**"ansible.utils.jsonschema" | The name of the validate plugin to use. The engine value should follow the fully qualified collection name format, that is <org-name>.<collection-name>.<validate-plugin-name>. |
Notes
-----
Note
* For the type of options *data* and *criteria* refer to the individual validate plugin documentation that is represented in the value of *engine* option.
* For additional plugin configuration options refer to the individual validate plugin documentation that is represented by the value of *engine* option.
* The plugin configuration option can be either passed as task or environment variables.
* The precedence of the validate plugin configurable option is task variables followed by the environment variables.
Examples
--------
```
- name: set facts for data and criteria
ansible.builtin.set_fact:
data: "{{ lookup('ansible.builtin.file', './validate/data/show_interfaces_iosxr.json')}}"
criteria: "{{ lookup('ansible.builtin.file', './validate/criteria/jsonschema/show_interfaces_iosxr.json')}}"
- name: validate data in with jsonschema engine (by passing task vars as configurable plugin options)
ansible.utils.validate:
data: "{{ data }}"
criteria: "{{ criteria }}"
engine: ansible.utils.jsonschema
vars:
ansible_jsonschema_draft: draft7
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **errors** list / elements=string | when *data* value is invalid | The list of errors in *data* based on the *criteria*. |
| **msg** string | always | The msg indicates if the *data* is valid as per the *criteria*. In case data is valid return success message **all checks passed**. In case data is invalid return error message **Validation errors were found** along with more information on error is available. |
### Authors
* Bradley Thornton (@cidrblock)
* Ganesh Nalawade (@ganeshrn)
ansible ansible.windows.win_user – Manages local Windows user accounts ansible.windows.win\_user – Manages local Windows user accounts
===============================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_user`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages local Windows user accounts.
* For non-Windows targets, use the [ansible.builtin.user](../builtin/user_module#ansible-collections-ansible-builtin-user-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **account\_disabled** boolean | **Choices:*** no
* yes
|
`yes` will disable the user account.
`no` will clear the disabled flag. |
| **account\_locked** boolean | **Choices:*** no
* yes
| Only `no` can be set and it will unlock the user account if locked. |
| **description** string | | Description of the user. |
| **fullname** string | | Full name of the user. |
| **groups** list / elements=string | | Adds or removes the user from this comma-separated list of groups, depending on the value of *groups\_action*. When *groups\_action* is `replace` and *groups* is set to the empty string ('groups='), the user is removed from all groups. Since `ansible.windows v1.5.0` it is possible to specify a group using it's security identifier. |
| **groups\_action** string | **Choices:*** add
* **replace** ←
* remove
| If `add`, the user is added to each group in *groups* where not already a member. If `replace`, the user is added as a member of each group in *groups* and removed from any other groups. If `remove`, the user is removed from each group in *groups*. |
| **home\_directory** string added in 1.0.0 of ansible.windows | | The designated home directory of the user. |
| **login\_script** string added in 1.0.0 of ansible.windows | | The login script of the user. |
| **name** string / required | | Name of the user to create, remove or modify. |
| **password** string | | Optionally set the user's password to this (plain text) value. |
| **password\_expired** boolean | **Choices:*** no
* yes
|
`yes` will require the user to change their password at next login.
`no` will clear the expired password flag. |
| **password\_never\_expires** boolean | **Choices:*** no
* yes
|
`yes` will set the password to never expire.
`no` will allow the password to expire. |
| **profile** string added in 1.0.0 of ansible.windows | | The profile path of the user. |
| **state** string | **Choices:*** absent
* **present** ←
* query
| When `absent`, removes the user account if it exists. When `present`, creates or updates the user account. When `query`, retrieves the user account details without making any changes. |
| **update\_password** string | **Choices:*** **always** ←
* on\_create
|
`always` will update passwords if they differ.
`on_create` will only set the password for newly created users. |
| **user\_cannot\_change\_password** boolean | **Choices:*** no
* yes
|
`yes` will prevent the user from changing their password.
`no` will allow the user to change their password. |
Notes
-----
Note
* The return values are based on the user object after the module options have been set. When running in check mode the values will still reflect the existing user settings and not what they would have been changed to.
See Also
--------
See also
[ansible.builtin.user](../builtin/user_module#ansible-collections-ansible-builtin-user-module)
The official documentation on the **ansible.builtin.user** module.
[ansible.windows.win\_domain\_membership](win_domain_membership_module#ansible-collections-ansible-windows-win-domain-membership-module)
The official documentation on the **ansible.windows.win\_domain\_membership** module.
[community.windows.win\_domain\_user](../../community/windows/win_domain_user_module#ansible-collections-community-windows-win-domain-user-module)
The official documentation on the **community.windows.win\_domain\_user** module.
[ansible.windows.win\_group](win_group_module#ansible-collections-ansible-windows-win-group-module)
The official documentation on the **ansible.windows.win\_group** module.
[ansible.windows.win\_group\_membership](win_group_membership_module#ansible-collections-ansible-windows-win-group-membership-module)
The official documentation on the **ansible.windows.win\_group\_membership** module.
[community.windows.win\_user\_profile](../../community/windows/win_user_profile_module#ansible-collections-community-windows-win-user-profile-module)
The official documentation on the **community.windows.win\_user\_profile** module.
Examples
--------
```
- name: Ensure user bob is present
ansible.windows.win_user:
name: bob
password: B0bP4ssw0rd
state: present
groups:
- Users
- name: Ensure user bob is absent
ansible.windows.win_user:
name: bob
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **account\_disabled** boolean | user exists | Whether the user is disabled. |
| **account\_locked** boolean | user exists | Whether the user is locked. |
| **description** string | user exists | The description set for the user. **Sample:** Username for test |
| **fullname** string | user exists | The full name set for the user. **Sample:** Test Username |
| **groups** list / elements=string | user exists | A list of groups and their ADSI path the user is a member of. **Sample:** [{'name': 'Administrators', 'path': 'WinNT://WORKGROUP/USER-PC/Administrators'}] |
| **name** string | always | The name of the user **Sample:** username |
| **password\_expired** boolean | user exists | Whether the password is expired. |
| **password\_never\_expires** boolean | user exists | Whether the password is set to never expire. **Sample:** True |
| **path** string | user exists | The ADSI path for the user. **Sample:** WinNT://WORKGROUP/USER-PC/username |
| **sid** string | user exists | The SID for the user. **Sample:** S-1-5-21-3322259488-2828151810-3939402796-1001 |
| **user\_cannot\_change\_password** boolean | user exists | Whether the user can change their own password. |
### Authors
* Paul Durivage (@angstwad)
* Chris Church (@cchurch)
ansible ansible.windows.win_service – Manage and query Windows services ansible.windows.win\_service – Manage and query Windows services
================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_service`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage and query Windows services.
* For non-Windows targets, use the [ansible.builtin.service](../builtin/service_module#ansible-collections-ansible-builtin-service-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dependencies** list / elements=string | | A list of service dependencies to set for this particular service. This should be a list of service names and not the display name of the service. This works by `dependency_action` to either add/remove or set the services in this list. |
| **dependency\_action** string | **Choices:*** add
* remove
* **set** ←
| Used in conjunction with `dependency` to either add the dependencies to the existing service dependencies. Remove the dependencies to the existing dependencies. Set the dependencies to only the values in the list replacing the existing dependencies. |
| **description** string | | The description to set for the service. |
| **desktop\_interact** boolean | **Choices:*** **no** ←
* yes
| Whether to allow the service user to interact with the desktop. This can only be set to `yes` when using the `LocalSystem` username. This can only be set to `yes` when the *service\_type* is `win32_own_process` or `win32_share_process`. |
| **display\_name** string | | The display name to set for the service. |
| **error\_control** string | **Choices:*** critical
* ignore
* normal
* severe
| The severity of the error and action token if the service fails to start. A new service defaults to `normal`.
`critical` will log the error and restart the system with the last-known good configuration. If the startup fails on reboot then the system will fail to operate.
`ignore` ignores the error.
`normal` logs the error in the event log but continues.
`severe` is like `critical` but a failure on the last-known good configuration reboot startup will be ignored. |
| **failure\_actions** list / elements=dictionary | | A list of failure actions the service controller should take on each failure of a service. The service manager will run the actions from first to last defined until the service starts. If *failure\_reset\_period\_sec* has been exceeded then the failure actions will restart from the beginning. If all actions have been performed the the service manager will repeat the last service defined. The existing actions will be replaced with the list defined in the task if there is a mismatch with any of them. Set to an empty list to delete all failure actions on a service otherwise an omitted or null value preserves the existing actions on the service. |
| | **delay\_ms** raw | **Default:**0 | The time to wait, in milliseconds, before performing the specified action.
aliases: delay |
| | **type** string / required | **Choices:*** none
* reboot
* restart
* run\_command
| The action to be performed.
`none` will perform no action, when used this should only be set as the last action.
`reboot` will reboot the host, when used this should only be set as the last action as the reboot will reset the action list back to the beginning.
`restart` will restart the service.
`run_command` will run the command specified by *failure\_command*. |
| **failure\_actions\_on\_non\_crash\_failure** boolean | **Choices:*** no
* yes
| Controls whether failure actions will be performed on non crash failures or not. |
| **failure\_command** string | | The command to run for a `run_command` failure action. Set to an empty string to remove the command. |
| **failure\_reboot\_msg** string | | The message to be broadcast to users logged on the host for a `reboot` failure action. Set to an empty string to remove the message. |
| **failure\_reset\_period\_sec** raw | | The time in seconds after which the failure action list resets back to the start of the list if there are no failures. To set this value, *failure\_actions* must have at least 1 action present. Specify `'0xFFFFFFFF'` to set an infinite reset period.
aliases: failure\_reset\_period |
| **force\_dependent\_services** boolean | **Choices:*** **no** ←
* yes
| If `yes`, stopping or restarting a service with dependent services will force the dependent services to stop or restart also. If `no`, stopping or restarting a service with dependent services may fail. |
| **load\_order\_group** string | | The name of the load ordering group of which this service is a member. Specify an empty string to remove the existing load order group of a service. |
| **name** string / required | | Name of the service. If only the name parameter is specified, the module will report on whether the service exists or not without making any changes. |
| **password** string | | The password to set the service to start as. This and the `username` argument should be supplied together when using a local or domain account. If omitted then the password will continue to use the existing value password set. If specifying `LocalSystem`, `NetworkService`, `LocalService`, the `NT SERVICE`, or a gMSA this field can be omitted as those accounts have no password. |
| **path** string | | The path to the executable to set for the service. |
| **pre\_shutdown\_timeout\_ms** raw | | The time in which the service manager waits after sending a preshutdown notification to the service until it proceeds to continue with the other shutdown actions.
aliases: pre\_shutdown\_timeout |
| **required\_privileges** list / elements=string | | A list of privileges the service must have when starting up. When set the service will only have the privileges specified on its access token. The *username* of the service must already have the privileges assigned. The existing privileges will be replace with the list defined in the task if there is a mismatch with any of them. Set to an empty list to remove all required privileges, otherwise an omitted or null value will keep the existing privileges. See [privilege text constants](https://docs.microsoft.com/en-us/windows/win32/secauthz/privilege-constants) for a list of privilege constants that can be used. |
| **service\_type** string | **Choices:*** user\_own\_process
* user\_share\_process
* win32\_own\_process
* win32\_share\_process
| The type of service. The default type of a new service is `win32_own_process`.
*desktop\_interact* can only be set if the service type is `win32_own_process` or `win32_share_process`. |
| **sid\_info** string | **Choices:*** none
* restricted
* unrestricted
| Used to define the behaviour of the service's access token groups.
`none` will not add any groups to the token.
`restricted` will add the `NT SERVICE\<service name>` SID to the access token's groups and restricted groups.
`unrestricted` will add the `NT SERVICE\<service name>` SID to the access token's groups. |
| **start\_mode** string | **Choices:*** auto
* delayed
* disabled
* manual
| Set the startup type for the service. A newly created service will default to `auto`. |
| **state** string | **Choices:*** absent
* paused
* started
* stopped
* restarted
| The desired state of the service.
`started`/`stopped`/`absent`/`paused` are idempotent actions that will not run commands unless necessary.
`restarted` will always bounce the service. Only services that support the paused state can be paused, you can check the return value `can_pause_and_continue`. You can only pause a service that is already started. A newly created service will default to `stopped`. |
| **update\_password** string | **Choices:*** always
* on\_create
| When set to `always` and *password* is set, the module will always report a change and set the password. Set to `on_create` to only set the password if the module needs to create the service. If *username* was specified and the service changed to that username then *password* will also be changed if specified. The current default is `on_create` but this behaviour may change in the future, it is best to be explicit here. |
| **username** string | | The username to set the service to start as. Can also be set to `LocalSystem` or `SYSTEM` to use the SYSTEM account. A newly created service will default to `LocalSystem`. If using a custom user account, it must have the `SeServiceLogonRight` granted to be able to start up. You can use the [ansible.windows.win\_user\_right](win_user_right_module) module to grant this user right for you. Set to `NT SERVICE\service name` to run as the NT SERVICE account for that service. This can also be a gMSA in the form `DOMAIN\gMSA$`. |
Notes
-----
Note
* This module historically returning information about the service in its return values. These should be avoided in favour of the [ansible.windows.win\_service\_info](win_service_info_module#ansible-collections-ansible-windows-win-service-info-module) module.
* Most of the options in this module are non-driver services that you can view in SCManager. While you can edit driver services, not all functionality may be available.
* The user running the module must have the following access rights on the service to be able to use it with this module - `SERVICE_CHANGE_CONFIG`, `SERVICE_ENUMERATE_DEPENDENTS`, `SERVICE_QUERY_CONFIG`, `SERVICE_QUERY_STATUS`.
* Changing the state or removing the service will also require futher rights depending on what needs to be done.
See Also
--------
See also
[ansible.builtin.service](../builtin/service_module#ansible-collections-ansible-builtin-service-module)
The official documentation on the **ansible.builtin.service** module.
[community.windows.win\_nssm](../../community/windows/win_nssm_module#ansible-collections-community-windows-win-nssm-module)
The official documentation on the **community.windows.win\_nssm** module.
[ansible.windows.win\_service\_info](win_service_info_module#ansible-collections-ansible-windows-win-service-info-module)
The official documentation on the **ansible.windows.win\_service\_info** module.
[ansible.windows.win\_user\_right](win_user_right_module#ansible-collections-ansible-windows-win-user-right-module)
The official documentation on the **ansible.windows.win\_user\_right** module.
Examples
--------
```
- name: Restart a service
ansible.windows.win_service:
name: spooler
state: restarted
- name: Set service startup mode to auto and ensure it is started
ansible.windows.win_service:
name: spooler
start_mode: auto
state: started
- name: Pause a service
ansible.windows.win_service:
name: Netlogon
state: paused
- name: Ensure that WinRM is started when the system has settled
ansible.windows.win_service:
name: WinRM
start_mode: delayed
# A new service will also default to the following values:
# - username: LocalSystem
# - state: stopped
# - start_mode: auto
- name: Create a new service
ansible.windows.win_service:
name: service name
path: C:\temp\test.exe
- name: Create a new service with extra details
ansible.windows.win_service:
name: service name
path: C:\temp\test.exe
display_name: Service Name
description: A test service description
- name: Remove a service
ansible.windows.win_service:
name: service name
state: absent
# This is required to be set for non-service accounts that need to run as a service
- name: Grant domain account the SeServiceLogonRight user right
ansible.windows.win_user_right:
name: SeServiceLogonRight
users:
- DOMAIN\User
action: add
- name: Set the log on user to a domain account
ansible.windows.win_service:
name: service name
state: restarted
username: DOMAIN\User
password: Password
- name: Set the log on user to a local account
ansible.windows.win_service:
name: service name
state: restarted
username: .\Administrator
password: Password
- name: Set the log on user to Local System
ansible.windows.win_service:
name: service name
state: restarted
username: SYSTEM
- name: Set the log on user to Local System and allow it to interact with the desktop
ansible.windows.win_service:
name: service name
state: restarted
username: SYSTEM
desktop_interact: yes
- name: Set the log on user to Network Service
ansible.windows.win_service:
name: service name
state: restarted
username: NT AUTHORITY\NetworkService
- name: Set the log on user to Local Service
ansible.windows.win_service:
name: service name
state: restarted
username: NT AUTHORITY\LocalService
- name: Set the log on user as the services' virtual account
ansible.windows.win_service:
name: service name
username: NT SERVICE\service name
- name: Set the log on user as a gMSA
ansible.windows.win_service:
name: service name
username: DOMAIN\gMSA$ # The end $ is important and should be set for all gMSA
- name: Set dependencies to ones only in the list
ansible.windows.win_service:
name: service name
dependencies: [ service1, service2 ]
- name: Add dependencies to existing dependencies
ansible.windows.win_service:
name: service name
dependencies: [ service1, service2 ]
dependency_action: add
- name: Remove dependencies from existing dependencies
ansible.windows.win_service:
name: service name
dependencies:
- service1
- service2
dependency_action: remove
- name: Set required privileges for a service
ansible.windows.win_service:
name: service name
username: NT SERVICE\LocalService
required_privileges:
- SeBackupPrivilege
- SeRestorePrivilege
- name: Remove all required privileges for a service
ansible.windows.win_service:
name: service name
username: NT SERVICE\LocalService
required_privileges: []
- name: Set failure actions for a service with no reset period
ansible.windows.win_service:
name: service name
failure_actions:
- type: restart
- type: run_command
delay_ms: 1000
- type: restart
delay_ms: 5000
- type: reboot
failure_command: C:\Windows\System32\cmd.exe /c mkdir C:\temp
failure_reboot_msg: Restarting host because service name has failed
failure_reset_period_sec: '0xFFFFFFFF'
- name: Set only 1 failure action without a repeat of the last action
ansible.windows.win_service:
name: service name
failure_actions:
- type: restart
delay_ms: 5000
- type: none
- name: Remove failure action information
ansible.windows.win_service:
name: service name
failure_actions: []
failure_command: '' # removes the existing command
failure_reboot_msg: '' # removes the existing reboot msg
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **can\_pause\_and\_continue** boolean | success and service exists | Whether the service can be paused and unpaused. **Sample:** True |
| **depended\_by** list / elements=string | success and service exists | A list of services that depend on this service. |
| **dependencies** list / elements=string | success and service exists | A list of services that is depended by this service. |
| **description** string | success and service exists | The description of the service. **Sample:** Manages communication between system components. |
| **desktop\_interact** boolean | success and service exists | Whether the current user is allowed to interact with the desktop. |
| **display\_name** string | success and service exists | The display name of the installed service. **Sample:** CoreMessaging |
| **exists** boolean | success | Whether the service exists or not. **Sample:** True |
| **name** string | success and service exists | The service name or id of the service. **Sample:** CoreMessagingRegistrar |
| **path** string | success and service exists | The path to the service executable. **Sample:** C:\Windows\system32\svchost.exe -k LocalServiceNoNetwork |
| **start\_mode** string | success and service exists | The startup type of the service. **Sample:** manual |
| **state** string | success and service exists | The current running status of the service. **Sample:** stopped |
| **username** string | success and service exists | The username that runs the service. **Sample:** LocalSystem |
### Authors
* Chris Hoffman (@chrishoffman)
| programming_docs |
ansible ansible.windows.win_group – Add and remove local groups ansible.windows.win\_group – Add and remove local groups
========================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_group`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Add and remove local groups.
* For non-Windows targets, please use the [ansible.builtin.group](../builtin/group_module#ansible-collections-ansible-builtin-group-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Description of the group. |
| **name** string / required | | Name of the group. |
| **state** string | **Choices:*** absent
* **present** ←
| Create or remove the group. |
See Also
--------
See also
[ansible.builtin.group](../builtin/group_module#ansible-collections-ansible-builtin-group-module)
The official documentation on the **ansible.builtin.group** module.
[community.windows.win\_domain\_group](../../community/windows/win_domain_group_module#ansible-collections-community-windows-win-domain-group-module)
The official documentation on the **community.windows.win\_domain\_group** module.
[ansible.windows.win\_group\_membership](win_group_membership_module#ansible-collections-ansible-windows-win-group-membership-module)
The official documentation on the **ansible.windows.win\_group\_membership** module.
Examples
--------
```
- name: Create a new group
ansible.windows.win_group:
name: deploy
description: Deploy Group
state: present
- name: Remove a group
ansible.windows.win_group:
name: deploy
state: absent
```
### Authors
* Chris Hoffman (@chrishoffman)
ansible ansible.windows.win_dsc – Invokes a PowerShell DSC configuration ansible.windows.win\_dsc – Invokes a PowerShell DSC configuration
=================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_dsc`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configures a resource using PowerShell DSC.
* Requires PowerShell version 5.0 or newer.
* Most of the options for this module are dynamic and will vary depending on the DSC Resource specified in *resource\_name*.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **free\_form** string / required | | The [ansible.windows.win\_dsc](win_dsc_module) module takes in multiple free form options based on the DSC resource being invoked by *resource\_name*. There is no option actually named `free_form` so see the examples. This module will try and convert the option to the correct type required by the DSC resource and throw a warning if it fails. If the type of the DSC resource option is a `CimInstance` or `CimInstance[]`, this means the value should be a dictionary or list of dictionaries based on the values required by that option. If the type of the DSC resource option is a `PSCredential` then there needs to be 2 options set in the Ansible task definition suffixed with `_username` and `_password`. If the type of the DSC resource option is an array, then a list should be provided but a comma separated string also work. Use a list where possible as no escaping is required and it works with more complex types list `CimInstance[]`. If the type of the DSC resource option is a `DateTime`, you should use a string in the form of an ISO 8901 string to ensure the exact date is used. |
| **module\_version** string | **Default:**"latest" | Can be used to configure the exact version of the DSC resource to be invoked. Useful if the target node has multiple versions installed of the module containing the DSC resource. If not specified, the module will follow standard PowerShell convention and use the highest version available. |
| **resource\_name** string / required | | The name of the DSC Resource to use. Must be accessible to PowerShell using any of the default paths. |
Notes
-----
Note
* By default there are a few builtin resources that come with PowerShell 5.0, See <https://docs.microsoft.com/en-us/powershell/scripting/dsc/resources/resources> for more information on these resources.
* Custom DSC resources can be installed with [community.windows.win\_psmodule](../../community/windows/win_psmodule_module#ansible-collections-community-windows-win-psmodule-module) using the *name* option.
* The DSC engine run’s each task as the SYSTEM account, any resources that need to be accessed with a different account need to have `PsDscRunAsCredential` set.
* To see the valid options for a DSC resource, run the module with `-vvv` to show the possible module invocation. Default values are not shown in this output but are applied within the DSC engine.
* The DSC engine requires the HTTP WSMan listener to be online and its port configured as the default listener for HTTP. This is set up by default but if a custom HTTP port is used or only a HTTPS listener is present then the module will fail. See the examples for a way to check this out in PowerShell.
* The Local Configuration Manager `LCM` on the targeted host in question should be disabled to avoid any conflicts with resources being applied by this module. See <https://devblogs.microsoft.com/powershell/invoking-powershell-dsc-resources-directly/> for more information on hwo to disable `LCM`.
Examples
--------
```
- name: Verify the WSMan HTTP listener is active and configured correctly
ansible.windows.win_shell: |
$port = (Get-Item -LiteralPath WSMan:\localhost\Client\DefaultPorts\HTTP).Value
$onlinePorts = @(Get-ChildItem -LiteralPath WSMan:\localhost\Listener |
Where-Object { 'Transport=HTTP' -in $_.Keys } |
Get-ChildItem |
Where-Object Name -eq Port |
Select-Object -ExpandProperty Value)
if ($port -notin $onlinePorts) {
"The default client port $port is not set up as a WSMan HTTP listener, win_dsc will not work."
}
- name: Extract zip file
ansible.windows.win_dsc:
resource_name: Archive
Ensure: Present
Path: C:\Temp\zipfile.zip
Destination: C:\Temp\Temp2
- name: Install a Windows feature with the WindowsFeature resource
ansible.windows.win_dsc:
resource_name: WindowsFeature
Name: telnet-client
- name: Edit HKCU reg key under specific user
ansible.windows.win_dsc:
resource_name: Registry
Ensure: Present
Key: HKEY_CURRENT_USER\ExampleKey
ValueName: TestValue
ValueData: TestData
PsDscRunAsCredential_username: '{{ansible_user}}'
PsDscRunAsCredential_password: '{{ansible_password}}'
no_log: true
- name: Create file with multiple attributes
ansible.windows.win_dsc:
resource_name: File
DestinationPath: C:\ansible\dsc
Attributes: # can also be a comma separated string, e.g. 'Hidden, System'
- Hidden
- System
Ensure: Present
Type: Directory
- name: Call DSC resource with DateTime option
ansible.windows.win_dsc:
resource_name: DateTimeResource
DateTimeOption: '2019-02-22T13:57:31.2311892+00:00'
# more complex example using custom DSC resource and dict values
- name: Setup the xWebAdministration module
ansible.windows.win_psmodule:
name: xWebAdministration
state: present
- name: Create IIS Website with Binding and Authentication options
ansible.windows.win_dsc:
resource_name: xWebsite
Ensure: Present
Name: DSC Website
State: Started
PhysicalPath: C:\inetpub\wwwroot
BindingInfo: # Example of a CimInstance[] DSC parameter (list of dicts)
- Protocol: https
Port: 1234
CertificateStoreName: MY
CertificateThumbprint: C676A89018C4D5902353545343634F35E6B3A659
HostName: DSCTest
IPAddress: '*'
SSLFlags: '1'
- Protocol: http
Port: 4321
IPAddress: '*'
AuthenticationInfo: # Example of a CimInstance DSC parameter (dict)
Anonymous: no
Basic: true
Digest: false
Windows: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **module\_version** string | always | The version of the dsc resource/module used. **Sample:** 1.0.1 |
| **reboot\_required** boolean | always | Flag returned from the DSC engine indicating whether or not the machine requires a reboot for the invoked changes to take effect. **Sample:** True |
| **verbose\_set** list / elements=string | Ansible verbosity is -vvv or greater and a change occurred | The verbose output as a list from executing the DSC Set method. **Sample:** ["Perform operation 'Invoke CimMethod' with the following parameters, ", '[SERVER]: LCM: [Start Set ] [[File]DirectResourceAccess]', "Operation 'Invoke CimMethod' complete."] |
| **verbose\_test** list / elements=string | Ansible verbosity is -vvv or greater | The verbose output as a list from executing the DSC test method. **Sample:** ["Perform operation 'Invoke CimMethod' with the following parameters, ", '[SERVER]: LCM: [Start Test ] [[File]DirectResourceAccess]', "Operation 'Invoke CimMethod' complete."] |
### Authors
* Trond Hindenes (@trondhindenes)
ansible ansible.windows.win_regedit – Add, change, or remove registry keys and values ansible.windows.win\_regedit – Add, change, or remove registry keys and values
==============================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_regedit`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Add, modify or remove registry keys and values.
* More information about the windows registry from Wikipedia <https://en.wikipedia.org/wiki/Windows_Registry>.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **data** raw | | Value of the registry entry `name` in `path`. If not specified then the value for the property will be null for the corresponding `type`. Binary and None data should be expressed in a yaml byte array or as comma separated hex values. An easy way to generate this is to run `regedit.exe` and use the *export* option to save the registry values to a file. In the exported file, binary value will look like `hex:be,ef,be,ef`, the `hex:` prefix is optional. DWORD and QWORD values should either be represented as a decimal number or a hex value. Multistring values should be passed in as a list. See the examples for more details on how to format this data. |
| **delete\_key** boolean | **Choices:*** no
* **yes** ←
| When `state` is 'absent' then this will delete the entire key. If `no` then it will only clear out the '(Default)' property for that key. |
| **hive** path | | A path to a hive key like C:\Users\Default\NTUSER.DAT to load in the registry. This hive is loaded under the HKLM:\ANSIBLE key which can then be used in *name* like any other path. This can be used to load the default user profile registry hive or any other hive saved as a file. Using this function requires the user to have the `SeRestorePrivilege` and `SeBackupPrivilege` privileges enabled. |
| **name** string | | Name of the registry entry in the above `path` parameters. If not provided, or empty then the '(Default)' property for the key will be used.
aliases: entry, value |
| **path** string / required | | Name of the registry path. Should be in one of the following registry hives: HKCC, HKCR, HKCU, HKLM, HKU.
aliases: key |
| **state** string | **Choices:*** absent
* **present** ←
| The state of the registry entry. |
| **type** string | **Choices:*** none
* binary
* dword
* expandstring
* multistring
* **string** ←
* qword
| The registry value data type.
aliases: datatype |
Notes
-----
Note
* Check-mode `-C/--check` and diff output `-D/--diff` are supported, so that you can test every change against the active configuration before applying changes.
* Beware that some registry hives (`HKEY_USERS` in particular) do not allow to create new registry paths in the root folder.
See Also
--------
See also
[ansible.windows.win\_reg\_stat](win_reg_stat_module#ansible-collections-ansible-windows-win-reg-stat-module)
The official documentation on the **ansible.windows.win\_reg\_stat** module.
ansible.windows.win\_regmerge
The official documentation on the **ansible.windows.win\_regmerge** module.
Examples
--------
```
- name: Create registry path MyCompany
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
- name: Add or update registry path MyCompany, with entry 'hello', and containing 'world'
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
name: hello
data: world
- name: Add or update registry path MyCompany, with dword entry 'hello', and containing 1337 as the decimal value
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
name: hello
data: 1337
type: dword
- name: Add or update registry path MyCompany, with dword entry 'hello', and containing 0xff2500ae as the hex value
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
name: hello
data: 0xff2500ae
type: dword
- name: Add or update registry path MyCompany, with binary entry 'hello', and containing binary data in hex-string format
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
name: hello
data: hex:be,ef,be,ef,be,ef,be,ef,be,ef
type: binary
- name: Add or update registry path MyCompany, with binary entry 'hello', and containing binary data in yaml format
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
name: hello
data: [0xbe,0xef,0xbe,0xef,0xbe,0xef,0xbe,0xef,0xbe,0xef]
type: binary
- name: Add or update registry path MyCompany, with expand string entry 'hello'
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
name: hello
data: '%appdata%\local'
type: expandstring
- name: Add or update registry path MyCompany, with multi string entry 'hello'
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
name: hello
data: ['hello', 'world']
type: multistring
- name: Disable keyboard layout hotkey for all users (changes existing)
ansible.windows.win_regedit:
path: HKU:\.DEFAULT\Keyboard Layout\Toggle
name: Layout Hotkey
data: 3
type: dword
- name: Disable language hotkey for current users (adds new)
ansible.windows.win_regedit:
path: HKCU:\Keyboard Layout\Toggle
name: Language Hotkey
data: 3
type: dword
- name: Remove registry path MyCompany (including all entries it contains)
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
state: absent
delete_key: yes
- name: Clear the existing (Default) entry at path MyCompany
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
state: absent
delete_key: no
- name: Remove entry 'hello' from registry path MyCompany
ansible.windows.win_regedit:
path: HKCU:\Software\MyCompany
name: hello
state: absent
- name: Change default mouse trailing settings for new users
ansible.windows.win_regedit:
path: HKLM:\ANSIBLE\Control Panel\Mouse
name: MouseTrails
data: 10
type: string
state: present
hive: C:\Users\Default\NTUSER.dat
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **data\_changed** boolean | success | Whether this invocation changed the data in the registry value. |
| **data\_type\_changed** boolean | success | Whether this invocation changed the datatype of the registry value. **Sample:** True |
### Authors
* Adam Keech (@smadam813)
* Josh Ludwig (@joshludwig)
* Jordan Borean (@jborean93)
ansible ansible.windows.win_environment – Modify environment variables on windows hosts ansible.windows.win\_environment – Modify environment variables on windows hosts
================================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_environment`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Uses .net Environment to set or remove environment variables and can set at User, Machine or Process level.
* User level environment variables will be set, but not available until the user has logged off and on again.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **level** string / required | **Choices:*** machine
* process
* user
| The level at which to set the environment variable. Use `machine` to set for all users. Use `user` to set for the current user that ansible is connected as. Use `process` to set for the current process. Probably not that useful. |
| **name** string | | The name of the environment variable. Required when *state=absent*. |
| **state** string | **Choices:*** absent
* present
| Set to `present` to ensure environment variable is set. Set to `absent` to ensure it is removed. When using *variables*, do not set this option. |
| **value** string | | The value to store in the environment variable. Must be set when *state=present* and cannot be an empty string. Should be omitted for *state=absent* and *variables*. |
| **variables** dictionary added in 1.3.0 of ansible.windows | | A dictionary where multiple environment variables can be defined at once. Not valid when *state* is set. Variables with a value will be set (`present`) and variables with an empty value will be unset (`absent`).
*level* applies to all vars defined this way. |
Notes
-----
Note
* This module is best-suited for setting the entire value of an environment variable. For safe element-based management of path-like environment vars, use the [ansible.windows.win\_path](win_path_module#ansible-collections-ansible-windows-win-path-module) module.
* This module does not broadcast change events. This means that the minority of windows applications which can have their environment changed without restarting will not be notified and therefore will need restarting to pick up new environment settings. User level environment variables will require the user to log out and in again before they become available.
* In the return, `before_value` and `value` will be set to the last values when using *variables*. It’s best to use `values` in that case if you need to find a specific variable’s before and after values.
See Also
--------
See also
[ansible.windows.win\_path](win_path_module#ansible-collections-ansible-windows-win-path-module)
The official documentation on the **ansible.windows.win\_path** module.
Examples
--------
```
- name: Set an environment variable for all users
ansible.windows.win_environment:
state: present
name: TestVariable
value: Test value
level: machine
- name: Remove an environment variable for the current user
ansible.windows.win_environment:
state: absent
name: TestVariable
level: user
- name: Set several variables at once
ansible.windows.win_environment:
level: machine
variables:
TestVariable: Test value
CUSTOM_APP_VAR: 'Very important value'
ANOTHER_VAR: '{{ my_ansible_var }}'
- name: Set and remove multiple variables at once
ansible.windows.win_environment:
level: user
variables:
TestVariable: Test value
CUSTOM_APP_VAR: 'Very important value'
ANOTHER_VAR: '{{ my_ansible_var }}'
UNWANTED_VAR: '' # < this will be removed
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **before\_value** string | always | the value of the environment key before a change, this is null if it didn't exist **Sample:** C:\Windows\System32 |
| **value** string | always | the value the environment key has been set to, this is null if removed **Sample:** C:\Program Files\jdk1.8 |
| **values** dictionary added in 1.3.0 of ansible.windows | always | dictionary of before and after values; each key is a variable name, each value is another dict with `before`, `after`, and `changed` keys |
### Authors
* Jon Hawkesworth (@jhawkesworth)
* Brian Scholer (@briantist)
| programming_docs |
ansible ansible.windows.win_group_membership – Manage Windows local group membership ansible.windows.win\_group\_membership – Manage Windows local group membership
==============================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_group_membership`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allows the addition and removal of local, service and domain users, and domain groups from a local group.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **members** list / elements=string / required | | A list of members to ensure are present/absent from the group. Accepts local users as .\username, and SERVERNAME\username. Accepts domain users and groups as DOMAIN\username and username@DOMAIN. Accepts service users as NT AUTHORITY\username. Accepts all local, domain and service user types as username, favoring domain lookups when in a domain. |
| **name** string / required | | Name of the local group to manage membership on. |
| **state** string | **Choices:*** absent
* **present** ←
* pure
| Desired state of the members in the group. When `state` is `pure`, only the members specified will exist, and all other existing members not specified are removed. |
See Also
--------
See also
[community.windows.win\_domain\_group](../../community/windows/win_domain_group_module#ansible-collections-community-windows-win-domain-group-module)
The official documentation on the **community.windows.win\_domain\_group** module.
[ansible.windows.win\_domain\_membership](win_domain_membership_module#ansible-collections-ansible-windows-win-domain-membership-module)
The official documentation on the **ansible.windows.win\_domain\_membership** module.
[ansible.windows.win\_group](win_group_module#ansible-collections-ansible-windows-win-group-module)
The official documentation on the **ansible.windows.win\_group** module.
Examples
--------
```
- name: Add a local and domain user to a local group
ansible.windows.win_group_membership:
name: Remote Desktop Users
members:
- NewLocalAdmin
- DOMAIN\TestUser
state: present
- name: Remove a domain group and service user from a local group
ansible.windows.win_group_membership:
name: Backup Operators
members:
- DOMAIN\TestGroup
- NT AUTHORITY\SYSTEM
state: absent
- name: Ensure only a domain user exists in a local group
ansible.windows.win_group_membership:
name: Remote Desktop Users
members:
- DOMAIN\TestUser
state: pure
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **added** list / elements=string | success and `state` is `present` | A list of members added when `state` is `present` or `pure`; this is empty if no members are added. **Sample:** ['SERVERNAME\\NewLocalAdmin', 'DOMAIN\\TestUser'] |
| **members** list / elements=string | success | A list of all local group members at completion; this is empty if the group contains no members. **Sample:** ['DOMAIN\\TestUser', 'SERVERNAME\\NewLocalAdmin'] |
| **name** string | always | The name of the target local group. **Sample:** Administrators |
| **removed** list / elements=string | success and `state` is `absent` | A list of members removed when `state` is `absent` or `pure`; this is empty if no members are removed. **Sample:** ['DOMAIN\\TestGroup', 'NT AUTHORITY\\SYSTEM'] |
### Authors
* Andrew Saraceni (@andrewsaraceni)
ansible Ansible.Windows Ansible.Windows
===============
Collection version 1.7.3
Plugin Index
------------
These are the plugins in the ansible.windows collection
### Modules
* [win\_acl](win_acl_module#ansible-collections-ansible-windows-win-acl-module) – Set file/directory/registry permissions for a system user or group
* [win\_acl\_inheritance](win_acl_inheritance_module#ansible-collections-ansible-windows-win-acl-inheritance-module) – Change ACL inheritance
* [win\_certificate\_store](win_certificate_store_module#ansible-collections-ansible-windows-win-certificate-store-module) – Manages the certificate store
* [win\_command](win_command_module#ansible-collections-ansible-windows-win-command-module) – Executes a command on a remote Windows node
* [win\_copy](win_copy_module#ansible-collections-ansible-windows-win-copy-module) – Copies files to remote locations on windows hosts
* [win\_dns\_client](win_dns_client_module#ansible-collections-ansible-windows-win-dns-client-module) – Configures DNS lookup on Windows hosts
* [win\_domain](win_domain_module#ansible-collections-ansible-windows-win-domain-module) – Ensures the existence of a Windows domain
* [win\_domain\_controller](win_domain_controller_module#ansible-collections-ansible-windows-win-domain-controller-module) – Manage domain controller/member server state for a Windows host
* [win\_domain\_membership](win_domain_membership_module#ansible-collections-ansible-windows-win-domain-membership-module) – Manage domain/workgroup membership for a Windows host
* [win\_dsc](win_dsc_module#ansible-collections-ansible-windows-win-dsc-module) – Invokes a PowerShell DSC configuration
* [win\_environment](win_environment_module#ansible-collections-ansible-windows-win-environment-module) – Modify environment variables on windows hosts
* [win\_feature](win_feature_module#ansible-collections-ansible-windows-win-feature-module) – Installs and uninstalls Windows Features on Windows Server
* [win\_file](win_file_module#ansible-collections-ansible-windows-win-file-module) – Creates, touches or removes files or directories
* [win\_find](win_find_module#ansible-collections-ansible-windows-win-find-module) – Return a list of files based on specific criteria
* [win\_get\_url](win_get_url_module#ansible-collections-ansible-windows-win-get-url-module) – Downloads file from HTTP, HTTPS, or FTP to node
* [win\_group](win_group_module#ansible-collections-ansible-windows-win-group-module) – Add and remove local groups
* [win\_group\_membership](win_group_membership_module#ansible-collections-ansible-windows-win-group-membership-module) – Manage Windows local group membership
* [win\_hostname](win_hostname_module#ansible-collections-ansible-windows-win-hostname-module) – Manages local Windows computer name
* [win\_optional\_feature](win_optional_feature_module#ansible-collections-ansible-windows-win-optional-feature-module) – Manage optional Windows features
* [win\_owner](win_owner_module#ansible-collections-ansible-windows-win-owner-module) – Set owner
* [win\_package](win_package_module#ansible-collections-ansible-windows-win-package-module) – Installs/uninstalls an installable package
* [win\_path](win_path_module#ansible-collections-ansible-windows-win-path-module) – Manage Windows path environment variables
* [win\_ping](win_ping_module#ansible-collections-ansible-windows-win-ping-module) – A windows version of the classic ping module
* [win\_powershell](win_powershell_module#ansible-collections-ansible-windows-win-powershell-module) – Run PowerShell scripts
* [win\_reboot](win_reboot_module#ansible-collections-ansible-windows-win-reboot-module) – Reboot a windows machine
* [win\_reg\_stat](win_reg_stat_module#ansible-collections-ansible-windows-win-reg-stat-module) – Get information about Windows registry keys
* [win\_regedit](win_regedit_module#ansible-collections-ansible-windows-win-regedit-module) – Add, change, or remove registry keys and values
* [win\_service](win_service_module#ansible-collections-ansible-windows-win-service-module) – Manage and query Windows services
* [win\_service\_info](win_service_info_module#ansible-collections-ansible-windows-win-service-info-module) – Gather information about Windows services
* [win\_share](win_share_module#ansible-collections-ansible-windows-win-share-module) – Manage Windows shares
* [win\_shell](win_shell_module#ansible-collections-ansible-windows-win-shell-module) – Execute shell commands on target hosts
* [win\_stat](win_stat_module#ansible-collections-ansible-windows-win-stat-module) – Get information about Windows files
* [win\_tempfile](win_tempfile_module#ansible-collections-ansible-windows-win-tempfile-module) – Creates temporary files and directories
* [win\_template](win_template_module#ansible-collections-ansible-windows-win-template-module) – Template a file out to a remote server
* [win\_updates](win_updates_module#ansible-collections-ansible-windows-win-updates-module) – Download and install Windows updates
* [win\_uri](win_uri_module#ansible-collections-ansible-windows-win-uri-module) – Interacts with webservices
* [win\_user](win_user_module#ansible-collections-ansible-windows-win-user-module) – Manages local Windows user accounts
* [win\_user\_right](win_user_right_module#ansible-collections-ansible-windows-win-user-right-module) – Manage Windows User Rights
* [win\_wait\_for](win_wait_for_module#ansible-collections-ansible-windows-win-wait-for-module) – Waits for a condition before continuing
* [win\_whoami](win_whoami_module#ansible-collections-ansible-windows-win-whoami-module) – Get information about the current user and process
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible ansible.windows.win_acl – Set file/directory/registry permissions for a system user or group ansible.windows.win\_acl – Set file/directory/registry permissions for a system user or group
=============================================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_acl`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Add or remove rights/permissions for a given user or group for the specified file, folder, registry key or AppPool identifies.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **inherit** string | **Choices:*** ContainerInherit
* ObjectInherit
| Inherit flags on the ACL rules. Can be specified as a comma separated list, e.g. `ContainerInherit`, `ObjectInherit`. For more information on the choices see MSDN InheritanceFlags enumeration at <https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.inheritanceflags.aspx>. Defaults to `ContainerInherit, ObjectInherit` for Directories. |
| **path** string / required | | The path to the file or directory. |
| **propagation** string | **Choices:*** InheritOnly
* **None** ←
* NoPropagateInherit
| Propagation flag on the ACL rules. For more information on the choices see MSDN PropagationFlags enumeration at <https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.propagationflags.aspx>. |
| **rights** string / required | | The rights/permissions that are to be allowed/denied for the specified user or group for the item at `path`. If `path` is a file or directory, rights can be any right under MSDN FileSystemRights <https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemrights.aspx>. If `path` is a registry key, rights can be any right under MSDN RegistryRights <https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.registryrights.aspx>. |
| **state** string | **Choices:*** absent
* **present** ←
| Specify whether to add `present` or remove `absent` the specified access rule. |
| **type** string / required | **Choices:*** allow
* deny
| Specify whether to allow or deny the rights specified. |
| **user** string / required | | User or Group to add specified rights to act on src file/folder or registry key. |
Notes
-----
Note
* If adding ACL’s for AppPool identities, the Windows Feature “Web-Scripting-Tools” must be enabled.
See Also
--------
See also
[ansible.windows.win\_acl\_inheritance](win_acl_inheritance_module#ansible-collections-ansible-windows-win-acl-inheritance-module)
The official documentation on the **ansible.windows.win\_acl\_inheritance** module.
[ansible.windows.win\_file](win_file_module#ansible-collections-ansible-windows-win-file-module)
The official documentation on the **ansible.windows.win\_file** module.
[ansible.windows.win\_owner](win_owner_module#ansible-collections-ansible-windows-win-owner-module)
The official documentation on the **ansible.windows.win\_owner** module.
[ansible.windows.win\_stat](win_stat_module#ansible-collections-ansible-windows-win-stat-module)
The official documentation on the **ansible.windows.win\_stat** module.
Examples
--------
```
- name: Restrict write and execute access to User Fed-Phil
ansible.windows.win_acl:
user: Fed-Phil
path: C:\Important\Executable.exe
type: deny
rights: ExecuteFile,Write
- name: Add IIS_IUSRS allow rights
ansible.windows.win_acl:
path: C:\inetpub\wwwroot\MySite
user: IIS_IUSRS
rights: FullControl
type: allow
state: present
inherit: ContainerInherit, ObjectInherit
propagation: 'None'
- name: Set registry key right
ansible.windows.win_acl:
path: HKCU:\Bovine\Key
user: BUILTIN\Users
rights: EnumerateSubKeys
type: allow
state: present
inherit: ContainerInherit, ObjectInherit
propagation: 'None'
- name: Remove FullControl AccessRule for IIS_IUSRS
ansible.windows.win_acl:
path: C:\inetpub\wwwroot\MySite
user: IIS_IUSRS
rights: FullControl
type: allow
state: absent
inherit: ContainerInherit, ObjectInherit
propagation: 'None'
- name: Deny Intern
ansible.windows.win_acl:
path: C:\Administrator\Documents
user: Intern
rights: Read,Write,Modify,FullControl,Delete
type: deny
state: present
```
### Authors
* Phil Schwartz (@schwartzmx)
* Trond Hindenes (@trondhindenes)
* Hans-Joachim Kliemeck (@h0nIg)
ansible ansible.windows.win_template – Template a file out to a remote server ansible.windows.win\_template – Template a file out to a remote server
======================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_template`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Templates are processed by the [Jinja2 templating language](http://jinja.pocoo.org/docs/).
* Documentation on the template formatting can be found in the [Template Designer Documentation](http://jinja.pocoo.org/docs/templates/).
* Additional variables listed below can be used in templates.
* `ansible_managed` (configurable via the `defaults` section of `ansible.cfg`) contains a string which can be used to describe the template name, host, modification time of the template file and the owner uid.
* `template_host` contains the node name of the template’s machine.
* `template_uid` is the numeric user id of the owner.
* `template_path` is the path of the template.
* `template_fullpath` is the absolute path of the template.
* `template_destpath` is the path of the template on the remote system (added in 2.8).
* `template_run_date` is the date that the template was rendered.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Determine whether a backup should be created. When set to `yes`, create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **block\_end\_string** string | **Default:**"%}" | The string marking the end of a block. |
| **block\_start\_string** string | **Default:**"{%" | The string marking the beginning of a block. |
| **dest** path / required | | Location to render the template to on the remote machine. |
| **force** boolean | **Choices:*** no
* **yes** ←
| Determine when the file is being transferred if the destination already exists. When set to `yes`, replace the remote file when contents are different than the source. When set to `no`, the file will only be transferred if the destination does not exist. |
| **lstrip\_blocks** boolean | **Choices:*** **no** ←
* yes
| Determine when leading spaces and tabs should be stripped. When set to `yes` leading spaces and tabs are stripped from the start of a line to a block. This functionality requires Jinja 2.7 or newer. |
| **newline\_sequence** string | **Choices:*** \n
* \r
* **\r\n** ←
| Specify the newline sequence to use for templating files. |
| **output\_encoding** string | **Default:**"utf-8" | Overrides the encoding used to write the template file defined by `dest`. It defaults to `utf-8`, but any encoding supported by python can be used. The source template file must always be encoded using `utf-8`, for homogeneity. |
| **src** path / required | | Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or an absolute path. The file must be encoded with `utf-8` but *output\_encoding* can be used to control the encoding of the output template. |
| **trim\_blocks** boolean | **Choices:*** no
* **yes** ←
| Determine when newlines should be removed from blocks. When set to `yes` the first newline after a block is removed (block, not variable tag!). |
| **variable\_end\_string** string | **Default:**"}}" | The string marking the end of a print statement. |
| **variable\_start\_string** string | **Default:**"{{" | The string marking the beginning of a print statement. |
Notes
-----
Note
* Including a string that uses a date in the template will result in the template being marked ‘changed’ each time.
* Also, you can override jinja2 settings by adding a special header to template file. i.e. `#jinja2:variable_start_string:'[%', variable_end_string:'%]', trim_blocks: False` which changes the variable interpolation markers to `[% var %]` instead of `{{ var }}`. This is the best way to prevent evaluation of things that look like, but should not be Jinja2.
* Using raw/endraw in Jinja2 will not work as you expect because templates in Ansible are recursively evaluated.
* To find Byte Order Marks in files, use `Format-Hex <file> -Count 16` on Windows, and use `od -a -t x1 -N 16 <file>` on Linux.
* Beware fetching files from windows machines when creating templates because certain tools, such as Powershell ISE, and regedit’s export facility add a Byte Order Mark as the first character of the file, which can cause tracebacks.
* You can use the [ansible.windows.win\_copy](win_copy_module#ansible-collections-ansible-windows-win-copy-module) module with the `content:` option if you prefer the template inline, as part of the playbook.
* For Linux you can use [ansible.builtin.template](../builtin/template_module#ansible-collections-ansible-builtin-template-module) which uses ‘\n’ as `newline_sequence` by default.
See Also
--------
See also
[ansible.windows.win\_copy](win_copy_module#ansible-collections-ansible-windows-win-copy-module)
The official documentation on the **ansible.windows.win\_copy** module.
[ansible.builtin.copy](../builtin/copy_module#ansible-collections-ansible-builtin-copy-module)
The official documentation on the **ansible.builtin.copy** module.
[ansible.builtin.template](../builtin/template_module#ansible-collections-ansible-builtin-template-module)
The official documentation on the **ansible.builtin.template** module.
Examples
--------
```
- name: Create a file from a Jinja2 template
ansible.windows.win_template:
src: /mytemplates/file.conf.j2
dest: C:\Temp\file.conf
- name: Create a Unix-style file from a Jinja2 template
ansible.windows.win_template:
src: unix/config.conf.j2
dest: C:\share\unix\config.conf
newline_sequence: '\n'
backup: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **backup\_file** string | if backup=yes | Name of the backup file that was created. **Sample:** C:\Path\To\File.txt.11540.20150212-220915.bak |
### Authors
* Jon Hawkesworth (@jhawkesworth)
| programming_docs |
ansible ansible.windows.win_find – Return a list of files based on specific criteria ansible.windows.win\_find – Return a list of files based on specific criteria
=============================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_find`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Return a list of files based on specified criteria.
* Multiple criteria are AND’d together.
* For non-Windows targets, use the [ansible.builtin.find](../builtin/find_module#ansible-collections-ansible-builtin-find-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **age** string | | Select files or folders whose age is equal to or greater than the specified time. Use a negative age to find files equal to or less than the specified time. You can choose seconds, minutes, hours, days or weeks by specifying the first letter of an of those words (e.g., "2s", "10d", 1w"). |
| **age\_stamp** string | **Choices:*** atime
* ctime
* **mtime** ←
| Choose the file property against which we compare `age`. The default attribute we compare with is the last modification time. |
| **checksum\_algorithm** string | **Choices:*** md5
* **sha1** ←
* sha256
* sha384
* sha512
| Algorithm to determine the checksum of a file. Will throw an error if the host is unable to use specified algorithm. |
| **file\_type** string | **Choices:*** directory
* **file** ←
| Type of file to search for. |
| **follow** boolean | **Choices:*** **no** ←
* yes
| Set this to `yes` to follow symlinks in the path. This needs to be used in conjunction with `recurse`. |
| **get\_checksum** boolean | **Choices:*** no
* **yes** ←
| Whether to return a checksum of the file in the return info (default sha1), use `checksum_algorithm` to change from the default. |
| **hidden** boolean | **Choices:*** **no** ←
* yes
| Set this to include hidden files or folders. |
| **paths** list / elements=string / required | | List of paths of directories to search for files or folders in. This can be supplied as a single path or a list of paths. |
| **patterns** list / elements=string | | One or more (powershell or regex) patterns to compare filenames with. The type of pattern matching is controlled by `use_regex` option. The patterns restrict the list of files or folders to be returned based on the filenames. For a file to be matched it only has to match with one pattern in a list provided.
aliases: regex, regexp |
| **recurse** boolean | **Choices:*** **no** ←
* yes
| Will recursively descend into the directory looking for files or folders. |
| **size** string | | Select files or folders whose size is equal to or greater than the specified size. Use a negative value to find files equal to or less than the specified size. You can specify the size with a suffix of the byte type i.e. kilo = k, mega = m... Size is not evaluated for symbolic links. |
| **use\_regex** boolean | **Choices:*** **no** ←
* yes
| Will set patterns to run as a regex check if set to `yes`. |
Examples
--------
```
- name: Find files in path
ansible.windows.win_find:
paths: D:\Temp
- name: Find hidden files in path
ansible.windows.win_find:
paths: D:\Temp
hidden: yes
- name: Find files in multiple paths
ansible.windows.win_find:
paths:
- C:\Temp
- D:\Temp
- name: Find files in directory while searching recursively
ansible.windows.win_find:
paths: D:\Temp
recurse: yes
- name: Find files in directory while following symlinks
ansible.windows.win_find:
paths: D:\Temp
recurse: yes
follow: yes
- name: Find files with .log and .out extension using powershell wildcards
ansible.windows.win_find:
paths: D:\Temp
patterns: [ '*.log', '*.out' ]
- name: Find files in path based on regex pattern
ansible.windows.win_find:
paths: D:\Temp
patterns: out_\d{8}-\d{6}.log
- name: Find files older than 1 day
ansible.windows.win_find:
paths: D:\Temp
age: 86400
- name: Find files older than 1 day based on create time
ansible.windows.win_find:
paths: D:\Temp
age: 86400
age_stamp: ctime
- name: Find files older than 1 day with unit syntax
ansible.windows.win_find:
paths: D:\Temp
age: 1d
- name: Find files newer than 1 hour
ansible.windows.win_find:
paths: D:\Temp
age: -3600
- name: Find files newer than 1 hour with unit syntax
ansible.windows.win_find:
paths: D:\Temp
age: -1h
- name: Find files larger than 1MB
ansible.windows.win_find:
paths: D:\Temp
size: 1048576
- name: Find files larger than 1GB with unit syntax
ansible.windows.win_find:
paths: D:\Temp
size: 1g
- name: Find files smaller than 1MB
ansible.windows.win_find:
paths: D:\Temp
size: -1048576
- name: Find files smaller than 1GB with unit syntax
ansible.windows.win_find:
paths: D:\Temp
size: -1g
- name: Find folders/symlinks in multiple paths
ansible.windows.win_find:
paths:
- C:\Temp
- D:\Temp
file_type: directory
- name: Find files and return SHA256 checksum of files found
ansible.windows.win_find:
paths: C:\Temp
get_checksum: yes
checksum_algorithm: sha256
- name: Find files and do not return the checksum
ansible.windows.win_find:
paths: C:\Temp
get_checksum: no
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **examined** integer | always | The number of files/folders that was checked. **Sample:** 10 |
| **files** complex | success | Information on the files/folders that match the criteria returned as a list of dictionary elements for each file matched. The entries are sorted by the path value alphabetically. |
| | **attributes** string | success, path exists | attributes of the file at path in raw form. **Sample:** Archive, Hidden |
| | **checksum** string | success, path exists, path is a file, get\_checksum == True | The checksum of a file based on checksum\_algorithm specified. **Sample:** 09cb79e8fc7453c84a07f644e441fd81623b7f98 |
| | **creationtime** float | success, path exists | The create time of the file represented in seconds since epoch. **Sample:** 1477984205.15 |
| | **exists** boolean | success, path exists | Whether the file exists, will always be true for [ansible.windows.win\_find](win_find_module). **Sample:** True |
| | **extension** string | success, path exists, path is a file | The extension of the file at path. **Sample:** .ps1 |
| | **filename** string | success, path exists | The name of the file. **Sample:** temp |
| | **hlnk\_targets** list / elements=string | success, path exists | List of other files pointing to the same file (hard links), excludes the current file. **Sample:** ['C:\\temp\\file.txt', 'C:\\Windows\\update.log'] |
| | **isarchive** boolean | success, path exists | If the path is ready for archiving or not. **Sample:** True |
| | **isdir** boolean | success, path exists | If the path is a directory or not. **Sample:** True |
| | **ishidden** boolean | success, path exists | If the path is hidden or not. **Sample:** True |
| | **isjunction** boolean | success, path exists | If the path is a junction point. **Sample:** True |
| | **islnk** boolean | success, path exists | If the path is a symbolic link. **Sample:** True |
| | **isreadonly** boolean | success, path exists | If the path is read only or not. **Sample:** True |
| | **isreg** boolean | success, path exists | If the path is a regular file or not. **Sample:** True |
| | **isshared** boolean | success, path exists | If the path is shared or not. **Sample:** True |
| | **lastaccesstime** float | success, path exists | The last access time of the file represented in seconds since epoch. **Sample:** 1477984205.15 |
| | **lastwritetime** float | success, path exists | The last modification time of the file represented in seconds since epoch. **Sample:** 1477984205.15 |
| | **lnk\_source** string | success, path exists, path is a symbolic link or junction point | The target of the symlink normalized for the remote filesystem. **Sample:** C:\temp |
| | **lnk\_target** string | success, path exists, path is a symbolic link or junction point | The target of the symlink. Note that relative paths remain relative, will return null if not a link. **Sample:** temp |
| | **nlink** integer | success, path exists | Number of links to the file (hard links) **Sample:** 1 |
| | **owner** string | success, path exists | The owner of the file. **Sample:** BUILTIN\Administrators |
| | **path** string | success, path exists | The full absolute path to the file. **Sample:** BUILTIN\Administrators |
| | **sharename** string | success, path exists, path is a directory and isshared == True | The name of share if folder is shared. **Sample:** file-share |
| | **size** integer | success, path exists, path is a file | The size in bytes of the file. **Sample:** 1024 |
| **matched** integer | always | The number of files/folders that match the criteria. **Sample:** 2 |
### Authors
* Jordan Borean (@jborean93)
ansible ansible.windows.win_get_url – Downloads file from HTTP, HTTPS, or FTP to node ansible.windows.win\_get\_url – Downloads file from HTTP, HTTPS, or FTP to node
===============================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_get_url`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Downloads files from HTTP, HTTPS, or FTP to the remote server.
* The remote server *must* have direct access to the remote resource.
* For non-Windows targets, use the [ansible.builtin.get\_url](../builtin/get_url_module#ansible-collections-ansible-builtin-get-url-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **checksum** string | | If a *checksum* is passed to this parameter, the digest of the destination file will be calculated after it is downloaded to ensure its integrity and verify that the transfer completed successfully. This option cannot be set with *checksum\_url*. |
| **checksum\_algorithm** string | **Choices:*** md5
* **sha1** ←
* sha256
* sha384
* sha512
| Specifies the hashing algorithm used when calculating the checksum of the remote and destination file. |
| **checksum\_url** string | | Specifies a URL that contains the checksum values for the resource at *url*. Like `checksum`, this is used to verify the integrity of the remote transfer. This option cannot be set with *checksum*. |
| **client\_cert** string | | The path to the client certificate (.pfx) that is used for X509 authentication. This path can either be the path to the `pfx` on the filesystem or the PowerShell certificate path `Cert:\CurrentUser\My\<thumbprint>`. The WinRM connection must be authenticated with `CredSSP` or `become` is used on the task if the certificate file is not password protected. Other authentication types can set *client\_cert\_password* when the cert is password protected. |
| **client\_cert\_password** string | | The password for *client\_cert* if the cert is password protected. |
| **dest** path / required | | The location to save the file at the URL. Be sure to include a filename and extension as appropriate. |
| **follow\_redirects** string | **Choices:*** all
* none
* **safe** ←
| Whether or the module should follow redirects.
`all` will follow all redirect.
`none` will not follow any redirect.
`safe` will follow only "safe" redirects, where "safe" means that the client is only doing a `GET` or `HEAD` on the URI to which it is being redirected. When following a redirected URL, the `Authorization` header and any credentials set will be dropped and not redirected. |
| **force** boolean | **Choices:*** no
* **yes** ←
| If `yes`, will download the file every time and replace the file if the contents change. If `no`, will only download the file if it does not exist or the remote file has been modified more recently than the local file. This works by sending an http HEAD request to retrieve last modified time of the requested resource, so for this to work, the remote web server must support HEAD requests. |
| **force\_basic\_auth** boolean | **Choices:*** **no** ←
* yes
| By default the authentication header is only sent when a webservice responses to an initial request with a 401 status. Since some basic auth services do not properly send a 401, logins will fail. This option forces the sending of the Basic authentication header upon the original request. |
| **headers** dictionary | | Extra headers to set on the request. This should be a dictionary where the key is the header name and the value is the value for that header. |
| **http\_agent** string | **Default:**"ansible-httpget" | Header to identify as, generally appears in web server logs. This is set to the `User-Agent` header on a HTTP request. |
| **maximum\_redirection** integer | **Default:**50 | Specify how many times the module will redirect a connection to an alternative URI before the connection fails. If set to `0` or *follow\_redirects* is set to `none`, or `safe` when not doing a `GET` or `HEAD` it prevents all redirection. |
| **proxy\_password** string | | The password for *proxy\_username*. |
| **proxy\_url** string | | An explicit proxy to use for the request. By default, the request will use the IE defined proxy unless *use\_proxy* is set to `no`. |
| **proxy\_use\_default\_credential** boolean | **Choices:*** **no** ←
* yes
| Uses the current user's credentials when authenticating with a proxy host protected with `NTLM`, `Kerberos`, or `Negotiate` authentication. Proxies that use `Basic` auth will still require explicit credentials through the *proxy\_username* and *proxy\_password* options. The module will only have access to the user's credentials if using `become` with a password, you are connecting with SSH using a password, or connecting with WinRM using `CredSSP` or `Kerberos with delegation`. If not using `become` or a different auth method to the ones stated above, there will be no default credentials available and no proxy authentication will occur. |
| **proxy\_username** string | | The username to use for proxy authentication. |
| **url** string / required | | The full URL of a file to download. |
| **url\_method** string | | The HTTP Method of the request.
aliases: method |
| **url\_password** string | | The password for *url\_username*. The alias *password* is deprecated and will be removed on the major release after `2022-07-01`.
aliases: password |
| **url\_timeout** integer | **Default:**30 | Specifies how long the request can be pending before it times out (in seconds). Set to `0` to specify an infinite timeout.
aliases: timeout |
| **url\_username** string | | The username to use for authentication. The alias *user* and *username* is deprecated and will be removed on the major release after `2022-07-01`.
aliases: user, username |
| **use\_default\_credential** boolean | **Choices:*** **no** ←
* yes
| Uses the current user's credentials when authenticating with a server protected with `NTLM`, `Kerberos`, or `Negotiate` authentication. Sites that use `Basic` auth will still require explicit credentials through the *url\_username* and *url\_password* options. The module will only have access to the user's credentials if using `become` with a password, you are connecting with SSH using a password, or connecting with WinRM using `CredSSP` or `Kerberos with delegation`. If not using `become` or a different auth method to the ones stated above, there will be no default credentials available and no authentication will occur. |
| **use\_proxy** boolean | **Choices:*** no
* **yes** ←
| If `no`, it will not use the proxy defined in IE for the current user. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If `no`, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
Notes
-----
Note
* If your URL includes an escaped slash character (%2F) this module will convert it to a real slash. This is a result of the behaviour of the System.Uri class as described in [the documentation](https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/network/schemesettings-element-uri-settings#remarks).
See Also
--------
See also
[ansible.builtin.get\_url](../builtin/get_url_module#ansible-collections-ansible-builtin-get-url-module)
The official documentation on the **ansible.builtin.get\_url** module.
[ansible.builtin.uri](../builtin/uri_module#ansible-collections-ansible-builtin-uri-module)
The official documentation on the **ansible.builtin.uri** module.
[ansible.windows.win\_uri](win_uri_module#ansible-collections-ansible-windows-win-uri-module)
The official documentation on the **ansible.windows.win\_uri** module.
[community.windows.win\_inet\_proxy](../../community/windows/win_inet_proxy_module#ansible-collections-community-windows-win-inet-proxy-module)
The official documentation on the **community.windows.win\_inet\_proxy** module.
Examples
--------
```
- name: Download earthrise.jpg to specified path
ansible.windows.win_get_url:
url: http://www.example.com/earthrise.jpg
dest: C:\Users\RandomUser\earthrise.jpg
- name: Download earthrise.jpg to specified path only if modified
ansible.windows.win_get_url:
url: http://www.example.com/earthrise.jpg
dest: C:\Users\RandomUser\earthrise.jpg
force: no
- name: Download earthrise.jpg to specified path through a proxy server.
ansible.windows.win_get_url:
url: http://www.example.com/earthrise.jpg
dest: C:\Users\RandomUser\earthrise.jpg
proxy_url: http://10.0.0.1:8080
proxy_username: username
proxy_password: password
- name: Download file from FTP with authentication
ansible.windows.win_get_url:
url: ftp://server/file.txt
dest: '%TEMP%\ftp-file.txt'
url_username: ftp-user
url_password: ftp-password
- name: Download src with sha256 checksum url
ansible.windows.win_get_url:
url: http://www.example.com/earthrise.jpg
dest: C:\temp\earthrise.jpg
checksum_url: http://www.example.com/sha256sum.txt
checksum_algorithm: sha256
force: True
- name: Download src with sha256 checksum url
ansible.windows.win_get_url:
url: http://www.example.com/earthrise.jpg
dest: C:\temp\earthrise.jpg
checksum: a97e6837f60cec6da4491bab387296bbcd72bdba
checksum_algorithm: sha1
force: True
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **checksum\_dest** string | success and dest has been downloaded | <algorithm> checksum of the file after the download **Sample:** 6e642bb8dd5c2e027bf21dd923337cbb4214f827 |
| **checksum\_src** string | force=yes or dest did not exist | <algorithm> checksum of the remote resource **Sample:** 6e642bb8dd5c2e027bf21dd923337cbb4214f827 |
| **dest** string | always | destination file/path **Sample:** C:\Users\RandomUser\earthrise.jpg |
| **elapsed** float | always | The elapsed seconds between the start of poll and the end of the module. **Sample:** 2.1406487 |
| **msg** string | always | Error message, or HTTP status message from web-server **Sample:** OK |
| **size** integer | success | size of the dest file **Sample:** 1220 |
| **status\_code** integer | always | HTTP status code **Sample:** 200 |
| **url** string | always | requested url **Sample:** http://www.example.com/earthrise.jpg |
### Authors
* Paul Durivage (@angstwad)
* Takeshi Kuramochi (@tksarah)
| programming_docs |
ansible ansible.windows.win_domain_controller – Manage domain controller/member server state for a Windows host ansible.windows.win\_domain\_controller – Manage domain controller/member server state for a Windows host
=========================================================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_domain_controller`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Ensure that a Windows Server 2012+ host is configured as a domain controller or demoted to member server.
* This module may require subsequent use of the [ansible.windows.win\_reboot](win_reboot_module#ansible-collections-ansible-windows-win-reboot-module) action if changes are made.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **database\_path** path | | The path to a directory on a fixed disk of the Windows host where the domain database will be created.. If not set then the default path is `%SYSTEMROOT%\NTDS`. |
| **dns\_domain\_name** string | | When `state` is `domain_controller`, the DNS name of the domain for which the targeted Windows host should be a DC. |
| **domain\_admin\_password** string / required | | Password for the specified `domain_admin_user`. |
| **domain\_admin\_user** string / required | | Username of a domain admin for the target domain (necessary to promote or demote a domain controller). |
| **domain\_log\_path** path | | Specified the fully qualified, non-UNC path to a directory on a fixed disk of the local computer that will contain the domain log files. |
| **install\_dns** boolean | **Choices:*** no
* yes
| Whether to install the DNS service when creating the domain controller. If not specified then the `-InstallDns` option is not supplied to `Install-ADDSDomainController` command, see <https://docs.microsoft.com/en-us/powershell/module/addsdeployment/install-addsdomaincontroller>. |
| **install\_media\_path** path | | The path to a directory on a fixed disk of the Windows host where the Install From Media `IFC` data will be used. See the [Install using IFM guide](https://social.technet.microsoft.com/wiki/contents/articles/8630.active-directory-step-by-step-guide-to-install-an-additional-domain-controller-using-ifm.aspx) for more information. |
| **local\_admin\_password** string | | Password to be assigned to the local `Administrator` user (required when `state` is `member_server`). |
| **log\_path** string | | The path to log any debug information when running the module. This option is deprecated and should not be used, it will be removed on the major release after `2022-07-01`. This does not relate to the `-LogPath` paramter of the install controller cmdlet. |
| **read\_only** boolean | **Choices:*** **no** ←
* yes
| Whether to install the domain controller as a read only replica for an existing domain. |
| **safe\_mode\_password** string | | Safe mode password for the domain controller (required when `state` is `domain_controller`). |
| **site\_name** string | | Specifies the name of an existing site where you can place the new domain controller. This option is required when *read\_only* is `yes`. |
| **state** string / required | **Choices:*** domain\_controller
* member\_server
| Whether the target host should be a domain controller or a member server. |
| **sysvol\_path** path | | The path to a directory on a fixed disk of the Windows host where the Sysvol folder will be created. If not set then the default path is `%SYSTEMROOT%\SYSVOL`. |
See Also
--------
See also
[ansible.windows.win\_domain](win_domain_module#ansible-collections-ansible-windows-win-domain-module)
The official documentation on the **ansible.windows.win\_domain** module.
ansible.windows.win\_domain\_computer
The official documentation on the **ansible.windows.win\_domain\_computer** module.
[community.windows.win\_domain\_group](../../community/windows/win_domain_group_module#ansible-collections-community-windows-win-domain-group-module)
The official documentation on the **community.windows.win\_domain\_group** module.
[ansible.windows.win\_domain\_membership](win_domain_membership_module#ansible-collections-ansible-windows-win-domain-membership-module)
The official documentation on the **ansible.windows.win\_domain\_membership** module.
[community.windows.win\_domain\_user](../../community/windows/win_domain_user_module#ansible-collections-community-windows-win-domain-user-module)
The official documentation on the **community.windows.win\_domain\_user** module.
Examples
--------
```
- name: Ensure a server is a domain controller
ansible.windows.win_domain_controller:
dns_domain_name: ansible.vagrant
domain_admin_user: [email protected]
domain_admin_password: password123!
safe_mode_password: password123!
state: domain_controller
# note that without an action wrapper, in the case where a DC is demoted,
# the task will fail with a 401 Unauthorized, because the domain credential
# becomes invalid to fetch the final output over WinRM. This requires win_async
# with credential switching (or other clever credential-switching
# mechanism to get the output and trigger the required reboot)
- name: Ensure a server is not a domain controller
ansible.windows.win_domain_controller:
domain_admin_user: [email protected]
domain_admin_password: password123!
local_admin_password: password123!
state: member_server
- name: Promote server as a read only domain controller
ansible.windows.win_domain_controller:
dns_domain_name: ansible.vagrant
domain_admin_user: [email protected]
domain_admin_password: password123!
safe_mode_password: password123!
state: domain_controller
read_only: yes
site_name: London
- name: Promote server with custom paths
ansible.windows.win_domain_controller:
dns_domain_name: ansible.vagrant
domain_admin_user: [email protected]
domain_admin_password: password123!
safe_mode_password: password123!
state: domain_controller
sysvol_path: D:\SYSVOL
database_path: D:\NTDS
domain_log_path: D:\NTDS
register: dc_promotion
- name: Reboot after promotion
ansible.windows.win_reboot:
when: dc_promotion.reboot_required
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **reboot\_required** boolean | always | True if changes were made that require a reboot. **Sample:** True |
### Authors
* Matt Davis (@nitzmahone)
ansible ansible.windows.win_hostname – Manages local Windows computer name ansible.windows.win\_hostname – Manages local Windows computer name
===================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_hostname`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages local Windows computer name.
* A reboot is required for the computer name to take effect.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | The hostname to set for the computer. |
See Also
--------
See also
[ansible.windows.win\_dns\_client](win_dns_client_module#ansible-collections-ansible-windows-win-dns-client-module)
The official documentation on the **ansible.windows.win\_dns\_client** module.
Examples
--------
```
- name: Change the hostname to sample-hostname
ansible.windows.win_hostname:
name: sample-hostname
register: res
- name: Reboot
ansible.windows.win_reboot:
when: res.reboot_required
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **old\_name** string | always | The original hostname that was set before it was changed. **Sample:** old\_hostname |
| **reboot\_required** boolean | always | Whether a reboot is required to complete the hostname change. **Sample:** True |
### Authors
* Ripon Banik (@riponbanik)
ansible ansible.windows.win_uri – Interacts with webservices ansible.windows.win\_uri – Interacts with webservices
=====================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_uri`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Interacts with FTP, HTTP and HTTPS web services.
* Supports Digest, Basic and WSSE HTTP authentication mechanisms.
* For non-Windows targets, use the [ansible.builtin.uri](../builtin/uri_module#ansible-collections-ansible-builtin-uri-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **body** raw | | The body of the HTTP request/response to the web service. |
| **client\_cert** string | | The path to the client certificate (.pfx) that is used for X509 authentication. This path can either be the path to the `pfx` on the filesystem or the PowerShell certificate path `Cert:\CurrentUser\My\<thumbprint>`. The WinRM connection must be authenticated with `CredSSP` or `become` is used on the task if the certificate file is not password protected. Other authentication types can set *client\_cert\_password* when the cert is password protected. |
| **client\_cert\_password** string | | The password for *client\_cert* if the cert is password protected. |
| **content\_type** string | | Sets the "Content-Type" header. |
| **creates** path | | A filename, when it already exists, this step will be skipped. |
| **dest** path | | Output the response body to a file. |
| **follow\_redirects** string | **Choices:*** all
* none
* **safe** ←
| Whether or the module should follow redirects.
`all` will follow all redirect.
`none` will not follow any redirect.
`safe` will follow only "safe" redirects, where "safe" means that the client is only doing a `GET` or `HEAD` on the URI to which it is being redirected. When following a redirected URL, the `Authorization` header and any credentials set will be dropped and not redirected. |
| **force\_basic\_auth** boolean | **Choices:*** **no** ←
* yes
| By default the authentication header is only sent when a webservice responses to an initial request with a 401 status. Since some basic auth services do not properly send a 401, logins will fail. This option forces the sending of the Basic authentication header upon the original request. |
| **headers** dictionary | | Extra headers to set on the request. This should be a dictionary where the key is the header name and the value is the value for that header. |
| **http\_agent** string | **Default:**"ansible-httpget" | Header to identify as, generally appears in web server logs. This is set to the `User-Agent` header on a HTTP request. |
| **maximum\_redirection** integer | **Default:**50 | Specify how many times the module will redirect a connection to an alternative URI before the connection fails. If set to `0` or *follow\_redirects* is set to `none`, or `safe` when not doing a `GET` or `HEAD` it prevents all redirection. |
| **proxy\_password** string | | The password for *proxy\_username*. |
| **proxy\_url** string | | An explicit proxy to use for the request. By default, the request will use the IE defined proxy unless *use\_proxy* is set to `no`. |
| **proxy\_use\_default\_credential** boolean | **Choices:*** **no** ←
* yes
| Uses the current user's credentials when authenticating with a proxy host protected with `NTLM`, `Kerberos`, or `Negotiate` authentication. Proxies that use `Basic` auth will still require explicit credentials through the *proxy\_username* and *proxy\_password* options. The module will only have access to the user's credentials if using `become` with a password, you are connecting with SSH using a password, or connecting with WinRM using `CredSSP` or `Kerberos with delegation`. If not using `become` or a different auth method to the ones stated above, there will be no default credentials available and no proxy authentication will occur. |
| **proxy\_username** string | | The username to use for proxy authentication. |
| **removes** path | | A filename, when it does not exist, this step will be skipped. |
| **return\_content** boolean | **Choices:*** **no** ←
* yes
| Whether or not to return the body of the response as a "content" key in the dictionary result. If the reported Content-type is "application/json", then the JSON is additionally loaded into a key called `json` in the dictionary results. |
| **status\_code** list / elements=integer | **Default:**[200] | A valid, numeric, HTTP status code that signifies success of the request. Can also be comma separated list of status codes. |
| **url** string / required | | Supports FTP, HTTP or HTTPS URLs in the form of (ftp|http|https)://host.domain:port/path. |
| **url\_method** string | **Default:**"GET" | The HTTP Method of the request.
aliases: method |
| **url\_password** string | | The password for *url\_username*. The alias *password* is deprecated and will be removed on the major release after `2022-07-01`.
aliases: password |
| **url\_timeout** integer | **Default:**30 | Specifies how long the request can be pending before it times out (in seconds). Set to `0` to specify an infinite timeout.
aliases: timeout |
| **url\_username** string | | The username to use for authentication. The alias *user* and *username* is deprecated and will be removed on the major release after `2022-07-01`.
aliases: user, username |
| **use\_default\_credential** boolean | **Choices:*** **no** ←
* yes
| Uses the current user's credentials when authenticating with a server protected with `NTLM`, `Kerberos`, or `Negotiate` authentication. Sites that use `Basic` auth will still require explicit credentials through the *url\_username* and *url\_password* options. The module will only have access to the user's credentials if using `become` with a password, you are connecting with SSH using a password, or connecting with WinRM using `CredSSP` or `Kerberos with delegation`. If not using `become` or a different auth method to the ones stated above, there will be no default credentials available and no authentication will occur. |
| **use\_proxy** boolean | **Choices:*** no
* **yes** ←
| If `no`, it will not use the proxy defined in IE for the current user. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If `no`, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
See Also
--------
See also
[ansible.builtin.uri](../builtin/uri_module#ansible-collections-ansible-builtin-uri-module)
The official documentation on the **ansible.builtin.uri** module.
[ansible.windows.win\_get\_url](win_get_url_module#ansible-collections-ansible-windows-win-get-url-module)
The official documentation on the **ansible.windows.win\_get\_url** module.
[community.windows.win\_inet\_proxy](../../community/windows/win_inet_proxy_module#ansible-collections-community-windows-win-inet-proxy-module)
The official documentation on the **community.windows.win\_inet\_proxy** module.
Examples
--------
```
- name: Perform a GET and Store Output
ansible.windows.win_uri:
url: http://example.com/endpoint
register: http_output
# Set a HOST header to hit an internal webserver:
- name: Hit a Specific Host on the Server
ansible.windows.win_uri:
url: http://example.com/
method: GET
headers:
host: www.somesite.com
- name: Perform a HEAD on an Endpoint
ansible.windows.win_uri:
url: http://www.example.com/
method: HEAD
- name: POST a Body to an Endpoint
ansible.windows.win_uri:
url: http://www.somesite.com/
method: POST
body: "{ 'some': 'json' }"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **content** string | success and return\_content is True | The raw content of the HTTP response. **Sample:** {"foo": "bar"} |
| **content\_length** integer | success | The byte size of the response. **Sample:** 54447 |
| **elapsed** float | always | The number of seconds that elapsed while performing the download. **Sample:** 23.2 |
| **json** dictionary | success and Content-Type is "application/json" or "application/javascript" and return\_content is True | The json structure returned under content as a dictionary. **Sample:** {'this-is-dependent': 'on the actual return content'} |
| **status\_code** integer | success | The HTTP Status Code of the response. **Sample:** 200 |
| **status\_description** string | success | A summary of the status. **Sample:** OK |
| **url** string | always | The Target URL. **Sample:** https://www.ansible.com |
### Authors
* Corwin Brown (@blakfeld)
* Dag Wieers (@dagwieers)
ansible ansible.windows.win_reboot – Reboot a windows machine ansible.windows.win\_reboot – Reboot a windows machine
======================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_reboot`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Reboot a Windows machine, wait for it to go down, come back up, and respond to commands.
* For non-Windows targets, use the [ansible.builtin.reboot](../builtin/reboot_module#ansible-collections-ansible-builtin-reboot-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **boot\_time\_command** string | **Default:**"(Get-CimInstance -ClassName Win32\_OperatingSystem -Property LastBootUpTime).LastBootUpTime.ToFileTime()" | Command to run that returns a unique string indicating the last time the system was booted. Setting this to a command that has different output each time it is run will cause the task to fail. |
| **connect\_timeout** float | **Default:**5 | Maximum seconds to wait for a single successful TCP connection to the WinRM endpoint before trying again.
aliases: connect\_timeout\_sec |
| **msg** string | **Default:**"Reboot initiated by Ansible" | Message to display to users. |
| **post\_reboot\_delay** float | **Default:**0 | Seconds to wait after the reboot command was successful before attempting to validate the system rebooted successfully. This is useful if you want wait for something to settle despite your connection already working.
aliases: post\_reboot\_delay\_sec |
| **pre\_reboot\_delay** float | **Default:**2 | Seconds to wait before reboot. Passed as a parameter to the reboot command.
aliases: pre\_reboot\_delay\_sec |
| **reboot\_timeout** float | **Default:**600 | Maximum seconds to wait for machine to re-appear on the network and respond to a test command. This timeout is evaluated separately for both reboot verification and test command success so maximum clock time is actually twice this value.
aliases: reboot\_timeout\_sec |
| **test\_command** string | | Command to expect success for to determine the machine is ready for management. By default this test command is a custom one to detect when the Windows Logon screen is up and ready to accept credentials. Using a custom command will replace this behaviour and just run the command specified. |
Notes
-----
Note
* If a shutdown was already scheduled on the system, [ansible.windows.win\_reboot](#ansible-collections-ansible-windows-win-reboot-module) will abort the scheduled shutdown and enforce its own shutdown.
* Beware that when [ansible.windows.win\_reboot](#ansible-collections-ansible-windows-win-reboot-module) returns, the Windows system may not have settled yet and some base services could be in limbo. This can result in unexpected behavior. Check the examples for ways to mitigate this. This has been slightly mitigated in the `1.6.0` release of `ansible.windows` but it is not guranteed to always wait until the logon prompt is shown.
* The connection user must have the `SeRemoteShutdownPrivilege` privilege enabled, see <https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/force-shutdown-from-a-remote-system> for more information.
See Also
--------
See also
[ansible.builtin.reboot](../builtin/reboot_module#ansible-collections-ansible-builtin-reboot-module)
The official documentation on the **ansible.builtin.reboot** module.
Examples
--------
```
- name: Reboot the machine with all defaults
ansible.windows.win_reboot:
- name: Reboot a slow machine that might have lots of updates to apply
ansible.windows.win_reboot:
reboot_timeout: 3600
# Install a Windows feature and reboot if necessary
- name: Install IIS Web-Server
ansible.windows.win_feature:
name: Web-Server
register: iis_install
- name: Reboot when Web-Server feature requires it
ansible.windows.win_reboot:
when: iis_install.reboot_required
# One way to ensure the system is reliable, is to set WinRM to a delayed startup
- name: Ensure WinRM starts when the system has settled and is ready to work reliably
ansible.windows.win_service:
name: WinRM
start_mode: delayed
# Additionally, you can add a delay before running the next task
- name: Reboot a machine that takes time to settle after being booted
ansible.windows.win_reboot:
post_reboot_delay: 120
# Or you can make win_reboot validate exactly what you need to work before running the next task
- name: Validate that the netlogon service has started, before running the next task
ansible.windows.win_reboot:
test_command: 'exit (Get-Service -Name Netlogon).Status -ne "Running"'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **elapsed** float | always | The number of seconds that elapsed waiting for the system to be rebooted. **Sample:** 23.2 |
| **rebooted** boolean | always | True if the machine was rebooted. **Sample:** True |
### Authors
* Matt Davis (@nitzmahone)
| programming_docs |
ansible ansible.windows.win_optional_feature – Manage optional Windows features ansible.windows.win\_optional\_feature – Manage optional Windows features
=========================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_optional_feature`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Install or uninstall optional Windows features on non-Server Windows.
* This module uses the `Enable-WindowsOptionalFeature` and `Disable-WindowsOptionalFeature` cmdlets.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **include\_parent** boolean | **Choices:*** **no** ←
* yes
| Whether to enable the parent feature and the parent's dependencies. |
| **name** list / elements=string / required | | The name(s) of the feature to install. This relates to `FeatureName` in the Powershell cmdlet. To list all available features use the PowerShell command `Get-WindowsOptionalFeature`. |
| **source** string | | Specify a source to install the feature from. Can either be `{driveletter}:\sources\sxs` or `\\{IP}\share\sources\sxs`. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether to ensure the feature is absent or present on the system. |
See Also
--------
See also
[chocolatey.chocolatey.win\_chocolatey](../../chocolatey/chocolatey/win_chocolatey_module#ansible-collections-chocolatey-chocolatey-win-chocolatey-module)
The official documentation on the **chocolatey.chocolatey.win\_chocolatey** module.
[ansible.windows.win\_feature](win_feature_module#ansible-collections-ansible-windows-win-feature-module)
The official documentation on the **ansible.windows.win\_feature** module.
[ansible.windows.win\_package](win_package_module#ansible-collections-ansible-windows-win-package-module)
The official documentation on the **ansible.windows.win\_package** module.
Examples
--------
```
- name: Install .Net 3.5
ansible.windows.win_optional_feature:
name: NetFx3
state: present
- name: Install .Net 3.5 from source
ansible.windows.win_optional_feature:
name: NetFx3
source: \\share01\win10\sources\sxs
state: present
- name: Install Microsoft Subsystem for Linux
ansible.windows.win_optional_feature:
name: Microsoft-Windows-Subsystem-Linux
state: present
register: wsl_status
- name: Reboot if installing Linux Subsytem as feature requires it
ansible.windows.win_reboot:
when: wsl_status.reboot_required
- name: Install multiple features in one task
ansible.windows.win_optional_feature:
name:
- NetFx3
- Microsoft-Windows-Subsystem-Linux
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **reboot\_required** boolean | success | True when the target server requires a reboot to complete updates **Sample:** True |
### Authors
* Carson Anderson (@rcanderson23)
ansible ansible.windows.win_domain – Ensures the existence of a Windows domain ansible.windows.win\_domain – Ensures the existence of a Windows domain
=======================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_domain`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Ensure that the domain named by `dns_domain_name` exists and is reachable.
* If the domain is not reachable, the domain is created in a new forest on the target Windows Server 2012R2+ host.
* This module may require subsequent use of the [ansible.windows.win\_reboot](win_reboot_module#ansible-collections-ansible-windows-win-reboot-module) action if changes are made.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **create\_dns\_delegation** boolean | **Choices:*** no
* yes
| Whether to create a DNS delegation that references the new DNS server that you install along with the domain controller. Valid for Active Directory-integrated DNS only. The default is computed automatically based on the environment. |
| **database\_path** path | | The path to a directory on a fixed disk of the Windows host where the domain database will be created. If not set then the default path is `%SYSTEMROOT%\NTDS`. |
| **dns\_domain\_name** string / required | | The DNS name of the domain which should exist and be reachable or reside on the target Windows host. |
| **domain\_mode** string | **Choices:*** Win2003
* Win2008
* Win2008R2
* Win2012
* Win2012R2
* WinThreshold
| Specifies the domain functional level of the first domain in the creation of a new forest. The domain functional level cannot be lower than the forest functional level, but it can be higher. The default is automatically computed and set. |
| **domain\_netbios\_name** string | | The NetBIOS name for the root domain in the new forest. For NetBIOS names to be valid for use with this parameter they must be single label names of 15 characters or less, if not it will fail. If this parameter is not set, then the default is automatically computed from the value of the *domain\_name* parameter. |
| **forest\_mode** string | **Choices:*** Win2003
* Win2008
* Win2008R2
* Win2012
* Win2012R2
* WinThreshold
| Specifies the forest functional level for the new forest. The default forest functional level in Windows Server is typically the same as the version you are running. |
| **install\_dns** boolean | **Choices:*** no
* **yes** ←
| Whether to install the DNS service when creating the domain controller. |
| **log\_path** path | | Specifies the fully qualified, non-UNC path to a directory on a fixed disk of the local computer where the log file for this operation is written. If not set then the default path is `%SYSTEMROOT%\NTDS`. |
| **safe\_mode\_password** string / required | | Safe mode password for the domain controller. |
| **sysvol\_path** path | | The path to a directory on a fixed disk of the Windows host where the Sysvol file will be created. If not set then the default path is `%SYSTEMROOT%\SYSVOL`. |
See Also
--------
See also
[ansible.windows.win\_domain\_controller](win_domain_controller_module#ansible-collections-ansible-windows-win-domain-controller-module)
The official documentation on the **ansible.windows.win\_domain\_controller** module.
[community.windows.win\_domain\_computer](../../community/windows/win_domain_computer_module#ansible-collections-community-windows-win-domain-computer-module)
The official documentation on the **community.windows.win\_domain\_computer** module.
[community.windows.win\_domain\_group](../../community/windows/win_domain_group_module#ansible-collections-community-windows-win-domain-group-module)
The official documentation on the **community.windows.win\_domain\_group** module.
[ansible.windows.win\_domain\_membership](win_domain_membership_module#ansible-collections-ansible-windows-win-domain-membership-module)
The official documentation on the **ansible.windows.win\_domain\_membership** module.
[community.windows.win\_domain\_user](../../community/windows/win_domain_user_module#ansible-collections-community-windows-win-domain-user-module)
The official documentation on the **community.windows.win\_domain\_user** module.
Examples
--------
```
- name: Create new domain in a new forest on the target host
ansible.windows.win_domain:
dns_domain_name: ansible.vagrant
safe_mode_password: password123!
- name: Create new Windows domain in a new forest with specific parameters
ansible.windows.win_domain:
create_dns_delegation: no
database_path: C:\Windows\NTDS
dns_domain_name: ansible.vagrant
domain_mode: Win2012R2
domain_netbios_name: ANSIBLE
forest_mode: Win2012R2
safe_mode_password: password123!
sysvol_path: C:\Windows\SYSVOL
register: domain_install
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **reboot\_required** boolean | always | True if changes were made that require a reboot. **Sample:** True |
### Authors
* Matt Davis (@nitzmahone)
ansible ansible.windows.win_user_right – Manage Windows User Rights ansible.windows.win\_user\_right – Manage Windows User Rights
=============================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_user_right`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Add, remove or set User Rights for a group or users or groups.
* You can set user rights for both local and domain accounts.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **action** string | **Choices:*** add
* remove
* **set** ←
|
`add` will add the users/groups to the existing right.
`remove` will remove the users/groups from the existing right.
`set` will replace the users/groups of the existing right. |
| **name** string / required | | The name of the User Right as shown by the `Constant Name` value from <https://technet.microsoft.com/en-us/library/dd349804.aspx>. The module will return an error if the right is invalid. |
| **users** list / elements=string / required | | A list of users or groups to add/remove on the User Right. These can be in the form DOMAIN\user-group, [email protected] for domain users/groups. For local users/groups it can be in the form user-group, .\user-group, SERVERNAME\user-group where SERVERNAME is the name of the remote server. You can also add special local accounts like SYSTEM and others. Can be set to an empty list with *action=set* to remove all accounts from the right. |
Notes
-----
Note
* If the server is domain joined this module can change a right but if a GPO governs this right then the changes won’t last.
See Also
--------
See also
[ansible.windows.win\_group](win_group_module#ansible-collections-ansible-windows-win-group-module)
The official documentation on the **ansible.windows.win\_group** module.
[ansible.windows.win\_group\_membership](win_group_membership_module#ansible-collections-ansible-windows-win-group-membership-module)
The official documentation on the **ansible.windows.win\_group\_membership** module.
[ansible.windows.win\_user](win_user_module#ansible-collections-ansible-windows-win-user-module)
The official documentation on the **ansible.windows.win\_user** module.
Examples
--------
```
---
- name: Replace the entries of Deny log on locally
ansible.windows.win_user_right:
name: SeDenyInteractiveLogonRight
users:
- Guest
- Users
action: set
- name: Add account to Log on as a service
ansible.windows.win_user_right:
name: SeServiceLogonRight
users:
- .\Administrator
- '{{ansible_hostname}}\local-user'
action: add
- name: Remove accounts who can create Symbolic links
ansible.windows.win_user_right:
name: SeCreateSymbolicLinkPrivilege
users:
- SYSTEM
- Administrators
- DOMAIN\User
- [email protected]
action: remove
- name: Remove all accounts who cannot log on remote interactively
ansible.windows.win_user_right:
name: SeDenyRemoteInteractiveLogonRight
users: []
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **added** list / elements=string | success | A list of accounts that were added to the right, this is empty if no accounts were added. **Sample:** ['NT AUTHORITY\\SYSTEM', 'DOMAIN\\User'] |
| **removed** list / elements=string | success | A list of accounts that were removed from the right, this is empty if no accounts were removed. **Sample:** ['SERVERNAME\\Administrator', 'BUILTIN\\Administrators'] |
### Authors
* Jordan Borean (@jborean93)
ansible ansible.windows.win_powershell – Run PowerShell scripts ansible.windows.win\_powershell – Run PowerShell scripts
========================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_powershell`.
New in version 1.5.0: of ansible.windows
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Runs a PowerShell script and outputs the data in a structured format.
* Use [ansible.windows.win\_command](win_command_module#ansible-collections-ansible-windows-win-command-module) or [ansible.windows.win\_shell](win_shell_module#ansible-collections-ansible-windows-win-shell-module) to run a tranditional PowerShell process with stdout, stderr, and rc results.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **arguments** list / elements=string | | A list of arguments to pass to *executable* when running a script in another PowerShell process. These are not arguments to pass to *script*, use *parameters* for that purpose. |
| **chdir** string | | The PowerShell location to set when starting the script. This can be a location in any of the PowerShell providers. The default location is dependent on many factors, if relative paths are used then set this option. |
| **creates** string | | A path or path filter pattern; when the referenced path exists on the target host, the task will be skipped. |
| **depth** integer | **Default:**2 | How deep the return values are serialized for `result`, `output`, and `information[x].message_data`. Setting this to a higher value can dramatically increase the amount of data that needs to be returned. |
| **error\_action** string | **Choices:*** silently\_continue
* **continue** ←
* stop
| The `$ErrorActionPreference` to set before executing *script*.
`silently_continue` will ignore any errors and exceptions raised.
`continue` is the default behaviour in PowerShell, errors are present in the *error* return value but only terminating exceptions will stop the script from continuing and set it as failed.
`stop` will treat errors like exceptions, will stop the script and set it as failed. |
| **executable** string | | A custom PowerShell executable to run the script in. When not defined the script will run in the current module PowerShell interpreter. Both the remote PowerShell and the one specified by *executable* must be running on PowerShell v5.1 or newer. Setting this value may change the values returned in the `output` return value depending on the underlying .NET type. |
| **parameters** dictionary | | Parameters to pass into the script as key value pairs. The key corresponds to the parameter name and the value is the value for that parameter. |
| **removes** string | | A path or path filter pattern; when the referenced path **does not** exist on the target host, the task will be skipped. |
| **script** string / required | | The PowerShell script to run. |
Notes
-----
Note
* The module is set as failed when a terminating exception is throw, or `error_action=stop` and a normal error record is raised.
* The output values are processed using a custom filter and while it mostly matches the `ConvertTo-Json` result the following value types are different.
* `DateTime` will be an ISO 8601 string in UTC, `DateTimeOffset` will have the offset as specified by the value.
* `Enum` will contain a dictionary with `Type`, `String`, `Value` being the type name, string representation and raw integer value respectively.
* `Type` will contain a dictionary with `Name`, `FullName`, `AssemblyQualifiedName`, `BaseType` being the type name, the type name including the namespace, the full assembly name the type was defined in and the base type it derives from.
* The script has access to the `$Ansible` variable where it can set `Result`, `Changed`, `Failed`, or access `Tmpdir`.
* `$Ansible.Result` is a value that is returned back to the controller as is.
* `$Ansible.Changed` can be set to `true` or `false` to reflect whether the module made a change or not. By default this is set to `true`.
* `$Ansible.Failed` can be set to `true` if the script wants to return the failure back to the controller.
* `$Ansible.Tmpdir` is the path to a temporary directory to use as a scratch location that is cleaned up after the module has finished.
* Any host/console output like `Write-Host` or `[Console]::WriteLine` is not considered an output object, they are returned as a string in *host\_out* and *host\_err*.
* The module will skip running the script when in check mode unless the script defines `[CmdletBinding(SupportsShouldProcess`]).
See Also
--------
See also
[ansible.windows.win\_command](win_command_module#ansible-collections-ansible-windows-win-command-module)
The official documentation on the **ansible.windows.win\_command** module.
[ansible.windows.win\_shell](win_shell_module#ansible-collections-ansible-windows-win-shell-module)
The official documentation on the **ansible.windows.win\_shell** module.
Examples
--------
```
- name: Run basic PowerShell script
ansible.windows.win_powershell:
script: |
echo "Hello World"
- name: Run PowerShell script with parameters
ansible.windows.win_powershell:
script: |
[CmdletBinding()]
param (
[String]
$Path,
[Switch]
$Force
)
New-Item -Path $Path -ItemType Direcotry -Force:$Force
parameters:
Path: C:\temp
Force: true
- name: Run PowerShell script that modifies the module changed result
ansible.windows.win_powershell:
script: |
if (Get-Service -Name test -ErrorAction SilentlyContinue) {
Remove-Service -Name test
}
else {
$Ansible.Changed = $false
}
- name: Run PowerShell script in PowerShell 7
ansible.windows.win_powershell:
script: |
$PSVersionTable.PSVersion.Major
executable: pwsh.exe
arguments:
- -ExecutionPolicy
- ByPass
register: pwsh_output
failed_when:
- pwsh_output.output[0] != 7
- name: Run code in check mode
ansible.windows.win_powershell:
script: |
[CmdletBinding(SupportsShouldProcess)]
param ()
# Use $Ansible to detect check mode
if ($Ansible.CheckMode) {
echo 'running in check mode'
}
else {
echo 'running in normal mode'
}
# Use builtin ShouldProcess (-WhatIf)
if ($PSCmdlet.ShouldProcess('target')) {
echo 'also running in normal mode'
}
else {
echo 'also running in check mode'
}
check_mode: yes
- name: Return a failure back to Ansible
ansible.windows.win_powershell:
script: |
if (Test-Path C:\bad.file) {
$Ansible.Failed = $true
}
- name: Define when the script made a change or not
ansible.windows.win_powershell:
script: |
if ((Get-Item WSMan:\localhost\Service\Auth\Basic).Value -eq 'true') {
Set-Item WSMan:\localhost\Service\Auth\Basic -Value false
}
else {
$Ansible.Changed = $true
}
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **debug** list / elements=string | always | A list of warning messages created by the script. Debug messages only appear when `$DebugPreference = 'Continue'`. **Sample:** ['debug record'] |
| **error** list / elements=dictionary | always | A list of error records created by the script. |
| | **category\_info** dictionary | success | More information about the error record. |
| | | **activity** string | always | Description of the operation which encountered the error. **Sample:** Write-Error |
| | | **category** string | always | The category name of the error record. **Sample:** NotSpecified |
| | | **category\_id** integer | always | The integer representation of the category. |
| | | **reason** string | always | Description of the error. **Sample:** WriteErrorException |
| | | **target\_name** string | always | Description of the target object. Can be an empty string if no target was specified. **Sample:** C:\Windows |
| | | **target\_type** string | always | Description of the type of the target object. Can be an empty string if no target object was specified. **Sample:** String |
| | **error\_details** dictionary | success | Additional details about an ErrorRecord. Can be null if there are not additional details. |
| | | **message** string | always | Message for the error record. **Sample:** Specific error message |
| | | **recommended\_action** string | always | Recommended action in the even that this error occurs. This is empty unless the code which generates the error adds this explicitly. **Sample:** Delete file |
| | **exception** dictionary | success | Details about the exception behind the error record. |
| | | **help\_link** string | always | A link to the help details for the exception. May not be set as it's dependent on whether the .NET exception class provides this info. **Sample:** http://docs.ansible.com/ |
| | | **hresult** integer | always | The signed integer assigned to this exception. May not be set as it's dependent on whether the .NET exception class provides this info. **Sample:** -1 |
| | | **inner\_exception** dictionary | always | The inner exception details if there is one present. The dict contains the same keys as a normal exception. |
| | | **message** string | always | The exception message. **Sample:** The method ran into an error |
| | | **source** string | always | Name of the application or object that causes the error. This may be an empty string as it's dependent on the code that raises the exception. **Sample:** C:\Windows |
| | | **type** string | always | The full .NET type of the Exception class. **Sample:** System.Exception |
| | **fully\_qualified\_error\_id** string | always | The unique identifier for the error condition May be null if no id was specified when the record was created. **Sample:** ParameterBindingFailed |
| | **output** string | always | The formatted error record message as typically seen in a PowerShell console. **Sample:** Write-Error "error" : error + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException |
| | **pipeline\_iteration\_info** list / elements=integer | always | The status of the pipeline when this record was created. The values are 0 index based. Each element entry represents the command index in a pipeline statement. The value of each element represents the pipeline input idx in that command. For Example `'C:\Windows', 'C:\temp' | Get-ChildItem | Get-Item`, `[1, 2, 9]` represents an error occured with the 2nd output, 3rd, and 9th output of the 1st, 2nd, and 3rd command in that pipeline respectively. **Sample:** [0, 0] |
| | **script\_stack\_trace** string | always | The script stack trace for the error record. **Sample:** at <ScriptBlock>, <No file>: line 1 |
| | **target\_object** string | always | The object which the error occured. May be null if no object was specified when the record was created. **Sample:** C:\Windows |
| **host\_err** string | always | The strings written to the host error output, typically the stderr. This is not the same as objects sent to the error stream in PowerShell. **Sample:** Error 1 Error 2 |
| **host\_out** string | always | The strings written to the host output, typically the stdout. This is not the same as objects sent to the output stream in PowerShell. **Sample:** Line 1 Line 2 |
| **information** list / elements=dictionary | always | A list of information records created by the script. The information stream was only added in PowerShell v5, older versions will always have an empty list as a value. |
| | **message\_data** complex | always | Message data associated with the record. The value here can be of any type. **Sample:** information record |
| | **source** string | always | The source of the record. **Sample:** Write-Information |
| | **tags** list / elements=string | always | A list of tags associated with the record. **Sample:** ['Host'] |
| | **time\_generated** string | always | The time the record was generated. This is the time in UTC as an ISO 8601 formatted string. **Sample:** 2021-02-11T04:46:00.4694240Z |
| **output** list / elements=string | always | A list containing all the objects outputted by the script. The list elements can be anything as it is based on what was ran. **Sample:** ['output 1', 2, ['inner list'], {'key': 'value'}, 'None'] |
| **result** complex | always | The values that were set by `$Ansible.Result` in the script. Defaults to an empty dict but can be set to anything by the script. **Sample:** {'key': 'value', 'other key': 1} |
| **verbose** list / elements=string | always | A list of warning messages created by the script. Verbose messages only appear when `$VerbosePreference = 'Continue'`. **Sample:** ['verbose record'] |
| **warning** list / elements=string | always | A list of warning messages created by the script. Warning messages only appear when `$WarningPreference = 'Continue'`. **Sample:** ['warning record'] |
### Authors
* Jordan Borean (@jborean93)
| programming_docs |
ansible ansible.windows.win_package – Installs/uninstalls an installable package ansible.windows.win\_package – Installs/uninstalls an installable package
=========================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_package`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Installs or uninstalls software packages for Windows.
* Supports `.exe`, `.msi`, `.msp`, `.appx`, `.appxbundle`, `.msix`, and `.msixbundle`.
* These packages can be sourced from the local file system, network file share or a url.
* See *provider* for more info on each package type that is supported.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **arguments** raw | | Any arguments the installer needs to either install or uninstall the package. If the package is an MSI do not supply the `/qn`, `/log` or `/norestart` arguments. This is only used for the `msi`, `msp`, and `registry` providers. Can be a list of arguments and the module will escape the arguments as necessary, it is recommended to use a string when dealing with MSI packages due to the unique escaping issues with msiexec. When using a list of arguments each item in the list is considered to be a single argument. As such, if an argument in the list contains a space then Ansible will quote this to ensure that this is seen by Windows as a single argument. Should this behaviour not be what is required, the argument should be split into two separate list items. See the examples section for more detail. |
| **chdir** path | | Set the specified path as the current working directory before installing or uninstalling a package. This is only used for the `msi`, `msp`, and `registry` providers. |
| **client\_cert** string | | The path to the client certificate (.pfx) that is used for X509 authentication. This path can either be the path to the `pfx` on the filesystem or the PowerShell certificate path `Cert:\CurrentUser\My\<thumbprint>`. The WinRM connection must be authenticated with `CredSSP` or `become` is used on the task if the certificate file is not password protected. Other authentication types can set *client\_cert\_password* when the cert is password protected. |
| **client\_cert\_password** string | | The password for *client\_cert* if the cert is password protected. |
| **creates\_path** path | | Will check the existence of the path specified and use the result to determine whether the package is already installed. You can use this in conjunction with `product_id` and other `creates_*`. |
| **creates\_service** string | | Will check the existing of the service specified and use the result to determine whether the package is already installed. You can use this in conjunction with `product_id` and other `creates_*`. |
| **creates\_version** string | | Will check the file version property of the file at `creates_path` and use the result to determine whether the package is already installed.
`creates_path` MUST be set and is a file. You can use this in conjunction with `product_id` and other `creates_*`. |
| **expected\_return\_code** list / elements=integer | **Default:**[0, 3010] | One or more return codes from the package installation that indicates success. The return codes are read as a signed integer, any values greater than 2147483647 need to be represented as the signed equivalent, i.e. `4294967295` is `-1`. To convert a unsigned number to the signed equivalent you can run "[Int32]("0x{0:X}" -f ([UInt32]3221225477))". A return code of `3010` usually means that a reboot is required, the `reboot_required` return value is set if the return code is `3010`. This is only used for the `msi`, `msp`, and `registry` providers. |
| **follow\_redirects** string | **Choices:*** all
* none
* **safe** ←
| Whether or the module should follow redirects.
`all` will follow all redirect.
`none` will not follow any redirect.
`safe` will follow only "safe" redirects, where "safe" means that the client is only doing a `GET` or `HEAD` on the URI to which it is being redirected. When following a redirected URL, the `Authorization` header and any credentials set will be dropped and not redirected. |
| **force\_basic\_auth** boolean | **Choices:*** **no** ←
* yes
| By default the authentication header is only sent when a webservice responses to an initial request with a 401 status. Since some basic auth services do not properly send a 401, logins will fail. This option forces the sending of the Basic authentication header upon the original request. |
| **headers** dictionary | | Extra headers to set on the request. This should be a dictionary where the key is the header name and the value is the value for that header. |
| **http\_agent** string | **Default:**"ansible-httpget" | Header to identify as, generally appears in web server logs. This is set to the `User-Agent` header on a HTTP request. |
| **log\_path** path | | Specifies the path to a log file that is persisted after a package is installed or uninstalled. This is only used for the `msi` or `msp` provider. When omitted, a temporary log file is used instead for those providers. This is only valid for MSI files, use `arguments` for the `registry` provider. |
| **maximum\_redirection** integer | **Default:**50 | Specify how many times the module will redirect a connection to an alternative URI before the connection fails. If set to `0` or *follow\_redirects* is set to `none`, or `safe` when not doing a `GET` or `HEAD` it prevents all redirection. |
| **password** string | | The password for `user_name`, must be set when `user_name` is. This option is deprecated in favour of using become, see examples for more information. Will be removed on the major release after `2022-07-01`.
aliases: user\_password |
| **path** string | | Location of the package to be installed or uninstalled. This package can either be on the local file system, network share or a url. When `state=present`, `product_id` is not set and the path is a URL, this file will always be downloaded to a temporary directory for idempotency checks, otherwise the file will only be downloaded if the package has not been installed based on the `product_id` checks. If `state=present` then this value MUST be set. If `state=absent` then this value does not need to be set if `product_id` is. |
| **product\_id** string | | The product id of the installed packaged. This is used for checking whether the product is already installed and getting the uninstall information if `state=absent`. For msi packages, this is the `ProductCode` (GUID) of the package. This can be found under the same registry paths as the `registry` provider. For msp packages, this is the `PatchCode` (GUID) of the package which can found under the `Details -> Revision number` of the file's properties. For msix packages, this is the `Name` or `PackageFullName` of the package found under the `Get-AppxPackage` cmdlet. For registry (exe) packages, this is the registry key name under the registry paths specified in *provider*. This value is ignored if `path` is set to a local accesible file path and the package is not an `exe`. This SHOULD be set when the package is an `exe`, or the path is a url or a network share and credential delegation is not being used. The `creates_*` options can be used instead but is not recommended. The alias *productid* is deprecated and will be removed on the major release after `2022-07-01`.
aliases: productid |
| **provider** string | **Choices:*** **auto** ←
* msi
* msix
* msp
* registry
| Set the package provider to use when searching for a package. The `auto` provider will select the proper provider if *path* otherwise it scans all the other providers based on the *product\_id*. The `msi` provider scans for MSI packages installed on a machine wide and current user context based on the `ProductCode` of the MSI. The `msix` provider is used to install `.appx`, `.msix`, `.appxbundle`, or `.msixbundle` packages. These packages are only installed or removed on the current use. The host must be set to allow sideloaded apps or in developer mode. See the examples for how to enable this. If a package is already installed but `path` points to an updated package, this will be installed over the top of the existing one. The `msp` provider scans for all MSP patches installed on a machine wide and current user context based on the `PatchCode` of the MSP. A `msp` will be applied or removed on all `msi` products that it applies to and is installed. If the patch is obsoleted or superseded then no action will be taken. The `registry` provider is used for traditional `exe` installers and uses the following registry path to determine if a product was installed; `HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall`, `HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall`, `HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall`, and `HKCU:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall`. |
| **proxy\_password** string | | The password for *proxy\_username*. |
| **proxy\_url** string | | An explicit proxy to use for the request. By default, the request will use the IE defined proxy unless *use\_proxy* is set to `no`. |
| **proxy\_use\_default\_credential** boolean | **Choices:*** **no** ←
* yes
| Uses the current user's credentials when authenticating with a proxy host protected with `NTLM`, `Kerberos`, or `Negotiate` authentication. Proxies that use `Basic` auth will still require explicit credentials through the *proxy\_username* and *proxy\_password* options. The module will only have access to the user's credentials if using `become` with a password, you are connecting with SSH using a password, or connecting with WinRM using `CredSSP` or `Kerberos with delegation`. If not using `become` or a different auth method to the ones stated above, there will be no default credentials available and no proxy authentication will occur. |
| **proxy\_username** string | | The username to use for proxy authentication. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether to install or uninstall the package. The module uses *product\_id* to determine whether the package is installed or not. For all providers but `auto`, the *path* can be used for idempotency checks if it is locally accesible filesystem path. The alias *ensure* is deprecated and will be removed on the major release after `2022-07-01`.
aliases: ensure |
| **url\_method** string | | The HTTP Method of the request. |
| **url\_password** string | | The password for *url\_username*. |
| **url\_timeout** integer | **Default:**30 | Specifies how long the request can be pending before it times out (in seconds). Set to `0` to specify an infinite timeout. |
| **url\_username** string | | The username to use for authentication. |
| **use\_default\_credential** boolean | **Choices:*** **no** ←
* yes
| Uses the current user's credentials when authenticating with a server protected with `NTLM`, `Kerberos`, or `Negotiate` authentication. Sites that use `Basic` auth will still require explicit credentials through the *url\_username* and *url\_password* options. The module will only have access to the user's credentials if using `become` with a password, you are connecting with SSH using a password, or connecting with WinRM using `CredSSP` or `Kerberos with delegation`. If not using `become` or a different auth method to the ones stated above, there will be no default credentials available and no authentication will occur. |
| **use\_proxy** boolean | **Choices:*** no
* **yes** ←
| If `no`, it will not use the proxy defined in IE for the current user. |
| **username** string | | Username of an account with access to the package if it is located on a file share. This is only needed if the WinRM transport is over an auth method that does not support credential delegation like Basic or NTLM or become is not used. This option is deprecated in favour of using become, see examples for more information. Will be removed on the major release after `2022-07-01`.
aliases: user\_name |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If `no`, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
| **wait\_for\_children** boolean added in 1.3.0 of ansible.windows | **Choices:*** **no** ←
* yes
| The module will wait for the process it spawns to finish but any processes spawned in that child process as ignored. Set to `yes` to wait for all descendent processes to finish before the module returns. This is useful if the install/uninstaller is just a wrapper which then calls the actual installer as its own child process. When this option is `yes` then the module will wait for both processes to finish before returning. This should not be required for most installers and setting to `yes` could result in the module not returning until the process it is waiting for has been stopped manually. Requires Windows Server 2012 or Windows 8 or newer to use. |
Notes
-----
Note
* When `state=absent` and the product is an exe, the path may be different from what was used to install the package originally. If path is not set then the path used will be what is set under `QuietUninstallString` or `UninstallString` in the registry for that *product\_id*.
* By default all msi installs and uninstalls will be run with the arguments `/log, /qn, /norestart`.
* All the installation checks under `product_id` and `creates_*` add together, if one fails then the program is considered to be absent.
See Also
--------
See also
[chocolatey.chocolatey.win\_chocolatey](../../chocolatey/chocolatey/win_chocolatey_module#ansible-collections-chocolatey-chocolatey-win-chocolatey-module)
The official documentation on the **chocolatey.chocolatey.win\_chocolatey** module.
[community.windows.win\_hotfix](../../community/windows/win_hotfix_module#ansible-collections-community-windows-win-hotfix-module)
The official documentation on the **community.windows.win\_hotfix** module.
[ansible.windows.win\_updates](win_updates_module#ansible-collections-ansible-windows-win-updates-module)
The official documentation on the **ansible.windows.win\_updates** module.
[community.windows.win\_inet\_proxy](../../community/windows/win_inet_proxy_module#ansible-collections-community-windows-win-inet-proxy-module)
The official documentation on the **community.windows.win\_inet\_proxy** module.
Examples
--------
```
- name: Install the Visual C thingy
ansible.windows.win_package:
path: http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe
product_id: '{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}'
arguments: /install /passive /norestart
- name: Install Visual C thingy with list of arguments instead of a string
ansible.windows.win_package:
path: http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe
product_id: '{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}'
arguments:
- /install
- /passive
- /norestart
- name: Install MSBuild thingy with arguments split to prevent quotes
ansible.windows.win_package:
path: https://download.visualstudio.microsoft.com/download/pr/9665567e-f580-4acd-85f2-bc94a1db745f/vs_BuildTools.exe
product_id: '{D1437F51-786A-4F57-A99C-F8E94FBA1BD8}'
arguments:
- --norestart
- --passive
- --wait
- --add
- Microsoft.Net.Component.4.6.1.TargetingPack
- --add
- Microsoft.Net.Component.4.6.TargetingPack
- name: Install Remote Desktop Connection Manager from msi with a permanent log
ansible.windows.win_package:
path: https://download.microsoft.com/download/A/F/0/AF0071F3-B198-4A35-AA90-C68D103BDCCF/rdcman.msi
product_id: '{0240359E-6A4C-4884-9E94-B397A02D893C}'
state: present
log_path: D:\logs\vcredist_x64-exe-{{lookup('pipe', 'date +%Y%m%dT%H%M%S')}}.log
- name: Uninstall Remote Desktop Connection Manager
ansible.windows.win_package:
product_id: '{0240359E-6A4C-4884-9E94-B397A02D893C}'
state: absent
- name: Install Remote Desktop Connection Manager locally omitting the product_id
ansible.windows.win_package:
path: C:\temp\rdcman.msi
state: present
- name: Uninstall Remote Desktop Connection Manager from local MSI omitting the product_id
ansible.windows.win_package:
path: C:\temp\rdcman.msi
state: absent
# 7-Zip exe doesn't use a guid for the Product ID
- name: Install 7zip from a network share with specific credentials
ansible.windows.win_package:
path: \\domain\programs\7z.exe
product_id: 7-Zip
arguments: /S
state: present
become: yes
become_method: runas
become_flags: logon_type=new_credential logon_flags=netcredentials_only
vars:
ansible_become_user: DOMAIN\User
ansible_become_password: Password
- name: Install 7zip and use a file version for the installation check
ansible.windows.win_package:
path: C:\temp\7z.exe
creates_path: C:\Program Files\7-Zip\7z.exe
creates_version: 16.04
state: present
- name: Uninstall 7zip from the exe
ansible.windows.win_package:
path: C:\Program Files\7-Zip\Uninstall.exe
product_id: 7-Zip
arguments: /S
state: absent
- name: Uninstall 7zip without specifying the path
ansible.windows.win_package:
product_id: 7-Zip
arguments: /S
state: absent
- name: Install application and override expected return codes
ansible.windows.win_package:
path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe
product_id: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}'
arguments: '/q /norestart'
state: present
expected_return_code: [0, 666, 3010]
- name: Install a .msp patch
ansible.windows.win_package:
path: C:\Patches\Product.msp
state: present
- name: Remove a .msp patch
ansible.windows.win_package:
product_id: '{AC76BA86-A440-FFFF-A440-0C13154E5D00}'
state: absent
- name: Enable installation of 3rd party MSIX packages
ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock
name: AllowAllTrustedApps
data: 1
type: dword
state: present
- name: Install an MSIX package for the current user
ansible.windows.win_package:
path: C:\Installers\Calculator.msix # Can be .appx, .msixbundle, or .appxbundle
state: present
- name: Uninstall an MSIX package using the product_id
ansible.windows.win_package:
product_id: InputApp
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **log** string | installation/uninstallation failure for MSI or MSP packages | The contents of the MSI or MSP log. **Sample:** Installation completed successfully |
| **rc** integer | change occurred | The return code of the package process. |
| **reboot\_required** boolean | always | Whether a reboot is required to finalise package. This is set to true if the executable return code is 3010. **Sample:** True |
| **stderr** string | failure during install or uninstall | The stderr stream of the package process. **Sample:** Failed to install program |
| **stdout** string | failure during install or uninstall | The stdout stream of the package process. **Sample:** Installing program |
### Authors
* Trond Hindenes (@trondhindenes)
* Jordan Borean (@jborean93)
| programming_docs |
ansible ansible.windows.win_feature – Installs and uninstalls Windows Features on Windows Server ansible.windows.win\_feature – Installs and uninstalls Windows Features on Windows Server
=========================================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_feature`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Installs or uninstalls Windows Roles or Features on Windows Server.
* This module uses the Add/Remove-WindowsFeature Cmdlets on Windows 2008 R2 and Install/Uninstall-WindowsFeature Cmdlets on Windows 2012, which are not available on client os machines.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **include\_management\_tools** boolean | **Choices:*** **no** ←
* yes
| Adds the corresponding management tools to the specified feature. Not supported in Windows 2008 R2 and will be ignored. |
| **include\_sub\_features** boolean | **Choices:*** **no** ←
* yes
| Adds all subfeatures of the specified feature. |
| **name** list / elements=string / required | | Names of roles or features to install as a single feature or a comma-separated list of features. To list all available features use the PowerShell command `Get-WindowsFeature`. |
| **source** string | | Specify a source to install the feature from. Not supported in Windows 2008 R2 and will be ignored. Can either be `{driveletter}:\sources\sxs` or `\\{IP}\share\sources\sxs`. |
| **state** string | **Choices:*** absent
* **present** ←
| State of the features or roles on the system. |
See Also
--------
See also
[chocolatey.chocolatey.win\_chocolatey](../../chocolatey/chocolatey/win_chocolatey_module#ansible-collections-chocolatey-chocolatey-win-chocolatey-module)
The official documentation on the **chocolatey.chocolatey.win\_chocolatey** module.
[ansible.windows.win\_package](win_package_module#ansible-collections-ansible-windows-win-package-module)
The official documentation on the **ansible.windows.win\_package** module.
Examples
--------
```
- name: Install IIS (Web-Server only)
ansible.windows.win_feature:
name: Web-Server
state: present
- name: Install IIS (Web-Server and Web-Common-Http)
ansible.windows.win_feature:
name:
- Web-Server
- Web-Common-Http
state: present
- name: Install NET-Framework-Core from file
ansible.windows.win_feature:
name: NET-Framework-Core
source: C:\Temp\iso\sources\sxs
state: present
- name: Install IIS Web-Server with sub features and management tools
ansible.windows.win_feature:
name: Web-Server
state: present
include_sub_features: yes
include_management_tools: yes
register: win_feature
- name: Reboot if installing Web-Server feature requires it
ansible.windows.win_reboot:
when: win_feature.reboot_required
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **exitcode** string | always | The stringified exit code from the feature installation/removal command. **Sample:** Success |
| **feature\_result** complex | success | List of features that were installed or removed. |
| | **display\_name** string | always | Feature display name. **Sample:** Telnet Client |
| | **id** integer | always | A list of KB article IDs that apply to the update. **Sample:** 44 |
| | **message** list / elements=string | always | Any messages returned from the feature subsystem that occurred during installation or removal of this feature. |
| | **reboot\_required** boolean | always | True when the target server requires a reboot as a result of installing or removing this feature. **Sample:** True |
| | **restart\_needed** boolean | always | DEPRECATED in Ansible 2.4 (refer to `reboot_required` instead). True when the target server requires a reboot as a result of installing or removing this feature. **Sample:** True |
| | **skip\_reason** string | always | The reason a feature installation or removal was skipped. **Sample:** NotSkipped |
| | **success** boolean | always | If the feature installation or removal was successful. **Sample:** True |
| **reboot\_required** boolean | success | True when the target server requires a reboot to complete updates (no further updates can be installed until after a reboot). **Sample:** True |
### Authors
* Paul Durivage (@angstwad)
* Trond Hindenes (@trondhindenes)
ansible ansible.windows.win_copy – Copies files to remote locations on windows hosts ansible.windows.win\_copy – Copies files to remote locations on windows hosts
=============================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_copy`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The `win_copy` module copies a file on the local box to remote windows locations.
* For non-Windows targets, use the [ansible.builtin.copy](../builtin/copy_module#ansible-collections-ansible-builtin-copy-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Determine whether a backup should be created. When set to `yes`, create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. No backup is taken when `remote_src=False` and multiple files are being copied. |
| **content** string | | When used instead of `src`, sets the contents of a file directly to the specified value. This is for simple values, for anything complex or with formatting please switch to the [ansible.windows.win\_template](win_template_module) module. |
| **decrypt** boolean | **Choices:*** no
* **yes** ←
| This option controls the autodecryption of source files using vault. |
| **dest** path / required | | Remote absolute path where the file should be copied to. If `src` is a directory, this must be a directory too. Use \ for path separators or \\ when in "double quotes". If `dest` ends with \ then source or the contents of source will be copied to the directory without renaming. If `dest` is a nonexistent path, it will only be created if `dest` ends with "/" or "\", or `src` is a directory. If `src` and `dest` are files and if the parent directory of `dest` doesn't exist, then the task will fail. |
| **force** boolean | **Choices:*** no
* **yes** ←
| If set to `yes`, the file will only be transferred if the content is different than destination. If set to `no`, the file will only be transferred if the destination does not exist. If set to `no`, no checksuming of the content is performed which can help improve performance on larger files. |
| **local\_follow** boolean | **Choices:*** no
* **yes** ←
| This flag indicates that filesystem links in the source tree, if they exist, should be followed. |
| **remote\_src** boolean | **Choices:*** **no** ←
* yes
| If `no`, it will search for src at originating/controller machine. If `yes`, it will go to the remote/target machine for the src. |
| **src** path | | Local path to a file to copy to the remote server; can be absolute or relative. If path is a directory, it is copied (including the source folder name) recursively to `dest`. If path is a directory and ends with "/", only the inside contents of that directory are copied to the destination. Otherwise, if it does not end with "/", the directory itself with all contents is copied. If path is a file and dest ends with "\", the file is copied to the folder with the same filename. Required unless using `content`. |
Notes
-----
Note
* Currently win\_copy does not support copying symbolic links from both local to remote and remote to remote.
* It is recommended that backslashes `\` are used instead of `/` when dealing with remote paths.
* Because win\_copy runs over WinRM, it is not a very efficient transfer mechanism. If sending large files consider hosting them on a web service and using [ansible.windows.win\_get\_url](win_get_url_module#ansible-collections-ansible-windows-win-get-url-module) instead.
See Also
--------
See also
community.general.assemble
The official documentation on the **community.general.assemble** module.
[ansible.builtin.copy](../builtin/copy_module#ansible-collections-ansible-builtin-copy-module)
The official documentation on the **ansible.builtin.copy** module.
[ansible.windows.win\_get\_url](win_get_url_module#ansible-collections-ansible-windows-win-get-url-module)
The official documentation on the **ansible.windows.win\_get\_url** module.
[community.windows.win\_robocopy](../../community/windows/win_robocopy_module#ansible-collections-community-windows-win-robocopy-module)
The official documentation on the **community.windows.win\_robocopy** module.
Examples
--------
```
- name: Copy a single file
ansible.windows.win_copy:
src: /srv/myfiles/foo.conf
dest: C:\Temp\renamed-foo.conf
- name: Copy a single file, but keep a backup
ansible.windows.win_copy:
src: /srv/myfiles/foo.conf
dest: C:\Temp\renamed-foo.conf
backup: yes
- name: Copy a single file keeping the filename
ansible.windows.win_copy:
src: /src/myfiles/foo.conf
dest: C:\Temp\
- name: Copy folder to C:\Temp (results in C:\Temp\temp_files)
ansible.windows.win_copy:
src: files/temp_files
dest: C:\Temp
- name: Copy folder contents recursively
ansible.windows.win_copy:
src: files/temp_files/
dest: C:\Temp
- name: Copy a single file where the source is on the remote host
ansible.windows.win_copy:
src: C:\Temp\foo.txt
dest: C:\ansible\foo.txt
remote_src: yes
- name: Copy a folder recursively where the source is on the remote host
ansible.windows.win_copy:
src: C:\Temp
dest: C:\ansible
remote_src: yes
- name: Set the contents of a file
ansible.windows.win_copy:
content: abc123
dest: C:\Temp\foo.txt
- name: Copy a single file as another user
ansible.windows.win_copy:
src: NuGet.config
dest: '%AppData%\NuGet\NuGet.config'
vars:
ansible_become_user: user
ansible_become_password: pass
# The tmp dir must be set when using win_copy as another user
# This ensures the become user will have permissions for the operation
# Make sure to specify a folder both the ansible_user and the become_user have access to (i.e not %TEMP% which is user specific and requires Admin)
ansible_remote_tmp: 'c:\tmp'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **backup\_file** string | if backup=yes | Name of the backup file that was created. **Sample:** C:\Path\To\File.txt.11540.20150212-220915.bak |
| **checksum** string | success, src is a file | SHA1 checksum of the file after running copy. **Sample:** 6e642bb8dd5c2e027bf21dd923337cbb4214f827 |
| **dest** string | changed | Destination file/path. **Sample:** C:\Temp\ |
| **operation** string | success | Whether a single file copy took place or a folder copy. **Sample:** file\_copy |
| **original\_basename** string | changed, src is a file | Basename of the copied file. **Sample:** foo.txt |
| **size** integer | changed, src is a file | Size of the target, after execution. **Sample:** 1220 |
| **src** string | changed | Source file used for the copy on the target machine. **Sample:** /home/httpd/.ansible/tmp/ansible-tmp-1423796390.97-147729857856000/source |
### Authors
* Jon Hawkesworth (@jhawkesworth)
* Jordan Borean (@jborean93)
ansible ansible.windows.win_file – Creates, touches or removes files or directories ansible.windows.win\_file – Creates, touches or removes files or directories
============================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_file`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Creates (empty) files, updates file modification stamps of existing files, and can create or remove directories.
* Unlike [ansible.builtin.file](../builtin/file_module#ansible-collections-ansible-builtin-file-module), does not modify ownership, permissions or manipulate links.
* For non-Windows targets, use the [ansible.builtin.file](../builtin/file_module#ansible-collections-ansible-builtin-file-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **path** path / required | | Path to the file being managed.
aliases: dest, name |
| **state** string | **Choices:*** absent
* directory
* file
* touch
| If `directory`, all immediate subdirectories will be created if they do not exist. If `file`, the file will NOT be created if it does not exist, see the [ansible.windows.win\_copy](win_copy_module) or [ansible.windows.win\_template](win_template_module) module if you want that behavior. If `absent`, directories will be recursively deleted, and files will be removed. If `touch`, an empty file will be created if the `path` does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way `touch` works from the command line). |
See Also
--------
See also
[ansible.builtin.file](../builtin/file_module#ansible-collections-ansible-builtin-file-module)
The official documentation on the **ansible.builtin.file** module.
[ansible.windows.win\_acl](win_acl_module#ansible-collections-ansible-windows-win-acl-module)
The official documentation on the **ansible.windows.win\_acl** module.
[ansible.windows.win\_acl\_inheritance](win_acl_inheritance_module#ansible-collections-ansible-windows-win-acl-inheritance-module)
The official documentation on the **ansible.windows.win\_acl\_inheritance** module.
[ansible.windows.win\_owner](win_owner_module#ansible-collections-ansible-windows-win-owner-module)
The official documentation on the **ansible.windows.win\_owner** module.
[ansible.windows.win\_stat](win_stat_module#ansible-collections-ansible-windows-win-stat-module)
The official documentation on the **ansible.windows.win\_stat** module.
Examples
--------
```
- name: Touch a file (creates if not present, updates modification time if present)
ansible.windows.win_file:
path: C:\Temp\foo.conf
state: touch
- name: Remove a file, if present
ansible.windows.win_file:
path: C:\Temp\foo.conf
state: absent
- name: Create directory structure
ansible.windows.win_file:
path: C:\Temp\folder\subfolder
state: directory
- name: Remove directory structure
ansible.windows.win_file:
path: C:\Temp
state: absent
```
### Authors
* Jon Hawkesworth (@jhawkesworth)
ansible ansible.windows.win_domain_membership – Manage domain/workgroup membership for a Windows host ansible.windows.win\_domain\_membership – Manage domain/workgroup membership for a Windows host
===============================================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_domain_membership`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages domain membership or workgroup membership for a Windows host. Also supports hostname changes.
* This module may require subsequent use of the [ansible.windows.win\_reboot](win_reboot_module#ansible-collections-ansible-windows-win-reboot-module) action if changes are made.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dns\_domain\_name** string | | When `state` is `domain`, the DNS name of the domain to which the targeted Windows host should be joined. |
| **domain\_admin\_password** string | | Password for the specified `domain_admin_user`. |
| **domain\_admin\_user** string / required | | Username of a domain admin for the target domain (required to join or leave the domain). |
| **domain\_ou\_path** string | | The desired OU path for adding the computer object. This is only used when adding the target host to a domain, if it is already a member then it is ignored. |
| **hostname** string | | The desired hostname for the Windows host. |
| **state** string | **Choices:*** domain
* workgroup
| Whether the target host should be a member of a domain or workgroup. |
| **workgroup\_name** string | | When `state` is `workgroup`, the name of the workgroup that the Windows host should be in. |
See Also
--------
See also
[ansible.windows.win\_domain](win_domain_module#ansible-collections-ansible-windows-win-domain-module)
The official documentation on the **ansible.windows.win\_domain** module.
[ansible.windows.win\_domain\_controller](win_domain_controller_module#ansible-collections-ansible-windows-win-domain-controller-module)
The official documentation on the **ansible.windows.win\_domain\_controller** module.
[community.windows.win\_domain\_computer](../../community/windows/win_domain_computer_module#ansible-collections-community-windows-win-domain-computer-module)
The official documentation on the **community.windows.win\_domain\_computer** module.
[community.windows.win\_domain\_group](../../community/windows/win_domain_group_module#ansible-collections-community-windows-win-domain-group-module)
The official documentation on the **community.windows.win\_domain\_group** module.
[community.windows.win\_domain\_user](../../community/windows/win_domain_user_module#ansible-collections-community-windows-win-domain-user-module)
The official documentation on the **community.windows.win\_domain\_user** module.
[ansible.windows.win\_group](win_group_module#ansible-collections-ansible-windows-win-group-module)
The official documentation on the **ansible.windows.win\_group** module.
[ansible.windows.win\_group\_membership](win_group_membership_module#ansible-collections-ansible-windows-win-group-membership-module)
The official documentation on the **ansible.windows.win\_group\_membership** module.
[ansible.windows.win\_user](win_user_module#ansible-collections-ansible-windows-win-user-module)
The official documentation on the **ansible.windows.win\_user** module.
Examples
--------
```
# host should be a member of domain ansible.vagrant; module will ensure the hostname is mydomainclient
# and will use the passed credentials to join domain if necessary.
# Ansible connection should use local credentials if possible.
# If a reboot is required, the second task will trigger one and wait until the host is available.
- hosts: winclient
gather_facts: no
tasks:
- ansible.windows.win_domain_membership:
dns_domain_name: ansible.vagrant
hostname: mydomainclient
domain_admin_user: [email protected]
domain_admin_password: password123!
domain_ou_path: "OU=Windows,OU=Servers,DC=ansible,DC=vagrant"
state: domain
register: domain_state
- ansible.windows.win_reboot:
when: domain_state.reboot_required
# Host should be in workgroup mywg- module will use the passed credentials to clean-unjoin domain if possible.
# Ansible connection should use local credentials if possible.
# The domain admin credentials can be sourced from a vault-encrypted variable
- hosts: winclient
gather_facts: no
tasks:
- ansible.windows.win_domain_membership:
workgroup_name: mywg
domain_admin_user: '{{ win_domain_admin_user }}'
domain_admin_password: '{{ win_domain_admin_password }}'
state: workgroup
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **reboot\_required** boolean | always | True if changes were made that require a reboot. **Sample:** True |
### Authors
* Matt Davis (@nitzmahone)
| programming_docs |
ansible ansible.windows.win_wait_for – Waits for a condition before continuing ansible.windows.win\_wait\_for – Waits for a condition before continuing
========================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_wait_for`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* You can wait for a set amount of time `timeout`, this is the default if nothing is specified.
* Waiting for a port to become available is useful for when services are not immediately available after their init scripts return which is true of certain Java application servers.
* You can wait for a file to exist or not exist on the filesystem.
* This module can also be used to wait for a regex match string to be present in a file.
* You can wait for active connections to be closed before continuing on a local port.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **connect\_timeout** integer | **Default:**5 | The maximum number of seconds to wait for a connection to happen before closing and retrying. |
| **delay** integer | | The number of seconds to wait before starting to poll. |
| **exclude\_hosts** list / elements=string | | The list of hosts or IPs to ignore when looking for active TCP connections when `state=drained`. |
| **host** string | **Default:**"127.0.0.1" | A resolvable hostname or IP address to wait for. If `state=drained` then it will only check for connections on the IP specified, you can use '0.0.0.0' to use all host IPs. |
| **path** path | | The path to a file on the filesystem to check. If `state` is present or started then it will wait until the file exists. If `state` is absent then it will wait until the file does not exist. |
| **port** integer | | The port number to poll on `host`. |
| **regex** string | | Can be used to match a string in a file. If `state` is present or started then it will wait until the regex matches. If `state` is absent then it will wait until the regex does not match. Defaults to a multiline regex.
aliases: search\_regex, regexp |
| **sleep** integer | **Default:**1 | Number of seconds to sleep between checks. |
| **state** string | **Choices:*** absent
* drained
* present
* **started** ←
* stopped
| When checking a port, `started` will ensure the port is open, `stopped` will check that is it closed and `drained` will check for active connections. When checking for a file or a search string `present` or `started` will ensure that the file or string is present, `absent` will check that the file or search string is absent or removed. |
| **timeout** integer | **Default:**300 | The maximum number of seconds to wait for. |
See Also
--------
See also
[ansible.builtin.wait\_for](../builtin/wait_for_module#ansible-collections-ansible-builtin-wait-for-module)
The official documentation on the **ansible.builtin.wait\_for** module.
[community.windows.win\_wait\_for\_process](../../community/windows/win_wait_for_process_module#ansible-collections-community-windows-win-wait-for-process-module)
The official documentation on the **community.windows.win\_wait\_for\_process** module.
Examples
--------
```
- name: Wait 300 seconds for port 8000 to become open on the host, don't start checking for 10 seconds
ansible.windows.win_wait_for:
port: 8000
delay: 10
- name: Wait 150 seconds for port 8000 of any IP to close active connections
ansible.windows.win_wait_for:
host: 0.0.0.0
port: 8000
state: drained
timeout: 150
- name: Wait for port 8000 of any IP to close active connection, ignoring certain hosts
ansible.windows.win_wait_for:
host: 0.0.0.0
port: 8000
state: drained
exclude_hosts: ['10.2.1.2', '10.2.1.3']
- name: Wait for file C:\temp\log.txt to exist before continuing
ansible.windows.win_wait_for:
path: C:\temp\log.txt
- name: Wait until process complete is in the file before continuing
ansible.windows.win_wait_for:
path: C:\temp\log.txt
regex: process complete
- name: Wait until file is removed
ansible.windows.win_wait_for:
path: C:\temp\log.txt
state: absent
- name: Wait until port 1234 is offline but try every 10 seconds
ansible.windows.win_wait_for:
port: 1234
state: absent
sleep: 10
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **elapsed** float | always | The elapsed seconds between the start of poll and the end of the module. This includes the delay if the option is set. **Sample:** 2.1406487 |
| **wait\_attempts** integer | always | The number of attempts to poll the file or port before module finishes. **Sample:** 1 |
### Authors
* Jordan Borean (@jborean93)
ansible ansible.windows.win_reg_stat – Get information about Windows registry keys ansible.windows.win\_reg\_stat – Get information about Windows registry keys
============================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_reg_stat`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Like [ansible.windows.win\_file](win_file_module#ansible-collections-ansible-windows-win-file-module), [ansible.windows.win\_reg\_stat](#ansible-collections-ansible-windows-win-reg-stat-module) will return whether the key/property exists.
* It also returns the sub keys and properties of the key specified.
* If specifying a property name through *property*, it will return the information specific for that property.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | | The registry property name to get information for, the return json will not include the sub\_keys and properties entries for the *key* specified. Set to an empty string to target the registry key's `(Default`) property value.
aliases: entry, value, property |
| **path** string / required | | The full registry key path including the hive to search for.
aliases: key |
Notes
-----
Note
* The `properties` return value will contain an empty string key `""` that refers to the key’s `Default` value. If the value has not been set then this key is not returned.
See Also
--------
See also
[ansible.windows.win\_regedit](win_regedit_module#ansible-collections-ansible-windows-win-regedit-module)
The official documentation on the **ansible.windows.win\_regedit** module.
ansible.windows.win\_regmerge
The official documentation on the **ansible.windows.win\_regmerge** module.
Examples
--------
```
- name: Obtain information about a registry key using short form
ansible.windows.win_reg_stat:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion
register: current_version
- name: Obtain information about a registry key property
ansible.windows.win_reg_stat:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion
name: CommonFilesDir
register: common_files_dir
- name: Obtain the registry key's (Default) property
ansible.windows.win_reg_stat:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion
name: ''
register: current_version_default
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | Whether anything was changed. **Sample:** True |
| **exists** boolean | success and path/property exists | States whether the registry key/property exists. **Sample:** True |
| **properties** dictionary | success, path exists and property not specified | A dictionary containing all the properties and their values in the registry key. **Sample:** {'': {'raw\_value': '', 'type': 'REG\_SZ', 'value': ''}, 'binary\_property': {'raw\_value': ['0x01', '0x16'], 'type': 'REG\_BINARY', 'value': [1, 22]}, 'multi\_string\_property': {'raw\_value': ['a', 'b'], 'type': 'REG\_MULTI\_SZ', 'value': ['a', 'b']}} |
| **raw\_value** string | success, path/property exists and property specified | Returns the raw value of the registry property, REG\_EXPAND\_SZ has no string expansion, REG\_BINARY or REG\_NONE is in hex 0x format. REG\_NONE, this value is a hex string in the 0x format. **Sample:** %ProgramDir%\\Common Files |
| **sub\_keys** list / elements=string | success, path exists and property not specified | A list of all the sub keys of the key specified. **Sample:** ['AppHost', 'Casting', 'DateTime'] |
| **type** string | success, path/property exists and property specified | The property type. **Sample:** REG\_EXPAND\_SZ |
| **value** string | success, path/property exists and property specified | The value of the property. **Sample:** C:\\Program Files\\Common Files |
### Authors
* Jordan Borean (@jborean93)
ansible ansible.windows.win_certificate_store – Manages the certificate store ansible.windows.win\_certificate\_store – Manages the certificate store
=======================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_certificate_store`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Used to import/export and remove certificates and keys from the local certificate store.
* This module is not used to create certificates and will only manage existing certs as a file or in the store.
* It can be used to import PEM, DER, P7B, PKCS12 (PFX) certificates and export PEM, DER and PKCS12 certificates.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **file\_type** string | **Choices:*** **der** ←
* pem
* pkcs12
| The file type to export the certificate as when `state=exported`.
`der` is a binary ASN.1 encoded file.
`pem` is a base64 encoded file of a der file in the OpenSSL form.
`pkcs12` (also known as pfx) is a binary container that contains both the certificate and private key unlike the other options. When `pkcs12` is set and the private key is not exportable or accessible by the current user, it will throw an exception. |
| **key\_exportable** boolean | **Choices:*** no
* **yes** ←
| Whether to allow the private key to be exported. If `no`, then this module and other process will only be able to export the certificate and the private key cannot be exported. Used when `state=present` only. |
| **key\_storage** string | **Choices:*** **default** ←
* machine
* user
| Specifies where Windows will store the private key when it is imported. When set to `default`, the default option as set by Windows is used, typically `user`. When set to `machine`, the key is stored in a path accessible by various users. When set to `user`, the key is stored in a path only accessible by the current user. Used when `state=present` only and cannot be changed once imported. See <https://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509keystorageflags.aspx> for more details. |
| **password** string | | The password of the pkcs12 certificate key. This is used when reading a pkcs12 certificate file or the password to set when `state=exported` and `file_type=pkcs12`. If the pkcs12 file has no password set or no password should be set on the exported file, do not set this option. |
| **path** path | | The path to a certificate file. This is required when *state* is `present` or `exported`. When *state* is `absent` and *thumbprint* is not specified, the thumbprint is derived from the certificate at this path. |
| **state** string | **Choices:*** absent
* exported
* **present** ←
| If `present`, will ensure that the certificate at *path* is imported into the certificate store specified. If `absent`, will ensure that the certificate specified by *thumbprint* or the thumbprint of the cert at *path* is removed from the store specified. If `exported`, will ensure the file at *path* is a certificate specified by *thumbprint*. When exporting a certificate, if *path* is a directory then the module will fail, otherwise the file will be replaced if needed. |
| **store\_location** string | **Default:**"LocalMachine" | The store location to use when importing a certificate or searching for a certificate. Can be set to `CurrentUser` or `LocalMachine` when `store_type=system`. Defaults to `LocalMachine` when `store_type=system`. Must be set to any service name when `store_type=service`. |
| **store\_name** string | **Default:**"My" | The store name to use when importing a certificate or searching for a certificate.
`AddressBook`: The X.509 certificate store for other users
`AuthRoot`: The X.509 certificate store for third-party certificate authorities (CAs)
`CertificateAuthority`: The X.509 certificate store for intermediate certificate authorities (CAs)
`Disallowed`: The X.509 certificate store for revoked certificates
`My`: The X.509 certificate store for personal certificates
`Root`: The X.509 certificate store for trusted root certificate authorities (CAs)
`TrustedPeople`: The X.509 certificate store for directly trusted people and resources
`TrustedPublisher`: The X.509 certificate store for directly trusted publishers |
| **store\_type** string added in 1.5.0 of ansible.windows | **Choices:*** **system** ←
* service
| The store type to manage. Use `system` to manage locations in the system store, `LocalMachine` and `CurrentUser`. Use `service` to manage the store of a service account specified by *store\_location*. |
| **thumbprint** string | | The thumbprint as a hex string to either export or remove. See the examples for how to specify the thumbprint. |
Notes
-----
Note
* Some actions on PKCS12 certificates and keys may fail with the error `the specified network password is not correct`, either use CredSSP or Kerberos with credential delegation, or use `become` to bypass these restrictions.
* The certificates must be located on the Windows host to be set with *path*.
* When importing a certificate for usage in IIS, it is generally required to use the `machine` key\_storage option, as both `default` and `user` will make the private key unreadable to IIS APPPOOL identities and prevent binding the certificate to the https endpoint.
Examples
--------
```
- name: Import a certificate
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pem
state: present
- name: Import pfx certificate that is password protected
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pfx
state: present
password: VeryStrongPasswordHere!
become: yes
become_method: runas
- name: Import pfx certificate without password and set private key as un-exportable
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pfx
state: present
key_exportable: no
# usually you don't set this here but it is for illustrative purposes
vars:
ansible_winrm_transport: credssp
- name: Remove a certificate based on file thumbprint
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pem
state: absent
- name: Remove a certificate based on thumbprint
ansible.windows.win_certificate_store:
thumbprint: BD7AF104CF1872BDB518D95C9534EA941665FD27
state: absent
- name: Remove certificate based on thumbprint is CurrentUser/TrustedPublishers store
ansible.windows.win_certificate_store:
thumbprint: BD7AF104CF1872BDB518D95C9534EA941665FD27
state: absent
store_location: CurrentUser
store_name: TrustedPublisher
- name: Export certificate as der encoded file
ansible.windows.win_certificate_store:
path: C:\Temp\cert.cer
state: exported
file_type: der
- name: Export certificate and key as pfx encoded file
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pfx
state: exported
file_type: pkcs12
password: AnotherStrongPass!
become: yes
become_method: runas
become_user: SYSTEM
- name: Import certificate be used by IIS
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pfx
file_type: pkcs12
password: StrongPassword!
store_location: LocalMachine
key_storage: machine
state: present
become: yes
become_method: runas
become_user: SYSTEM
- name: Import certificate to be used for LDAPS
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pfx
password: StrongPassword!
store_type: service
store_location: NTDS
key_exportable: no
key_storage: machine
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **thumbprints** list / elements=string | success | A list of certificate thumbprints that were touched by the module. **Sample:** ['BC05633694E675449136679A658281F17A191087'] |
### Authors
* Jordan Borean (@jborean93)
ansible ansible.windows.win_command – Executes a command on a remote Windows node ansible.windows.win\_command – Executes a command on a remote Windows node
==========================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_command`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The `win_command` module takes the command name followed by a list of space-delimited arguments.
* The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like `$env:HOME` and operations like `"<"`, `">"`, `"|"`, and `";"` will not work (use the [ansible.windows.win\_shell](win_shell_module#ansible-collections-ansible-windows-win-shell-module) module if you need these features).
* For non-Windows targets, use the [ansible.builtin.command](../builtin/command_module#ansible-collections-ansible-builtin-command-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **chdir** path | | Set the specified path as the current working directory before executing a command. |
| **creates** path | | A path or path filter pattern; when the referenced path exists on the target host, the task will be skipped. |
| **free\_form** string / required | | The `win_command` module takes a free form command to run. There is no parameter actually named 'free form'. See the examples! |
| **output\_encoding\_override** string | | This option overrides the encoding of stdout/stderr output. You can use this option when you need to run a command which ignore the console's codepage. You should only need to use this option in very rare circumstances. This value can be any valid encoding `Name` based on the output of `[System.Text.Encoding]::GetEncodings(`). See <https://docs.microsoft.com/dotnet/api/system.text.encoding.getencodings>. |
| **removes** path | | A path or path filter pattern; when the referenced path **does not** exist on the target host, the task will be skipped. |
| **stdin** string | | Set the stdin of the command directly to the specified value. |
Notes
-----
Note
* If you want to run a command through a shell (say you are using `<`, `>`, `|`, etc), you actually want the [ansible.windows.win\_shell](win_shell_module#ansible-collections-ansible-windows-win-shell-module) module instead. The [ansible.windows.win\_command](#ansible-collections-ansible-windows-win-command-module) module is much more secure as it’s not affected by the user’s environment.
* `creates`, `removes`, and `chdir` can be specified after the command. For instance, if you only want to run a command if a certain file does not exist, use this.
See Also
--------
See also
[ansible.builtin.command](../builtin/command_module#ansible-collections-ansible-builtin-command-module)
The official documentation on the **ansible.builtin.command** module.
[community.windows.psexec](../../community/windows/psexec_module#ansible-collections-community-windows-psexec-module)
The official documentation on the **community.windows.psexec** module.
[ansible.builtin.raw](../builtin/raw_module#ansible-collections-ansible-builtin-raw-module)
The official documentation on the **ansible.builtin.raw** module.
[community.windows.win\_psexec](../../community/windows/win_psexec_module#ansible-collections-community-windows-win-psexec-module)
The official documentation on the **community.windows.win\_psexec** module.
[ansible.windows.win\_shell](win_shell_module#ansible-collections-ansible-windows-win-shell-module)
The official documentation on the **ansible.windows.win\_shell** module.
Examples
--------
```
- name: Save the result of 'whoami' in 'whoami_out'
ansible.windows.win_command: whoami
register: whoami_out
- name: Run command that only runs if folder exists and runs from a specific folder
ansible.windows.win_command: wbadmin -backupTarget:C:\backup\
args:
chdir: C:\somedir\
creates: C:\backup\
- name: Run an executable and send data to the stdin for the executable
ansible.windows.win_command: powershell.exe -
args:
stdin: Write-Host test
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cmd** string | always | The command executed by the task **Sample:** rabbitmqctl join\_cluster rabbit@main |
| **delta** string | always | The command execution delta time **Sample:** 0:00:00.325771 |
| **end** string | always | The command execution end time **Sample:** 2016-02-25 09:18:26.755339 |
| **msg** boolean | always | changed **Sample:** True |
| **rc** integer | always | The command return code (0 means success) |
| **start** string | always | The command execution start time **Sample:** 2016-02-25 09:18:26.429568 |
| **stderr** string | always | The command standard error **Sample:** ls: cannot access foo: No such file or directory |
| **stdout** string | always | The command standard output **Sample:** Clustering node rabbit@slave1 with rabbit@main ... |
| **stdout\_lines** list / elements=string | always | The command standard output split in lines **Sample:** ["u'Clustering node rabbit@slave1 with rabbit@main ...'"] |
### Authors
* Matt Davis (@nitzmahone)
| programming_docs |
ansible ansible.windows.win_stat – Get information about Windows files ansible.windows.win\_stat – Get information about Windows files
===============================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_stat`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Returns information about a Windows file.
* For non-Windows targets, use the [ansible.builtin.stat](../builtin/stat_module#ansible-collections-ansible-builtin-stat-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **checksum\_algorithm** string | **Choices:*** md5
* **sha1** ←
* sha256
* sha384
* sha512
| Algorithm to determine checksum of file. Will throw an error if the host is unable to use specified algorithm. |
| **follow** boolean | **Choices:*** **no** ←
* yes
| Whether to follow symlinks or junction points. In the case of `path` pointing to another link, then that will be followed until no more links are found. |
| **get\_checksum** boolean | **Choices:*** no
* **yes** ←
| Whether to return a checksum of the file (default sha1) |
| **path** path / required | | The full path of the file/object to get the facts of; both forward and back slashes are accepted.
aliases: dest, name |
See Also
--------
See also
[ansible.builtin.stat](../builtin/stat_module#ansible-collections-ansible-builtin-stat-module)
The official documentation on the **ansible.builtin.stat** module.
[ansible.windows.win\_acl](win_acl_module#ansible-collections-ansible-windows-win-acl-module)
The official documentation on the **ansible.windows.win\_acl** module.
[ansible.windows.win\_file](win_file_module#ansible-collections-ansible-windows-win-file-module)
The official documentation on the **ansible.windows.win\_file** module.
[ansible.windows.win\_owner](win_owner_module#ansible-collections-ansible-windows-win-owner-module)
The official documentation on the **ansible.windows.win\_owner** module.
Examples
--------
```
- name: Obtain information about a file
ansible.windows.win_stat:
path: C:\foo.ini
register: file_info
- name: Obtain information about a folder
ansible.windows.win_stat:
path: C:\bar
register: folder_info
- name: Get MD5 checksum of a file
ansible.windows.win_stat:
path: C:\foo.ini
get_checksum: yes
checksum_algorithm: md5
register: md5_checksum
- debug:
var: md5_checksum.stat.checksum
- name: Get SHA1 checksum of file
ansible.windows.win_stat:
path: C:\foo.ini
get_checksum: yes
register: sha1_checksum
- debug:
var: sha1_checksum.stat.checksum
- name: Get SHA256 checksum of file
ansible.windows.win_stat:
path: C:\foo.ini
get_checksum: yes
checksum_algorithm: sha256
register: sha256_checksum
- debug:
var: sha256_checksum.stat.checksum
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | Whether anything was changed **Sample:** True |
| **stat** complex | success | dictionary containing all the stat data |
| | **attributes** string | success, path exists | Attributes of the file at path in raw form. **Sample:** Archive, Hidden |
| | **checksum** string | success, path exist, path is a file, get\_checksum == True checksum\_algorithm specified is supported | The checksum of a file based on checksum\_algorithm specified. **Sample:** 09cb79e8fc7453c84a07f644e441fd81623b7f98 |
| | **creationtime** float | success, path exists | The create time of the file represented in seconds since epoch. **Sample:** 1477984205.15 |
| | **exists** boolean | success | If the path exists or not. **Sample:** True |
| | **extension** string | success, path exists, path is a file | The extension of the file at path. **Sample:** .ps1 |
| | **filename** string | success, path exists, path is a file | The name of the file (without path). **Sample:** foo.ini |
| | **hlnk\_targets** list / elements=string | success, path exists | List of other files pointing to the same file (hard links), excludes the current file. **Sample:** ['C:\\temp\\file.txt', 'C:\\Windows\\update.log'] |
| | **isarchive** boolean | success, path exists | If the path is ready for archiving or not. **Sample:** True |
| | **isdir** boolean | success, path exists | If the path is a directory or not. **Sample:** True |
| | **ishidden** boolean | success, path exists | If the path is hidden or not. **Sample:** True |
| | **isjunction** boolean | success, path exists | If the path is a junction point or not. **Sample:** True |
| | **islnk** boolean | success, path exists | If the path is a symbolic link or not. **Sample:** True |
| | **isreadonly** boolean | success, path exists | If the path is read only or not. **Sample:** True |
| | **isreg** boolean | success, path exists | If the path is a regular file. **Sample:** True |
| | **isshared** boolean | success, path exists | If the path is shared or not. **Sample:** True |
| | **lastaccesstime** float | success, path exists | The last access time of the file represented in seconds since epoch. **Sample:** 1477984205.15 |
| | **lastwritetime** float | success, path exists | The last modification time of the file represented in seconds since epoch. **Sample:** 1477984205.15 |
| | **lnk\_source** string | success, path exists and the path is a symbolic link or junction point | Target of the symlink normalized for the remote filesystem. **Sample:** C:\temp\link |
| | **lnk\_target** string | success, path exists and the path is a symbolic link or junction point | Target of the symlink. Note that relative paths remain relative. **Sample:** ..\link |
| | **nlink** integer | success, path exists | Number of links to the file (hard links). **Sample:** 1 |
| | **owner** string | success, path exists | The owner of the file. **Sample:** BUILTIN\Administrators |
| | **path** string | success, path exists, file exists | The full absolute path to the file. **Sample:** C:\foo.ini |
| | **sharename** string | success, path exists, file is a directory and isshared == True | The name of share if folder is shared. **Sample:** file-share |
| | **size** integer | success, path exists, file is not a link | The size in bytes of a file or folder. **Sample:** 1024 |
### Authors
* Chris Church (@cchurch)
ansible ansible.windows.win_shell – Execute shell commands on target hosts ansible.windows.win\_shell – Execute shell commands on target hosts
===================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_shell`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [ansible.windows.win\_shell](#ansible-collections-ansible-windows-win-shell-module) module takes the command name followed by a list of space-delimited arguments. It is similar to the [ansible.windows.win\_command](win_command_module#ansible-collections-ansible-windows-win-command-module) module, but runs the command via a shell (defaults to PowerShell) on the target host.
* For non-Windows targets, use the [ansible.builtin.shell](../builtin/shell_module#ansible-collections-ansible-builtin-shell-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **chdir** path | | Set the specified path as the current working directory before executing a command |
| **creates** path | | A path or path filter pattern; when the referenced path exists on the target host, the task will be skipped. |
| **executable** path | | Change the shell used to execute the command (eg, `cmd`). The target shell must accept a `/c` parameter followed by the raw command line to be executed. |
| **free\_form** string / required | | The [ansible.windows.win\_shell](win_shell_module) module takes a free form command to run. There is no parameter actually named 'free form'. See the examples! |
| **no\_profile** boolean | **Choices:*** **no** ←
* yes
| Do not load the user profile before running a command. This is only valid when using PowerShell as the executable. |
| **output\_encoding\_override** string | | This option overrides the encoding of stdout/stderr output. You can use this option when you need to run a command which ignore the console's codepage. You should only need to use this option in very rare circumstances. This value can be any valid encoding `Name` based on the output of `[System.Text.Encoding]::GetEncodings(`). See <https://docs.microsoft.com/dotnet/api/system.text.encoding.getencodings>. |
| **removes** path | | A path or path filter pattern; when the referenced path **does not** exist on the target host, the task will be skipped. |
| **stdin** string | | Set the stdin of the command directly to the specified value. |
Notes
-----
Note
* If you want to run an executable securely and predictably, it may be better to use the [ansible.windows.win\_command](win_command_module#ansible-collections-ansible-windows-win-command-module) module instead. Best practices when writing playbooks will follow the trend of using [ansible.windows.win\_command](win_command_module#ansible-collections-ansible-windows-win-command-module) unless `win_shell` is explicitly required. When running ad-hoc commands, use your best judgement.
* WinRM will not return from a command execution until all child processes created have exited. Thus, it is not possible to use [ansible.windows.win\_shell](#ansible-collections-ansible-windows-win-shell-module) to spawn long-running child or background processes. Consider creating a Windows service for managing background processes. - Consider using [ansible.windows.win\_powershell](win_powershell_module#ansible-collections-ansible-windows-win-powershell-module) if you want to capture the output from the PowerShell script as structured objects.
See Also
--------
See also
[community.windows.psexec](../../community/windows/psexec_module#ansible-collections-community-windows-psexec-module)
The official documentation on the **community.windows.psexec** module.
[ansible.builtin.raw](../builtin/raw_module#ansible-collections-ansible-builtin-raw-module)
The official documentation on the **ansible.builtin.raw** module.
[ansible.builtin.script](../builtin/script_module#ansible-collections-ansible-builtin-script-module)
The official documentation on the **ansible.builtin.script** module.
[ansible.builtin.shell](../builtin/shell_module#ansible-collections-ansible-builtin-shell-module)
The official documentation on the **ansible.builtin.shell** module.
[ansible.windows.win\_command](win_command_module#ansible-collections-ansible-windows-win-command-module)
The official documentation on the **ansible.windows.win\_command** module.
[ansible.windows.win\_powershell](win_powershell_module#ansible-collections-ansible-windows-win-powershell-module)
The official documentation on the **ansible.windows.win\_powershell** module.
[community.windows.win\_psexec](../../community/windows/win_psexec_module#ansible-collections-community-windows-win-psexec-module)
The official documentation on the **community.windows.win\_psexec** module.
Examples
--------
```
- name: Execute a command in the remote shell, stdout goes to the specified file on the remote
ansible.windows.win_shell: C:\somescript.ps1 >> C:\somelog.txt
- name: Change the working directory to somedir/ before executing the command
ansible.windows.win_shell: C:\somescript.ps1 >> C:\somelog.txt
args:
chdir: C:\somedir
- name: Run a command with an idempotent check on what it creates, will only run when somedir/somelog.txt does not exist
ansible.windows.win_shell: C:\somescript.ps1 >> C:\somelog.txt
args:
chdir: C:\somedir
creates: C:\somelog.txt
- name: Run a command under a non-Powershell interpreter (cmd in this case)
ansible.windows.win_shell: echo %HOMEDIR%
args:
executable: cmd
register: homedir_out
- name: Run multi-lined shell commands
ansible.windows.win_shell: |
$value = Test-Path -Path C:\temp
if ($value) {
Remove-Item -Path C:\temp -Force
}
New-Item -Path C:\temp -ItemType Directory
- name: Retrieve the input based on stdin
ansible.windows.win_shell: '$string = [Console]::In.ReadToEnd(); Write-Output $string.Trim()'
args:
stdin: Input message
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cmd** string | always | The command executed by the task. **Sample:** rabbitmqctl join\_cluster rabbit@main |
| **delta** string | always | The command execution delta time. **Sample:** 0:00:00.325771 |
| **end** string | always | The command execution end time. **Sample:** 2016-02-25 09:18:26.755339 |
| **msg** boolean | always | Changed. **Sample:** True |
| **rc** integer | always | The command return code (0 means success). |
| **start** string | always | The command execution start time. **Sample:** 2016-02-25 09:18:26.429568 |
| **stderr** string | always | The command standard error. **Sample:** ls: cannot access foo: No such file or directory |
| **stdout** string | always | The command standard output. **Sample:** Clustering node rabbit@slave1 with rabbit@main ... |
| **stdout\_lines** list / elements=string | always | The command standard output split in lines. **Sample:** ["u'Clustering node rabbit@slave1 with rabbit@main ...'"] |
### Authors
* Matt Davis (@nitzmahone)
ansible ansible.windows.win_updates – Download and install Windows updates ansible.windows.win\_updates – Download and install Windows updates
===================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_updates`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Searches, downloads, and installs Windows updates synchronously by automating the Windows Update client.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **\_output\_path** string | | Internal use only. |
| **\_wait** boolean | **Choices:*** **no** ←
* yes
| Internal use only. |
| **accept\_list** list / elements=string | | A list of update titles or KB numbers that can be used to specify which updates are to be searched or installed. If an available update does not match one of the entries, then it is skipped and not installed. Each entry can either be the KB article or Update title as a regex according to the PowerShell regex rules. The accept list is only validated on updates that were found based on *category\_names*. It will not force the module to install an update if it was not in the category specified. The alias `whitelist` is deprecated and will be removed in a release after `2023-06-01`.
aliases: whitelist |
| **category\_names** list / elements=string | **Default:**["CriticalUpdates", "SecurityUpdates", "UpdateRollups"] | A scalar or list of categories to install updates from. To get the list of categories, run the module with `state=searched`. The category must be the full category string, but is case insensitive. Some possible categories are Application, Connectors, Critical Updates, Definition Updates, Developer Kits, Feature Packs, Guidance, Security Updates, Service Packs, Tools, Update Rollups, Updates, and Upgrades. Since `v1.7.0` the value `*` will match all categories. |
| **log\_path** path | | If set, `win_updates` will append update progress to the specified file. The directory must already exist. |
| **reboot** boolean | **Choices:*** **no** ←
* yes
| Ansible will automatically reboot the remote host if it is required and continue to install updates after the reboot. This can be used instead of using a [ansible.windows.win\_reboot](win_reboot_module) task after this one and ensures all updates for that category is installed in one go. Async does not work when `reboot=yes`. |
| **reboot\_timeout** integer | **Default:**1200 | The time in seconds to wait until the host is back online from a reboot. This is only used if `reboot=yes` and a reboot is required. |
| **reject\_list** list / elements=string | | A list of update titles or KB numbers that can be used to specify which updates are to be excluded from installation. If an available update does match one of the entries, then it is skipped and not installed. Each entry can either be the KB article or Update title as a regex according to the PowerShell regex rules. The alias `blacklist` is deprecated and will be removed in a release after `2023-06-01`.
aliases: blacklist |
| **server\_selection** string | **Choices:*** **default** ←
* managed\_server
* windows\_update
| Defines the Windows Update source catalog.
`default` Use the default search source. For many systems default is set to the Microsoft Windows Update catalog. Systems participating in Windows Server Update Services (WSUS) or similar corporate update server environments may default to those managed update sources instead of the Windows Update catalog.
`managed_server` Use a managed server catalog. For environments utilizing Windows Server Update Services (WSUS) or similar corporate update servers, this option selects the defined corporate update source.
`windows_update` Use the Microsoft Windows Update catalog. |
| **state** string | **Choices:*** **installed** ←
* searched
* downloaded
| Controls whether found updates are downloaded or installed or listed This module also supports Ansible check mode, which has the same effect as setting state=searched |
| **use\_scheduled\_task** boolean | **Choices:*** **no** ←
* yes
| This option is deprecated and no longer does anything since `v1.7.0` of this collection. The option will be removed in a release after `2023-06-01`. |
Notes
-----
Note
* [ansible.windows.win\_updates](#ansible-collections-ansible-windows-win-updates-module) must be run by a user with membership in the local Administrators group.
* [ansible.windows.win\_updates](#ansible-collections-ansible-windows-win-updates-module) will use the default update service configured for the machine (Windows Update, Microsoft Update, WSUS, etc).
* By default [ansible.windows.win\_updates](#ansible-collections-ansible-windows-win-updates-module) does not manage reboots, but will signal when a reboot is required with the *reboot\_required* return value. *reboot* can be used to reboot the host if required in the one task.
* [ansible.windows.win\_updates](#ansible-collections-ansible-windows-win-updates-module) can take a significant amount of time to complete (hours, in some cases). Performance depends on many factors, including OS version, number of updates, system load, and update server load.
* Beware that just after [ansible.windows.win\_updates](#ansible-collections-ansible-windows-win-updates-module) reboots the system, the Windows system may not have settled yet and some base services could be in limbo. This can result in unexpected behavior. Check the examples for ways to mitigate this.
* More information about PowerShell and how it handles RegEx strings can be found at <https://technet.microsoft.com/en-us/library/2007.11.powershell.aspx>.
* The current module doesn’t support Systems Center Configuration Manager (SCCM). See L(<https://github.com/ansible-collections/ansible.windows/issues/194>)
See Also
--------
See also
[chocolatey.chocolatey.win\_chocolatey](../../chocolatey/chocolatey/win_chocolatey_module#ansible-collections-chocolatey-chocolatey-win-chocolatey-module)
The official documentation on the **chocolatey.chocolatey.win\_chocolatey** module.
[ansible.windows.win\_feature](win_feature_module#ansible-collections-ansible-windows-win-feature-module)
The official documentation on the **ansible.windows.win\_feature** module.
[community.windows.win\_hotfix](../../community/windows/win_hotfix_module#ansible-collections-community-windows-win-hotfix-module)
The official documentation on the **community.windows.win\_hotfix** module.
[ansible.windows.win\_package](win_package_module#ansible-collections-ansible-windows-win-package-module)
The official documentation on the **ansible.windows.win\_package** module.
Examples
--------
```
- name: Install all updates and reboot as many times as needed
ansible.windows.win_updates:
category_names: '*'
reboot: yes
- name: Install all security, critical, and rollup updates without a scheduled task
ansible.windows.win_updates:
category_names:
- SecurityUpdates
- CriticalUpdates
- UpdateRollups
- name: Search-only, return list of found updates (if any), log to C:\ansible_wu.txt
ansible.windows.win_updates:
category_names: SecurityUpdates
state: searched
log_path: C:\ansible_wu.txt
- name: Install all security updates with automatic reboots
ansible.windows.win_updates:
category_names:
- SecurityUpdates
reboot: yes
- name: Install only particular updates based on the KB numbers
ansible.windows.win_updates:
category_name:
- SecurityUpdates
accept_list:
- KB4056892
- KB4073117
- name: Exclude updates based on the update title
ansible.windows.win_updates:
category_name:
- SecurityUpdates
- CriticalUpdates
reject_list:
- Windows Malicious Software Removal Tool for Windows
- \d{4}-\d{2} Cumulative Update for Windows Server 2016
# Optionally, you can increase the reboot_timeout to survive long updates during reboot
- name: Ensure we wait long enough for the updates to be applied during reboot
ansible.windows.win_updates:
reboot: yes
reboot_timeout: 3600
# Search and download Windows updates
- name: Search and download Windows updates without installing them
ansible.windows.win_updates:
state: downloaded
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **failed\_update\_count** integer | always | The number of updates that failed to install. |
| **filtered\_updates** complex | success | List of updates that were found but were filtered based on *blacklist*, *whitelist* or *category\_names*. The return value is in the same form as *updates*, along with *filtered\_reason*. **Sample:** see the updates return value |
| | **filtered\_reason** string | always | The reason why this update was filtered. This value has been deprecated since `1.7.0`, use `filtered_reasons` which contain a list of all the reasons why the update is filtered. **Sample:** skip\_hidden |
| | **filtered\_reasons** list / elements=string added in 1.7.0 of ansible.windows | success | A list of reasons why the update has been filtered. Can be `accept_list`, `reject_list`, `hidden`, or `category_names`. **Sample:** ['category\_names', 'accept\_list'] |
| **found\_update\_count** integer | success | The number of updates found needing to be applied. **Sample:** 3 |
| **installed\_update\_count** integer | success | The number of updates successfully installed or downloaded. **Sample:** 2 |
| **reboot\_required** boolean | success | True when the target server requires a reboot to complete updates (no further updates can be installed until after a reboot). **Sample:** True |
| **updates** complex | success | List of updates that were found/installed. |
| | **categories** list / elements=string | always | A list of category strings for this update. **Sample:** ['Critical Updates', 'Windows Server 2012 R2'] |
| | **downloaded** boolean added in 1.7.0 of ansible.windows | always | Was the update downloaded. **Sample:** True |
| | **failure\_hresult\_code** boolean | on install or download failure | The HRESULT code from a failed update. **Sample:** 2147942402 |
| | **failure\_msg** string added in 1.7.0 of ansible.windows | on install or download failure and not running with async | The error message with more details on the failure. **Sample:** Operation did not complete because there is no logged-on interactive user (WU\_E\_NO\_INTERACTIVE\_USER 0x80240020) |
| | **id** string | always | Internal Windows Update GUID. **Sample:** fb95c1c8-de23-4089-ae29-fd3351d55421 |
| | **installed** boolean | always | Was the update successfully installed. **Sample:** True |
| | **kb** list / elements=string | always | A list of KB article IDs that apply to the update. **Sample:** ['3004365'] |
| | **title** string | always | Display name. **Sample:** Security Update for Windows Server 2012 R2 (KB3004365) |
### Authors
* Matt Davis (@nitzmahone)
| programming_docs |
ansible ansible.windows.win_dns_client – Configures DNS lookup on Windows hosts ansible.windows.win\_dns\_client – Configures DNS lookup on Windows hosts
=========================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_dns_client`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* The [ansible.windows.win\_dns\_client](#ansible-collections-ansible-windows-win-dns-client-module) module configures the DNS client on Windows network adapters.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **adapter\_names** list / elements=string / required | | Adapter name or list of adapter names for which to manage DNS settings ('\*' is supported as a wildcard value). The adapter name used is the connection caption in the Network Control Panel or the InterfaceAlias of `Get-DnsClientServerAddress`. |
| **dns\_servers** list / elements=string / required | | Single or ordered list of DNS servers (IPv4 and IPv6 addresses) to configure for lookup. An empty list will configure the adapter to use the DHCP-assigned values on connections where DHCP is enabled, or disable DNS lookup on statically-configured connections. IPv6 DNS servers can only be set on Windows Server 2012 or newer, older hosts can only set IPv4 addresses.
aliases: ipv4\_addresses, ip\_addresses, addresses |
Examples
--------
```
- name: Set a single address on the adapter named Ethernet
ansible.windows.win_dns_client:
adapter_names: Ethernet
dns_servers: 192.168.34.5
- name: Set multiple lookup addresses on all visible adapters (usually physical adapters that are in the Up state), with debug logging to a file
ansible.windows.win_dns_client:
adapter_names: '*'
dns_servers:
- 192.168.34.5
- 192.168.34.6
log_path: C:\dns_log.txt
- name: Set IPv6 DNS servers on the adapter named Ethernet
ansible.windows.win_dns_client:
adapter_names: Ethernet
dns_servers:
- '2001:db8::2'
- '2001:db8::3'
- name: Configure all adapters whose names begin with Ethernet to use DHCP-assigned DNS values
ansible.windows.win_dns_client:
adapter_names: 'Ethernet*'
dns_servers: []
```
### Authors
* Matt Davis (@nitzmahone)
* Brian Scholer (@briantist)
ansible ansible.windows.win_share – Manage Windows shares ansible.windows.win\_share – Manage Windows shares
==================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_share`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Add, modify or remove Windows share and set share permissions.
Requirements
------------
The below requirements are needed on the host that executes this module.
* As this module used newer cmdlets like New-SmbShare this can only run on Windows 8 / Windows 2012 or newer.
* This is due to the reliance on the WMI provider MSFT\_SmbShare <https://msdn.microsoft.com/en-us/library/hh830471> which was only added with these Windows releases.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **caching\_mode** string | **Choices:*** BranchCache
* Documents
* **Manual** ←
* None
* Programs
* Unknown
| Set the CachingMode for this share. |
| **change** string | | Specify user list that should get read and write access on share, separated by comma. |
| **deny** string | | Specify user list that should get no access, regardless of implied access on share, separated by comma. |
| **description** string | | Share description. |
| **encrypt** boolean | **Choices:*** **no** ←
* yes
| Sets whether to encrypt the traffic to the share or not. |
| **full** string | | Specify user list that should get full access on share, separated by comma. |
| **list** boolean | **Choices:*** **no** ←
* yes
| Specify whether to allow or deny file listing, in case user has no permission on share. Also known as Access-Based Enumeration. |
| **name** string / required | | Share name. |
| **path** path / required | | Share directory. |
| **read** string | | Specify user list that should get read access on share, separated by comma. |
| **rule\_action** string | **Choices:*** **set** ←
* add
| Whether to add or set (replace) access control entries. |
| **state** string | **Choices:*** absent
* **present** ←
| Specify whether to add `present` or remove `absent` the specified share. |
Examples
--------
```
- name: Add secret share
ansible.windows.win_share:
name: internal
description: top secret share
path: C:\shares\internal
list: no
full: Administrators,CEO
read: HR-Global
deny: HR-External
- name: Add public company share
ansible.windows.win_share:
name: company
description: top secret share
path: C:\shares\company
list: yes
full: Administrators,CEO
read: Global
- name: Remove previously added share
ansible.windows.win_share:
name: internal
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **actions** list / elements=string | success | A list of action cmdlets that were run by the module. **Sample:** ['New-SmbShare -Name share -Path C:\\temp'] |
### Authors
* Hans-Joachim Kliemeck (@h0nIg)
* David Baumann (@daBONDi)
* Shachaf Goldstein (@Shachaf92)
ansible ansible.windows.win_whoami – Get information about the current user and process ansible.windows.win\_whoami – Get information about the current user and process
================================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_whoami`.
* [Synopsis](#synopsis)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Designed to return the same information as the `whoami /all` command.
* Also includes information missing from `whoami` such as logon metadata like logon rights, id, type.
Notes
-----
Note
* If running this module with a non admin user, the logon rights will be an empty list as Administrator rights are required to query LSA for the information.
See Also
--------
See also
[community.windows.win\_credential](../../community/windows/win_credential_module#ansible-collections-community-windows-win-credential-module)
The official documentation on the **community.windows.win\_credential** module.
[ansible.windows.win\_group\_membership](win_group_membership_module#ansible-collections-ansible-windows-win-group-membership-module)
The official documentation on the **ansible.windows.win\_group\_membership** module.
[ansible.windows.win\_user\_right](win_user_right_module#ansible-collections-ansible-windows-win-user-right-module)
The official documentation on the **ansible.windows.win\_user\_right** module.
Examples
--------
```
- name: Get whoami information
ansible.windows.win_whoami:
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **account** complex | success | The running account SID details. |
| | **account\_name** string | success | The account name of the account SID. **Sample:** Administrator |
| | **domain\_name** string | success | The domain name of the account SID. **Sample:** DOMAIN |
| | **sid** string | success | The SID in string form. **Sample:** S-1-5-21-1654078763-769949647-2968445802-500 |
| | **type** string | success | The type of SID. **Sample:** User |
| **authentication\_package** string | success | The name of the authentication package used to authenticate the user in the session. **Sample:** Negotiate |
| **dns\_domain\_name** string | success | The DNS name of the logon session, this is an empty string if this is not set. **Sample:** DOMAIN.COM |
| **groups** list / elements=string | success | A list of groups and attributes that the user is a member of. **Sample:** [{'account\_name': 'Domain Users', 'attributes': ['Mandatory', 'Enabled by default', 'Enabled'], 'domain\_name': 'DOMAIN', 'sid': 'S-1-5-21-1654078763-769949647-2968445802-513', 'type': 'Group'}, {'account\_name': 'Administrators', 'attributes': ['Mandatory', 'Enabled by default', 'Enabled', 'Owner'], 'domain\_name': 'BUILTIN', 'sid': 'S-1-5-32-544', 'type': 'Alias'}] |
| **impersonation\_level** string | success | The impersonation level of the token, only valid if `token_type` is `TokenImpersonation`, see <https://msdn.microsoft.com/en-us/library/windows/desktop/aa379572.aspx>. **Sample:** SecurityAnonymous |
| **label** complex | success | The mandatory label set to the logon session. |
| | **account\_name** string | success | The account name of the label SID. **Sample:** High Mandatory Level |
| | **domain\_name** string | success | The domain name of the label SID. **Sample:** Mandatory Label |
| | **sid** string | success | The SID in string form. **Sample:** S-1-16-12288 |
| | **type** string | success | The type of SID. **Sample:** Label |
| **login\_domain** string | success | The name of the domain used to authenticate the owner of the session. **Sample:** DOMAIN |
| **login\_time** string | success | The logon time in ISO 8601 format **Sample:** 2017-11-27T06:24:14.3321665+10:00 |
| **logon\_id** integer | success | The unique identifier of the logon session. **Sample:** 20470143 |
| **logon\_server** string | success | The name of the server used to authenticate the owner of the logon session. **Sample:** DC01 |
| **logon\_type** string | success | The logon type that identifies the logon method, see <https://msdn.microsoft.com/en-us/library/windows/desktop/aa380129.aspx>. **Sample:** Network |
| **privileges** dictionary | success | A dictionary of privileges and their state on the logon token. **Sample:** {'SeChangeNotifyPrivileges': 'enabled-by-default', 'SeDebugPrivilege': 'enabled', 'SeRemoteShutdownPrivilege': 'disabled'} |
| **rights** list / elements=string | success and running user is a member of the local Administrators group | A list of logon rights assigned to the logon. **Sample:** ['SeNetworkLogonRight', 'SeInteractiveLogonRight', 'SeBatchLogonRight', 'SeRemoteInteractiveLogonRight'] |
| **token\_type** string | success | The token type to indicate whether it is a primary or impersonation token. **Sample:** TokenPrimary |
| **upn** string | success | The user principal name of the current user. **Sample:** [email protected] |
| **user\_flags** string | success | The user flags for the logon session, see UserFlags in <https://msdn.microsoft.com/en-us/library/windows/desktop/aa380128>. **Sample:** Winlogon |
### Authors
* Jordan Borean (@jborean93)
ansible ansible.windows.win_service_info – Gather information about Windows services ansible.windows.win\_service\_info – Gather information about Windows services
==============================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_service_info`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about all or a specific installed Windows service(s).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | | If specified, this is used to match the `name` or `display_name` of the Windows service to get the info for. Can be a wildcard to match multiple services but the wildcard will only be matched on the `name` of the service and not `display_name`. If omitted then all services will returned. |
See Also
--------
See also
[ansible.windows.win\_service](win_service_module#ansible-collections-ansible-windows-win-service-module)
The official documentation on the **ansible.windows.win\_service** module.
Examples
--------
```
- name: Get info for all installed services
ansible.windows.win_service_info:
register: service_info
- name: Get info for a single service
ansible.windows.win_service_info:
name: WinRM
register: service_info
- name: Get info for a service using its display name
ansible.windows.win_service_info:
name: Windows Remote Management (WS-Management)
- name: Find all services that start with 'win'
ansible.windows.win_service_info:
name: win*
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **exists** boolean | always | Whether any services were found based on the criteria specified. **Sample:** True |
| **services** list / elements=dictionary | always | A list of service(s) that were found based on the criteria. Will be an empty list if no services were found. |
| | **checkpoint** integer | success | A check-point value that the service increments periodically to report its progress. |
| | **controls\_accepted** list / elements=string | success | A list of controls that the service can accept. Common controls are `stop`, `pause_continue`, `shutdown`. **Sample:** ['stop', 'shutdown'] |
| | **dependencies** list / elements=string | success | A list of services by their `name` that this service is dependent on. **Sample:** ['HTTP', 'RPCSS'] |
| | **dependency\_of** list / elements=string | success | A list of services by their `name` that depend on this service. **Sample:** ['upnphost', 'WMPNetworkSvc'] |
| | **description** string | success | The description of the service. **Sample:** Example description of the Windows service. |
| | **desktop\_interact** boolean | success | Whether the service can interact with the desktop, only valid for services running as `SYSTEM`. |
| | **display\_name** string | success | The display name to be used by SCM to identify the service. **Sample:** Windows Remote Management (WS-Management) |
| | **error\_control** string | success | The action to take if a service fails to start. Common values are `critical`, `ignore`, `normal`, `severe`. **Sample:** normal |
| | **failure\_action\_on\_non\_crash\_failure** boolean | success | Controls when failure actions are fired based on how the service was stopped. |
| | **failure\_actions** list / elements=dictionary | success | A list of failure actions to run in the event of a failure. |
| | | **delay\_ms** integer | success | The time to wait, in milliseconds, before performing the specified action. **Sample:** 120000 |
| | | **type** string | success | The action that will be performed. Common values are `none`, `reboot`, `restart`, `run_command`. **Sample:** run\_command |
| | **failure\_command** string | success | The command line that will be run when a `run_command` failure action is fired. **Sample:** runme.exe |
| | **failure\_reboot\_msg** string | success | The message to be broadcast to server users before rebooting when a `reboot` failure action is fired. **Sample:** Service failed, rebooting host. |
| | **failure\_reset\_period\_sec** integer | success | The time, in seconds, after which to reset the failure count to zero. **Sample:** 86400 |
| | **launch\_protection** string | success | The protection type of the service. Common values are `none`, `windows`, `windows_light`, or `antimalware_light`. **Sample:** none |
| | **load\_order\_group** string | success | The name of the load ordering group to which the service belongs. Will be an empty string if it does not belong to any group. **Sample:** My group |
| | **name** string | success | The name of the service. **Sample:** WinRM |
| | **path** string | success | The path to the service binary and any arguments used when starting the service. The binary part can be quoted to ensure any spaces in path are not treated as arguments. **Sample:** C:\Windows\System32\svchost.exe -k netsvcs -p |
| | **pre\_shutdown\_timeout\_ms** integer | success | The preshutdown timeout out value in milliseconds. **Sample:** 10000 |
| | **preferred\_node** integer | success | The node number for the preferred node. This will be `null` if the Windows host has no NUMA configuration. |
| | **process\_id** integer | success | The process identifier of the running service. **Sample:** 5135 |
| | **required\_privileges** list / elements=string | success | A list of privileges that the service requires and will run with **Sample:** ['SeBackupPrivilege', 'SeRestorePrivilege'] |
| | **service\_exit\_code** integer | success | A service-specific error code that is set while the service is starting or stopping. |
| | **service\_flags** list / elements=string | success | Shows more information about the behaviour of a running service. Currently the only flag that can be set is `runs_in_system_process`. **Sample:** ['runs\_in\_system\_process'] |
| | **service\_type** string | success | The type of service. Common types are `win32_own_process`, `win32_share_process`, `user_own_process`, `user_share_process`, `kernel_driver`. **Sample:** win32\_own\_process |
| | **sid\_info** string | success | The behavior of how the service's access token is generated and how to add the service SID to the token. Common values are `none`, `restricted`, or `unrestricted`. **Sample:** none |
| | **start\_mode** string | success | When the service is set to start. Common values are `auto`, `manual`, `disabled`, `delayed`. **Sample:** auto |
| | **state** string | success | The current running state of the service. Common values are `stopped`, `start_pending`, `stop_pending`, `started`, `continue_pending`, `pause_pending`, `paused`. **Sample:** started |
| | **triggers** list / elements=dictionary | success | A list of triggers defined for the service. |
| | | **action** string | success | The action to perform once triggered, can be `start_service` or `stop_service`. **Sample:** start\_service |
| | | **data\_items** list / elements=dictionary | success | A list of trigger data items that contain trigger specific data. A trigger can contain 0 or multiple data items. |
| | | | **data** complex | success | The trigger data item value. Can be a string, list of string, int, or base64 string of binary data. **Sample:** named pipe |
| | | | **type** string | success | The type of `data` for the trigger. Common values are `string`, `binary`, `level`, `keyword_any`, or `keyword_all`. **Sample:** string |
| | | **sub\_type** string | success | The trigger event sub type that is specific to each `type`. Common values are `named_pipe_event`, `domain_join`, `domain_leave`, `firewall_port_open`, and others. |
| | | **sub\_type\_guid** string | success | The guid which represents the trigger sub type. **Sample:** 1ce20aba-9851-4421-9430-1ddeb766e809 |
| | | **type** string | success | The trigger event type. Common values are `custom`, `rpc_interface_event`, `domain_join`, `group_policy`, and others. **Sample:** domain\_join |
| | **username** string | success | The username used to run the service. Can be null for user services and certain driver services. **Sample:** NT AUTHORITY\SYSTEM |
| | **wait\_hint\_ms** integer | success | The estimated time in milliseconds required for a pending start, stop, pause,or continue operations. |
| | **win32\_exitcode** integer | success | The error code returned from the service binary once it has stopped. When set to `1066` then a service specific error is returned on `service_exit_code`. |
### Authors
* Jordan Borean (@jborean93)
| programming_docs |
ansible ansible.windows.win_ping – A windows version of the classic ping module ansible.windows.win\_ping – A windows version of the classic ping module
========================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_ping`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Checks management connectivity of a windows host.
* This is NOT ICMP ping, this is just a trivial test module.
* For non-Windows targets, use the [ansible.builtin.ping](../builtin/ping_module#ansible-collections-ansible-builtin-ping-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **data** string | **Default:**"pong" | Alternate data to return instead of 'pong'. If this parameter is set to `crash`, the module will cause an exception. |
See Also
--------
See also
[ansible.builtin.ping](../builtin/ping_module#ansible-collections-ansible-builtin-ping-module)
The official documentation on the **ansible.builtin.ping** module.
Examples
--------
```
# Test connectivity to a windows host
# ansible winserver -m ansible.windows.win_ping
- name: Example from an Ansible Playbook
ansible.windows.win_ping:
- name: Induce an exception to see what happens
ansible.windows.win_ping:
data: crash
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **ping** string | success | Value provided with the data parameter. **Sample:** pong |
### Authors
* Chris Church (@cchurch)
ansible ansible.windows.win_path – Manage Windows path environment variables ansible.windows.win\_path – Manage Windows path environment variables
=====================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_path`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Allows element-based ordering, addition, and removal of Windows path environment variables.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **elements** list / elements=string / required | | A single path element, or a list of path elements (ie, directories) to add or remove. When multiple elements are included in the list (and `state` is `present`), the elements are guaranteed to appear in the same relative order in the resultant path value. Variable expansions (eg, `%VARNAME%`) are allowed, and are stored unexpanded in the target path element. Any existing path elements not mentioned in `elements` are always preserved in their current order. New path elements are appended to the path, and existing path elements may be moved closer to the end to satisfy the requested ordering. Paths are compared in a case-insensitive fashion, and trailing backslashes are ignored for comparison purposes. However, note that trailing backslashes in YAML require quotes. |
| **name** string | **Default:**"PATH" | Target path environment variable name. |
| **scope** string | **Choices:*** **machine** ←
* user
| The level at which the environment variable specified by `name` should be managed (either for the current user or global machine scope). |
| **state** string | **Choices:*** absent
* present
| Whether the path elements specified in `elements` should be present or absent. |
Notes
-----
Note
* This module is for modifying individual elements of path-like environment variables. For general-purpose management of other environment vars, use the [ansible.windows.win\_environment](win_environment_module#ansible-collections-ansible-windows-win-environment-module) module.
* This module does not broadcast change events. This means that the minority of windows applications which can have their environment changed without restarting will not be notified and therefore will need restarting to pick up new environment settings.
* User level environment variables will require an interactive user to log out and in again before they become available.
See Also
--------
See also
[ansible.windows.win\_environment](win_environment_module#ansible-collections-ansible-windows-win-environment-module)
The official documentation on the **ansible.windows.win\_environment** module.
Examples
--------
```
- name: Ensure that system32 and Powershell are present on the global system path, and in the specified order
ansible.windows.win_path:
elements:
- '%SystemRoot%\system32'
- '%SystemRoot%\system32\WindowsPowerShell\v1.0'
- name: Ensure that C:\Program Files\MyJavaThing is not on the current user's CLASSPATH
ansible.windows.win_path:
name: CLASSPATH
elements: C:\Program Files\MyJavaThing
scope: user
state: absent
```
### Authors
* Matt Davis (@nitzmahone)
ansible ansible.windows.win_tempfile – Creates temporary files and directories ansible.windows.win\_tempfile – Creates temporary files and directories
=======================================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_tempfile`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates temporary files and directories.
* For non-Windows targets, please use the [ansible.builtin.tempfile](../builtin/tempfile_module#ansible-collections-ansible-builtin-tempfile-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **path** path | **Default:**"%TEMP%" | Location where temporary file or directory should be created. If path is not specified default system temporary directory (%TEMP%) will be used.
aliases: dest |
| **prefix** string | **Default:**"ansible." | Prefix of file/directory name created by module. |
| **state** string | **Choices:*** directory
* **file** ←
| Whether to create file or directory. |
| **suffix** string | **Default:**"" | Suffix of file/directory name created by module. |
See Also
--------
See also
[ansible.builtin.tempfile](../builtin/tempfile_module#ansible-collections-ansible-builtin-tempfile-module)
The official documentation on the **ansible.builtin.tempfile** module.
Examples
--------
```
- name: Create temporary build directory
ansible.windows.win_tempfile:
state: directory
suffix: build
- name: Create temporary file
ansible.windows.win_tempfile:
state: file
suffix: temp
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **path** string | success | The absolute path to the created file or directory. **Sample:** C:\Users\Administrator\AppData\Local\Temp\ansible.bMlvdk |
### Authors
* Dag Wieers (@dagwieers)
ansible ansible.windows.win_owner – Set owner ansible.windows.win\_owner – Set owner
======================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_owner`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Set owner of files or directories.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **path** path / required | | Path to be used for changing owner. |
| **recurse** boolean | **Choices:*** **no** ←
* yes
| Indicates if the owner should be changed recursively. |
| **user** string / required | | Name to be used for changing owner. |
See Also
--------
See also
[ansible.windows.win\_acl](win_acl_module#ansible-collections-ansible-windows-win-acl-module)
The official documentation on the **ansible.windows.win\_acl** module.
[ansible.windows.win\_file](win_file_module#ansible-collections-ansible-windows-win-file-module)
The official documentation on the **ansible.windows.win\_file** module.
[ansible.windows.win\_stat](win_stat_module#ansible-collections-ansible-windows-win-stat-module)
The official documentation on the **ansible.windows.win\_stat** module.
Examples
--------
```
- name: Change owner of path
ansible.windows.win_owner:
path: C:\apache
user: apache
recurse: yes
- name: Set the owner of root directory
ansible.windows.win_owner:
path: C:\apache
user: SYSTEM
recurse: no
```
### Authors
* Hans-Joachim Kliemeck (@h0nIg)
ansible ansible.windows.win_acl_inheritance – Change ACL inheritance ansible.windows.win\_acl\_inheritance – Change ACL inheritance
==============================================================
Note
This plugin is part of the [ansible.windows collection](https://galaxy.ansible.com/ansible/windows) (version 1.7.3).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install ansible.windows`.
To use it in a playbook, specify: `ansible.windows.win_acl_inheritance`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Change ACL (Access Control List) inheritance and optionally copy inherited ACE’s (Access Control Entry) to dedicated ACE’s or vice versa.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **path** path / required | | Path to be used for changing inheritance |
| **reorganize** boolean | **Choices:*** **no** ←
* yes
| For P(state) = *absent*, indicates if the inherited ACE's should be copied from the parent directory. This is necessary (in combination with removal) for a simple ACL instead of using multiple ACE deny entries. For P(state) = *present*, indicates if the inherited ACE's should be deduplicated compared to the parent directory. This removes complexity of the ACL structure. |
| **state** string | **Choices:*** **absent** ←
* present
| Specify whether to enable *present* or disable *absent* ACL inheritance. |
See Also
--------
See also
[ansible.windows.win\_acl](win_acl_module#ansible-collections-ansible-windows-win-acl-module)
The official documentation on the **ansible.windows.win\_acl** module.
[ansible.windows.win\_file](win_file_module#ansible-collections-ansible-windows-win-file-module)
The official documentation on the **ansible.windows.win\_file** module.
[ansible.windows.win\_stat](win_stat_module#ansible-collections-ansible-windows-win-stat-module)
The official documentation on the **ansible.windows.win\_stat** module.
Examples
--------
```
- name: Disable inherited ACE's
ansible.windows.win_acl_inheritance:
path: C:\apache
state: absent
- name: Disable and copy inherited ACE's
ansible.windows.win_acl_inheritance:
path: C:\apache
state: absent
reorganize: yes
- name: Enable and remove dedicated ACE's
ansible.windows.win_acl_inheritance:
path: C:\apache
state: present
reorganize: yes
```
### Authors
* Hans-Joachim Kliemeck (@h0nIg)
ansible ansible.builtin.toml – Uses a specific TOML file as an inventory source. ansible.builtin.toml – Uses a specific TOML file as an inventory source.
========================================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `toml` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* TOML based inventory format
* File MUST have a valid ‘.toml’ file extension
Notes
-----
Note
* Requires the ‘toml’ python library
Examples
--------
```
# fmt: toml
# Example 1
[all.vars]
has_java = false
[web]
children = [
"apache",
"nginx"
]
vars = { http_port = 8080, myvar = 23 }
[web.hosts]
host1 = {}
host2 = { ansible_port = 222 }
[apache.hosts]
tomcat1 = {}
tomcat2 = { myvar = 34 }
tomcat3 = { mysecret = "03#pa33w0rd" }
[nginx.hosts]
jenkins1 = {}
[nginx.vars]
has_java = true
# Example 2
[all.vars]
has_java = false
[web]
children = [
"apache",
"nginx"
]
[web.vars]
http_port = 8080
myvar = 23
[web.hosts.host1]
[web.hosts.host2]
ansible_port = 222
[apache.hosts.tomcat1]
[apache.hosts.tomcat2]
myvar = 34
[apache.hosts.tomcat3]
mysecret = "03#pa33w0rd"
[nginx.hosts.jenkins1]
[nginx.vars]
has_java = true
# Example 3
[ungrouped.hosts]
host1 = {}
host2 = { ansible_host = "127.0.0.1", ansible_port = 44 }
host3 = { ansible_host = "127.0.0.1", ansible_port = 45 }
[g1.hosts]
host4 = {}
[g2.hosts]
host4 = {}
```
ansible ansible.builtin.script – Executes an inventory script that returns JSON ansible.builtin.script – Executes an inventory script that returns JSON
=======================================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `script` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
Synopsis
--------
* The source provided must be an executable that returns Ansible inventory JSON
* The source must accept `--list` and `--host <hostname>` as arguments. `--host` will only be used if no `_meta` key is present. This is a performance optimization as the script would be called per host otherwise.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **always\_show\_stderr** boolean added in 2.5.1 of ansible.builtin | **Choices:*** no
* **yes** ←
| ini entries: [inventory\_plugin\_script]always\_show\_stderr = yes env:ANSIBLE\_INVENTORY\_PLUGIN\_SCRIPT\_STDERR | Toggle display of stderr even when script was successful |
| **cache** string Removed in: version 2.12 Why: This option has never been in use. External scripts must implement their own caching. Alternative: | | ini entries: [inventory\_plugin\_script]cache = None env:ANSIBLE\_INVENTORY\_PLUGIN\_SCRIPT\_CACHE | This option has no effect. The plugin will not cache results because external inventory scripts are responsible for their own caching. This option will be removed in 2.12. |
Notes
-----
Note
* Whitelisted in configuration by default.
* The plugin does not cache results because external inventory scripts are responsible for their own caching.
ansible ansible.builtin.junit – write playbook output to a JUnit file. ansible.builtin.junit – write playbook output to a JUnit file.
==============================================================
Note
This callback plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `junit` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same callback plugin name.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
Synopsis
--------
* This callback writes playbook output to a JUnit formatted XML file.
* Tasks show up in the report as follows: ‘ok’: pass ‘failed’ with ‘EXPECTED FAILURE’ in the task name: pass ‘failed’ with ‘TOGGLE RESULT’ in the task name: pass ‘ok’ with ‘TOGGLE RESULT’ in the task name: failure ‘failed’ due to an exception: error ‘failed’ for other reasons: failure ‘skipped’: skipped
Requirements
------------
The below requirements are needed on the local controller node that executes this callback.
* whitelist in configuration
* junit\_xml (python lib)
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **fail\_on\_change** string | **Default:**"no" | env:JUNIT\_FAIL\_ON\_CHANGE | Consider any tasks reporting "changed" as a junit test failure |
| **fail\_on\_ignore** string | **Default:**"no" | env:JUNIT\_FAIL\_ON\_IGNORE | Consider failed tasks as a junit test failure even if ignore\_on\_error is set |
| **hide\_task\_arguments** string added in 2.8 of ansible.builtin | **Default:**"no" | env:JUNIT\_HIDE\_TASK\_ARGUMENTS | Hide the arguments for a task |
| **include\_setup\_tasks\_in\_report** string | **Default:**"yes" | env:JUNIT\_INCLUDE\_SETUP\_TASKS\_IN\_REPORT | Should the setup tasks be included in the final report |
| **output\_dir** string | **Default:**"~/.ansible.log" | env:JUNIT\_OUTPUT\_DIR | Directory to write XML files to. |
| **task\_class** string | **Default:**"no" | env:JUNIT\_TASK\_CLASS | Configure the output to be one class per yaml file |
| **task\_relative\_path** string added in 2.8 of ansible.builtin | **Default:**"none" | env:JUNIT\_TASK\_RELATIVE\_PATH | Configure the output to use relative paths to given directory |
| **test\_case\_prefix** string added in 2.8 of ansible.builtin | **Default:**"\u003cempty\u003e" | env:JUNIT\_TEST\_CASE\_PREFIX | Consider a task only as test case if it has this value as prefix. Additionaly failing tasks are recorded as failed test cases. |
ansible ansible.builtin.local – execute on controller ansible.builtin.local – execute on controller
=============================================
Note
This connection plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `local` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same connection plugin name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
Synopsis
--------
* This connection plugin allows ansible to execute tasks on the Ansible ‘controller’ instead of on a remote host.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **pipelining** boolean | **Choices:*** no
* yes
**Default:**"ANSIBLE\_PIPELINING" | ini entries: [defaults]pipelining = ANSIBLE\_PIPELINING env:ANSIBLE\_PIPELINING var: ansible\_pipelining | Pipelining reduces the number of connection operations required to execute a module on the remote server, by executing many Ansible modules without actual file transfers. This can result in a very significant performance improvement when enabled. However this can conflict with privilege escalation (become). For example, when using sudo operations you must first disable 'requiretty' in the sudoers file for the target hosts, which is why this feature is disabled by default. |
Notes
-----
Note
* The remote user is ignored, the user with which the ansible CLI was executed is used instead.
### Authors
* ansible (@core)
| programming_docs |
ansible ansible.builtin.config – Lookup current Ansible configuration values ansible.builtin.config – Lookup current Ansible configuration values
====================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `config` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 2.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Retrieves the value of an Ansible configuration setting.
* You can use `ansible-config list` to see all available settings.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | The key(s) to look up |
| **on\_missing** string | **Choices:*** **error** ←
* skip
* warn
| | action to take if term is missing from config Error will raise a fatal error Skip will just ignore the term Warn will skip over it but issue a warning |
Examples
--------
```
- name: Show configured default become user
debug: msg="{{ lookup('config', 'DEFAULT_BECOME_USER')}}"
- name: print out role paths
debug:
msg: "These are the configured role paths: {{lookup('config', 'DEFAULT_ROLES_PATH')}}"
- name: find retry files, skip if missing that key
find:
paths: "{{lookup('config', 'RETRY_FILES_SAVE_PATH')|default(playbook_dir, True)}}"
patterns: "*.retry"
- name: see the colors
debug: msg="{{item}}"
loop: "{{lookup('config', 'COLOR_OK', 'COLOR_CHANGED', 'COLOR_SKIP', wantlist=True)}}"
- name: skip if bad value in var
debug: msg="{{ lookup('config', config_in_var, on_missing='skip')}}"
var:
config_in_var: UNKNOWN
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** any | success | value(s) of the key(s) in the config |
### Authors
* Ansible Core Team
ansible ansible.builtin.su – Substitute User ansible.builtin.su – Substitute User
====================================
Note
This become plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `su` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same become plugin name.
New in version 2.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* This become plugins allows your remote/login user to execute commands as another user via the su utility.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **become\_exe** string | **Default:**"su" | ini entries: [privilege\_escalation]become\_exe = su [su\_become\_plugin]executable = su env:ANSIBLE\_BECOME\_EXE env:ANSIBLE\_SU\_EXE var: ansible\_become\_exe var: ansible\_su\_exe | Su executable |
| **become\_flags** string | **Default:**"" | ini entries: [privilege\_escalation]become\_flags = [su\_become\_plugin]flags = env:ANSIBLE\_BECOME\_FLAGS env:ANSIBLE\_SU\_FLAGS var: ansible\_become\_flags var: ansible\_su\_flags | Options to pass to su |
| **become\_pass** string | | ini entries: [su\_become\_plugin]password = None env:ANSIBLE\_BECOME\_PASS env:ANSIBLE\_SU\_PASS var: ansible\_become\_password var: ansible\_become\_pass var: ansible\_su\_pass | Password to pass to su |
| **become\_user** string | **Default:**"root" | ini entries: [privilege\_escalation]become\_user = root [su\_become\_plugin]user = root env:ANSIBLE\_BECOME\_USER env:ANSIBLE\_SU\_USER var: ansible\_become\_user var: ansible\_su\_user | User you 'become' to execute the task |
| **prompt\_l10n** list / elements=string | **Default:**[] | ini entries: [su\_become\_plugin]localized\_prompts = [] env:ANSIBLE\_SU\_PROMPT\_L10N var: ansible\_su\_prompt\_l10n | List of localized strings to match for prompt detection If empty we'll use the built in one |
### Authors
* ansible (@core)
ansible ansible.builtin.import_tasks – Import a task list ansible.builtin.import\_tasks – Import a task list
==================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `import_tasks` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Imports a list of tasks to be added to the current playbook for subsequent execution.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **free-form** string | | The name of the imported file is specified directly without any other option. Most keywords, including loops and conditionals, only applied to the imported tasks, not to this statement itself. If you need any of those to apply, use [ansible.builtin.include\_tasks](include_tasks_module) instead. |
Notes
-----
Note
* This is a core feature of Ansible, rather than a module, and cannot be overridden like a module.
See Also
--------
See also
[ansible.builtin.import\_playbook](import_playbook_module#ansible-collections-ansible-builtin-import-playbook-module)
The official documentation on the **ansible.builtin.import\_playbook** module.
[ansible.builtin.import\_role](import_role_module#ansible-collections-ansible-builtin-import-role-module)
The official documentation on the **ansible.builtin.import\_role** module.
[ansible.builtin.include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module)
The official documentation on the **ansible.builtin.include\_role** module.
[ansible.builtin.include\_tasks](include_tasks_module#ansible-collections-ansible-builtin-include-tasks-module)
The official documentation on the **ansible.builtin.include\_tasks** module.
[Including and importing](../../../user_guide/playbooks_reuse_includes#playbooks-reuse-includes)
More information related to including and importing playbooks, roles and tasks.
Examples
--------
```
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play
import_tasks: stuff.yaml
- debug:
msg: task10
- hosts: all
tasks:
- debug:
msg: task1
- name: Apply conditional to all imported tasks
import_tasks: stuff.yaml
when: hostvar is defined
```
### Authors
* Ansible Core Team (@ansible)
ansible ansible.builtin.systemd – Manage systemd units ansible.builtin.systemd – Manage systemd units
==============================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `systemd` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Controls systemd units (services, timers, and so on) on remote hosts.
Requirements
------------
The below requirements are needed on the host that executes this module.
* A system managed by systemd.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **daemon\_reexec** boolean added in 2.8 of ansible.builtin | **Choices:*** **no** ←
* yes
| Run daemon\_reexec command before doing any other operations, the systemd manager will serialize the manager state.
aliases: daemon-reexec |
| **daemon\_reload** boolean | **Choices:*** **no** ←
* yes
| Run daemon-reload before doing any other operations, to make sure systemd has read any changes. When set to `true`, runs daemon-reload even if the module does not start or stop anything.
aliases: daemon-reload |
| **enabled** boolean | **Choices:*** no
* yes
| Whether the unit should start on boot. **At least one of state and enabled are required.**
|
| **force** boolean added in 2.6 of ansible.builtin | **Choices:*** no
* yes
| Whether to override existing symlinks. |
| **masked** boolean | **Choices:*** no
* yes
| Whether the unit should be masked or not, a masked unit is impossible to start. |
| **name** string | | Name of the unit. This parameter takes the name of exactly one unit to work with. When no extension is given, it is implied to a `.service` as systemd. When using in a chroot environment you always need to specify the name of the unit with the extension. For example, `crond.service`.
aliases: service, unit |
| **no\_block** boolean added in 2.3 of ansible.builtin | **Choices:*** **no** ←
* yes
| Do not synchronously wait for the requested operation to finish. Enqueued job will continue without Ansible blocking on its completion. |
| **scope** string added in 2.7 of ansible.builtin | **Choices:*** **system** ←
* user
* global
| Run systemctl within a given service manager scope, either as the default system scope `system`, the current user's scope `user`, or the scope of all users `global`. For systemd to work with 'user', the executing user must have its own instance of dbus started and accessible (systemd requirement). The user dbus process is normally started during normal login, but not during the run of Ansible tasks. Otherwise you will probably get a 'Failed to connect to bus: no such file or directory' error. The user must have access, normally given via setting the ``XDG\_RUNTIME\_DIR`` variable, see example below. |
| **state** string | **Choices:*** reloaded
* restarted
* started
* stopped
|
`started`/`stopped` are idempotent actions that will not run commands unless necessary. `restarted` will always bounce the unit. `reloaded` will always reload. |
Notes
-----
Note
* Since 2.4, one of the following options is required `state`, `enabled`, `masked`, `daemon_reload`, (`daemon_reexec` since 2.8), and all except `daemon_reload` and (`daemon_reexec` since 2.8) also require `name`.
* Before 2.4 you always required `name`.
* Globs are not supported in name, i.e `postgres*.service`.
* Supports `check_mode`.
Examples
--------
```
- name: Make sure a service unit is running
ansible.builtin.systemd:
state: started
name: httpd
- name: Stop service cron on debian, if running
ansible.builtin.systemd:
name: cron
state: stopped
- name: Restart service cron on centos, in all cases, also issue daemon-reload to pick up config changes
ansible.builtin.systemd:
state: restarted
daemon_reload: yes
name: crond
- name: Reload service httpd, in all cases
ansible.builtin.systemd:
name: httpd.service
state: reloaded
- name: Enable service httpd and ensure it is not masked
ansible.builtin.systemd:
name: httpd
enabled: yes
masked: no
- name: Enable a timer unit for dnf-automatic
ansible.builtin.systemd:
name: dnf-automatic.timer
state: started
enabled: yes
- name: Just force systemd to reread configs (2.4 and above)
ansible.builtin.systemd:
daemon_reload: yes
- name: Just force systemd to re-execute itself (2.8 and above)
ansible.builtin.systemd:
daemon_reexec: yes
- name: Run a user service when XDG_RUNTIME_DIR is not set on remote login
ansible.builtin.systemd:
name: myservice
state: started
scope: user
environment:
XDG_RUNTIME_DIR: "/run/user/{{ myuid }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **status** complex | success | A dictionary with the key=value pairs returned from `systemctl show`. **Sample:** {'ActiveEnterTimestamp': 'Sun 2016-05-15 18:28:49 EDT', 'ActiveEnterTimestampMonotonic': '8135942', 'ActiveExitTimestampMonotonic': '0', 'ActiveState': 'active', 'After': 'auditd.service systemd-user-sessions.service time-sync.target systemd-journald.socket basic.target system.slice', 'AllowIsolate': 'no', 'Before': 'shutdown.target multi-user.target', 'BlockIOAccounting': 'no', 'BlockIOWeight': '1000', 'CPUAccounting': 'no', 'CPUSchedulingPolicy': '0', 'CPUSchedulingPriority': '0', 'CPUSchedulingResetOnFork': 'no', 'CPUShares': '1024', 'CanIsolate': 'no', 'CanReload': 'yes', 'CanStart': 'yes', 'CanStop': 'yes', 'CapabilityBoundingSet': '18446744073709551615', 'ConditionResult': 'yes', 'ConditionTimestamp': 'Sun 2016-05-15 18:28:49 EDT', 'ConditionTimestampMonotonic': '7902742', 'Conflicts': 'shutdown.target', 'ControlGroup': '/system.slice/crond.service', 'ControlPID': '0', 'DefaultDependencies': 'yes', 'Delegate': 'no', 'Description': 'Command Scheduler', 'DevicePolicy': 'auto', 'EnvironmentFile': '/etc/sysconfig/crond (ignore\_errors=no)', 'ExecMainCode': '0', 'ExecMainExitTimestampMonotonic': '0', 'ExecMainPID': '595', 'ExecMainStartTimestamp': 'Sun 2016-05-15 18:28:49 EDT', 'ExecMainStartTimestampMonotonic': '8134990', 'ExecMainStatus': '0', 'ExecReload': '{ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; ignore\_errors=no ; start\_time=[n/a] ; stop\_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }', 'ExecStart': '{ path=/usr/sbin/crond ; argv[]=/usr/sbin/crond -n $CRONDARGS ; ignore\_errors=no ; start\_time=[n/a] ; stop\_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }', 'FragmentPath': '/usr/lib/systemd/system/crond.service', 'GuessMainPID': 'yes', 'IOScheduling': '0', 'Id': 'crond.service', 'IgnoreOnIsolate': 'no', 'IgnoreOnSnapshot': 'no', 'IgnoreSIGPIPE': 'yes', 'InactiveEnterTimestampMonotonic': '0', 'InactiveExitTimestamp': 'Sun 2016-05-15 18:28:49 EDT', 'InactiveExitTimestampMonotonic': '8135942', 'JobTimeoutUSec': '0', 'KillMode': 'process', 'KillSignal': '15', 'LimitAS': '18446744073709551615', 'LimitCORE': '18446744073709551615', 'LimitCPU': '18446744073709551615', 'LimitDATA': '18446744073709551615', 'LimitFSIZE': '18446744073709551615', 'LimitLOCKS': '18446744073709551615', 'LimitMEMLOCK': '65536', 'LimitMSGQUEUE': '819200', 'LimitNICE': '0', 'LimitNOFILE': '4096', 'LimitNPROC': '3902', 'LimitRSS': '18446744073709551615', 'LimitRTPRIO': '0', 'LimitRTTIME': '18446744073709551615', 'LimitSIGPENDING': '3902', 'LimitSTACK': '18446744073709551615', 'LoadState': 'loaded', 'MainPID': '595', 'MemoryAccounting': 'no', 'MemoryLimit': '18446744073709551615', 'MountFlags': '0', 'Names': 'crond.service', 'NeedDaemonReload': 'no', 'Nice': '0', 'NoNewPrivileges': 'no', 'NonBlocking': 'no', 'NotifyAccess': 'none', 'OOMScoreAdjust': '0', 'OnFailureIsolate': 'no', 'PermissionsStartOnly': 'no', 'PrivateNetwork': 'no', 'PrivateTmp': 'no', 'RefuseManualStart': 'no', 'RefuseManualStop': 'no', 'RemainAfterExit': 'no', 'Requires': 'basic.target', 'Restart': 'no', 'RestartUSec': '100ms', 'Result': 'success', 'RootDirectoryStartOnly': 'no', 'SameProcessGroup': 'no', 'SecureBits': '0', 'SendSIGHUP': 'no', 'SendSIGKILL': 'yes', 'Slice': 'system.slice', 'StandardError': 'inherit', 'StandardInput': 'null', 'StandardOutput': 'journal', 'StartLimitAction': 'none', 'StartLimitBurst': '5', 'StartLimitInterval': '10000000', 'StatusErrno': '0', 'StopWhenUnneeded': 'no', 'SubState': 'running', 'SyslogLevelPrefix': 'yes', 'SyslogPriority': '30', 'TTYReset': 'no', 'TTYVHangup': 'no', 'TTYVTDisallocate': 'no', 'TimeoutStartUSec': '1min 30s', 'TimeoutStopUSec': '1min 30s', 'TimerSlackNSec': '50000', 'Transient': 'no', 'Type': 'simple', 'UMask': '0022', 'UnitFileState': 'enabled', 'WantedBy': 'multi-user.target', 'Wants': 'system.slice', 'WatchdogTimestampMonotonic': '0', 'WatchdogUSec': '0'} |
### Authors
* Ansible Core Team
ansible ansible.builtin.free – Executes tasks without waiting for all hosts ansible.builtin.free – Executes tasks without waiting for all hosts
===================================================================
Note
This strategy plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `free` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same strategy plugin name.
New in version 2.0: of ansible.builtin
Synopsis
--------
* Task execution is as fast as possible per batch as defined by `serial` (default all). Ansible will not wait for other hosts to finish the current task before queuing more tasks for other hosts. All hosts are still attempted for the current task, but it prevents blocking new tasks for hosts that have already finished.
* With the free strategy, unlike the default linear strategy, a host that is slow or stuck on a specific task won’t hold up the rest of the hosts and tasks.
### Authors
* Ansible Core Team
ansible ansible.builtin.add_host – Add a host (and alternatively a group) to the ansible-playbook in-memory inventory ansible.builtin.add\_host – Add a host (and alternatively a group) to the ansible-playbook in-memory inventory
==============================================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `add_host` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Use variables to create new hosts and groups in inventory for use in later plays of the same playbook.
* Takes variables so you can define the new hosts more fully.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **groups** list / elements=string | | The groups to add the hostname to.
aliases: group, groupname |
| **name** string / required | | The hostname/ip of the host to add to the inventory, can include a colon and a port number.
aliases: host, hostname |
Notes
-----
Note
* This module bypasses the play host loop and only runs once for all the hosts in the play, if you need it to iterate use a `loop` construct. If you need to dynamically add all hosts targeted by a playbook for later use, the `group_by` module is potentially a better choice.
* The alias `host` of the parameter `name` is only available on Ansible 2.4 and newer.
* Since Ansible 2.4, the `inventory_dir` variable is now set to `None` instead of the ‘global inventory source’, because you can now have multiple sources. An example was added that shows how to partially restore the previous behaviour.
* Windows targets are supported by this module.
* Though this module does not change the remote host, we do provide ‘changed’ status as it can be useful for those trying to track inventory changes.
See Also
--------
See also
[ansible.builtin.group\_by](group_by_module#ansible-collections-ansible-builtin-group-by-module)
The official documentation on the **ansible.builtin.group\_by** module.
Examples
--------
```
- name: Add host to group 'just_created' with variable foo=42
add_host:
name: '{{ ip_from_ec2 }}'
groups: just_created
foo: 42
- name: Add host to multiple groups
add_host:
hostname: '{{ new_ip }}'
groups:
- group1
- group2
- name: Add a host with a non-standard port local to your machines
add_host:
name: '{{ new_ip }}:{{ new_port }}'
- name: Add a host alias that we reach through a tunnel (Ansible 1.9 and older)
add_host:
hostname: '{{ new_ip }}'
ansible_ssh_host: '{{ inventory_hostname }}'
ansible_ssh_port: '{{ new_port }}'
- name: Add a host alias that we reach through a tunnel (Ansible 2.0 and newer)
add_host:
hostname: '{{ new_ip }}'
ansible_host: '{{ inventory_hostname }}'
ansible_port: '{{ new_port }}'
- name: Ensure inventory vars are set to the same value as the inventory_hostname has (close to pre Ansible 2.4 behaviour)
add_host:
hostname: charlie
inventory_dir: '{{ inventory_dir }}'
- name: Add all hosts running this playbook to the done group
add_host:
name: '{{ item }}'
groups: done
loop: "{{ ansible_play_hosts }}"
```
### Authors
* Ansible Core Team
* Seth Vidal (@skvidal)
| programming_docs |
ansible ansible.builtin.import_role – Import a role into a play ansible.builtin.import\_role – Import a role into a play
========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `import_role` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Much like the `roles:` keyword, this task loads a role, but it allows you to control when the role tasks run in between other tasks of the play.
* Most keywords, loops and conditionals will only be applied to the imported tasks, not to this statement itself. If you want the opposite behavior, use [ansible.builtin.include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module) instead.
* Does not work in handlers.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_duplicates** boolean | **Choices:*** no
* **yes** ←
| Overrides the role's metadata setting to allow using a role more than once with the same parameters. |
| **defaults\_from** string | **Default:**"main" | File to load from a role's `defaults/` directory. |
| **handlers\_from** string added in 2.8 of ansible.builtin | **Default:**"main" | File to load from a role's `handlers/` directory. |
| **name** string / required | | The name of the role to be executed. |
| **rolespec\_validate** boolean added in 2.11 of ansible.builtin | **Choices:*** no
* **yes** ←
| Perform role argument spec validation if an argument spec is defined. |
| **tasks\_from** string | **Default:**"main" | File to load from a role's `tasks/` directory. |
| **vars\_from** string | **Default:**"main" | File to load from a role's `vars/` directory. |
Notes
-----
Note
* Handlers are made available to the whole play.
* Since Ansible 2.7 variables defined in `vars` and `defaults` for the role are exposed to the play at playbook parsing time. Due to this, these variables will be accessible to roles and tasks executed before the location of the [ansible.builtin.import\_role](#ansible-collections-ansible-builtin-import-role-module) task.
* Unlike [ansible.builtin.include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module) variable exposure is not configurable, and will always be exposed.
See Also
--------
See also
[ansible.builtin.import\_playbook](import_playbook_module#ansible-collections-ansible-builtin-import-playbook-module)
The official documentation on the **ansible.builtin.import\_playbook** module.
[ansible.builtin.import\_tasks](import_tasks_module#ansible-collections-ansible-builtin-import-tasks-module)
The official documentation on the **ansible.builtin.import\_tasks** module.
[ansible.builtin.include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module)
The official documentation on the **ansible.builtin.include\_role** module.
[ansible.builtin.include\_tasks](include_tasks_module#ansible-collections-ansible-builtin-include-tasks-module)
The official documentation on the **ansible.builtin.include\_tasks** module.
[Including and importing](../../../user_guide/playbooks_reuse_includes#playbooks-reuse-includes)
More information related to including and importing playbooks, roles and tasks.
Examples
--------
```
- hosts: all
tasks:
- import_role:
name: myrole
- name: Run tasks/other.yaml instead of 'main'
import_role:
name: myrole
tasks_from: other
- name: Pass variables to role
import_role:
name: myrole
vars:
rolevar1: value from task
- name: Apply condition to each task in role
import_role:
name: myrole
when: not idontwanttorun
```
### Authors
* Ansible Core Team (@ansible)
ansible ansible.builtin.host_pinned – Executes tasks on each host without interruption ansible.builtin.host\_pinned – Executes tasks on each host without interruption
===============================================================================
Note
This strategy plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `host_pinned` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same strategy plugin name.
New in version 2.7: of ansible.builtin
Synopsis
--------
* Task execution is as fast as possible per host in batch as defined by `serial` (default all). Ansible will not start a play for a host unless the play can be finished without interruption by tasks for another host, i.e. the number of hosts with an active play does not exceed the number of forks. Ansible will not wait for other hosts to finish the current task before queuing the next task for a host that has finished. Once a host is done with the play, it opens it’s slot to a new host that was waiting to start. Other than that, it behaves just like the “free” strategy.
### Authors
* Ansible Core Team
ansible ansible.builtin.yum_repository – Add or remove YUM repositories ansible.builtin.yum\_repository – Add or remove YUM repositories
================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `yum_repository` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.1: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Add or remove YUM repositories in RPM-based Linux distributions.
* If you wish to update an existing repository definition use [community.general.ini\_file](../../community/general/ini_file_module#ansible-collections-community-general-ini-file-module) instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **async** boolean | **Choices:*** no
* **yes** ←
| If set to `yes` Yum will download packages and metadata from this repo in parallel, if possible. |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **bandwidth** string | **Default:**0 | Maximum available network bandwidth in bytes/second. Used with the *throttle* option. If *throttle* is a percentage and bandwidth is `0` then bandwidth throttling will be disabled. If *throttle* is expressed as a data rate (bytes/sec) then this option is ignored. Default is `0` (no bandwidth throttling). |
| **baseurl** list / elements=string | | URL to the directory where the yum repository's 'repodata' directory lives. It can also be a list of multiple URLs. This, the *metalink* or *mirrorlist* parameters are required if *state* is set to `present`. |
| **cost** string | **Default:**1000 | Relative cost of accessing this repository. Useful for weighing one repo's packages as greater/less than any other. |
| **deltarpm\_metadata\_percentage** string | **Default:**100 | When the relative size of deltarpm metadata vs pkgs is larger than this, deltarpm metadata is not downloaded from the repo. Note that you can give values over `100`, so `200` means that the metadata is required to be half the size of the packages. Use `0` to turn off this check, and always download metadata. |
| **deltarpm\_percentage** string | **Default:**75 | When the relative size of delta vs pkg is larger than this, delta is not used. Use `0` to turn off delta rpm processing. Local repositories (with file:// *baseurl*) have delta rpms turned off by default. |
| **description** string | | A human readable string describing the repository. This option corresponds to the "name" property in the repo file. This parameter is only required if *state* is set to `present`. |
| **enabled** boolean | **Choices:*** no
* yes
| This tells yum whether or not use this repository. Yum default value is `true`. |
| **enablegroups** boolean | **Choices:*** no
* yes
| Determines whether yum will allow the use of package groups for this repository. Yum default value is `true`. |
| **exclude** list / elements=string | | List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. `*` and `?`) are allowed. The list can also be a regular YAML array. |
| **failovermethod** string | **Choices:*** **roundrobin** ←
* priority
|
`roundrobin` randomly selects a URL out of the list of URLs to start with and proceeds through each of them as it encounters a failure contacting the host.
`priority` starts from the first *baseurl* listed and reads through them sequentially. |
| **file** string | | File name without the `.repo` extension to save the repo in. Defaults to the value of *name*. |
| **gpgcakey** string | | A URL pointing to the ASCII-armored CA key file for the repository. |
| **gpgcheck** boolean | **Choices:*** no
* yes
| Tells yum whether or not it should perform a GPG signature check on packages. No default setting. If the value is not set, the system setting from `/etc/yum.conf` or system default of `no` will be used. |
| **gpgkey** list / elements=string | | A URL pointing to the ASCII-armored GPG key file for the repository. It can also be a list of multiple URLs. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **http\_caching** string | **Choices:*** **all** ←
* packages
* none
| Determines how upstream HTTP caches are instructed to handle any HTTP downloads that Yum does.
`all` means that all HTTP downloads should be cached.
`packages` means that only RPM package downloads should be cached (but not repository metadata downloads).
`none` means that no HTTP downloads should be cached. |
| **include** string | | Include external configuration file. Both, local path and URL is supported. Configuration file will be inserted at the position of the *include=* line. Included files may contain further include lines. Yum will abort with an error if an inclusion loop is detected. |
| **includepkgs** list / elements=string | | List of packages you want to only use from a repository. This should be a space separated list. Shell globs using wildcards (eg. `*` and `?`) are allowed. Substitution variables (e.g. `$releasever`) are honored here. The list can also be a regular YAML array. |
| **ip\_resolve** string | **Choices:*** 4
* 6
* IPv4
* IPv6
* **whatever** ←
| Determines how yum resolves host names.
`4` or `IPv4` - resolve to IPv4 addresses only.
`6` or `IPv6` - resolve to IPv6 addresses only. |
| **keepalive** boolean | **Choices:*** **no** ←
* yes
| This tells yum whether or not HTTP/1.1 keepalive should be used with this repository. This can improve transfer speeds by using one connection when downloading multiple files from a repository. |
| **keepcache** string | **Choices:*** 0
* **1** ←
| Either `1` or `0`. Determines whether or not yum keeps the cache of headers and packages after successful installation. |
| **metadata\_expire** string | **Default:**21600 | Time (in seconds) after which the metadata will expire. Default value is 6 hours. |
| **metadata\_expire\_filter** string | **Choices:*** never
* read-only:past
* **read-only:present** ←
* read-only:future
| Filter the *metadata\_expire* time, allowing a trade of speed for accuracy if a command doesn't require it. Each yum command can specify that it requires a certain level of timeliness quality from the remote repos. from "I'm about to install/upgrade, so this better be current" to "Anything that's available is good enough".
`never` - Nothing is filtered, always obey *metadata\_expire*.
`read-only:past` - Commands that only care about past information are filtered from metadata expiring. Eg. *yum history* info (if history needs to lookup anything about a previous transaction, then by definition the remote package was available in the past).
`read-only:present` - Commands that are balanced between past and future. Eg. *yum list yum*.
`read-only:future` - Commands that are likely to result in running other commands which will require the latest metadata. Eg. *yum check-update*. Note that this option does not override "yum clean expire-cache". |
| **metalink** string | | Specifies a URL to a metalink file for the repomd.xml, a list of mirrors for the entire repository are generated by converting the mirrors for the repomd.xml file to a *baseurl*. This, the *baseurl* or *mirrorlist* parameters are required if *state* is set to `present`. |
| **mirrorlist** string | | Specifies a URL to a file containing a list of baseurls. This, the *baseurl* or *metalink* parameters are required if *state* is set to `present`. |
| **mirrorlist\_expire** string | **Default:**21600 | Time (in seconds) after which the mirrorlist locally cached will expire. Default value is 6 hours. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **module\_hotfixes** boolean added in 2.11 of ansible.builtin | **Choices:*** no
* yes
| Disable module RPM filtering and make all RPMs from the repository available. The default is `None`. |
| **name** string / required | | Unique repository ID. This option builds the section name of the repository in the repo file. This parameter is only required if *state* is set to `present` or `absent`. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **password** string | | Password to use with the username for basic authentication. |
| **priority** string | **Default:**99 | Enforce ordered protection of repositories. The value is an integer from 1 to 99. This option only works if the YUM Priorities plugin is installed. |
| **protect** boolean | **Choices:*** **no** ←
* yes
| Protect packages from updates from other repositories. |
| **proxy** string | | URL to the proxy server that yum should use. Set to `_none_` to disable the global proxy setting. |
| **proxy\_password** string | | Password for this proxy. |
| **proxy\_username** string | | Username to use for proxy. |
| **repo\_gpgcheck** boolean | **Choices:*** **no** ←
* yes
| This tells yum whether or not it should perform a GPG signature check on the repodata from this repository. |
| **reposdir** path | **Default:**"/etc/yum.repos.d" | Directory where the `.repo` files will be stored. |
| **retries** string | **Default:**10 | Set the number of times any attempt to retrieve a file should retry before returning an error. Setting this to `0` makes yum try forever. |
| **s3\_enabled** boolean | **Choices:*** **no** ←
* yes
| Enables support for S3 repositories. This option only works if the YUM S3 plugin is installed. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **skip\_if\_unavailable** boolean | **Choices:*** **no** ←
* yes
| If set to `yes` yum will continue running if this repository cannot be contacted for any reason. This should be set carefully as all repos are consulted for any given command. |
| **ssl\_check\_cert\_permissions** boolean | **Choices:*** **no** ←
* yes
| Whether yum should check the permissions on the paths for the certificates on the repository (both remote and local). If we can't read any of the files then yum will force *skip\_if\_unavailable* to be `yes`. This is most useful for non-root processes which use yum on repos that have client cert files which are readable only by root. |
| **sslcacert** string | | Path to the directory containing the databases of the certificate authorities yum should use to verify SSL certificates.
aliases: ca\_cert |
| **sslclientcert** string | | Path to the SSL client certificate yum should use to connect to repos/remote sites.
aliases: client\_cert |
| **sslclientkey** string | | Path to the SSL client key yum should use to connect to repos/remote sites.
aliases: client\_key |
| **sslverify** boolean | **Choices:*** no
* **yes** ←
| Defines whether yum should verify SSL certificates/hosts at all.
aliases: validate\_certs |
| **state** string | **Choices:*** absent
* **present** ←
| State of the repo file. |
| **throttle** string | | Enable bandwidth throttling for downloads. This option can be expressed as a absolute data rate in bytes/sec. An SI prefix (k, M or G) may be appended to the bandwidth value. |
| **timeout** string | **Default:**30 | Number of seconds to wait for a connection before timing out. |
| **ui\_repoid\_vars** string | **Default:**"releasever basearch" | When a repository id is displayed, append these yum variables to the string if they are used in the *baseurl*/etc. Variables are appended in the order listed (and found). |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **username** string | | Username to use for basic authentication to a repo or really any url. |
Notes
-----
Note
* All comments will be removed if modifying an existing repo file.
* Section order is preserved in an existing repo file.
* Parameters in a section are ordered alphabetically in an existing repo file.
* The repo file will be automatically deleted if it contains no repository.
* When removing a repository, beware that the metadata cache may still remain on disk until you run `yum clean all`. Use a notification handler for this.
* The `params` parameter was removed in Ansible 2.5 due to circumventing Ansible’s parameter handling
Examples
--------
```
- name: Add repository
yum_repository:
name: epel
description: EPEL YUM repo
baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/
- name: Add multiple repositories into the same file (1/2)
yum_repository:
name: epel
description: EPEL YUM repo
file: external_repos
baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/
gpgcheck: no
- name: Add multiple repositories into the same file (2/2)
yum_repository:
name: rpmforge
description: RPMforge YUM repo
file: external_repos
baseurl: http://apt.sw.be/redhat/el7/en/$basearch/rpmforge
mirrorlist: http://mirrorlist.repoforge.org/el7/mirrors-rpmforge
enabled: no
# Handler showing how to clean yum metadata cache
- name: yum-clean-metadata
command: yum clean metadata
args:
warn: no
# Example removing a repository and cleaning up metadata cache
- name: Remove repository (and clean up left-over metadata)
yum_repository:
name: epel
state: absent
notify: yum-clean-metadata
- name: Remove repository from a specific repo file
yum_repository:
name: epel
file: external_repos
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **repo** string | success | repository name **Sample:** epel |
| **state** string | success | state of the target, after execution **Sample:** present |
### Authors
* Jiri Tyr (@jtyr)
| programming_docs |
ansible ansible.builtin.package – Generic OS package manager ansible.builtin.package – Generic OS package manager
====================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `package` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This modules manages packages on a target without specifying a package manager module (like [ansible.builtin.yum](yum_module#ansible-collections-ansible-builtin-yum-module), [ansible.builtin.apt](apt_module#ansible-collections-ansible-builtin-apt-module), …). It is convenient to use in an heterogeneous environment of machines without having to create a specific task for each package manager. `package` calls behind the module for the package manager used by the operating system discovered by the module [ansible.builtin.setup](setup_module#ansible-collections-ansible-builtin-setup-module). If `setup` was not yet run, `package` will run it.
* This module acts as a proxy to the underlying package manager module. While all arguments will be passed to the underlying module, not all modules support the same arguments. This documentation only covers the minimum intersection of module arguments that all packaging modules support.
* For Windows targets, use the [ansible.windows.win\_package](../windows/win_package_module#ansible-collections-ansible-windows-win-package-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* Whatever is required for the package plugins specific for each system.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Package name, or package specifier with version. Syntax varies with package manager. For example `name-1.0` or `name=1.0`. Package names also vary with package manager; this module will not "translate" them per distro. For example `libyaml-dev`, `libyaml-devel`. |
| **state** string / required | | Whether to install (`present`), or remove (`absent`) a package. You can use other states like `latest` ONLY if they are supported by the underlying package module(s) executed. |
| **use** string | **Default:**"auto" | The required package manager module to use (`yum`, `apt`, and so on). The default 'auto' will use existing facts or try to autodetect it. You should only use this field if the automatic selection is not working for some reason. |
Notes
-----
Note
* While `package` abstracts package managers to ease dealing with multiple distributions, package name often differs for the same software.
Examples
--------
```
- name: Install ntpdate
ansible.builtin.package:
name: ntpdate
state: present
# This uses a variable as this changes per distribution.
- name: Remove the apache package
ansible.builtin.package:
name: "{{ apache }}"
state: absent
- name: Install the latest version of Apache and MariaDB
ansible.builtin.package:
name:
- httpd
- mariadb-server
state: latest
```
### Authors
* Ansible Core Team
ansible ansible.builtin.runas – Run As user ansible.builtin.runas – Run As user
===================================
Note
This become plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `runas` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same become plugin name.
New in version 2.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
Synopsis
--------
* This become plugins allows your remote/login user to execute commands as another user via the windows runas facility.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **become\_flags** string | **Default:**"" | ini entries: [privilege\_escalation]become\_flags = [runas\_become\_plugin]flags = env:ANSIBLE\_BECOME\_FLAGS env:ANSIBLE\_RUNAS\_FLAGS var: ansible\_become\_flags var: ansible\_runas\_flags | Options to pass to runas, a space delimited list of k=v pairs |
| **become\_pass** string | | ini entries: [runas\_become\_plugin]password = None env:ANSIBLE\_BECOME\_PASS env:ANSIBLE\_RUNAS\_PASS var: ansible\_become\_password var: ansible\_become\_pass var: ansible\_runas\_pass | password |
| **become\_user** string / required | | ini entries: [privilege\_escalation]become\_user = None [runas\_become\_plugin]user = None env:ANSIBLE\_BECOME\_USER env:ANSIBLE\_RUNAS\_USER var: ansible\_become\_user var: ansible\_runas\_user | User you 'become' to execute the task |
Notes
-----
Note
* runas is really implemented in the powershell module handler and as such can only be used with winrm connections.
* This plugin ignores the ‘become\_exe’ setting as it uses an API and not an executable.
* The Secondary Logon service (seclogon) must be running to use runas
### Authors
* ansible (@core)
ansible ansible.builtin.sequence – generate a list based on a number sequence ansible.builtin.sequence – generate a list based on a number sequence
=====================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `sequence` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* generates a sequence of items. You can specify a start value, an end value, an optional “stride” value that specifies the number of steps to increment the sequence, and an optional printf-style format string.
* Arguments can be specified as key=value pair strings or as a shortcut form of the arguments string is also accepted: [start-]end[/stride][:format].
* Numerical values can be specified in decimal, hexadecimal (0x3f8) or octal (0600).
* Starting at version 1.9.2, negative strides are allowed.
* Generated items are strings. Use Jinja2 filters to convert items to preferred type, e.g. `{{ 1 + item|int }}`.
* See also Jinja2 `range` filter as an alternative.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **count** integer | **Default:**0 | | number of elements in the sequence, this is not to be used with end |
| **end** integer | **Default:**0 | | number at which to end the sequence, dont use this with count |
| **format** string | | | return a string with the generated number formatted in |
| **start** integer | **Default:**0 | | number at which to start the sequence |
| **stride** integer | | | increments between sequence numbers, the default is 1 unless the end is less than the start, then it is -1. |
Examples
--------
```
- name: create some test users
user:
name: "{{ item }}"
state: present
groups: "evens"
with_sequence: start=0 end=32 format=testuser%02x
- name: create a series of directories with even numbers for some reason
file:
dest: "/var/stuff/{{ item }}"
state: directory
with_sequence: start=4 end=16 stride=2
- name: a simpler way to use the sequence plugin create 4 groups
group:
name: "group{{ item }}"
state: present
with_sequence: count=4
- name: the final countdown
debug:
msg: "{{item}} seconds to detonation"
with_sequence: start=10 end=0 stride=-1
- name: Use of variable
debug:
msg: "{{ item }}"
with_sequence: start=1 end="{{ end_at }}"
vars:
- end_at: 10
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=string | success | A list containing generated sequence of items |
### Authors
* Jayson Vantuyl (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#503a3129233f3e767363676b767365626b767364686b31373722352323392635767364666b3c29)>
ansible ansible.builtin.rpm_key – Adds or removes a gpg key from the rpm db ansible.builtin.rpm\_key – Adds or removes a gpg key from the rpm db
====================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `rpm_key` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.3: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Adds or removes (rpm –import) a gpg key to your rpm database.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **fingerprint** string added in 2.9 of ansible.builtin | | The long-form fingerprint of the key being imported. This will be used to verify the specified key. |
| **key** string / required | | Key that will be modified. Can be a url, a file on the managed node, or a keyid if the key already exists in the database. |
| **state** string | **Choices:*** absent
* **present** ←
| If the key will be imported or removed from the rpm db. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If `no` and the `key` is a url starting with https, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
- name: Import a key from a url
ansible.builtin.rpm_key:
state: present
key: http://apt.sw.be/RPM-GPG-KEY.dag.txt
- name: Import a key from a file
ansible.builtin.rpm_key:
state: present
key: /path/to/key.gpg
- name: Ensure a key is not present in the db
ansible.builtin.rpm_key:
state: absent
key: DEADB33F
- name: Verify the key, using a fingerprint, before import
ansible.builtin.rpm_key:
key: /path/to/RPM-GPG-KEY.dag.txt
fingerprint: EBC6 E12C 62B1 C734 026B 2122 A20E 5214 6B8D 79E6
```
### Authors
* Hector Acosta (@hacosta) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#31595452455e43171205070a50525e424550171202060a171204030a171205090a56504b4b505f56171205070a525e5c)>
ansible ansible.builtin.powershell – Windows PowerShell ansible.builtin.powershell – Windows PowerShell
===============================================
Note
This shell plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `powershell` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same shell plugin name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* The only option when using ‘winrm’ or ‘psrp’ as a connection plugin.
* Can also be used when using ‘ssh’ as a connection plugin and the `DefaultShell` has been configured to PowerShell.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **async\_dir** string added in 2.8 of ansible.builtin | **Default:**"%USERPROFILE%\\.ansible\_async" | ini entries: [powershell]async\_dir = %USERPROFILE%\.ansible\_async var: ansible\_async\_dir | Directory in which ansible will keep async job information. Before Ansible 2.8, this was set to `remote_tmp + "\.ansible_async"`. |
| **environment** list / elements=string | **Default:**[{}] | | List of dictionaries of environment variables and their values to use when executing commands. |
| **remote\_tmp** string | **Default:**"%TEMP%" | ini entries: [powershell]remote\_tmp = %TEMP% var: ansible\_remote\_tmp | Temporary directory to use on targets when copying files to the host. |
| **set\_module\_language** boolean | **Choices:*** **no** ←
* yes
| | Controls if we set the locale for modules when executing on the target. Windows only supports `no` as an option. |
ansible ansible.builtin.setup – Gathers facts about remote hosts ansible.builtin.setup – Gathers facts about remote hosts
========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `setup` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module is automatically called by playbooks to gather useful variables about remote hosts that can be used in playbooks. It can also be executed directly by `/usr/bin/ansible` to check what variables are available to a host. Ansible provides many *facts* about the system, automatically.
* This module is also supported for Windows targets.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **fact\_path** path added in 1.3 of ansible.builtin | **Default:**"/etc/ansible/facts.d" | Path used for local ansible facts (`*.fact`) - files in this dir will be run (if executable) and their results be added to `ansible_local` facts. If a file is not executable it is read instead. File/results format can be JSON or INI-format. The default `fact_path` can be specified in `ansible.cfg` for when setup is automatically called as part of `gather_facts`. NOTE - For windows clients, the results will be added to a variable named after the local file (without extension suffix), rather than `ansible_local`. Since Ansible 2.1, Windows hosts can use `fact_path`. Make sure that this path exists on the target host. Files in this path MUST be PowerShell scripts `.ps1` which outputs an object. This object will be formatted by Ansible as json so the script should be outputting a raw hashtable, array, or other primitive object. |
| **filter** list / elements=string added in 1.1 of ansible.builtin | **Default:**[] | If supplied, only return facts that match one of the shell-style (fnmatch) pattern. An empty list basically means 'no filter'. As of Ansible 2.11, the type has changed from string to list and the default has became an empty list. A simple string is still accepted and works as a single pattern. The behaviour prior to Ansible 2.11 remains. |
| **gather\_subset** list / elements=string added in 2.1 of ansible.builtin | **Default:**"all" | If supplied, restrict the additional facts collected to the given subset. Possible values: `all`, `min`, `hardware`, `network`, `virtual`, `ohai`, and `facter`. Can specify a list of values to specify a larger subset. Values can also be used with an initial `!` to specify that that specific subset should not be collected. For instance: `!hardware,!network,!virtual,!ohai,!facter`. If `!all` is specified then only the min subset is collected. To avoid collecting even the min subset, specify `!all,!min`. To collect only specific facts, use `!all,!min`, and specify the particular fact subsets. Use the filter parameter if you do not want to display some collected facts. |
| **gather\_timeout** integer added in 2.2 of ansible.builtin | **Default:**10 | Set the default timeout in seconds for individual fact gathering. |
Notes
-----
Note
* More ansible facts will be added with successive releases. If *facter* or *ohai* are installed, variables from these programs will also be snapshotted into the JSON file for usage in templating. These variables are prefixed with `facter_` and `ohai_` so it’s easy to tell their source. All variables are bubbled up to the caller. Using the ansible facts and choosing to not install *facter* and *ohai* means you can avoid Ruby-dependencies on your remote systems. (See also [community.general.facter](../../community/general/facter_module#ansible-collections-community-general-facter-module) and [community.general.ohai](../../community/general/ohai_module#ansible-collections-community-general-ohai-module).)
* The filter option filters only the first level subkey below ansible\_facts.
* If the target host is Windows, you will not currently have the ability to use `filter` as this is provided by a simpler implementation of the module.
* This module is also supported for Windows targets.
* This module should be run with elevated privileges on BSD systems to gather facts like ansible\_product\_version.
* Supports `check_mode`.
* For more information about delegated facts, please check [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_delegation.html#delegating-facts](../../../user_guide/playbooks_delegation#delegating-facts).
Examples
--------
```
# Display facts from all hosts and store them indexed by I(hostname) at C(/tmp/facts).
# ansible all -m ansible.builtin.setup --tree /tmp/facts
# Display only facts regarding memory found by ansible on all hosts and output them.
# ansible all -m ansible.builtin.setup -a 'filter=ansible_*_mb'
# Display only facts returned by facter.
# ansible all -m ansible.builtin.setup -a 'filter=facter_*'
# Collect only facts returned by facter.
# ansible all -m ansible.builtin.setup -a 'gather_subset=!all,!any,facter'
- name: Collect only facts returned by facter
ansible.builtin.setup:
gather_subset:
- '!all'
- '!any'
- facter
- name: Collect only selected facts
ansible.builtin.setup:
filter:
- 'ansible_distribution'
- 'ansible_machine_id'
- 'ansible_*_mb'
# Display only facts about certain interfaces.
# ansible all -m ansible.builtin.setup -a 'filter=ansible_eth[0-2]'
# Restrict additional gathered facts to network and virtual (includes default minimum facts)
# ansible all -m ansible.builtin.setup -a 'gather_subset=network,virtual'
# Collect only network and virtual (excludes default minimum facts)
# ansible all -m ansible.builtin.setup -a 'gather_subset=!all,!any,network,virtual'
# Do not call puppet facter or ohai even if present.
# ansible all -m ansible.builtin.setup -a 'gather_subset=!facter,!ohai'
# Only collect the default minimum amount of facts:
# ansible all -m ansible.builtin.setup -a 'gather_subset=!all'
# Collect no facts, even the default minimum subset of facts:
# ansible all -m ansible.builtin.setup -a 'gather_subset=!all,!min'
# Display facts from Windows hosts with custom facts stored in C(C:\custom_facts).
# ansible windows -m ansible.builtin.setup -a "fact_path='c:\custom_facts'"
# Gathers facts for the machines in the dbservers group (a.k.a Delegating facts)
- hosts: app_servers
tasks:
- name: Gather facts from db servers
ansible.builtin.setup:
delegate_to: "{{ item }}"
delegate_facts: true
loop: "{{ groups['dbservers'] }}"
```
### Authors
* Ansible Core Team
* Michael DeHaan
| programming_docs |
ansible ansible.builtin.apt_repository – Add and remove APT repositories ansible.builtin.apt\_repository – Add and remove APT repositories
=================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `apt_repository` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.7: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Add or remove an APT repositories in Ubuntu and Debian.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python-apt (python 2)
* python3-apt (python 3)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **codename** string added in 2.3 of ansible.builtin | | Override the distribution codename to use for PPA repositories. Should usually only be set when working with a PPA on a non-Ubuntu target (for example, Debian or Mint). |
| **filename** string added in 2.1 of ansible.builtin | | Sets the name of the source list file in sources.list.d. Defaults to a file name based on the repository source url. The .list extension will be automatically added. |
| **install\_python\_apt** boolean | **Choices:*** no
* **yes** ←
| Whether to automatically try to install the Python apt library or not, if it is not already installed. Without this library, the module does not work. Runs `apt-get install python-apt` for Python 2, and `apt-get install python3-apt` for Python 3. Only works with the system Python 2 or Python 3. If you are using a Python on the remote that is not the system Python, set *install\_python\_apt=false* and ensure that the Python apt library for your Python version is installed some other way. |
| **mode** raw added in 1.6 of ansible.builtin | | The octal mode for newly created files in sources.list.d. Default is what system uses (probably 0644). |
| **repo** string / required | | A source string for the repository. |
| **state** string | **Choices:*** absent
* **present** ←
| A source string state. |
| **update\_cache** boolean | **Choices:*** no
* **yes** ←
| Run the equivalent of `apt-get update` when a change occurs. Cache updates are run after making changes.
aliases: update-cache |
| **update\_cache\_retries** integer added in 2.10 of ansible.builtin | **Default:**5 | Amount of retries if the cache update fails. Also see *update\_cache\_retry\_max\_delay*. |
| **update\_cache\_retry\_max\_delay** integer added in 2.10 of ansible.builtin | **Default:**12 | Use an exponential backoff delay for each retry (see *update\_cache\_retries*) up to this max delay in seconds. |
| **validate\_certs** boolean added in 1.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, SSL certificates for the target repo will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
Notes
-----
Note
* This module works on Debian, Ubuntu and their derivatives.
* This module supports Debian Squeeze (version 6) as well as its successors.
* Supports `check_mode`.
Examples
--------
```
- name: Add specified repository into sources list
ansible.builtin.apt_repository:
repo: deb http://archive.canonical.com/ubuntu hardy partner
state: present
- name: Add specified repository into sources list using specified filename
ansible.builtin.apt_repository:
repo: deb http://dl.google.com/linux/chrome/deb/ stable main
state: present
filename: google-chrome
- name: Add source repository into sources list
ansible.builtin.apt_repository:
repo: deb-src http://archive.canonical.com/ubuntu hardy partner
state: present
- name: Remove specified repository from sources list
ansible.builtin.apt_repository:
repo: deb http://archive.canonical.com/ubuntu hardy partner
state: absent
- name: Add nginx stable repository from PPA and install its signing key on Ubuntu target
ansible.builtin.apt_repository:
repo: ppa:nginx/stable
- name: Add nginx stable repository from PPA and install its signing key on Debian target
ansible.builtin.apt_repository:
repo: 'ppa:nginx/stable'
codename: trusty
```
### Authors
* Alexander Saltanov (@sashka)
ansible ansible.builtin.tree – Save host events to files ansible.builtin.tree – Save host events to files
================================================
Note
This callback plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `tree` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same callback plugin name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
Synopsis
--------
* This callback is used by the Ansible (adhoc) command line option `-t|–tree`
* This produces a JSON dump of events in a directory, a file for each host, the directory used MUST be passed as a command line option.
Requirements
------------
The below requirements are needed on the local controller node that executes this callback.
* invoked in the command line
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **directory** path added in 2.11 of ansible.builtin | **Default:**"~/.ansible/tree" | ini entries: [callback\_tree]directory = ~/.ansible/tree env:ANSIBLE\_CALLBACK\_TREE\_DIR | directory that will contain the per host JSON files. Also set by the ``--tree`` option when using adhoc. |
ansible ansible.builtin.oneline – oneline Ansible screen output ansible.builtin.oneline – oneline Ansible screen output
=======================================================
Note
This callback plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `oneline` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same callback plugin name.
Synopsis
--------
* This is the output callback used by the -o/–one-line command line option.
ansible ansible.builtin.tempfile – Creates temporary files and directories ansible.builtin.tempfile – Creates temporary files and directories
==================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `tempfile` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.3: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The `tempfile` module creates temporary files and directories. `mktemp` command takes different parameters on various systems, this module helps to avoid troubles related to that. Files/directories created by module are accessible only by creator. In case you need to make them world-accessible you need to use [ansible.builtin.file](file_module#ansible-collections-ansible-builtin-file-module) module.
* For Windows targets, use the [ansible.windows.win\_tempfile](../windows/win_tempfile_module#ansible-collections-ansible-windows-win-tempfile-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **path** path | | Location where temporary file or directory should be created. If path is not specified, the default system temporary directory will be used. |
| **prefix** string | **Default:**"ansible." | Prefix of file/directory name created by module. |
| **state** string | **Choices:*** directory
* **file** ←
| Whether to create file or directory. |
| **suffix** string | **Default:**"" | Suffix of file/directory name created by module. |
See Also
--------
See also
[ansible.builtin.file](file_module#ansible-collections-ansible-builtin-file-module)
The official documentation on the **ansible.builtin.file** module.
[ansible.windows.win\_tempfile](../windows/win_tempfile_module#ansible-collections-ansible-windows-win-tempfile-module)
The official documentation on the **ansible.windows.win\_tempfile** module.
Examples
--------
```
- name: Create temporary build directory
ansible.builtin.tempfile:
state: directory
suffix: build
- name: Create temporary file
ansible.builtin.tempfile:
state: file
suffix: temp
register: tempfile_1
- name: Use the registered var and the file module to remove the temporary file
ansible.builtin.file:
path: "{{ tempfile_1.path }}"
state: absent
when: tempfile_1.path is defined
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **path** string | success | Path to created file or directory. **Sample:** /tmp/ansible.bMlvdk |
### Authors
* Krzysztof Magosa (@krzysztof-magosa)
ansible ansible.builtin.ping – Try to connect to host, verify a usable python and return pong on success ansible.builtin.ping – Try to connect to host, verify a usable python and return pong on success
================================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `ping` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* A trivial test module, this module always returns `pong` on successful contact. It does not make sense in playbooks, but it is useful from `/usr/bin/ansible` to verify the ability to login and that a usable Python is configured.
* This is NOT ICMP ping, this is just a trivial test module that requires Python on the remote-node.
* For Windows targets, use the [ansible.windows.win\_ping](../windows/win_ping_module#ansible-collections-ansible-windows-win-ping-module) module instead.
* For Network targets, use the [ansible.netcommon.net\_ping](../netcommon/net_ping_module#ansible-collections-ansible-netcommon-net-ping-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **data** string | **Default:**"pong" | Data to return for the `ping` return value. If this parameter is set to `crash`, the module will cause an exception. |
Notes
-----
Note
* Supports `check_mode`.
See Also
--------
See also
[ansible.netcommon.net\_ping](../netcommon/net_ping_module#ansible-collections-ansible-netcommon-net-ping-module)
The official documentation on the **ansible.netcommon.net\_ping** module.
[ansible.windows.win\_ping](../windows/win_ping_module#ansible-collections-ansible-windows-win-ping-module)
The official documentation on the **ansible.windows.win\_ping** module.
Examples
--------
```
# Test we can logon to 'webservers' and execute python with json lib.
# ansible webservers -m ping
- name: Example from an Ansible Playbook
ansible.builtin.ping:
- name: Induce an exception to see what happens
ansible.builtin.ping:
data: crash
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **ping** string | success | Value provided with the data parameter. **Sample:** pong |
### Authors
* Ansible Core Team
* Michael DeHaan
ansible Ansible.Builtin Ansible.Builtin
===============
Collection version 2.11.6.post0
Plugin Index
------------
These are the plugins in the ansible.builtin collection
### Become Plugins
* [runas](runas_become#ansible-collections-ansible-builtin-runas-become) – Run As user
* [su](su_become#ansible-collections-ansible-builtin-su-become) – Substitute User
* [sudo](sudo_become#ansible-collections-ansible-builtin-sudo-become) – Substitute User DO
### Cache Plugins
* [jsonfile](jsonfile_cache#ansible-collections-ansible-builtin-jsonfile-cache) – JSON formatted files.
* [memory](memory_cache#ansible-collections-ansible-builtin-memory-cache) – RAM backed, non persistent
### Callback Plugins
* [default](default_callback#ansible-collections-ansible-builtin-default-callback) – default Ansible screen output
* [junit](junit_callback#ansible-collections-ansible-builtin-junit-callback) – write playbook output to a JUnit file.
* [minimal](minimal_callback#ansible-collections-ansible-builtin-minimal-callback) – minimal Ansible screen output
* [oneline](oneline_callback#ansible-collections-ansible-builtin-oneline-callback) – oneline Ansible screen output
* [tree](tree_callback#ansible-collections-ansible-builtin-tree-callback) – Save host events to files
### Connection Plugins
* [local](local_connection#ansible-collections-ansible-builtin-local-connection) – execute on controller
* [paramiko\_ssh](paramiko_ssh_connection#ansible-collections-ansible-builtin-paramiko-ssh-connection) – Run tasks via python ssh (paramiko)
* [psrp](psrp_connection#ansible-collections-ansible-builtin-psrp-connection) – Run tasks over Microsoft PowerShell Remoting Protocol
* [ssh](ssh_connection#ansible-collections-ansible-builtin-ssh-connection) – connect via ssh client binary
* [winrm](winrm_connection#ansible-collections-ansible-builtin-winrm-connection) – Run tasks over Microsoft’s WinRM
### Inventory Plugins
* [advanced\_host\_list](advanced_host_list_inventory#ansible-collections-ansible-builtin-advanced-host-list-inventory) – Parses a ‘host list’ with ranges
* [auto](auto_inventory#ansible-collections-ansible-builtin-auto-inventory) – Loads and executes an inventory plugin specified in a YAML config
* [constructed](constructed_inventory#ansible-collections-ansible-builtin-constructed-inventory) – Uses Jinja2 to construct vars and groups based on existing inventory.
* [generator](generator_inventory#ansible-collections-ansible-builtin-generator-inventory) – Uses Jinja2 to construct hosts and groups from patterns
* [host\_list](host_list_inventory#ansible-collections-ansible-builtin-host-list-inventory) – Parses a ‘host list’ string
* [ini](ini_inventory#ansible-collections-ansible-builtin-ini-inventory) – Uses an Ansible INI file as inventory source.
* [script](script_inventory#ansible-collections-ansible-builtin-script-inventory) – Executes an inventory script that returns JSON
* [toml](toml_inventory#ansible-collections-ansible-builtin-toml-inventory) – Uses a specific TOML file as an inventory source.
* [yaml](yaml_inventory#ansible-collections-ansible-builtin-yaml-inventory) – Uses a specific YAML file as an inventory source.
### Lookup Plugins
* [config](config_lookup#ansible-collections-ansible-builtin-config-lookup) – Lookup current Ansible configuration values
* [csvfile](csvfile_lookup#ansible-collections-ansible-builtin-csvfile-lookup) – read data from a TSV or CSV file
* [dict](dict_lookup#ansible-collections-ansible-builtin-dict-lookup) – returns key/value pair items from dictionaries
* [env](env_lookup#ansible-collections-ansible-builtin-env-lookup) – Read the value of environment variables
* [file](file_lookup#ansible-collections-ansible-builtin-file-lookup) – read file contents
* [fileglob](fileglob_lookup#ansible-collections-ansible-builtin-fileglob-lookup) – list files matching a pattern
* [first\_found](first_found_lookup#ansible-collections-ansible-builtin-first-found-lookup) – return first file found from list
* [indexed\_items](indexed_items_lookup#ansible-collections-ansible-builtin-indexed-items-lookup) – rewrites lists to return ‘indexed items’
* [ini](ini_lookup#ansible-collections-ansible-builtin-ini-lookup) – read data from a ini file
* [inventory\_hostnames](inventory_hostnames_lookup#ansible-collections-ansible-builtin-inventory-hostnames-lookup) – list of inventory hosts matching a host pattern
* [items](items_lookup#ansible-collections-ansible-builtin-items-lookup) – list of items
* [lines](lines_lookup#ansible-collections-ansible-builtin-lines-lookup) – read lines from command
* [list](list_lookup#ansible-collections-ansible-builtin-list-lookup) – simply returns what it is given.
* [nested](nested_lookup#ansible-collections-ansible-builtin-nested-lookup) – composes a list with nested elements of other lists
* [password](password_lookup#ansible-collections-ansible-builtin-password-lookup) – retrieve or generate a random password, stored in a file
* [pipe](pipe_lookup#ansible-collections-ansible-builtin-pipe-lookup) – read output from a command
* [random\_choice](random_choice_lookup#ansible-collections-ansible-builtin-random-choice-lookup) – return random element from list
* [sequence](sequence_lookup#ansible-collections-ansible-builtin-sequence-lookup) – generate a list based on a number sequence
* [subelements](subelements_lookup#ansible-collections-ansible-builtin-subelements-lookup) – traverse nested key from a list of dictionaries
* [template](template_lookup#ansible-collections-ansible-builtin-template-lookup) – retrieve contents of file after templating with Jinja2
* [together](together_lookup#ansible-collections-ansible-builtin-together-lookup) – merges lists into synchronized list
* [unvault](unvault_lookup#ansible-collections-ansible-builtin-unvault-lookup) – read vaulted file(s) contents
* [url](url_lookup#ansible-collections-ansible-builtin-url-lookup) – return contents from URL
* [varnames](varnames_lookup#ansible-collections-ansible-builtin-varnames-lookup) – Lookup matching variable names
* [vars](vars_lookup#ansible-collections-ansible-builtin-vars-lookup) – Lookup templated value of variables
### Modules
* [add\_host](add_host_module#ansible-collections-ansible-builtin-add-host-module) – Add a host (and alternatively a group) to the ansible-playbook in-memory inventory
* [apt](apt_module#ansible-collections-ansible-builtin-apt-module) – Manages apt-packages
* [apt\_key](apt_key_module#ansible-collections-ansible-builtin-apt-key-module) – Add or remove an apt key
* [apt\_repository](apt_repository_module#ansible-collections-ansible-builtin-apt-repository-module) – Add and remove APT repositories
* [assemble](assemble_module#ansible-collections-ansible-builtin-assemble-module) – Assemble configuration files from fragments
* [assert](assert_module#ansible-collections-ansible-builtin-assert-module) – Asserts given expressions are true
* [async\_status](async_status_module#ansible-collections-ansible-builtin-async-status-module) – Obtain status of asynchronous task
* [blockinfile](blockinfile_module#ansible-collections-ansible-builtin-blockinfile-module) – Insert/update/remove a text block surrounded by marker lines
* [command](command_module#ansible-collections-ansible-builtin-command-module) – Execute commands on targets
* [copy](copy_module#ansible-collections-ansible-builtin-copy-module) – Copy files to remote locations
* [cron](cron_module#ansible-collections-ansible-builtin-cron-module) – Manage cron.d and crontab entries
* [debconf](debconf_module#ansible-collections-ansible-builtin-debconf-module) – Configure a .deb package
* [debug](debug_module#ansible-collections-ansible-builtin-debug-module) – Print statements during execution
* [dnf](dnf_module#ansible-collections-ansible-builtin-dnf-module) – Manages packages with the *dnf* package manager
* [dpkg\_selections](dpkg_selections_module#ansible-collections-ansible-builtin-dpkg-selections-module) – Dpkg package selection selections
* [expect](expect_module#ansible-collections-ansible-builtin-expect-module) – Executes a command and responds to prompts
* [fail](fail_module#ansible-collections-ansible-builtin-fail-module) – Fail with custom message
* [fetch](fetch_module#ansible-collections-ansible-builtin-fetch-module) – Fetch files from remote nodes
* [file](file_module#ansible-collections-ansible-builtin-file-module) – Manage files and file properties
* [find](find_module#ansible-collections-ansible-builtin-find-module) – Return a list of files based on specific criteria
* [gather\_facts](gather_facts_module#ansible-collections-ansible-builtin-gather-facts-module) – Gathers facts about remote hosts
* [get\_url](get_url_module#ansible-collections-ansible-builtin-get-url-module) – Downloads files from HTTP, HTTPS, or FTP to node
* [getent](getent_module#ansible-collections-ansible-builtin-getent-module) – A wrapper to the unix getent utility
* [git](git_module#ansible-collections-ansible-builtin-git-module) – Deploy software (or files) from git checkouts
* [group](group_module#ansible-collections-ansible-builtin-group-module) – Add or remove groups
* [group\_by](group_by_module#ansible-collections-ansible-builtin-group-by-module) – Create Ansible groups based on facts
* [hostname](hostname_module#ansible-collections-ansible-builtin-hostname-module) – Manage hostname
* [import\_playbook](import_playbook_module#ansible-collections-ansible-builtin-import-playbook-module) – Import a playbook
* [import\_role](import_role_module#ansible-collections-ansible-builtin-import-role-module) – Import a role into a play
* [import\_tasks](import_tasks_module#ansible-collections-ansible-builtin-import-tasks-module) – Import a task list
* [include](include_module#ansible-collections-ansible-builtin-include-module) – Include a play or task list
* [include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module) – Load and execute a role
* [include\_tasks](include_tasks_module#ansible-collections-ansible-builtin-include-tasks-module) – Dynamically include a task list
* [include\_vars](include_vars_module#ansible-collections-ansible-builtin-include-vars-module) – Load variables from files, dynamically within a task
* [iptables](iptables_module#ansible-collections-ansible-builtin-iptables-module) – Modify iptables rules
* [known\_hosts](known_hosts_module#ansible-collections-ansible-builtin-known-hosts-module) – Add or remove a host from the `known_hosts` file
* [lineinfile](lineinfile_module#ansible-collections-ansible-builtin-lineinfile-module) – Manage lines in text files
* [meta](meta_module#ansible-collections-ansible-builtin-meta-module) – Execute Ansible ‘actions’
* [package](package_module#ansible-collections-ansible-builtin-package-module) – Generic OS package manager
* [package\_facts](package_facts_module#ansible-collections-ansible-builtin-package-facts-module) – Package information as facts
* [pause](pause_module#ansible-collections-ansible-builtin-pause-module) – Pause playbook execution
* [ping](ping_module#ansible-collections-ansible-builtin-ping-module) – Try to connect to host, verify a usable python and return `pong` on success
* [pip](pip_module#ansible-collections-ansible-builtin-pip-module) – Manages Python library dependencies
* [raw](raw_module#ansible-collections-ansible-builtin-raw-module) – Executes a low-down and dirty command
* [reboot](reboot_module#ansible-collections-ansible-builtin-reboot-module) – Reboot a machine
* [replace](replace_module#ansible-collections-ansible-builtin-replace-module) – Replace all instances of a particular string in a file using a back-referenced regular expression
* [rpm\_key](rpm_key_module#ansible-collections-ansible-builtin-rpm-key-module) – Adds or removes a gpg key from the rpm db
* [script](script_module#ansible-collections-ansible-builtin-script-module) – Runs a local script on a remote node after transferring it
* [service](service_module#ansible-collections-ansible-builtin-service-module) – Manage services
* [service\_facts](service_facts_module#ansible-collections-ansible-builtin-service-facts-module) – Return service state information as fact data
* [set\_fact](set_fact_module#ansible-collections-ansible-builtin-set-fact-module) – Set host variable(s) and fact(s).
* [set\_stats](set_stats_module#ansible-collections-ansible-builtin-set-stats-module) – Define and display stats for the current ansible run
* [setup](setup_module#ansible-collections-ansible-builtin-setup-module) – Gathers facts about remote hosts
* [shell](shell_module#ansible-collections-ansible-builtin-shell-module) – Execute shell commands on targets
* [slurp](slurp_module#ansible-collections-ansible-builtin-slurp-module) – Slurps a file from remote nodes
* [stat](stat_module#ansible-collections-ansible-builtin-stat-module) – Retrieve file or file system status
* [subversion](subversion_module#ansible-collections-ansible-builtin-subversion-module) – Deploys a subversion repository
* [systemd](systemd_module#ansible-collections-ansible-builtin-systemd-module) – Manage systemd units
* [sysvinit](sysvinit_module#ansible-collections-ansible-builtin-sysvinit-module) – Manage SysV services.
* [tempfile](tempfile_module#ansible-collections-ansible-builtin-tempfile-module) – Creates temporary files and directories
* [template](template_module#ansible-collections-ansible-builtin-template-module) – Template a file out to a target host
* [unarchive](unarchive_module#ansible-collections-ansible-builtin-unarchive-module) – Unpacks an archive after (optionally) copying it from the local machine
* [uri](uri_module#ansible-collections-ansible-builtin-uri-module) – Interacts with webservices
* [user](user_module#ansible-collections-ansible-builtin-user-module) – Manage user accounts
* [validate\_argument\_spec](validate_argument_spec_module#ansible-collections-ansible-builtin-validate-argument-spec-module) – Validate role argument specs.
* [wait\_for](wait_for_module#ansible-collections-ansible-builtin-wait-for-module) – Waits for a condition before continuing
* [wait\_for\_connection](wait_for_connection_module#ansible-collections-ansible-builtin-wait-for-connection-module) – Waits until remote system is reachable/usable
* [yum](yum_module#ansible-collections-ansible-builtin-yum-module) – Manages packages with the *yum* package manager
* [yum\_repository](yum_repository_module#ansible-collections-ansible-builtin-yum-repository-module) – Add or remove YUM repositories
### Shell Plugins
* [cmd](cmd_shell#ansible-collections-ansible-builtin-cmd-shell) – Windows Command Prompt
* [powershell](powershell_shell#ansible-collections-ansible-builtin-powershell-shell) – Windows PowerShell
* [sh](sh_shell#ansible-collections-ansible-builtin-sh-shell) – POSIX shell (/bin/sh)
### Strategy Plugins
* [debug](debug_strategy#ansible-collections-ansible-builtin-debug-strategy) – Executes tasks in interactive debug session.
* [free](free_strategy#ansible-collections-ansible-builtin-free-strategy) – Executes tasks without waiting for all hosts
* [host\_pinned](host_pinned_strategy#ansible-collections-ansible-builtin-host-pinned-strategy) – Executes tasks on each host without interruption
* [linear](linear_strategy#ansible-collections-ansible-builtin-linear-strategy) – Executes tasks in a linear fashion
### Vars Plugins
* [host\_group\_vars](host_group_vars_vars#ansible-collections-ansible-builtin-host-group-vars-vars) – In charge of loading group\_vars and host\_vars
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
| programming_docs |
ansible ansible.builtin.shell – Execute shell commands on targets ansible.builtin.shell – Execute shell commands on targets
=========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `shell` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The `shell` module takes the command name followed by a list of space-delimited arguments.
* Either a free form command or `cmd` parameter is required, see the examples.
* It is almost exactly like the [ansible.builtin.command](command_module#ansible-collections-ansible-builtin-command-module) module but runs the command through a shell (`/bin/sh`) on the remote node.
* For Windows targets, use the [ansible.windows.win\_shell](../windows/win_shell_module#ansible-collections-ansible-windows-win-shell-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **chdir** path added in 0.6 of ansible.builtin | | Change into this directory before running the command. |
| **cmd** string | | The command to run followed by optional arguments. |
| **creates** path | | A filename, when it already exists, this step will **not** be run. |
| **executable** path added in 0.9 of ansible.builtin | | Change the shell used to execute the command. This expects an absolute path to the executable. |
| **free\_form** string | | The shell module takes a free form command to run, as a string. There is no actual parameter named 'free form'. See the examples on how to use this module. |
| **removes** path added in 0.8 of ansible.builtin | | A filename, when it does not exist, this step will **not** be run. |
| **stdin** string added in 2.4 of ansible.builtin | | Set the stdin of the command directly to the specified value. |
| **stdin\_add\_newline** boolean added in 2.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| Whether to append a newline to stdin data. |
| **warn** boolean added in 1.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| Whether to enable task warnings. |
Notes
-----
Note
* If you want to execute a command securely and predictably, it may be better to use the [ansible.builtin.command](command_module#ansible-collections-ansible-builtin-command-module) module instead. Best practices when writing playbooks will follow the trend of using [ansible.builtin.command](command_module#ansible-collections-ansible-builtin-command-module) unless the [ansible.builtin.shell](#ansible-collections-ansible-builtin-shell-module) module is explicitly required. When running ad-hoc commands, use your best judgement.
* Check mode is supported when passing `creates` or `removes`. If running in check mode and either of these are specified, the module will check for the existence of the file and report the correct changed status. If these are not supplied, the task will be skipped.
* To sanitize any variables passed to the shell module, you should use `{{ var | quote }}` instead of just `{{ var }}` to make sure they do not include evil things like semicolons.
* An alternative to using inline shell scripts with this module is to use the [ansible.builtin.script](script_module#ansible-collections-ansible-builtin-script-module) module possibly together with the [ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module) module.
* For rebooting systems, use the [ansible.builtin.reboot](reboot_module#ansible-collections-ansible-builtin-reboot-module) or [ansible.windows.win\_reboot](../windows/win_reboot_module#ansible-collections-ansible-windows-win-reboot-module) module.
See Also
--------
See also
[ansible.builtin.command](command_module#ansible-collections-ansible-builtin-command-module)
The official documentation on the **ansible.builtin.command** module.
[ansible.builtin.raw](raw_module#ansible-collections-ansible-builtin-raw-module)
The official documentation on the **ansible.builtin.raw** module.
[ansible.builtin.script](script_module#ansible-collections-ansible-builtin-script-module)
The official documentation on the **ansible.builtin.script** module.
[ansible.windows.win\_shell](../windows/win_shell_module#ansible-collections-ansible-windows-win-shell-module)
The official documentation on the **ansible.windows.win\_shell** module.
Examples
--------
```
- name: Execute the command in remote shell; stdout goes to the specified file on the remote
ansible.builtin.shell: somescript.sh >> somelog.txt
- name: Change the working directory to somedir/ before executing the command
ansible.builtin.shell: somescript.sh >> somelog.txt
args:
chdir: somedir/
# You can also use the 'args' form to provide the options.
- name: This command will change the working directory to somedir/ and will only run when somedir/somelog.txt doesn't exist
ansible.builtin.shell: somescript.sh >> somelog.txt
args:
chdir: somedir/
creates: somelog.txt
# You can also use the 'cmd' parameter instead of free form format.
- name: This command will change the working directory to somedir/
ansible.builtin.shell:
cmd: ls -l | grep log
chdir: somedir/
- name: Run a command that uses non-posix shell-isms (in this example /bin/sh doesn't handle redirection and wildcards together but bash does)
ansible.builtin.shell: cat < /tmp/*txt
args:
executable: /bin/bash
- name: Run a command using a templated variable (always use quote filter to avoid injection)
ansible.builtin.shell: cat {{ myfile|quote }}
# You can use shell to run other executables to perform actions inline
- name: Run expect to wait for a successful PXE boot via out-of-band CIMC
ansible.builtin.shell: |
set timeout 300
spawn ssh admin@{{ cimc_host }}
expect "password:"
send "{{ cimc_password }}\n"
expect "\n{{ cimc_name }}"
send "connect host\n"
expect "pxeboot.n12"
send "\n"
exit 0
args:
executable: /usr/bin/expect
delegate_to: localhost
# Disabling warnings
- name: Using curl to connect to a host via SOCKS proxy (unsupported in uri). Ordinarily this would throw a warning
ansible.builtin.shell: curl --socks5 localhost:9000 http://www.ansible.com
args:
warn: no
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cmd** string | always | The command executed by the task. **Sample:** rabbitmqctl join\_cluster rabbit@master |
| **delta** string | always | The command execution delta time. **Sample:** 0:00:00.325771 |
| **end** string | always | The command execution end time. **Sample:** 2016-02-25 09:18:26.755339 |
| **msg** boolean | always | changed **Sample:** True |
| **rc** integer | always | The command return code (0 means success). |
| **start** string | always | The command execution start time. **Sample:** 2016-02-25 09:18:26.429568 |
| **stderr** string | always | The command standard error. **Sample:** ls: cannot access foo: No such file or directory |
| **stderr\_lines** list / elements=string | always | The command standard error split in lines. **Sample:** [{"u'ls cannot access foo": "No such file or directory'"}, "u'ls …'"] |
| **stdout** string | always | The command standard output. **Sample:** Clustering node rabbit@slave1 with rabbit@master … |
| **stdout\_lines** list / elements=string | always | The command standard output split in lines. **Sample:** ["u'Clustering node rabbit@slave1 with rabbit@master …'"] |
### Authors
* Ansible Core Team
* Michael DeHaan
ansible ansible.builtin.auto – Loads and executes an inventory plugin specified in a YAML config ansible.builtin.auto – Loads and executes an inventory plugin specified in a YAML config
========================================================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `auto` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Examples](#examples)
Synopsis
--------
* By whitelisting `auto` inventory plugin, any YAML inventory config file with a `plugin` key at its root will automatically cause the named plugin to be loaded and executed with that config. This effectively provides automatic whitelisting of all installed/accessible inventory plugins.
* To disable this behavior, remove `auto` from the `INVENTORY_ENABLED` config element.
Examples
--------
```
# This plugin is not intended for direct use; it is a fallback mechanism for automatic whitelisting of
# all installed inventory plugins.
```
### Authors
* Matt Davis (@nitzmahone)
ansible ansible.builtin.dnf – Manages packages with the dnf package manager ansible.builtin.dnf – Manages packages with the dnf package manager
===================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `dnf` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Installs, upgrade, removes, and lists packages and groups with the *dnf* package manager.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* python-dnf
* for the autoremove option you need dnf >= 2.0.1”
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_downgrade** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| Specify if the named package and version is allowed to downgrade a maybe already installed higher version of that package. Note that setting allow\_downgrade=True can make this module behave in a non-idempotent way. The task could end up with a set of packages that does not match the complete list of specified packages to install (because dependencies between the downgraded package and others can cause changes to the packages which were in the earlier transaction). |
| **allowerasing** boolean added in 2.10 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes` it allows erasing of installed packages to resolve dependencies. |
| **autoremove** boolean added in 2.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, removes all "leaf" packages from the system that were originally installed as dependencies of user-installed packages but which are no longer required by any such package. Should be used alone or when state is *absent*
|
| **bugfix** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| If set to `yes`, and `state=latest` then only installs updates that have been marked bugfix related. Note that, similar to ``dnf upgrade-minimal``, this filter applies to dependencies as well. |
| **conf\_file** string | | The remote dnf configuration file to use for the transaction. |
| **disable\_excludes** string added in 2.7 of ansible.builtin | | Disable the excludes defined in DNF config files. If set to `all`, disables all excludes. If set to `main`, disable excludes defined in [main] in dnf.conf. If set to `repoid`, disable excludes defined for given repo id. |
| **disable\_gpg\_check** boolean | **Choices:*** **no** ←
* yes
| Whether to disable the GPG checking of signatures of packages being installed. Has an effect only if state is *present* or *latest*. This setting affects packages installed from a repository as well as "local" packages installed from the filesystem or a URL. |
| **disable\_plugin** list / elements=string added in 2.7 of ansible.builtin | |
*Plugin* name to disable for the install/update operation. The disabled plugins will not persist beyond the transaction. |
| **disablerepo** list / elements=string | |
*Repoid* of repositories to disable for the install/update operation. These repos will not persist beyond the transaction. When specifying multiple repos, separate them with a ",". |
| **download\_dir** string added in 2.8 of ansible.builtin | | Specifies an alternate directory to store packages. Has an effect only if *download\_only* is specified. |
| **download\_only** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| Only download the packages, do not install them. |
| **enable\_plugin** list / elements=string added in 2.7 of ansible.builtin | |
*Plugin* name to enable for the install/update operation. The enabled plugin will not persist beyond the transaction. |
| **enablerepo** list / elements=string | |
*Repoid* of repositories to enable for the install/update operation. These repos will not persist beyond the transaction. When specifying multiple repos, separate them with a ",". |
| **exclude** list / elements=string added in 2.7 of ansible.builtin | | Package name(s) to exclude when state=present, or latest. This can be a list or a comma separated string. |
| **install\_repoquery** boolean added in 2.7 of ansible.builtin | **Choices:*** no
* **yes** ←
| This is effectively a no-op in DNF as it is not needed with DNF, but is an accepted parameter for feature parity/compatibility with the *yum* module. |
| **install\_weak\_deps** boolean added in 2.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| Will also install all packages linked by a weak dependency relation. |
| **installroot** string added in 2.3 of ansible.builtin | **Default:**"/" | Specifies an alternative installroot, relative to which all packages will be installed. |
| **list** string | | Various (non-idempotent) commands for usage with `/usr/bin/ansible` and *not* playbooks. See examples. |
| **lock\_timeout** integer added in 2.8 of ansible.builtin | **Default:**30 | Amount of time to wait for the dnf lockfile to be freed. |
| **name** list / elements=string / required | | A package name or package specifier with version, like `name-1.0`. When using state=latest, this can be '\*' which means run: dnf -y update. You can also pass a url or a local path to a rpm file. To operate on several packages this can accept a comma separated string of packages or a list of packages. Comparison operators for package version are valid here `>`, `<`, `>=`, `<=`. Example - `name>=1.0`
aliases: pkg |
| **nobest** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| Set best option to False, so that transactions are not limited to best candidates only. |
| **releasever** string added in 2.6 of ansible.builtin | | Specifies an alternative release from which all packages will be installed. |
| **security** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| If set to `yes`, and `state=latest` then only installs updates that have been marked security related. Note that, similar to ``dnf upgrade-minimal``, this filter applies to dependencies as well. |
| **skip\_broken** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| Skip packages with broken dependencies(devsolve) and are causing problems. |
| **state** string | **Choices:*** absent
* present
* installed
* removed
* latest
| Whether to install (`present`, `latest`), or remove (`absent`) a package. Default is `None`, however in effect the default action is `present` unless the `autoremove` option is enabled for this module, then `absent` is inferred. |
| **update\_cache** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| Force dnf to check if cache is out of date and redownload if needed. Has an effect only if state is *present* or *latest*.
aliases: expire-cache |
| **update\_only** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| When using latest, only update installed packages. Do not install packages. Has an effect only if state is *latest*
|
| **validate\_certs** boolean added in 2.7 of ansible.builtin | **Choices:*** no
* **yes** ←
| This only applies if using a https url as the source of the rpm. e.g. for localinstall. If set to `no`, the SSL certificates will not be validated. This should only set to `no` used on personally controlled sites using self-signed certificates as it avoids verifying the source site. |
Notes
-----
Note
* When used with a `loop:` each package will be processed individually, it is much more efficient to pass the list directly to the `name` option.
* Group removal doesn’t work if the group was installed with Ansible because upstream dnf’s API doesn’t properly mark groups as installed, therefore upon removal the module is unable to detect that the group is installed (<https://bugzilla.redhat.com/show_bug.cgi?id=1620324>)
Examples
--------
```
- name: Install the latest version of Apache
dnf:
name: httpd
state: latest
- name: Install Apache >= 2.4
dnf:
name: httpd>=2.4
state: present
- name: Install the latest version of Apache and MariaDB
dnf:
name:
- httpd
- mariadb-server
state: latest
- name: Remove the Apache package
dnf:
name: httpd
state: absent
- name: Install the latest version of Apache from the testing repo
dnf:
name: httpd
enablerepo: testing
state: present
- name: Upgrade all packages
dnf:
name: "*"
state: latest
- name: Install the nginx rpm from a remote repo
dnf:
name: 'http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm'
state: present
- name: Install nginx rpm from a local file
dnf:
name: /usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm
state: present
- name: Install the 'Development tools' package group
dnf:
name: '@Development tools'
state: present
- name: Autoremove unneeded packages installed as dependencies
dnf:
autoremove: yes
- name: Uninstall httpd but keep its dependencies
dnf:
name: httpd
state: absent
autoremove: no
- name: Install a modularity appstream with defined stream and profile
dnf:
name: '@postgresql:9.6/client'
state: present
- name: Install a modularity appstream with defined stream
dnf:
name: '@postgresql:9.6'
state: present
- name: Install a modularity appstream with defined profile
dnf:
name: '@postgresql/client'
state: present
```
### Authors
* Igor Gnatenko (@ignatenkobrain) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#f099d6d3c4c6cb979e9184959e9b9fd6d3c4c6cb928291999ed6d3c3c7cbd6d3c5c2cbd6d3c4c8cb979d91999cd6d3c4c6cb939f9d)>
* Cristian van Ee (@DJMuggs) <cristian at cvee.org>
* Berend De Schouwer (@berenddeschouwer)
* Adam Miller (@maxamillion) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#88e9ece5e1e4e4edfaaeabbbbfb3aeabbdbab3aeabbcb0b3faedece0e9fcaeabbcbeb3ebe7e5)>
| programming_docs |
ansible ansible.builtin.get_url – Downloads files from HTTP, HTTPS, or FTP to node ansible.builtin.get\_url – Downloads files from HTTP, HTTPS, or FTP to node
===========================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `get_url` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.6: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Downloads files from HTTP, HTTPS, or FTP to the remote server. The remote server *must* have direct access to the remote resource.
* By default, if an environment variable `<protocol>_proxy` is set on the target host, requests will be sent through that proxy. This behaviour can be overridden by setting a variable for this task (see [setting the environment](../../../user_guide/playbooks_environment#playbooks-environment)), or by using the use\_proxy option.
* HTTP redirects can redirect from HTTP to HTTPS so you should be sure that your proxy environment for both protocols is correct.
* From Ansible 2.4 when run with `--check`, it will do a HEAD request to validate the URL but will not download the entire file or verify it against hashes.
* For Windows targets, use the [ansible.windows.win\_get\_url](../windows/win_get_url_module#ansible-collections-ansible-windows-win-get-url-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **backup** boolean added in 2.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **checksum** string added in 2.0 of ansible.builtin | **Default:**"" | If a checksum is passed to this parameter, the digest of the destination file will be calculated after it is downloaded to ensure its integrity and verify that the transfer completed successfully. Format: <algorithm>:<checksum|url>, e.g. checksum="sha256:D98291AC[...]B6DC7B97", checksum="sha256:http://example.com/path/sha256sum.txt" If you worry about portability, only the sha1 algorithm is available on all platforms and python versions. The third party hashlib library can be installed for access to additional algorithms. Additionally, if a checksum is passed to this parameter, and the file exist under the `dest` location, the *destination\_checksum* would be calculated, and if checksum equals *destination\_checksum*, the file download would be skipped (unless `force` is true). If the checksum does not equal *destination\_checksum*, the destination file is deleted. |
| **client\_cert** path added in 2.4 of ansible.builtin | | PEM formatted certificate chain file to be used for SSL client authentication. This file can also include the key as well, and if the key is included, `client_key` is not required. |
| **client\_key** path added in 2.4 of ansible.builtin | | PEM formatted file that contains your private key to be used for SSL client authentication. If `client_cert` contains both the certificate and key, this option is not required. |
| **dest** path / required | | Absolute path of where to download the file to. If `dest` is a directory, either the server provided filename or, if none provided, the base name of the URL on the remote server will be used. If a directory, `force` has no effect. If `dest` is a directory, the file will always be downloaded (regardless of the `force` option), but replaced only if the contents changed.. |
| **force** boolean added in 0.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes` and `dest` is not a directory, will download the file every time and replace the file if the contents change. If `no`, the file will only be downloaded if the destination does not exist. Generally should be `yes` only for small local files. Prior to 0.6, this module behaved as if `yes` was the default. Alias `thirsty` has been deprecated and will be removed in 2.13.
aliases: thirsty |
| **force\_basic\_auth** boolean added in 2.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| Force the sending of the Basic authentication header upon initial request. httplib2, the library used by the uri module only sends authentication information when a webservice responds to an initial request with a 401 status. Since some basic auth services do not properly send a 401, logins will fail. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **headers** dictionary added in 2.0 of ansible.builtin | | Add custom HTTP headers to a request in hash/dict format. The hash/dict format was added in Ansible 2.6. Previous versions used a `"key:value,key:value"` string format. The `"key:value,key:value"` string format is deprecated and has been removed in version 2.10. |
| **http\_agent** string | **Default:**"ansible-httpget" | Header to identify as, generally appears in web server logs. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **sha256sum** string added in 1.3 of ansible.builtin | **Default:**"" | If a SHA-256 checksum is passed to this parameter, the digest of the destination file will be calculated after it is downloaded to ensure its integrity and verify that the transfer completed successfully. This option is deprecated and will be removed in version 2.14. Use option `checksum` instead. |
| **timeout** integer added in 1.8 of ansible.builtin | **Default:**10 | Timeout in seconds for URL request. |
| **tmp\_dest** path added in 2.1 of ansible.builtin | | Absolute path of where temporary file is downloaded to. When run on Ansible 2.5 or greater, path defaults to ansible's remote\_tmp setting When run on Ansible prior to 2.5, it defaults to `TMPDIR`, `TEMP` or `TMP` env variables or a platform specific value. <https://docs.python.org/2/library/tempfile.html#tempfile.tempdir> |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **url** string / required | | HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path |
| **url\_password** string added in 1.6 of ansible.builtin | | The password for use in HTTP basic authentication. If the `url_username` parameter is not specified, the `url_password` parameter will not be used. Since version 2.8 you can also use the 'password' alias for this option.
aliases: password |
| **url\_username** string added in 1.6 of ansible.builtin | | The username for use in HTTP basic authentication. This parameter can be used without `url_password` for sites that allow empty passwords. Since version 2.8 you can also use the `username` alias for this option.
aliases: username |
| **use\_gssapi** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. Requires the Python library [gssapi](https://github.com/pythongssapi/python-gssapi) to be installed. Credentials for GSSAPI can be specified with *url\_username*/*url\_password* or with the GSSAPI env var `KRB5CCNAME` that specified a custom Kerberos credential cache. NTLM authentication is `not` supported even if the GSSAPI mech for NTLM has been installed. |
| **use\_proxy** boolean | **Choices:*** no
* **yes** ←
| if `no`, it will not use a proxy, even if one is defined in an environment variable on the target hosts. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If `no`, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
Notes
-----
Note
* For Windows targets, use the [ansible.windows.win\_get\_url](../windows/win_get_url_module#ansible-collections-ansible-windows-win-get-url-module) module instead.
See Also
--------
See also
[ansible.builtin.uri](uri_module#ansible-collections-ansible-builtin-uri-module)
The official documentation on the **ansible.builtin.uri** module.
[ansible.windows.win\_get\_url](../windows/win_get_url_module#ansible-collections-ansible-windows-win-get-url-module)
The official documentation on the **ansible.windows.win\_get\_url** module.
Examples
--------
```
- name: Download foo.conf
get_url:
url: http://example.com/path/file.conf
dest: /etc/foo.conf
mode: '0440'
- name: Download file and force basic auth
get_url:
url: http://example.com/path/file.conf
dest: /etc/foo.conf
force_basic_auth: yes
- name: Download file with custom HTTP headers
get_url:
url: http://example.com/path/file.conf
dest: /etc/foo.conf
headers:
key1: one
key2: two
- name: Download file with check (sha256)
get_url:
url: http://example.com/path/file.conf
dest: /etc/foo.conf
checksum: sha256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
- name: Download file with check (md5)
get_url:
url: http://example.com/path/file.conf
dest: /etc/foo.conf
checksum: md5:66dffb5228a211e61d6d7ef4a86f5758
- name: Download file with checksum url (sha256)
get_url:
url: http://example.com/path/file.conf
dest: /etc/foo.conf
checksum: sha256:http://example.com/path/sha256sum.txt
- name: Download file from a file path
get_url:
url: file:///tmp/afile.txt
dest: /tmp/afilecopy.txt
- name: < Fetch file that requires authentication.
username/password only available since 2.8, in older versions you need to use url_username/url_password
get_url:
url: http://example.com/path/file.conf
dest: /etc/foo.conf
username: bar
password: '{{ mysecret }}'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **backup\_file** string | changed and if backup=yes | name of backup file created after download **Sample:** /path/to/file.txt.2015-02-12@22:09~ |
| **checksum\_dest** string | success | sha1 checksum of the file after copy **Sample:** 6e642bb8dd5c2e027bf21dd923337cbb4214f827 |
| **checksum\_src** string | success | sha1 checksum of the file **Sample:** 6e642bb8dd5c2e027bf21dd923337cbb4214f827 |
| **dest** string | success | destination file/path **Sample:** /path/to/file.txt |
| **elapsed** integer | always | The number of seconds that elapsed while performing the download **Sample:** 23 |
| **gid** integer | success | group id of the file **Sample:** 100 |
| **group** string | success | group of the file **Sample:** httpd |
| **md5sum** string | when supported | md5 checksum of the file after download **Sample:** 2a5aeecc61dc98c4d780b14b330e3282 |
| **mode** string | success | permissions of the target **Sample:** 0644 |
| **msg** string | always | the HTTP message from the request **Sample:** OK (unknown bytes) |
| **owner** string | success | owner of the file **Sample:** httpd |
| **secontext** string | success | the SELinux security context of the file **Sample:** unconfined\_u:object\_r:user\_tmp\_t:s0 |
| **size** integer | success | size of the target **Sample:** 1220 |
| **src** string | always | source file used after download **Sample:** /tmp/tmpAdFLdV |
| **state** string | success | state of the target **Sample:** file |
| **status\_code** integer | always | the HTTP status code from the request **Sample:** 200 |
| **uid** integer | success | owner id of the file, after execution **Sample:** 100 |
| **url** string | always | the actual URL used for the request **Sample:** https://www.ansible.com/ |
### Authors
* Jan-Piet Mens (@jpmens)
ansible ansible.builtin.jsonfile – JSON formatted files. ansible.builtin.jsonfile – JSON formatted files.
================================================
Note
This cache plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `jsonfile` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same cache plugin name.
New in version 1.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* This cache uses JSON formatted, per host, files saved to the filesystem.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_prefix** string | | ini entries: [defaults]fact\_caching\_prefix = None env:ANSIBLE\_CACHE\_PLUGIN\_PREFIX | User defined prefix to use when creating the JSON files |
| **\_timeout** integer | **Default:**86400 | ini entries: [defaults]fact\_caching\_timeout = 86400 env:ANSIBLE\_CACHE\_PLUGIN\_TIMEOUT | Expiration timeout for the cache plugin data |
| **\_uri** path / required | | ini entries: [defaults]fact\_caching\_connection = None env:ANSIBLE\_CACHE\_PLUGIN\_CONNECTION | Path in which the cache plugin will save the JSON files |
### Authors
* Ansible Core (@ansible-core)
ansible ansible.builtin.iptables – Modify iptables rules ansible.builtin.iptables – Modify iptables rules
================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `iptables` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* `iptables` is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel.
* This module does not handle the saving and/or loading of rules, but rather only manipulates the current rules that are present in memory. This is the same as the behaviour of the `iptables` and `ip6tables` command which this module uses internally.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **action** string added in 2.2 of ansible.builtin | **Choices:*** **append** ←
* insert
| Whether the rule should be appended at the bottom or inserted at the top. If the rule already exists the chain will not be modified. |
| **chain** string | | Specify the iptables chain to modify. This could be a user-defined chain or one of the standard iptables chains, like `INPUT`, `FORWARD`, `OUTPUT`, `PREROUTING`, `POSTROUTING`, `SECMARK` or `CONNSECMARK`. |
| **comment** string | | This specifies a comment that will be added to the rule. |
| **ctstate** list / elements=string | **Default:**[] | A list of the connection states to match in the conntrack module. Possible values are `INVALID`, `NEW`, `ESTABLISHED`, `RELATED`, `UNTRACKED`, `SNAT`, `DNAT`. |
| **destination** string | | Destination specification. Address can be either a network name, a hostname, a network IP address (with /mask), or a plain IP address. Hostnames will be resolved once only, before the rule is submitted to the kernel. Please note that specifying any name to be resolved with a remote query such as DNS is a really bad idea. The mask can be either a network mask or a plain number, specifying the number of 1's at the left side of the network mask. Thus, a mask of 24 is equivalent to 255.255.255.0. A `!` argument before the address specification inverts the sense of the address. |
| **destination\_port** string | | Destination port or port range specification. This can either be a service name or a port number. An inclusive range can also be specified, using the format first:last. If the first port is omitted, '0' is assumed; if the last is omitted, '65535' is assumed. If the first port is greater than the second one they will be swapped. This is only valid if the rule also specifies one of the following protocols: tcp, udp, dccp or sctp. |
| **destination\_ports** list / elements=string added in 2.11 of ansible.builtin | | This specifies multiple destination port numbers or port ranges to match in the multiport module. It can only be used in conjunction with the protocols tcp, udp, udplite, dccp and sctp. |
| **dst\_range** string added in 2.8 of ansible.builtin | | Specifies the destination IP range to match in the iprange module. |
| **flush** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Flushes the specified table and chain of all rules. If no chain is specified then the entire table is purged. Ignores all other parameters. |
| **fragment** string | | This means that the rule only refers to second and further fragments of fragmented packets. Since there is no way to tell the source or destination ports of such a packet (or ICMP type), such a packet will not match any rules which specify them. When the "!" argument precedes fragment argument, the rule will only match head fragments, or unfragmented packets. |
| **gateway** string added in 2.8 of ansible.builtin | | This specifies the IP address of host to send the cloned packets. This option is only valid when `jump` is set to `TEE`. |
| **gid\_owner** string added in 2.9 of ansible.builtin | | Specifies the GID or group to use in match by owner rule. |
| **goto** string | | This specifies that the processing should continue in a user specified chain. Unlike the jump argument return will not continue processing in this chain but instead in the chain that called us via jump. |
| **icmp\_type** string added in 2.2 of ansible.builtin | | This allows specification of the ICMP type, which can be a numeric ICMP type, type/code pair, or one of the ICMP type names shown by the command 'iptables -p icmp -h' |
| **in\_interface** string | | Name of an interface via which a packet was received (only for packets entering the `INPUT`, `FORWARD` and `PREROUTING` chains). When the `!` argument is used before the interface name, the sense is inverted. If the interface name ends in a `+`, then any interface which begins with this name will match. If this option is omitted, any interface name will match. |
| **ip\_version** string | **Choices:*** **ipv4** ←
* ipv6
| Which version of the IP protocol this rule should apply to. |
| **jump** string | | This specifies the target of the rule; i.e., what to do if the packet matches it. The target can be a user-defined chain (other than the one this rule is in), one of the special builtin targets which decide the fate of the packet immediately, or an extension (see EXTENSIONS below). If this option is omitted in a rule (and the goto parameter is not used), then matching the rule will have no effect on the packet's fate, but the counters on the rule will be incremented. |
| **limit** string | | Specifies the maximum average number of matches to allow per second. The number can specify units explicitly, using `/second', `/minute', `/hour' or `/day', or parts of them (so `5/second' is the same as `5/s'). |
| **limit\_burst** string added in 2.1 of ansible.builtin | | Specifies the maximum burst before the above limit kicks in. |
| **log\_level** string added in 2.8 of ansible.builtin | **Choices:*** 0
* 1
* 2
* 3
* 4
* 5
* 6
* 7
* emerg
* alert
* crit
* error
* warning
* notice
* info
* debug
| Logging level according to the syslogd-defined priorities. The value can be strings or numbers from 1-8. This parameter is only applicable if `jump` is set to `LOG`. |
| **log\_prefix** string added in 2.5 of ansible.builtin | | Specifies a log text for the rule. Only make sense with a LOG jump. |
| **match** list / elements=string | **Default:**[] | Specifies a match to use, that is, an extension module that tests for a specific property. The set of matches make up the condition under which a target is invoked. Matches are evaluated first to last if specified as an array and work in short-circuit fashion, i.e. if one extension yields false, evaluation will stop. |
| **match\_set** string added in 2.11 of ansible.builtin | | Specifies a set name which can be defined by ipset. Must be used together with the match\_set\_flags parameter. When the `!` argument is prepended then it inverts the rule. Uses the iptables set extension. |
| **match\_set\_flags** string added in 2.11 of ansible.builtin | **Choices:*** src
* dst
* src,dst
* dst,src
| Specifies the necessary flags for the match\_set parameter. Must be used together with the match\_set parameter. Uses the iptables set extension. |
| **out\_interface** string | | Name of an interface via which a packet is going to be sent (for packets entering the `FORWARD`, `OUTPUT` and `POSTROUTING` chains). When the `!` argument is used before the interface name, the sense is inverted. If the interface name ends in a `+`, then any interface which begins with this name will match. If this option is omitted, any interface name will match. |
| **policy** string added in 2.2 of ansible.builtin | **Choices:*** ACCEPT
* DROP
* QUEUE
* RETURN
| Set the policy for the chain to the given target. Only built-in chains can have policies. This parameter requires the `chain` parameter. If you specify this parameter, all other parameters will be ignored. This parameter is used to set default policy for the given `chain`. Do not confuse this with `jump` parameter. |
| **protocol** string | | The protocol of the rule or of the packet to check. The specified protocol can be one of `tcp`, `udp`, `udplite`, `icmp`, `ipv6-icmp` or `icmpv6`, `esp`, `ah`, `sctp` or the special keyword `all`, or it can be a numeric value, representing one of these protocols or a different one. A protocol name from */etc/protocols* is also allowed. A `!` argument before the protocol inverts the test. The number zero is equivalent to all.
`all` will match with all protocols and is taken as default when this option is omitted. |
| **reject\_with** string added in 2.1 of ansible.builtin | | Specifies the error packet type to return while rejecting. It implies "jump: REJECT". |
| **rule\_num** string added in 2.5 of ansible.builtin | | Insert the rule as the given rule number. This works only with `action=insert`. |
| **set\_counters** string | | This enables the administrator to initialize the packet and byte counters of a rule (during `INSERT`, `APPEND`, `REPLACE` operations). |
| **set\_dscp\_mark** string added in 2.1 of ansible.builtin | | This allows specifying a DSCP mark to be added to packets. It takes either an integer or hex value. Mutually exclusive with `set_dscp_mark_class`. |
| **set\_dscp\_mark\_class** string added in 2.1 of ansible.builtin | | This allows specifying a predefined DiffServ class which will be translated to the corresponding DSCP mark. Mutually exclusive with `set_dscp_mark`. |
| **source** string | | Source specification. Address can be either a network name, a hostname, a network IP address (with /mask), or a plain IP address. Hostnames will be resolved once only, before the rule is submitted to the kernel. Please note that specifying any name to be resolved with a remote query such as DNS is a really bad idea. The mask can be either a network mask or a plain number, specifying the number of 1's at the left side of the network mask. Thus, a mask of 24 is equivalent to 255.255.255.0. A `!` argument before the address specification inverts the sense of the address. |
| **source\_port** string | | Source port or port range specification. This can either be a service name or a port number. An inclusive range can also be specified, using the format `first:last`. If the first port is omitted, `0` is assumed; if the last is omitted, `65535` is assumed. If the first port is greater than the second one they will be swapped. |
| **src\_range** string added in 2.8 of ansible.builtin | | Specifies the source IP range to match in the iprange module. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the rule should be absent or present. |
| **syn** string added in 2.5 of ansible.builtin | **Choices:*** **ignore** ←
* match
* negate
| This allows matching packets that have the SYN bit set and the ACK and RST bits unset. When negated, this matches all packets with the RST or the ACK bits set. |
| **table** string | **Choices:*** **filter** ←
* nat
* mangle
* raw
* security
| This option specifies the packet matching table which the command should operate on. If the kernel is configured with automatic module loading, an attempt will be made to load the appropriate module for that table if it is not already there. |
| **tcp\_flags** dictionary added in 2.4 of ansible.builtin | **Default:**{} | TCP flags specification.
`tcp_flags` expects a dict with the two keys `flags` and `flags_set`. |
| | **flags** list / elements=string | | List of flags you want to examine. |
| | **flags\_set** list / elements=string | | Flags to be set. |
| **to\_destination** string added in 2.1 of ansible.builtin | | This specifies a destination address to use with `DNAT`. Without this, the destination address is never altered. |
| **to\_ports** string | | This specifies a destination port or range of ports to use, without this, the destination port is never altered. This is only valid if the rule also specifies one of the protocol `tcp`, `udp`, `dccp` or `sctp`. |
| **to\_source** string added in 2.2 of ansible.builtin | | This specifies a source address to use with `SNAT`. Without this, the source address is never altered. |
| **uid\_owner** string added in 2.1 of ansible.builtin | | Specifies the UID or username to use in match by owner rule. From Ansible 2.6 when the `!` argument is prepended then the it inverts the rule to apply instead to all users except that one specified. |
| **wait** string added in 2.10 of ansible.builtin | | Wait N seconds for the xtables lock to prevent multiple instances of the program from running concurrently. |
Notes
-----
Note
* This module just deals with individual rules.If you need advanced chaining of rules the recommended way is to template the iptables restore file.
Examples
--------
```
- name: Block specific IP
ansible.builtin.iptables:
chain: INPUT
source: 8.8.8.8
jump: DROP
become: yes
- name: Forward port 80 to 8600
ansible.builtin.iptables:
table: nat
chain: PREROUTING
in_interface: eth0
protocol: tcp
match: tcp
destination_port: 80
jump: REDIRECT
to_ports: 8600
comment: Redirect web traffic to port 8600
become: yes
- name: Allow related and established connections
ansible.builtin.iptables:
chain: INPUT
ctstate: ESTABLISHED,RELATED
jump: ACCEPT
become: yes
- name: Allow new incoming SYN packets on TCP port 22 (SSH)
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_port: 22
ctstate: NEW
syn: match
jump: ACCEPT
comment: Accept new SSH connections.
- name: Match on IP ranges
ansible.builtin.iptables:
chain: FORWARD
src_range: 192.168.1.100-192.168.1.199
dst_range: 10.0.0.1-10.0.0.50
jump: ACCEPT
- name: Allow source IPs defined in ipset "admin_hosts" on port 22
ansible.builtin.iptables:
chain: INPUT
match_set: admin_hosts
match_set_flags: src
destination_port: 22
jump: ALLOW
- name: Tag all outbound tcp packets with DSCP mark 8
ansible.builtin.iptables:
chain: OUTPUT
jump: DSCP
table: mangle
set_dscp_mark: 8
protocol: tcp
- name: Tag all outbound tcp packets with DSCP DiffServ class CS1
ansible.builtin.iptables:
chain: OUTPUT
jump: DSCP
table: mangle
set_dscp_mark_class: CS1
protocol: tcp
- name: Insert a rule on line 5
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_port: 8080
jump: ACCEPT
action: insert
rule_num: 5
# Think twice before running following task as this may lock target system
- name: Set the policy for the INPUT chain to DROP
ansible.builtin.iptables:
chain: INPUT
policy: DROP
- name: Reject tcp with tcp-reset
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
reject_with: tcp-reset
ip_version: ipv4
- name: Set tcp flags
ansible.builtin.iptables:
chain: OUTPUT
jump: DROP
protocol: tcp
tcp_flags:
flags: ALL
flags_set:
- ACK
- RST
- SYN
- FIN
- name: Iptables flush filter
ansible.builtin.iptables:
chain: "{{ item }}"
flush: yes
with_items: [ 'INPUT', 'FORWARD', 'OUTPUT' ]
- name: Iptables flush nat
ansible.builtin.iptables:
table: nat
chain: '{{ item }}'
flush: yes
with_items: [ 'INPUT', 'OUTPUT', 'PREROUTING', 'POSTROUTING' ]
- name: Log packets arriving into an user-defined chain
ansible.builtin.iptables:
chain: LOGGING
action: append
state: present
limit: 2/second
limit_burst: 20
log_prefix: "IPTABLES:INFO: "
log_level: info
- name: Allow connections on multiple ports
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_ports:
- "80"
- "443"
- "8081:8083"
jump: ACCEPT
```
### Authors
* Linus Unnebäck (@LinusU) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#274b4e495254010414101c010412151c0104131f1c41484b4c434653485549010413111c5442)>
* Sébastien DA ROCHA (@sebastiendarocha)
| programming_docs |
ansible ansible.builtin.ini – Uses an Ansible INI file as inventory source. ansible.builtin.ini – Uses an Ansible INI file as inventory source.
===================================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `ini` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* INI file based inventory, sections are groups or group related with special `:modifiers`.
* Entries in sections `[group_1]` are hosts, members of the group.
* Hosts can have variables defined inline as key/value pairs separated by `=`.
* The `children` modifier indicates that the section contains groups.
* The `vars` modifier indicates that the section contains variables assigned to members of the group.
* Anything found outside a section is considered an ‘ungrouped’ host.
* Values passed in the INI format using the `key=value` syntax are interpreted differently depending on where they are declared within your inventory.
* When declared inline with the host, INI values are processed by Python’s ast.literal\_eval function (<https://docs.python.org/2/library/ast.html#ast.literal_eval>) and interpreted as Python literal structures (strings, numbers, tuples, lists, dicts, booleans, None). Host lines accept multiple `key=value` parameters per line. Therefore they need a way to indicate that a space is part of a value rather than a separator.
* When declared in a `:vars` section, INI values are interpreted as strings. For example `var=FALSE` would create a string equal to `FALSE`. Unlike host lines, `:vars` sections accept only a single entry per line, so everything after the `=` must be the value for the entry.
* Do not rely on types set during definition, always make sure you specify type with a filter when needed when consuming the variable.
* See the Examples for proper quoting to prevent changes to variable type.
Notes
-----
Note
* Whitelisted in configuration by default.
* Consider switching to YAML format for inventory sources to avoid confusion on the actual type of a variable. The YAML inventory plugin processes variable values consistently and correctly.
Examples
--------
```
# fmt: ini
# Example 1
[web]
host1
host2 ansible_port=222 # defined inline, interpreted as an integer
[web:vars]
http_port=8080 # all members of 'web' will inherit these
myvar=23 # defined in a :vars section, interpreted as a string
[web:children] # child groups will automatically add their hosts to parent group
apache
nginx
[apache]
tomcat1
tomcat2 myvar=34 # host specific vars override group vars
tomcat3 mysecret="'03#pa33w0rd'" # proper quoting to prevent value changes
[nginx]
jenkins1
[nginx:vars]
has_java = True # vars in child groups override same in parent
[all:vars]
has_java = False # 'all' is 'top' parent
# Example 2
host1 # this is 'ungrouped'
# both hosts have same IP but diff ports, also 'ungrouped'
host2 ansible_host=127.0.0.1 ansible_port=44
host3 ansible_host=127.0.0.1 ansible_port=45
[g1]
host4
[g2]
host4 # same host as above, but member of 2 groups, will inherit vars from both
# inventory hostnames are unique
```
ansible ansible.builtin.ini – read data from a ini file ansible.builtin.ini – read data from a ini file
===============================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `ini` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The ini lookup reads the contents of a file in INI format `key1=value1`. This plugin retrieves the value on the right side after the equal sign `'='` of a given section `[section]`.
* You can also read a property file which - in this case - does not contain section.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | The key(s) to look up. On Python 2, key names are case **insensitive**. In Python 3, key names are case **sensitive**. Duplicate key names found in a file will result in an error. |
| **default** string | **Default:**"" | | Return value if the key is not in the ini file. |
| **encoding** string | **Default:**"utf-8" | | Text encoding to use. |
| **file** string | **Default:**"ansible.ini" | | Name of the file to load. |
| **re** boolean | **Choices:*** **no** ←
* yes
| | Flag to indicate if the key supplied is a regexp. |
| **section** string | **Default:**"global" | | Section where to lookup the key. |
| **type** string | **Choices:*** **ini** ←
* properties
| | Type of the file. 'properties' refers to the Java properties files. |
Examples
--------
```
- debug: msg="User in integration is {{ lookup('ini', 'user section=integration file=users.ini') }}"
- debug: msg="User in production is {{ lookup('ini', 'user section=production file=users.ini') }}"
- debug: msg="user.name is {{ lookup('ini', 'user.name type=properties file=user.properties') }}"
- debug:
msg: "{{ item }}"
with_ini:
- '.* section=section1 file=test.ini re=True'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=string | success | value(s) of the key(s) in the ini file |
### Authors
* Yannig Perre (!UNKNOWN) <yannig.perre(at)gmail.com>
ansible ansible.builtin.ssh – connect via ssh client binary ansible.builtin.ssh – connect via ssh client binary
===================================================
Note
This connection plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `ssh` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same connection plugin name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
Synopsis
--------
* This connection plugin allows ansible to communicate to the target machines via normal ssh command line.
* Ansible does not expose a channel to allow communication between the user and the ssh process to accept a password manually to decrypt an ssh key when using this connection plugin (which is the default). The use of `ssh-agent` is highly recommended.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **control\_path** string | | ini entries: [ssh\_connection]control\_path = None env:ANSIBLE\_SSH\_CONTROL\_PATH var: ansible\_control\_path added in 2.7 of ansible.builtin | This is the location to save ssh's ControlPath sockets, it uses ssh's variable substitution. Since 2.3, if null (default), ansible will generate a unique hash. Use `%(directory)s` to indicate where to use the control dir path setting. Before 2.3 it defaulted to `control\_path=%(directory)s/ansible-ssh-%%h-%%p-%%r`. Be aware that this setting is ignored if `-o ControlPath` is set in ssh args. |
| **control\_path\_dir** string | **Default:**"~/.ansible/cp" | ini entries: [ssh\_connection]control\_path\_dir = ~/.ansible/cp env:ANSIBLE\_SSH\_CONTROL\_PATH\_DIR var: ansible\_control\_path\_dir added in 2.7 of ansible.builtin | This sets the directory to use for ssh control path if the control path setting is null. Also, provides the `%(directory)s` variable for the control path setting. |
| **host** string | | var: inventory\_hostname var: ansible\_host var: ansible\_ssh\_host var: delegated\_vars['ansible\_host'] var: delegated\_vars['ansible\_ssh\_host'] | Hostname/ip to connect to. |
| **host\_key\_checking** boolean | **Choices:*** no
* yes
| ini entries: [defaults]host\_key\_checking = None [ssh\_connection]host\_key\_checking = None
added in 2.5 of ansible.builtin env:ANSIBLE\_HOST\_KEY\_CHECKING env:ANSIBLE\_SSH\_HOST\_KEY\_CHECKING added in 2.5 of ansible.builtin var: ansible\_host\_key\_checking added in 2.5 of ansible.builtin var: ansible\_ssh\_host\_key\_checking added in 2.5 of ansible.builtin | Determines if ssh should check host keys |
| **password** string | | var: ansible\_password var: ansible\_ssh\_pass var: ansible\_ssh\_password | Authentication password for the `remote_user`. Can be supplied as CLI option. |
| **pipelining** boolean | **Choices:*** no
* yes
**Default:**"ANSIBLE\_PIPELINING" | ini entries: [connection]pipelining = ANSIBLE\_PIPELINING [ssh\_connection]pipelining = ANSIBLE\_PIPELINING env:ANSIBLE\_PIPELINING env:ANSIBLE\_SSH\_PIPELINING var: ansible\_pipelining var: ansible\_ssh\_pipelining | Pipelining reduces the number of connection operations required to execute a module on the remote server, by executing many Ansible modules without actual file transfers. This can result in a very significant performance improvement when enabled. However this can conflict with privilege escalation (become). For example, when using sudo operations you must first disable 'requiretty' in the sudoers file for the target hosts, which is why this feature is disabled by default. |
| **port** integer | | ini entries: [defaults]remote\_port = None env:ANSIBLE\_REMOTE\_PORT var: ansible\_port var: ansible\_ssh\_port | Remote port to connect to. |
| **private\_key\_file** string | | ini entries: [defaults]private\_key\_file = None env:ANSIBLE\_PRIVATE\_KEY\_FILE var: ansible\_private\_key\_file var: ansible\_ssh\_private\_key\_file cli: --private-key-file | Path to private key file to use for authentication |
| **reconnection\_retries** integer | **Default:**0 | ini entries: [connection]retries = 0 [ssh\_connection]retries = 0 env:ANSIBLE\_SSH\_RETRIES var: ansible\_ssh\_retries added in 2.7 of ansible.builtin | Number of attempts to connect. |
| **remote\_user** string | | ini entries: [defaults]remote\_user = None env:ANSIBLE\_REMOTE\_USER var: ansible\_user var: ansible\_ssh\_user cli: --user | User name with which to login to the remote server, normally set by the remote\_user keyword. If no user is supplied, Ansible will let the ssh client binary choose the user as it normally |
| **scp\_executable** string added in 2.6 of ansible.builtin | **Default:**"scp" | ini entries: [ssh\_connection]scp\_executable = scp env:ANSIBLE\_SCP\_EXECUTABLE var: ansible\_scp\_executable added in 2.7 of ansible.builtin | This defines the location of the scp binary. It defaults to `scp` which will use the first binary available in $PATH. |
| **scp\_extra\_args** string | **Default:**"" | ini entries: [ssh\_connection]scp\_extra\_args =
added in 2.7 of ansible.builtin env:ANSIBLE\_SCP\_EXTRA\_ARGS added in 2.7 of ansible.builtin var: ansible\_scp\_extra\_args cli: --scp-extra-args | Extra exclusive to the ``scp`` CLI |
| **scp\_if\_ssh** string | **Default:**"smart" | ini entries: [ssh\_connection]scp\_if\_ssh = smart env:ANSIBLE\_SCP\_IF\_SSH var: ansible\_scp\_if\_ssh added in 2.7 of ansible.builtin | Preferred method to use when transfering files over ssh When set to smart, Ansible will try them until one succeeds or they all fail If set to True, it will force 'scp', if False it will use 'sftp' |
| **sftp\_batch\_mode** boolean | **Choices:*** no
* **yes** ←
| ini entries: [ssh\_connection]sftp\_batch\_mode = yes env:ANSIBLE\_SFTP\_BATCH\_MODE var: ansible\_sftp\_batch\_mode added in 2.7 of ansible.builtin | TODO: write it |
| **sftp\_executable** string added in 2.6 of ansible.builtin | **Default:**"sftp" | ini entries: [ssh\_connection]sftp\_executable = sftp env:ANSIBLE\_SFTP\_EXECUTABLE var: ansible\_sftp\_executable added in 2.7 of ansible.builtin | This defines the location of the sftp binary. It defaults to ``sftp`` which will use the first binary available in $PATH. |
| **sftp\_extra\_args** string | **Default:**"" | ini entries: [ssh\_connection]sftp\_extra\_args =
added in 2.7 of ansible.builtin env:ANSIBLE\_SFTP\_EXTRA\_ARGS added in 2.7 of ansible.builtin var: ansible\_sftp\_extra\_args cli: --sftp-extra-args | Extra exclusive to the ``sftp`` CLI |
| **ssh\_args** string | **Default:**"-C -o ControlMaster=auto -o ControlPersist=60s" | ini entries: [ssh\_connection]ssh\_args = -C -o ControlMaster=auto -o ControlPersist=60s env:ANSIBLE\_SSH\_ARGS var: ansible\_ssh\_args added in 2.7 of ansible.builtin cli: --ssh-args | Arguments to pass to all ssh cli tools |
| **ssh\_common\_args** string | **Default:**"" | ini entries: [ssh\_connection]ssh\_common\_args =
added in 2.7 of ansible.builtin env:ANSIBLE\_SSH\_COMMON\_ARGS added in 2.7 of ansible.builtin var: ansible\_ssh\_common\_args cli: --ssh-common-args | Common extra args for all ssh CLI tools |
| **ssh\_executable** string added in 2.2 of ansible.builtin | **Default:**"ssh" | ini entries: [ssh\_connection]ssh\_executable = ssh env:ANSIBLE\_SSH\_EXECUTABLE var: ansible\_ssh\_executable added in 2.7 of ansible.builtin | This defines the location of the ssh binary. It defaults to ``ssh`` which will use the first ssh binary available in $PATH. This option is usually not required, it might be useful when access to system ssh is restricted, or when using ssh wrappers to connect to remote hosts. |
| **ssh\_extra\_args** string | **Default:**"" | ini entries: [ssh\_connection]ssh\_extra\_args =
added in 2.7 of ansible.builtin env:ANSIBLE\_SSH\_EXTRA\_ARGS added in 2.7 of ansible.builtin var: ansible\_ssh\_extra\_args cli: --ssh-extra-args | Extra exclusive to the 'ssh' CLI |
| **ssh\_transfer\_method** string | **Choices:*** sftp
* scp
* piped
* smart
| ini entries: [ssh\_connection]transfer\_method = None env:ANSIBLE\_SSH\_TRANSFER\_METHOD | Preferred method to use when transferring files over ssh Setting to 'smart' (default) will try them in order, until one succeeds or they all fail Using 'piped' creates an ssh pipe with ``dd`` on either side to copy the data |
| **sshpass\_prompt** string added in 2.10 of ansible.builtin | **Default:**"" | ini entries: [ssh\_connection]sshpass\_prompt = env:ANSIBLE\_SSHPASS\_PROMPT var: ansible\_sshpass\_prompt | Password prompt that sshpass should search for. Supported by sshpass 1.06 and up. |
| **timeout** integer | **Default:**10 | ini entries: [defaults]timeout = 10 [ssh\_connection]timeout = 10
added in 2.11 of ansible.builtin env:ANSIBLE\_TIMEOUT env:ANSIBLE\_SSH\_TIMEOUT added in 2.11 of ansible.builtin var: ansible\_ssh\_timeout added in 2.11 of ansible.builtin cli: --timeout | This is the default ammount of time we will wait while establishing an ssh connection It also controls how long we can wait to access reading the connection once established (select on the socket) |
| **use\_tty** boolean added in 2.5 of ansible.builtin | **Choices:*** no
* **yes** ←
| ini entries: [ssh\_connection]usetty = yes env:ANSIBLE\_SSH\_USETTY var: ansible\_ssh\_use\_tty added in 2.7 of ansible.builtin | add -tt to ssh commands to force tty allocation |
Notes
-----
Note
* Many options default to ‘None’ here but that only means we don’t override the ssh tool’s defaults and/or configuration. For example, if you specify the port in this plugin it will override any `Port` entry in your `.ssh/config`.
### Authors
* ansible (@core)
ansible ansible.builtin.async_status – Obtain status of asynchronous task ansible.builtin.async\_status – Obtain status of asynchronous task
==================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `async_status` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module gets the status of an asynchronous task.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **jid** string / required | | Job or task identifier |
| **mode** string | **Choices:*** cleanup
* **status** ←
| If `status`, obtain the status. If `cleanup`, clean up the async job cache (by default in `~/.ansible_async/`) for the specified job *jid*. |
Notes
-----
Note
* This module is also supported for Windows targets.
See Also
--------
See also
[Asynchronous actions and polling](../../../user_guide/playbooks_async#playbooks-async)
Detailed information on how to use asynchronous actions and polling.
Examples
--------
```
---
- name: Asynchronous yum task
yum:
name: docker-io
state: present
async: 1000
poll: 0
register: yum_sleeper
- name: Wait for asynchronous job to end
async_status:
jid: '{{ yum_sleeper.ansible_job_id }}'
register: job_result
until: job_result.finished
retries: 100
delay: 10
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **ansible\_job\_id** string | success | The asynchronous job id **Sample:** 360874038559.4169 |
| **finished** integer | success | Whether the asynchronous job has finished (`1`) or not (`0`) **Sample:** 1 |
| **started** integer | success | Whether the asynchronous job has started (`1`) or not (`0`) **Sample:** 1 |
### Authors
* Ansible Core Team
* Michael DeHaan
ansible ansible.builtin.pause – Pause playbook execution ansible.builtin.pause – Pause playbook execution
================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `pause` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Pauses playbook execution for a set amount of time, or until a prompt is acknowledged. All parameters are optional. The default behavior is to pause with a prompt.
* To pause/wait/sleep per host, use the [ansible.builtin.wait\_for](wait_for_module#ansible-collections-ansible-builtin-wait-for-module) module.
* You can use `ctrl+c` if you wish to advance a pause earlier than it is set to expire or if you need to abort a playbook run entirely. To continue early press `ctrl+c` and then `c`. To abort a playbook press `ctrl+c` and then `a`.
* The pause module integrates into async/parallelized playbooks without any special considerations (see Rolling Updates). When using pauses with the `serial` playbook parameter (as in rolling updates) you are only prompted once for the current group of hosts.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **echo** boolean added in 2.5 of ansible.builtin | **Choices:*** no
* **yes** ←
| Controls whether or not keyboard input is shown when typing. Has no effect if 'seconds' or 'minutes' is set. |
| **minutes** string | | A positive number of minutes to pause for. |
| **prompt** string | | Optional text to use for the prompt message. |
| **seconds** string | | A positive number of seconds to pause for. |
Notes
-----
Note
* Starting in 2.2, if you specify 0 or negative for minutes or seconds, it will wait for 1 second, previously it would wait indefinitely.
* This module is also supported for Windows targets.
* User input is not captured or echoed, regardless of echo setting, when minutes or seconds is specified.
Examples
--------
```
- name: Pause for 5 minutes to build app cache
pause:
minutes: 5
- name: Pause until you can verify updates to an application were successful
pause:
- name: A helpful reminder of what to look out for post-update
pause:
prompt: "Make sure org.foo.FooOverload exception is not present"
- name: Pause to get some sensitive input
pause:
prompt: "Enter a secret"
echo: no
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **delta** string | always | Time paused in seconds **Sample:** 2 |
| **echo** boolean | always | Value of echo setting **Sample:** True |
| **start** string | always | Time when started pausing **Sample:** 2017-02-23 14:35:07.298862 |
| **stdout** string | always | Output of pause module **Sample:** Paused for 0.04 minutes |
| **stop** string | always | Time when ended pausing **Sample:** 2017-02-23 14:35:09.552594 |
| **user\_input** string | if no waiting time set | User input from interactive console **Sample:** Example user input |
### Authors
* Tim Bielawa (@tbielawa)
| programming_docs |
ansible ansible.builtin.include – Include a play or task list ansible.builtin.include – Include a play or task list
=====================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `include` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.6: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Includes a file with a list of plays or tasks to be executed in the current playbook.
* Files with a list of plays can only be included at the top level. Lists of tasks can only be included where tasks normally run (in play).
* Before Ansible 2.0, all includes were ‘static’ and were executed when the play was compiled.
* Static includes are not subject to most directives. For example, loops or conditionals are applied instead to each inherited task.
* Since Ansible 2.0, task includes are dynamic and behave more like real tasks. This means they can be looped, skipped and use variables from any source. Ansible tries to auto detect this, but you can use the `static` directive (which was added in Ansible 2.1) to bypass autodetection.
* This module is also supported for Windows targets.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **free-form** string | | This module allows you to specify the name of the file directly without any other options. |
Notes
-----
Note
* This is a core feature of Ansible, rather than a module, and cannot be overridden like a module.
* Include has some unintuitive behaviours depending on if it is running in a static or dynamic in play or in playbook context, in an effort to clarify behaviours we are moving to a new set modules ([ansible.builtin.include\_tasks](include_tasks_module#ansible-collections-ansible-builtin-include-tasks-module), [ansible.builtin.include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module), [ansible.builtin.import\_playbook](import_playbook_module#ansible-collections-ansible-builtin-import-playbook-module), [ansible.builtin.import\_tasks](import_tasks_module#ansible-collections-ansible-builtin-import-tasks-module)) that have well established and clear behaviours.
* **This module will still be supported for some time but we are looking at deprecating it in the near future.**
See Also
--------
See also
[ansible.builtin.import\_playbook](import_playbook_module#ansible-collections-ansible-builtin-import-playbook-module)
The official documentation on the **ansible.builtin.import\_playbook** module.
[ansible.builtin.import\_role](import_role_module#ansible-collections-ansible-builtin-import-role-module)
The official documentation on the **ansible.builtin.import\_role** module.
[ansible.builtin.import\_tasks](import_tasks_module#ansible-collections-ansible-builtin-import-tasks-module)
The official documentation on the **ansible.builtin.import\_tasks** module.
[ansible.builtin.include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module)
The official documentation on the **ansible.builtin.include\_role** module.
[ansible.builtin.include\_tasks](include_tasks_module#ansible-collections-ansible-builtin-include-tasks-module)
The official documentation on the **ansible.builtin.include\_tasks** module.
[Including and importing](../../../user_guide/playbooks_reuse_includes#playbooks-reuse-includes)
More information related to including and importing playbooks, roles and tasks.
Examples
--------
```
- hosts: localhost
tasks:
- debug:
msg: play1
- name: Include a play after another play
include: otherplays.yaml
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play
include: stuff.yaml
- debug:
msg: task10
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play only if the condition is true
include: "{{ hostvar }}.yaml"
static: no
when: hostvar is defined
```
### Authors
* Ansible Core Team (@ansible)
ansible ansible.builtin.fetch – Fetch files from remote nodes ansible.builtin.fetch – Fetch files from remote nodes
=====================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `fetch` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* This module works like [ansible.builtin.copy](copy_module#ansible-collections-ansible-builtin-copy-module), but in reverse.
* It is used for fetching files from remote machines and storing them locally in a file tree, organized by hostname.
* Files that already exist at *dest* will be overwritten if they are different than the *src*.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dest** string / required | | A directory to save the file into. For example, if the *dest* directory is `/backup` a *src* file named `/etc/profile` on host `host.example.com`, would be saved into `/backup/host.example.com/etc/profile`. The host name is based on the inventory name. |
| **fail\_on\_missing** boolean added in 1.1 of ansible.builtin | **Choices:*** no
* **yes** ←
| When set to `yes`, the task will fail if the remote file cannot be read for any reason. Prior to Ansible 2.5, setting this would only fail if the source file was missing. The default was changed to `yes` in Ansible 2.5. |
| **flat** boolean added in 1.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Allows you to override the default behavior of appending hostname/path/to/file to the destination. If `dest` ends with '/', it will use the basename of the source file, similar to the copy module. This can be useful if working with a single host, or if retrieving files that are uniquely named per host. If using multiple hosts with the same filename, the file will be overwritten for each host. |
| **src** string / required | | The file on the remote system to fetch. This *must* be a file, not a directory. Recursive fetching may be supported in a later release. |
| **validate\_checksum** boolean added in 1.4 of ansible.builtin | **Choices:*** no
* **yes** ←
| Verify that the source and destination checksums match after the files are fetched. |
Notes
-----
Note
* When running fetch with `become`, the [ansible.builtin.slurp](slurp_module#ansible-collections-ansible-builtin-slurp-module) module will also be used to fetch the contents of the file for determining the remote checksum. This effectively doubles the transfer size, and depending on the file size can consume all available memory on the remote or local hosts causing a `MemoryError`. Due to this it is advisable to run this module without `become` whenever possible.
* Prior to Ansible 2.5 this module would not fail if reading the remote file was impossible unless `fail_on_missing` was set.
* In Ansible 2.5 or later, playbook authors are encouraged to use `fail_when` or `ignore_errors` to get this ability. They may also explicitly set `fail_on_missing` to `no` to get the non-failing behaviour.
* This module is also supported for Windows targets.
* Supports `check_mode`.
See Also
--------
See also
[ansible.builtin.copy](copy_module#ansible-collections-ansible-builtin-copy-module)
The official documentation on the **ansible.builtin.copy** module.
[ansible.builtin.slurp](slurp_module#ansible-collections-ansible-builtin-slurp-module)
The official documentation on the **ansible.builtin.slurp** module.
Examples
--------
```
- name: Store file into /tmp/fetched/host.example.com/tmp/somefile
ansible.builtin.fetch:
src: /tmp/somefile
dest: /tmp/fetched
- name: Specifying a path directly
ansible.builtin.fetch:
src: /tmp/somefile
dest: /tmp/prefix-{{ inventory_hostname }}
flat: yes
- name: Specifying a destination path
ansible.builtin.fetch:
src: /tmp/uniquefile
dest: /tmp/special/
flat: yes
- name: Storing in a path relative to the playbook
ansible.builtin.fetch:
src: /tmp/uniquefile
dest: special/prefix-{{ inventory_hostname }}
flat: yes
```
### Authors
* Ansible Core Team
* Michael DeHaan
ansible ansible.builtin.debug – Print statements during execution ansible.builtin.debug – Print statements during execution
=========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `debug` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* This module prints statements during execution and can be useful for debugging variables or expressions without necessarily halting the playbook.
* Useful for debugging together with the ‘when:’ directive.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **msg** string | **Default:**"Hello world!" | The customized message that is printed. If omitted, prints a generic message. |
| **var** string | | A variable name to debug. Mutually exclusive with the `msg` option. Be aware that this option already runs in Jinja2 context and has an implicit `{{ }}` wrapping, so you should not be using Jinja2 delimiters unless you are looking for double interpolation. |
| **verbosity** integer added in 2.1 of ansible.builtin | **Default:**0 | A number that controls when the debug is run, if you set to 3 it will only run debug when -vvv or above. |
Notes
-----
Note
* This module is also supported for Windows targets.
See Also
--------
See also
[ansible.builtin.assert](assert_module#ansible-collections-ansible-builtin-assert-module)
The official documentation on the **ansible.builtin.assert** module.
[ansible.builtin.fail](fail_module#ansible-collections-ansible-builtin-fail-module)
The official documentation on the **ansible.builtin.fail** module.
Examples
--------
```
- name: Print the gateway for each host when defined
ansible.builtin.debug:
msg: System {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }}
when: ansible_default_ipv4.gateway is defined
- name: Get uptime information
ansible.builtin.shell: /usr/bin/uptime
register: result
- name: Print return information from the previous task
ansible.builtin.debug:
var: result
verbosity: 2
- name: Display all variables/facts known for a host
ansible.builtin.debug:
var: hostvars[inventory_hostname]
verbosity: 4
- name: Prints two lines of messages, but only if there is an environment value set
ansible.builtin.debug:
msg:
- "Provisioning based on YOUR_KEY which is: {{ lookup('env', 'YOUR_KEY') }}"
- "These servers were built using the password of '{{ password_used }}'. Please retain this for later use."
```
### Authors
* Dag Wieers (@dagwieers)
* Michael DeHaan
ansible ansible.builtin.constructed – Uses Jinja2 to construct vars and groups based on existing inventory. ansible.builtin.constructed – Uses Jinja2 to construct vars and groups based on existing inventory.
===================================================================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `constructed` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Uses a YAML configuration file with a valid YAML or `.config` extension to define var expressions and group conditionals
* The Jinja2 conditionals that qualify a host for membership.
* The Jinja2 expressions are calculated and assigned to the variables
* Only variables already available from previous inventories or the fact cache can be used for templating.
* When *strict* is False, failed expressions will be ignored (assumes vars were missing).
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **compose** dictionary | **Default:**{} | | Create vars from jinja2 expressions. |
| **groups** dictionary | **Default:**{} | | Add hosts to group based on Jinja2 conditionals. |
| **keyed\_groups** list / elements=string | **Default:**[] | | Add hosts to group based on the values of a variable. |
| **leading\_separator** boolean added in 2.11 of ansible.builtin | **Choices:*** no
* **yes** ←
| | Use in conjunction with keyed\_groups. By default, a keyed group that does not have a prefix or a separator provided will have a name that starts with an underscore. This is because the default prefix is "" and the default separator is "\_". Set this option to False to omit the leading underscore (or other separator) if no prefix is given. If the group name is derived from a mapping the separator is still used to concatenate the items. To not use a separator in the group name at all, set the separator for the keyed group to an empty string instead. |
| **plugin** string / required | **Choices:*** constructed
| | token that ensures this is a source file for the 'constructed' plugin. |
| **strict** boolean | **Choices:*** **no** ←
* yes
| | If `yes` make invalid entries a fatal error, otherwise skip and continue. Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default. |
| **use\_extra\_vars** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [inventory\_plugins]use\_extra\_vars = no env:ANSIBLE\_INVENTORY\_USE\_EXTRA\_VARS | Merge extra vars into the available variables for composition (highest precedence). |
| **use\_vars\_plugins** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| | Normally, for performance reasons, vars plugins get executed after the inventory sources complete the base inventory, this option allows for getting vars related to hosts/groups from those plugins. The host\_group\_vars (enabled by default) 'vars plugin' is the one responsible for reading host\_vars/ and group\_vars/ directories. This will execute all vars plugins, even those that are not supposed to execute at the 'inventory' stage. See vars plugins docs for details on 'stage'. |
Examples
--------
```
# inventory.config file in YAML format
plugin: constructed
strict: False
compose:
var_sum: var1 + var2
# this variable will only be set if I have a persistent fact cache enabled (and have non expired facts)
# `strict: False` will skip this instead of producing an error if it is missing facts.
server_type: "ansible_hostname | regex_replace ('(.{6})(.{2}).*', '\\2')"
groups:
# simple name matching
webservers: inventory_hostname.startswith('web')
# using ec2 'tags' (assumes aws inventory)
development: "'devel' in (ec2_tags|list)"
# using other host properties populated in inventory
private_only: not (public_dns_name is defined or ip_address is defined)
# complex group membership
multi_group: (group_names | intersect(['alpha', 'beta', 'omega'])) | length >= 2
keyed_groups:
# this creates a group per distro (distro_CentOS, distro_Debian) and assigns the hosts that have matching values to it,
# using the default separator "_"
- prefix: distro
key: ansible_distribution
# the following examples assume the first inventory is from the `aws_ec2` plugin
# this creates a group per ec2 architecture and assign hosts to the matching ones (arch_x86_64, arch_sparc, etc)
- prefix: arch
key: architecture
# this creates a group per ec2 region like "us_west_1"
- prefix: ""
separator: ""
key: placement.region
# this creates a common parent group for all ec2 availability zones
- key: placement.availability_zone
parent_group: all_ec2_zones
```
ansible ansible.builtin.fileglob – list files matching a pattern ansible.builtin.fileglob – list files matching a pattern
========================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `fileglob` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Matches all files in a single directory, non-recursively, that match a pattern. It calls Python’s “glob” library.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | path(s) of files to read |
Notes
-----
Note
* Patterns are only supported on files, not directory/paths.
* Matching is against local system files on the Ansible controller. To iterate a list of files on a remote node, use the [ansible.builtin.find](find_module#ansible-collections-ansible-builtin-find-module) module.
* Returns a string list of paths joined by commas, or an empty list if no files match. For a ‘true list’ pass `wantlist=True` to the lookup.
Examples
--------
```
- name: Display paths of all .txt files in dir
debug: msg={{ lookup('fileglob', '/my/path/*.txt') }}
- name: Copy each file over that matches the given pattern
copy:
src: "{{ item }}"
dest: "/etc/fooapp/"
owner: "root"
mode: 0600
with_fileglob:
- "/playbooks/files/fooapp/*"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=path | success | list of files |
### Authors
* Michael DeHaan
ansible ansible.builtin.unarchive – Unpacks an archive after (optionally) copying it from the local machine ansible.builtin.unarchive – Unpacks an archive after (optionally) copying it from the local machine
===================================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `unarchive` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The `unarchive` module unpacks an archive. It will not unpack a compressed file that does not contain an archive.
* By default, it will copy the source file from the local system to the target before unpacking.
* Set `remote_src=yes` to unpack an archive which already exists on the target.
* If checksum validation is desired, use [ansible.builtin.get\_url](get_url_module#ansible-collections-ansible-builtin-get-url-module) or [ansible.builtin.uri](uri_module#ansible-collections-ansible-builtin-uri-module) instead to fetch the file and set `remote_src=yes`.
* For Windows targets, use the [community.windows.win\_unzip](../../community/windows/win_unzip_module#ansible-collections-community-windows-win-unzip-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **copy** boolean | **Choices:*** no
* **yes** ←
| If true, the file is copied from local controller to the managed (remote) node, otherwise, the plugin will look for src archive on the managed machine. This option has been deprecated in favor of `remote_src`. This option is mutually exclusive with `remote_src`. |
| **creates** path added in 1.6 of ansible.builtin | | If the specified absolute path (file or directory) already exists, this step will **not** be run. |
| **decrypt** boolean added in 2.4 of ansible.builtin | **Choices:*** no
* **yes** ←
| This option controls the autodecryption of source files using vault. |
| **dest** path / required | | Remote absolute path where the archive should be unpacked. |
| **exclude** list / elements=string added in 2.1 of ansible.builtin | **Default:**[] | List the directory and file entries that you would like to exclude from the unarchive action. Mutually exclusive with `include`. |
| **extra\_opts** list / elements=string added in 2.1 of ansible.builtin | **Default:**"" | Specify additional options by passing in an array. Each space-separated command-line option should be a new element of the array. See examples. Command-line options with multiple elements must use multiple lines in the array, one for each element. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **include** list / elements=string added in 2.11 of ansible.builtin | **Default:**[] | List of directory and file entries that you would like to extract from the archive. Only files listed here will be extracted. Mutually exclusive with `exclude`. |
| **keep\_newer** boolean added in 2.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| Do not replace existing files that are newer than files from the archive. |
| **list\_files** boolean added in 2.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| If set to True, return the list of files that are contained in the tarball. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **remote\_src** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Set to `yes` to indicate the archived file is already on the remote system and not local to the Ansible controller. This option is mutually exclusive with `copy`. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **src** path / required | | If `remote_src=no` (default), local path to archive file to copy to the target server; can be absolute or relative. If `remote_src=yes`, path on the target server to existing archive file to unpack. If `remote_src=yes` and `src` contains `://`, the remote machine will download the file from the URL first. (version\_added 2.0). This is only for simple cases, for full download support use the [ansible.builtin.get\_url](get_url_module) module. |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **validate\_certs** boolean added in 2.2 of ansible.builtin | **Choices:*** no
* **yes** ←
| This only applies if using a https URL as the source of the file. This should only set to `no` used on personally controlled sites using self-signed certificate. Prior to 2.2 the code worked as if this was set to `yes`. |
Notes
-----
Note
* Requires `zipinfo` and `gtar`/`unzip` command on target host.
* Requires `zstd` command on target host to expand *.tar.zst* files.
* Can handle *.zip* files using `unzip` as well as *.tar*, *.tar.gz*, *.tar.bz2*, *.tar.xz*, and *.tar.zst* files using `gtar`.
* Does not handle *.gz* files, *.bz2* files, *.xz*, or *.zst* files that do not contain a *.tar* archive.
* Uses gtar’s `--diff` arg to calculate if changed or not. If this `arg` is not supported, it will always unpack the archive.
* Existing files/directories in the destination which are not in the archive are not touched. This is the same behavior as a normal archive extraction.
* Existing files/directories in the destination which are not in the archive are ignored for purposes of deciding if the archive should be unpacked or not.
* Supports `check_mode`.
See Also
--------
See also
[community.general.archive](../../community/general/archive_module#ansible-collections-community-general-archive-module)
The official documentation on the **community.general.archive** module.
[community.general.iso\_extract](../../community/general/iso_extract_module#ansible-collections-community-general-iso-extract-module)
The official documentation on the **community.general.iso\_extract** module.
[community.windows.win\_unzip](../../community/windows/win_unzip_module#ansible-collections-community-windows-win-unzip-module)
The official documentation on the **community.windows.win\_unzip** module.
Examples
--------
```
- name: Extract foo.tgz into /var/lib/foo
ansible.builtin.unarchive:
src: foo.tgz
dest: /var/lib/foo
- name: Unarchive a file that is already on the remote machine
ansible.builtin.unarchive:
src: /tmp/foo.zip
dest: /usr/local/bin
remote_src: yes
- name: Unarchive a file that needs to be downloaded (added in 2.0)
ansible.builtin.unarchive:
src: https://example.com/example.zip
dest: /usr/local/bin
remote_src: yes
- name: Unarchive a file with extra options
ansible.builtin.unarchive:
src: /tmp/foo.zip
dest: /usr/local/bin
extra_opts:
- --transform
- s/^xxx/yyy/
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dest** string | always | Path to the destination directory. **Sample:** /opt/software |
| **files** list / elements=string | When *list\_files* is True | List of all the files in the archive. **Sample:** ["file1", "file2"] |
| **gid** integer | always | Numerical ID of the group that owns the destination directory. **Sample:** 1000 |
| **group** string | always | Name of the group that owns the destination directory. **Sample:** librarians |
| **handler** string | always | Archive software handler used to extract and decompress the archive. **Sample:** TgzArchive |
| **mode** string | always | String that represents the octal permissions of the destination directory. **Sample:** 0755 |
| **owner** string | always | Name of the user that owns the destination directory. **Sample:** paul |
| **size** integer | always | The size of destination directory in bytes. Does not include the size of files or subdirectories contained within. **Sample:** 36 |
| **src** string | always | The source archive's path. If *src* was a remote web URL, or from the local ansible controller, this shows the temporary location where the download was stored. **Sample:** /home/paul/test.tar.gz |
| **state** string | always | State of the destination. Effectively always "directory". **Sample:** directory |
| **uid** integer | always | Numerical ID of the user that owns the destination directory. **Sample:** 1000 |
### Authors
* Michael DeHaan
| programming_docs |
ansible ansible.builtin.blockinfile – Insert/update/remove a text block surrounded by marker lines ansible.builtin.blockinfile – Insert/update/remove a text block surrounded by marker lines
==========================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `blockinfile` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module will insert/update/remove a block of multi-line text surrounded by customizable marker lines.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **block** string | **Default:**"" | The text to insert inside the marker lines. If it is missing or an empty string, the block will be removed as if `state` were specified to `absent`.
aliases: content |
| **create** boolean | **Choices:*** **no** ←
* yes
| Create a new file if it does not exist. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **insertafter** string | **Choices:*** **EOF** ←
* \*regex\*
| If specified and no begin/ending `marker` lines are found, the block will be inserted after the last match of specified regular expression. A special value is available; `EOF` for inserting the block at the end of the file. If specified regular expression has no matches, `EOF` will be used instead. |
| **insertbefore** string | **Choices:*** BOF
* \*regex\*
| If specified and no begin/ending `marker` lines are found, the block will be inserted before the last match of specified regular expression. A special value is available; `BOF` for inserting the block at the beginning of the file. If specified regular expression has no matches, the block will be inserted at the end of the file. |
| **marker** string | **Default:**"# {mark} ANSIBLE MANAGED BLOCK" | The marker line template.
`{mark}` will be replaced with the values in `marker_begin` (default="BEGIN") and `marker_end` (default="END"). Using a custom marker without the `{mark}` variable may result in the block being repeatedly inserted on subsequent playbook runs. |
| **marker\_begin** string added in 2.5 of ansible.builtin | **Default:**"BEGIN" | This will be inserted at `{mark}` in the opening ansible block marker. |
| **marker\_end** string added in 2.5 of ansible.builtin | **Default:**"END" | This will be inserted at `{mark}` in the closing ansible block marker. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **path** path / required | | The file to modify. Before Ansible 2.3 this option was only usable as *dest*, *destfile* and *name*.
aliases: dest, destfile, name |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the block should be there or not. |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **validate** string | | The validation command to run before copying into place. The path to the file to validate is passed in via '%s' which must be present as in the examples below. The command is passed securely so shell features like expansion and pipes will not work. |
Notes
-----
Note
* This module supports check mode.
* When using ‘with\_\*’ loops be aware that if you do not set a unique mark the block will be overwritten on each iteration.
* As of Ansible 2.3, the *dest* option has been changed to *path* as default, but *dest* still works as well.
* Option *follow* has been removed in Ansible 2.5, because this module modifies the contents of the file so *follow=no* doesn’t make sense.
* When more then one block should be handled in one file you must change the *marker* per task.
Examples
--------
```
# Before Ansible 2.3, option 'dest' or 'name' was used instead of 'path'
- name: Insert/Update "Match User" configuration block in /etc/ssh/sshd_config
blockinfile:
path: /etc/ssh/sshd_config
block: |
Match User ansible-agent
PasswordAuthentication no
- name: Insert/Update eth0 configuration stanza in /etc/network/interfaces
(it might be better to copy files into /etc/network/interfaces.d/)
blockinfile:
path: /etc/network/interfaces
block: |
iface eth0 inet static
address 192.0.2.23
netmask 255.255.255.0
- name: Insert/Update configuration using a local file and validate it
blockinfile:
block: "{{ lookup('file', './local/sshd_config') }}"
path: /etc/ssh/sshd_config
backup: yes
validate: /usr/sbin/sshd -T -f %s
- name: Insert/Update HTML surrounded by custom markers after <body> line
blockinfile:
path: /var/www/html/index.html
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK -->"
insertafter: "<body>"
block: |
<h1>Welcome to {{ ansible_hostname }}</h1>
<p>Last updated on {{ ansible_date_time.iso8601 }}</p>
- name: Remove HTML as well as surrounding markers
blockinfile:
path: /var/www/html/index.html
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK -->"
block: ""
- name: Add mappings to /etc/hosts
blockinfile:
path: /etc/hosts
block: |
{{ item.ip }} {{ item.name }}
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item.name }}"
loop:
- { name: host1, ip: 10.10.1.10 }
- { name: host2, ip: 10.10.1.11 }
- { name: host3, ip: 10.10.1.12 }
```
### Authors
* Yaegashi Takeshi (@yaegashi)
ansible ansible.builtin.debconf – Configure a .deb package ansible.builtin.debconf – Configure a .deb package
==================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `debconf` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.6: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Configure a .deb package using debconf-set-selections.
* Or just query existing selections.
Requirements
------------
The below requirements are needed on the host that executes this module.
* debconf
* debconf-utils
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name of package to configure.
aliases: pkg |
| **question** string | | A debconf configuration setting.
aliases: selection, setting |
| **unseen** boolean | **Choices:*** **no** ←
* yes
| Do not set 'seen' flag when pre-seeding. |
| **value** string | | Value to set the configuration to.
aliases: answer |
| **vtype** string | **Choices:*** boolean
* error
* multiselect
* note
* password
* seen
* select
* string
* text
* title
| The type of the value supplied. It is highly recommended to add *no\_log=True* to task while specifying *vtype=password*.
`seen` was added in Ansible 2.2. |
Notes
-----
Note
* This module requires the command line debconf tools.
* A number of questions have to be answered (depending on the package). Use ‘debconf-show <package>’ on any Debian or derivative with the package installed to see questions/settings available.
* Some distros will always record tasks involving the setting of passwords as changed. This is due to debconf-get-selections masking passwords.
* It is highly recommended to add *no\_log=True* to task while handling sensitive information using this module.
* Supports `check_mode`.
Examples
--------
```
- name: Set default locale to fr_FR.UTF-8
ansible.builtin.debconf:
name: locales
question: locales/default_environment_locale
value: fr_FR.UTF-8
vtype: select
- name: Set to generate locales
ansible.builtin.debconf:
name: locales
question: locales/locales_to_be_generated
value: en_US.UTF-8 UTF-8, fr_FR.UTF-8 UTF-8
vtype: multiselect
- name: Accept oracle license
ansible.builtin.debconf:
name: oracle-java7-installer
question: shared/accepted-oracle-license-v1-1
value: 'true'
vtype: select
- name: Specifying package you can register/return the list of questions and current values
ansible.builtin.debconf:
name: tzdata
- name: Pre-configure tripwire site passphrase
ansible.builtin.debconf:
name: tripwire
question: tripwire/site-passphrase
value: "{{ site_passphrase }}"
vtype: password
no_log: True
```
### Authors
* Brian Coca (@bcoca)
ansible ansible.builtin.advanced_host_list – Parses a ‘host list’ with ranges ansible.builtin.advanced\_host\_list – Parses a ‘host list’ with ranges
=======================================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `advanced_host_list` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Examples](#examples)
Synopsis
--------
* Parses a host list string as a comma separated values of hosts and supports host ranges.
* This plugin only applies to inventory sources that are not paths and contain at least one comma.
Examples
--------
```
# simple range
# ansible -i 'host[1:10],' -m ping
# still supports w/o ranges also
# ansible-playbook -i 'localhost,' play.yml
```
ansible ansible.builtin.apt – Manages apt-packages ansible.builtin.apt – Manages apt-packages
==========================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `apt` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.0.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages *apt* packages (such as for Debian/Ubuntu).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python-apt (python 2)
* python3-apt (python 3)
* aptitude (before 2.4)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_unauthenticated** boolean added in 2.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| Ignore if packages cannot be authenticated. This is useful for bootstrapping environments that manage their own apt-key setup.
`allow_unauthenticated` is only supported with state: *install*/*present*
aliases: allow-unauthenticated |
| **autoclean** boolean added in 2.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, cleans the local repository of retrieved package files that can no longer be downloaded. |
| **autoremove** boolean added in 2.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, remove unused dependency packages for all module states except *build-dep*. It can also be used as the only option. Previous to version 2.4, autoclean was also an alias for autoremove, now it is its own separate command. See documentation for further information. |
| **cache\_valid\_time** integer | **Default:**0 | Update the apt cache if it is older than the *cache\_valid\_time*. This option is set in seconds. As of Ansible 2.4, if explicitly set, this sets *update\_cache=yes*. |
| **deb** path added in 1.6 of ansible.builtin | | Path to a .deb package on the remote machine. If :// in the path, ansible will attempt to download deb before installing. (Version added 2.1) Requires the `xz-utils` package to extract the control file of the deb package to install. |
| **default\_release** string | | Corresponds to the `-t` option for *apt* and sets pin priorities
aliases: default-release |
| **dpkg\_options** string | **Default:**"force-confdef,force-confold" | Add dpkg options to apt command. Defaults to '-o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold"' Options should be supplied as comma separated list |
| **fail\_on\_autoremove** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| Corresponds to the `--no-remove` option for `apt`. If `yes`, it is ensured that no packages will be removed or the task will fail.
`fail_on_autoremove` is only supported with state except `absent`
|
| **force** boolean | **Choices:*** **no** ←
* yes
| Corresponds to the `--force-yes` to *apt-get* and implies `allow_unauthenticated: yes`
This option will disable checking both the packages' signatures and the certificates of the web servers they are downloaded from. This option \*is not\* the equivalent of passing the `-f` flag to *apt-get* on the command line \*\*This is a destructive operation with the potential to destroy your system, and it should almost never be used.\*\* Please also see `man apt-get` for more information. |
| **force\_apt\_get** boolean added in 2.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| Force usage of apt-get instead of aptitude |
| **install\_recommends** boolean | **Choices:*** no
* yes
| Corresponds to the `--no-install-recommends` option for *apt*. `yes` installs recommended packages. `no` does not install recommended packages. By default, Ansible will use the same defaults as the operating system. Suggested packages are never installed.
aliases: install-recommends |
| **name** list / elements=string | | A list of package names, like `foo`, or package specifier with version, like `foo=1.0`. Name wildcards (fnmatch) like `apt*` and version wildcards like `foo=1.0*` are also supported.
aliases: package, pkg |
| **only\_upgrade** boolean added in 2.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| Only upgrade a package if it is already installed. |
| **policy\_rc\_d** integer added in 2.8 of ansible.builtin | | Force the exit code of /usr/sbin/policy-rc.d. For example, if *policy\_rc\_d=101* the installed package will not trigger a service start. If /usr/sbin/policy-rc.d already exists, it is backed up and restored after the package installation. If `null`, the /usr/sbin/policy-rc.d isn't created/changed. |
| **purge** boolean | **Choices:*** **no** ←
* yes
| Will force purging of configuration files if the module state is set to *absent*. |
| **state** string | **Choices:*** absent
* build-dep
* latest
* **present** ←
* fixed
| Indicates the desired package state. `latest` ensures that the latest version is installed. `build-dep` ensures the package build dependencies are installed. `fixed` attempt to correct a system with broken dependencies in place. |
| **update\_cache** boolean | **Choices:*** no
* yes
| Run the equivalent of `apt-get update` before the operation. Can be run as part of the package installation or as a separate step. Default is not to update the cache.
aliases: update-cache |
| **update\_cache\_retries** integer added in 2.10 of ansible.builtin | **Default:**5 | Amount of retries if the cache update fails. Also see *update\_cache\_retry\_max\_delay*. |
| **update\_cache\_retry\_max\_delay** integer added in 2.10 of ansible.builtin | **Default:**12 | Use an exponential backoff delay for each retry (see *update\_cache\_retries*) up to this max delay in seconds. |
| **upgrade** string added in 1.1 of ansible.builtin | **Choices:*** dist
* full
* **no** ←
* safe
* yes
| If yes or safe, performs an aptitude safe-upgrade. If full, performs an aptitude full-upgrade. If dist, performs an apt-get dist-upgrade. Note: This does not upgrade a specific package, use state=latest for that. Note: Since 2.4, apt-get is used as a fall-back if aptitude is not present. |
Notes
-----
Note
* Three of the upgrade modes (`full`, `safe` and its alias `yes`) required `aptitude` up to 2.3, since 2.4 `apt-get` is used as a fall-back.
* In most cases, packages installed with apt will start newly installed services by default. Most distributions have mechanisms to avoid this. For example when installing Postgresql-9.5 in Debian 9, creating an excutable shell script (/usr/sbin/policy-rc.d) that throws a return code of 101 will stop Postgresql 9.5 starting up after install. Remove the file or remove its execute permission afterwards.
* The apt-get commandline supports implicit regex matches here but we do not because it can let typos through easier (If you typo `foo` as `fo` apt-get would install packages that have “fo” in their name with a warning and a prompt for the user. Since we don’t have warnings and prompts before installing we disallow this.Use an explicit fnmatch pattern if you want wildcarding)
* When used with a `loop:` each package will be processed individually, it is much more efficient to pass the list directly to the `name` option.
Examples
--------
```
- name: Install apache httpd (state=present is optional)
apt:
name: apache2
state: present
- name: Update repositories cache and install "foo" package
apt:
name: foo
update_cache: yes
- name: Remove "foo" package
apt:
name: foo
state: absent
- name: Install the package "foo"
apt:
name: foo
- name: Install a list of packages
apt:
pkg:
- foo
- foo-tools
- name: Install the version '1.00' of package "foo"
apt:
name: foo=1.00
- name: Update the repository cache and update package "nginx" to latest version using default release squeeze-backport
apt:
name: nginx
state: latest
default_release: squeeze-backports
update_cache: yes
- name: Install zfsutils-linux with ensuring conflicted packages (e.g. zfs-fuse) will not be removed.
apt:
name: zfsutils-linux
state: latest
fail_on_autoremove: yes
- name: Install latest version of "openjdk-6-jdk" ignoring "install-recommends"
apt:
name: openjdk-6-jdk
state: latest
install_recommends: no
- name: Update all packages to their latest version
apt:
name: "*"
state: latest
- name: Upgrade the OS (apt-get dist-upgrade)
apt:
upgrade: dist
- name: Run the equivalent of "apt-get update" as a separate step
apt:
update_cache: yes
- name: Only run "update_cache=yes" if the last one is more than 3600 seconds ago
apt:
update_cache: yes
cache_valid_time: 3600
- name: Pass options to dpkg on run
apt:
upgrade: dist
update_cache: yes
dpkg_options: 'force-confold,force-confdef'
- name: Install a .deb package
apt:
deb: /tmp/mypackage.deb
- name: Install the build dependencies for package "foo"
apt:
pkg: foo
state: build-dep
- name: Install a .deb package from the internet
apt:
deb: https://example.com/python-ppq_0.1-1_all.deb
- name: Remove useless packages from the cache
apt:
autoclean: yes
- name: Remove dependencies that are no longer required
apt:
autoremove: yes
# Sometimes apt tasks fail because apt is locked by an autoupdate or by a race condition on a thread.
# To check for a lock file before executing, and keep trying until the lock file is released:
- name: Install packages only when the apt process is not locked
apt:
name: foo
state: present
register: apt_action
retries: 100
until: apt_action is success or ('Failed to lock apt for exclusive operation' not in apt_action.msg and '/var/lib/dpkg/lock' not in apt_action.msg)
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cache\_update\_time** integer | success, in some cases | time of the last cache update (0 if unknown) **Sample:** 1425828348000 |
| **cache\_updated** boolean | success, in some cases | if the cache was updated or not **Sample:** True |
| **stderr** string | success, when needed | error output from apt **Sample:** AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to ... |
| **stdout** string | success, when needed | output from apt **Sample:** Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: apache2-bin ... |
### Authors
* Matthew Williams (@mgwilliams)
| programming_docs |
ansible ansible.builtin.unvault – read vaulted file(s) contents ansible.builtin.unvault – read vaulted file(s) contents
=======================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `unvault` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 2.10: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This lookup returns the contents from vaulted (or not) file(s) on the Ansible controller’s file system.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | path(s) of files to read |
Notes
-----
Note
* This lookup does not understand ‘globbing’ nor shell environment variables.
Examples
--------
```
- debug: msg="the value of foo.txt is {{lookup('unvault', '/etc/foo.txt')|to_string }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=any | success | content of file(s) as bytes |
### Authors
* Ansible Core Team
ansible ansible.builtin.paramiko_ssh – Run tasks via python ssh (paramiko) ansible.builtin.paramiko\_ssh – Run tasks via python ssh (paramiko)
===================================================================
Note
This connection plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `paramiko_ssh` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same connection plugin name.
New in version 0.1: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* Use the python ssh implementation (Paramiko) to connect to targets
* The paramiko transport is provided because many distributions, in particular EL6 and before do not support ControlPersist in their SSH implementations.
* This is needed on the Ansible control machine to be reasonably efficient with connections. Thus paramiko is faster for most users on these platforms. Users with ControlPersist capability can consider using -c ssh or configuring the transport in the configuration file.
* This plugin also borrows a lot of settings from the ssh plugin as they both cover the same protocol.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **host\_key\_auto\_add** boolean | **Choices:*** no
* yes
| ini entries: [paramiko\_connection]host\_key\_auto\_add = None env:ANSIBLE\_PARAMIKO\_HOST\_KEY\_AUTO\_ADD | TODO: write it |
| **host\_key\_checking** boolean | **Choices:*** no
* **yes** ←
| ini entries: [defaults]host\_key\_checking = yes [paramiko\_connection]host\_key\_checking = yes
added in 2.5 of ansible.builtin env:ANSIBLE\_HOST\_KEY\_CHECKING env:ANSIBLE\_SSH\_HOST\_KEY\_CHECKING added in 2.5 of ansible.builtin env:ANSIBLE\_PARAMIKO\_HOST\_KEY\_CHECKING added in 2.5 of ansible.builtin var: ansible\_host\_key\_checking added in 2.5 of ansible.builtin var: ansible\_ssh\_host\_key\_checking added in 2.5 of ansible.builtin var: ansible\_paramiko\_host\_key\_checking added in 2.5 of ansible.builtin | Set this to "False" if you want to avoid host key checking by the underlying tools Ansible uses to connect to the host |
| **look\_for\_keys** boolean | **Choices:*** no
* **yes** ←
| ini entries: [paramiko\_connection]look\_for\_keys = yes env:ANSIBLE\_PARAMIKO\_LOOK\_FOR\_KEYS | TODO: write it |
| **password** string | | var: ansible\_password var: ansible\_ssh\_pass var: ansible\_ssh\_password var: ansible\_paramiko\_pass var: ansible\_paramiko\_password added in 2.5 of ansible.builtin | Secret used to either login the ssh server or as a passphrase for ssh keys that require it Can be set from the CLI via the `--ask-pass` option. |
| **proxy\_command** string | **Default:**"" | ini entries: [paramiko\_connection]proxy\_command = env:ANSIBLE\_PARAMIKO\_PROXY\_COMMAND | Proxy information for running the connection via a jumphost Also this plugin will scan 'ssh\_args', 'ssh\_extra\_args' and 'ssh\_common\_args' from the 'ssh' plugin settings for proxy information if set. |
| **pty** boolean | **Choices:*** no
* **yes** ←
| ini entries: [paramiko\_connection]pty = yes env:ANSIBLE\_PARAMIKO\_PTY | TODO: write it |
| **record\_host\_keys** boolean | **Choices:*** no
* **yes** ←
| ini entries: [paramiko\_connection]record\_host\_keys = yes env:ANSIBLE\_PARAMIKO\_RECORD\_HOST\_KEYS | TODO: write it |
| **remote\_addr** string | **Default:**"inventory\_hostname" | var: ansible\_host var: ansible\_ssh\_host var: ansible\_paramiko\_host | Address of the remote target |
| **remote\_user** string | | ini entries: [defaults]remote\_user = None [paramiko\_connection]remote\_user = None
added in 2.5 of ansible.builtin env:ANSIBLE\_REMOTE\_USER env:ANSIBLE\_PARAMIKO\_REMOTE\_USER added in 2.5 of ansible.builtin var: ansible\_user var: ansible\_ssh\_user var: ansible\_paramiko\_user | User to login/authenticate as Can be set from the CLI via the `--user` or `-u` options. |
| **use\_persistent\_connections** boolean | **Choices:*** **no** ←
* yes
| ini entries: [defaults]use\_persistent\_connections = no env:ANSIBLE\_USE\_PERSISTENT\_CONNECTIONS | Toggles the use of persistence for connections |
### Authors
* Ansible Core Team
ansible ansible.builtin.stat – Retrieve file or file system status ansible.builtin.stat – Retrieve file or file system status
==========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `stat` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.3: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Retrieves facts for a file similar to the Linux/Unix ‘stat’ command.
* For Windows targets, use the [ansible.windows.win\_stat](../windows/win_stat_module#ansible-collections-ansible-windows-win-stat-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **checksum\_algorithm** string added in 2.0 of ansible.builtin | **Choices:*** md5
* **sha1** ←
* sha224
* sha256
* sha384
* sha512
| Algorithm to determine checksum of file. Will throw an error if the host is unable to use specified algorithm. The remote host has to support the hashing method specified, `md5` can be unavailable if the host is FIPS-140 compliant.
aliases: checksum, checksum\_algo |
| **follow** boolean | **Choices:*** **no** ←
* yes
| Whether to follow symlinks. |
| **get\_attributes** boolean added in 2.3 of ansible.builtin | **Choices:*** no
* **yes** ←
| Get file attributes using lsattr tool if present.
aliases: attr, attributes |
| **get\_checksum** boolean added in 1.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| Whether to return a checksum of the file. |
| **get\_mime** boolean added in 2.1 of ansible.builtin | **Choices:*** no
* **yes** ←
| Use file magic and return data about the nature of the file. this uses the 'file' utility found on most Linux/Unix systems. This will add both `mime\_type` and 'charset' fields to the return, if possible. In Ansible 2.3 this option changed from 'mime' to 'get\_mime' and the default changed to 'Yes'.
aliases: mime, mime\_type, mime-type |
| **path** path / required | | The full path of the file/object to get the facts of.
aliases: dest, name |
Notes
-----
Note
* Supports `check_mode`.
See Also
--------
See also
[ansible.builtin.file](file_module#ansible-collections-ansible-builtin-file-module)
The official documentation on the **ansible.builtin.file** module.
[ansible.windows.win\_stat](../windows/win_stat_module#ansible-collections-ansible-windows-win-stat-module)
The official documentation on the **ansible.windows.win\_stat** module.
Examples
--------
```
# Obtain the stats of /etc/foo.conf, and check that the file still belongs
# to 'root'. Fail otherwise.
- name: Get stats of a file
ansible.builtin.stat:
path: /etc/foo.conf
register: st
- name: Fail if the file does not belong to 'root'
ansible.builtin.fail:
msg: "Whoops! file ownership has changed"
when: st.stat.pw_name != 'root'
# Determine if a path exists and is a symlink. Note that if the path does
# not exist, and we test sym.stat.islnk, it will fail with an error. So
# therefore, we must test whether it is defined.
# Run this to understand the structure, the skipped ones do not pass the
# check performed by 'when'
- name: Get stats of the FS object
ansible.builtin.stat:
path: /path/to/something
register: sym
- name: Print a debug message
ansible.builtin.debug:
msg: "islnk isn't defined (path doesn't exist)"
when: sym.stat.islnk is not defined
- name: Print a debug message
ansible.builtin.debug:
msg: "islnk is defined (path must exist)"
when: sym.stat.islnk is defined
- name: Print a debug message
ansible.builtin.debug:
msg: "Path exists and is a symlink"
when: sym.stat.islnk is defined and sym.stat.islnk
- name: Print a debug message
ansible.builtin.debug:
msg: "Path exists and isn't a symlink"
when: sym.stat.islnk is defined and sym.stat.islnk == False
# Determine if a path exists and is a directory. Note that we need to test
# both that p.stat.isdir actually exists, and also that it's set to true.
- name: Get stats of the FS object
ansible.builtin.stat:
path: /path/to/something
register: p
- name: Print a debug message
ansible.builtin.debug:
msg: "Path exists and is a directory"
when: p.stat.isdir is defined and p.stat.isdir
- name: Don not do checksum
ansible.builtin.stat:
path: /path/to/myhugefile
get_checksum: no
- name: Use sha256 to calculate checksum
ansible.builtin.stat:
path: /path/to/something
checksum_algorithm: sha256
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stat** complex | success | Dictionary containing all the stat data, some platforms might add additional fields. |
| | **atime** float | success, path exists and user can read stats | Time of last access **Sample:** 1424348972.575 |
| | **attributes** list / elements=string added in 2.3 of ansible.builtin | success, path exists and user can execute the path | list of file attributes **Sample:** ['immutable', 'extent'] |
| | **charset** string | success, path exists and user can read stats and installed python supports it and the `mime` option was true, will return 'unknown' on error. | file character set or encoding **Sample:** us-ascii |
| | **checksum** string | success, path exists, user can read stats, path supports hashing and supplied checksum algorithm is available | hash of the file **Sample:** 50ba294cdf28c0d5bcde25708df53346825a429f |
| | **ctime** float | success, path exists and user can read stats | Time of last metadata update or creation (depends on OS) **Sample:** 1424348972.575 |
| | **dev** integer | success, path exists and user can read stats | Device the inode resides on **Sample:** 33 |
| | **executable** boolean added in 2.2 of ansible.builtin | success, path exists and user can execute the path | Tells you if the invoking user has execute permission on the path |
| | **exists** boolean | success | If the destination path actually exists or not **Sample:** True |
| | **gid** integer | success, path exists and user can read stats | Numeric id representing the group of the owner **Sample:** 1003 |
| | **gr\_name** string | success, path exists and user can read stats and installed python supports it | Group name of owner **Sample:** www-data |
| | **inode** integer | success, path exists and user can read stats | Inode number of the path **Sample:** 12758 |
| | **isblk** boolean | success, path exists and user can read stats | Tells you if the path is a block device |
| | **ischr** boolean | success, path exists and user can read stats | Tells you if the path is a character device |
| | **isdir** boolean | success, path exists and user can read stats | Tells you if the path is a directory |
| | **isfifo** boolean | success, path exists and user can read stats | Tells you if the path is a named pipe |
| | **isgid** boolean | success, path exists and user can read stats | Tells you if the invoking user's group id matches the owner's group id |
| | **islnk** boolean | success, path exists and user can read stats | Tells you if the path is a symbolic link |
| | **isreg** boolean | success, path exists and user can read stats | Tells you if the path is a regular file **Sample:** True |
| | **issock** boolean | success, path exists and user can read stats | Tells you if the path is a unix domain socket |
| | **isuid** boolean | success, path exists and user can read stats | Tells you if the invoking user's id matches the owner's id |
| | **lnk\_source** string | success, path exists and user can read stats and the path is a symbolic link | Target of the symlink normalized for the remote filesystem **Sample:** /home/foobar/21102015-1445431274-908472971 |
| | **lnk\_target** string added in 2.4 of ansible.builtin | success, path exists and user can read stats and the path is a symbolic link | Target of the symlink. Note that relative paths remain relative **Sample:** ../foobar/21102015-1445431274-908472971 |
| | **md5** string | success, path exists and user can read stats and path supports hashing and md5 is supported | md5 hash of the file; this will be removed in Ansible 2.9 in favor of the checksum return value **Sample:** f88fa92d8cf2eeecf4c0a50ccc96d0c0 |
| | **mimetype** string | success, path exists and user can read stats and installed python supports it and the `mime` option was true, will return 'unknown' on error. | file magic data or mime-type **Sample:** application/pdf; charset=binary |
| | **mode** string | success, path exists and user can read stats | Unix permissions of the file in octal representation as a string **Sample:** 1755 |
| | **mtime** float | success, path exists and user can read stats | Time of last modification **Sample:** 1424348972.575 |
| | **nlink** integer | success, path exists and user can read stats | Number of links to the inode (hard links) **Sample:** 1 |
| | **path** string | success and if path exists | The full path of the file/object to get the facts of **Sample:** /path/to/file |
| | **pw\_name** string | success, path exists and user can read stats and installed python supports it | User name of owner **Sample:** httpd |
| | **readable** boolean added in 2.2 of ansible.builtin | success, path exists and user can read the path | Tells you if the invoking user has the right to read the path |
| | **rgrp** boolean | success, path exists and user can read stats | Tells you if the owner's group has read permission **Sample:** True |
| | **roth** boolean | success, path exists and user can read stats | Tells you if others have read permission **Sample:** True |
| | **rusr** boolean | success, path exists and user can read stats | Tells you if the owner has read permission **Sample:** True |
| | **size** integer | success, path exists and user can read stats | Size in bytes for a plain file, amount of data for some special files **Sample:** 203 |
| | **uid** integer | success, path exists and user can read stats | Numeric id representing the file owner **Sample:** 1003 |
| | **wgrp** boolean | success, path exists and user can read stats | Tells you if the owner's group has write permission |
| | **woth** boolean | success, path exists and user can read stats | Tells you if others have write permission |
| | **writeable** boolean added in 2.2 of ansible.builtin | success, path exists and user can write the path | Tells you if the invoking user has the right to write the path |
| | **wusr** boolean | success, path exists and user can read stats | Tells you if the owner has write permission **Sample:** True |
| | **xgrp** boolean | success, path exists and user can read stats | Tells you if the owner's group has execute permission **Sample:** True |
| | **xoth** boolean | success, path exists and user can read stats | Tells you if others have execute permission **Sample:** True |
| | **xusr** boolean | success, path exists and user can read stats | Tells you if the owner has execute permission **Sample:** True |
### Authors
* Bruce Pennypacker (@bpennypacker)
ansible ansible.builtin.getent – A wrapper to the unix getent utility ansible.builtin.getent – A wrapper to the unix getent utility
=============================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `getent` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Runs getent against one of it’s various databases and returns information into the host’s facts, in a getent\_<database> prefixed variable.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **database** string / required | | The name of a getent database supported by the target system (passwd, group, hosts, etc). |
| **fail\_key** boolean | **Choices:*** no
* **yes** ←
| If a supplied key is missing this will make the task fail if `yes`. |
| **key** string | **Default:**"" | Key from which to return values from the specified database, otherwise the full contents are returned. |
| **service** string added in 2.9 of ansible.builtin | | Override all databases with the specified service The underlying system must support the service flag which is not always available. |
| **split** string | | Character used to split the database values into lists/arrays such as ':' or ' ', otherwise it will try to pick one depending on the database. |
Notes
-----
Note
* Not all databases support enumeration, check system documentation for details.
Examples
--------
```
- name: Get root user info
getent:
database: passwd
key: root
- debug:
var: getent_passwd
- name: Get all groups
getent:
database: group
split: ':'
- debug:
var: getent_group
- name: Get all hosts, split by tab
getent:
database: hosts
- debug:
var: getent_hosts
- name: Get http service info, no error if missing
getent:
database: services
key: http
fail_key: False
- debug:
var: getent_services
- name: Get user password hash (requires sudo/root)
getent:
database: shadow
key: www-data
split: ':'
- debug:
var: getent_shadow
```
### Authors
* Brian Coca (@bcoca)
| programming_docs |
ansible ansible.builtin.apt_key – Add or remove an apt key ansible.builtin.apt\_key – Add or remove an apt key
===================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `apt_key` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Add or remove an *apt* key, optionally downloading it.
Requirements
------------
The below requirements are needed on the host that executes this module.
* gpg
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **data** string | | The keyfile contents to add to the keyring. |
| **file** path | | The path to a keyfile on the remote server to add to the keyring. |
| **id** string | | The identifier of the key. Including this allows check mode to correctly report the changed state. If specifying a subkey's id be aware that apt-key does not understand how to remove keys via a subkey id. Specify the primary key's id instead. This parameter is required when `state` is set to `absent`. |
| **keyring** path added in 1.3 of ansible.builtin | | The full path to specific keyring file in `/etc/apt/trusted.gpg.d/`. |
| **keyserver** string added in 1.6 of ansible.builtin | | The keyserver to retrieve key from. |
| **state** string | **Choices:*** absent
* **present** ←
| Ensures that the key is present (added) or absent (revoked). |
| **url** string | | The URL to retrieve key from. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If `no`, SSL certificates for the target url will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
Notes
-----
Note
* The apt-key command has been deprecated and suggests to ‘manage keyring files in trusted.gpg.d instead’. See the Debian wiki for details. This module is kept for backwards compatiblity for systems that still use apt-key as the main way to manage apt repository keys.
* As a sanity check, downloaded key id must match the one specified.
* Use full fingerprint (40 characters) key ids to avoid key collisions. To generate a full-fingerprint imported key: `apt-key adv --list-public-keys --with-fingerprint --with-colons`.
* If you specify both the key id and the URL with `state=present`, the task can verify or add the key as needed.
* Adding a new key requires an apt cache update (e.g. using the [ansible.builtin.apt](apt_module#ansible-collections-ansible-builtin-apt-module) module’s update\_cache option).
* Supports `check_mode`.
Examples
--------
```
- name: Add an apt key by id from a keyserver
ansible.builtin.apt_key:
keyserver: keyserver.ubuntu.com
id: 36A1D7869245C8950F966E92D8576A8BA88D21E9
- name: Add an Apt signing key, uses whichever key is at the URL
ansible.builtin.apt_key:
url: https://ftp-master.debian.org/keys/archive-key-6.0.asc
state: present
- name: Add an Apt signing key, will not download if present
ansible.builtin.apt_key:
id: 9FED2BCBDCD29CDF762678CBAED4B06F473041FA
url: https://ftp-master.debian.org/keys/archive-key-6.0.asc
state: present
- name: Remove a Apt specific signing key, leading 0x is valid
ansible.builtin.apt_key:
id: 0x9FED2BCBDCD29CDF762678CBAED4B06F473041FA
state: absent
# Use armored file since utf-8 string is expected. Must be of "PGP PUBLIC KEY BLOCK" type.
- name: Add a key from a file on the Ansible server
ansible.builtin.apt_key:
data: "{{ lookup('file', 'apt.asc') }}"
state: present
- name: Add an Apt signing key to a specific keyring file
ansible.builtin.apt_key:
id: 9FED2BCBDCD29CDF762678CBAED4B06F473041FA
url: https://ftp-master.debian.org/keys/archive-key-6.0.asc
keyring: /etc/apt/trusted.gpg.d/debian.gpg
- name: Add Apt signing key on remote server to keyring
ansible.builtin.apt_key:
id: 9FED2BCBDCD29CDF762678CBAED4B06F473041FA
file: /tmp/apt.gpg
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | on change | List of apt key ids or fingerprints after any modification **Sample:** ['D8576A8BA88D21E9', '3B4FE6ACC0B21F32', 'D94AA3F0EFE21092', '871920D1991BC93C'] |
| **before** list / elements=string | always | List of apt key ids or fingprints before any modifications **Sample:** ['3B4FE6ACC0B21F32', 'D94AA3F0EFE21092', '871920D1991BC93C'] |
| **fp** string | always | Fingerprint of the key to import **Sample:** D8576A8BA88D21E9 |
| **id** string | always | key id from source **Sample:** 36A1D7869245C8950F966E92D8576A8BA88D21E9 |
| **key\_id** string | always | calculated key id, it should be same as 'id', but can be different **Sample:** 36A1D7869245C8950F966E92D8576A8BA88D21E9 |
| **short\_id** string | always | caclulated short key id **Sample:** A88D21E9 |
### Authors
* Jayson Vantuyl (@jvantuyl)
ansible ansible.builtin.random_choice – return random element from list ansible.builtin.random\_choice – return random element from list
================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `random_choice` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.1: of ansible.builtin
* [Synopsis](#synopsis)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The ‘random\_choice’ feature can be used to pick something at random. While it’s not a load balancer (there are modules for those), it can somewhat be used as a poor man’s load balancer in a MacGyver like situation.
* At a more basic level, they can be used to add chaos and excitement to otherwise predictable automation environments.
Examples
--------
```
- name: Magic 8 ball for MUDs
debug:
msg: "{{ item }}"
with_random_choice:
- "go through the door"
- "drink from the goblet"
- "press the red button"
- "do nothing"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** any | success | random item |
### Authors
* Michael DeHaan
ansible ansible.builtin.cmd – Windows Command Prompt ansible.builtin.cmd – Windows Command Prompt
============================================
Note
This shell plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `cmd` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same shell plugin name.
New in version 2.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* Used with the ‘ssh’ connection plugin and no `DefaultShell` has been set on the Windows host.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **async\_dir** string added in 2.8 of ansible.builtin | **Default:**"%USERPROFILE%\\.ansible\_async" | ini entries: [powershell]async\_dir = %USERPROFILE%\.ansible\_async var: ansible\_async\_dir | Directory in which ansible will keep async job information. Before Ansible 2.8, this was set to `remote_tmp + "\.ansible_async"`. |
| **environment** list / elements=string | **Default:**[{}] | | List of dictionaries of environment variables and their values to use when executing commands. |
| **remote\_tmp** string | **Default:**"%TEMP%" | ini entries: [powershell]remote\_tmp = %TEMP% var: ansible\_remote\_tmp | Temporary directory to use on targets when copying files to the host. |
| **set\_module\_language** boolean | **Choices:*** **no** ←
* yes
| | Controls if we set the locale for modules when executing on the target. Windows only supports `no` as an option. |
ansible ansible.builtin.sh – POSIX shell (/bin/sh) ansible.builtin.sh – POSIX shell (/bin/sh)
==========================================
Note
This shell plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `sh` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same shell plugin name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* This shell plugin is the one you want to use on most Unix systems, it is the most compatible and widely installed shell.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **admin\_users** list / elements=string | **Default:**["root", "toor"] | ini entries: [defaults]admin\_users = ['root', 'toor'] env:ANSIBLE\_ADMIN\_USERS var: ansible\_admin\_users | list of users to be expected to have admin privileges. This is used by the controller to determine how to share temporary files between the remote user and the become user. |
| **async\_dir** string | **Default:**"~/.ansible\_async" | ini entries: [defaults]async\_dir = ~/.ansible\_async env:ANSIBLE\_ASYNC\_DIR var: ansible\_async\_dir | Directory in which ansible will keep async job information |
| **common\_remote\_group** string added in 2.10 of ansible.builtin | | ini entries: [defaults]common\_remote\_group = None env:ANSIBLE\_COMMON\_REMOTE\_GROUP var: ansible\_common\_remote\_group | Checked when Ansible needs to execute a module as a different user. If setfacl and chown both fail and do not let the different user access the module's files, they will be chgrp'd to this group. In order for this to work, the remote\_user and become\_user must share a common group and this setting must be set to that group. |
| **environment** list / elements=string | **Default:**[{}] | | List of dictionaries of environment variables and their values to use when executing commands. |
| **remote\_tmp** string | **Default:**"~/.ansible/tmp" | ini entries: [defaults]remote\_tmp = ~/.ansible/tmp env:ANSIBLE\_REMOTE\_TEMP env:ANSIBLE\_REMOTE\_TMP var: ansible\_remote\_tmp | Temporary directory to use on targets when executing tasks. |
| **system\_tmpdirs** list / elements=string | **Default:**["/var/tmp", "/tmp"] | ini entries: [defaults]system\_tmpdirs = ['/var/tmp', '/tmp'] env:ANSIBLE\_SYSTEM\_TMPDIRS var: ansible\_system\_tmpdirs | List of valid system temporary directories on the managed machine for Ansible to choose when it cannot use ``remote\_tmp``, normally due to permission issues. These must be world readable, writable, and executable. This list should only contain directories which the system administrator has pre-created with the proper ownership and permissions otherwise security issues can arise. |
| **world\_readable\_temp** boolean added in 2.10 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [defaults]allow\_world\_readable\_tmpfiles = no env:ANSIBLE\_SHELL\_ALLOW\_WORLD\_READABLE\_TEMP var: ansible\_shell\_allow\_world\_readable\_temp | This makes the temporary files created on the machine world-readable and will issue a warning instead of failing the task. It is useful when becoming an unprivileged user. |
ansible ansible.builtin.validate_argument_spec – Validate role argument specs. ansible.builtin.validate\_argument\_spec – Validate role argument specs.
========================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `validate_argument_spec` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.11: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module validates role arguments with a defined argument specification.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **argument\_spec** string / required | | A dictionary like AnsibleModule argument\_spec |
| **provided\_arguments** string | | A dictionary of the arguments that will be validated according to argument\_spec |
Examples
--------
```
- name: verify vars needed for this task file are present when included
validate_argument_spec:
argument_spec: '{{required_data}}'
vars:
required_data:
# unlike spec file, just put the options in directly
stuff:
description: stuff
type: str
choices: ['who', 'knows', 'what']
default: what
but:
description: i guess we need one
type: str
required: true
- name: verify vars needed for this task file are present when included, with spec from a spec file
validate_argument_spec:
argument_spec: "{{lookup('file', 'myargspec.yml')['specname']['options']}}"
- name: verify vars needed for next include and not from inside it, also with params i'll only define there
block:
- validate_argument_spec:
argument_spec: "{{lookup('file', 'nakedoptions.yml'}}"
provided_arguments:
but: "that i can define on the include itself, like in it's `vars:` keyword"
- name: the include itself
vars:
stuff: knows
but: nobuts!
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **argument\_errors** list / elements=string | failure | A list of arg validation errors. **Sample:** ['error message 1', 'error message 2'] |
| **argument\_spec\_data** dictionary | failure | A dict of the data from the 'argument\_spec' arg. **Sample:** {'some\_arg': {'type': 'str'}, 'some\_other\_arg': {'required': True, 'type': 'int'}} |
| **validate\_args\_context** dictionary | always | A dict of info about where validate\_args\_spec was used **Sample:** {'argument\_spec\_name': 'main', 'name': 'my\_role', 'path': '/home/user/roles/my\_role/', 'type': 'role'} |
### Authors
* Ansible Core Team
ansible ansible.builtin.raw – Executes a low-down and dirty command ansible.builtin.raw – Executes a low-down and dirty command
===========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `raw` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Executes a low-down and dirty SSH command, not going through the module subsystem.
* This is useful and should only be done in a few cases. A common case is installing `python` on a system without python installed by default. Another is speaking to any devices such as routers that do not have any Python installed. In any other case, using the [ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module) or [ansible.builtin.command](command_module#ansible-collections-ansible-builtin-command-module) module is much more appropriate.
* Arguments given to `raw` are run directly through the configured remote shell.
* Standard output, error output and return code are returned when available.
* There is no change handler support for this module.
* This module does not require python on the remote system, much like the [ansible.builtin.script](script_module#ansible-collections-ansible-builtin-script-module) module.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **executable** string added in 1.0 of ansible.builtin | | Change the shell used to execute the command. Should be an absolute path to the executable. When using privilege escalation (`become`) a default shell will be assigned if one is not provided as privilege escalation requires a shell. |
| **free\_form** string / required | | The raw module takes a free form command to run. There is no parameter actually named 'free form'; see the examples! |
Notes
-----
Note
* If using raw from a playbook, you may need to disable fact gathering using `gather_facts: no` if you’re using `raw` to bootstrap python onto the machine.
* If you want to execute a command securely and predictably, it may be better to use the [ansible.builtin.command](command_module#ansible-collections-ansible-builtin-command-module) or [ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module) modules instead.
* The `environment` keyword does not work with raw normally, it requires a shell which means it only works if `executable` is set or using the module with privilege escalation (`become`).
* This module is also supported for Windows targets.
See Also
--------
See also
[ansible.builtin.command](command_module#ansible-collections-ansible-builtin-command-module)
The official documentation on the **ansible.builtin.command** module.
[ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module)
The official documentation on the **ansible.builtin.shell** module.
[ansible.windows.win\_command](../windows/win_command_module#ansible-collections-ansible-windows-win-command-module)
The official documentation on the **ansible.windows.win\_command** module.
[ansible.windows.win\_shell](../windows/win_shell_module#ansible-collections-ansible-windows-win-shell-module)
The official documentation on the **ansible.windows.win\_shell** module.
Examples
--------
```
- name: Bootstrap a host without python2 installed
raw: dnf install -y python2 python2-dnf libselinux-python
- name: Run a command that uses non-posix shell-isms (in this example /bin/sh doesn't handle redirection and wildcards together but bash does)
raw: cat < /tmp/*txt
args:
executable: /bin/bash
- name: Safely use templated variables. Always use quote filter to avoid injection issues.
raw: "{{ package_mgr|quote }} {{ pkg_flags|quote }} install {{ python|quote }}"
- name: List user accounts on a Windows system
raw: Get-WmiObject -Class Win32_UserAccount
```
### Authors
* Ansible Core Team
* Michael DeHaan
| programming_docs |
ansible ansible.builtin.list – simply returns what it is given. ansible.builtin.list – simply returns what it is given.
=======================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `list` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* this is mostly a noop, to be used as a with\_list loop when you dont want the content transformed in any way.
Examples
--------
```
- name: unlike with_items you will get 3 items from this loop, the 2nd one being a list
debug: var=item
with_list:
- 1
- [2,3]
- 4
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=any | success | basically the same as you fed in |
### Authors
* Ansible Core Team
ansible ansible.builtin.service – Manage services ansible.builtin.service – Manage services
=========================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `service` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.1: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Controls services on remote hosts. Supported init systems include BSD init, OpenRC, SysV, Solaris SMF, systemd, upstart.
* For Windows targets, use the [ansible.windows.win\_service](../windows/win_service_module#ansible-collections-ansible-windows-win-service-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **arguments** string | | Additional arguments provided on the command line. While using remote hosts with systemd this setting will be ignored.
aliases: args |
| **enabled** boolean | **Choices:*** no
* yes
| Whether the service should start on boot. **At least one of state and enabled are required.** |
| **name** string / required | | Name of the service. |
| **pattern** string added in 0.7 of ansible.builtin | | If the service does not respond to the status command, name a substring to look for as would be found in the output of the *ps* command as a stand-in for a status result. If the string is found, the service will be assumed to be started. While using remote hosts with systemd this setting will be ignored. |
| **runlevel** string | **Default:**"default" | For OpenRC init scripts (e.g. Gentoo) only. The runlevel that this service belongs to. While using remote hosts with systemd this setting will be ignored. |
| **sleep** integer added in 1.3 of ansible.builtin | | If the service is being `restarted` then sleep this many seconds between the stop and start command. This helps to work around badly-behaving init scripts that exit immediately after signaling a process to stop. Not all service managers support sleep, i.e when using systemd this setting will be ignored. |
| **state** string | **Choices:*** reloaded
* restarted
* started
* stopped
|
`started`/`stopped` are idempotent actions that will not run commands unless necessary.
`restarted` will always bounce the service.
`reloaded` will always reload. **At least one of state and enabled are required.** Note that reloaded will start the service if it is not already started, even if your chosen init system wouldn't normally. |
| **use** string added in 2.2 of ansible.builtin | **Default:**"auto" | The service module actually uses system specific modules, normally through auto detection, this setting can force a specific module. Normally it uses the value of the 'ansible\_service\_mgr' fact and falls back to the old 'service' module when none matching is found. |
Notes
-----
Note
* For AIX, group subsystem names can be used.
* Supports `check_mode`.
See Also
--------
See also
[ansible.windows.win\_service](../windows/win_service_module#ansible-collections-ansible-windows-win-service-module)
The official documentation on the **ansible.windows.win\_service** module.
Examples
--------
```
- name: Start service httpd, if not started
ansible.builtin.service:
name: httpd
state: started
- name: Stop service httpd, if started
ansible.builtin.service:
name: httpd
state: stopped
- name: Restart service httpd, in all cases
ansible.builtin.service:
name: httpd
state: restarted
- name: Reload service httpd, in all cases
ansible.builtin.service:
name: httpd
state: reloaded
- name: Enable service httpd, and not touch the state
ansible.builtin.service:
name: httpd
enabled: yes
- name: Start service foo, based on running process /usr/bin/foo
ansible.builtin.service:
name: foo
pattern: /usr/bin/foo
state: started
- name: Restart network service for interface eth0
ansible.builtin.service:
name: network
state: restarted
args: eth0
```
### Authors
* Ansible Core Team
* Michael DeHaan
ansible ansible.builtin.winrm – Run tasks over Microsoft’s WinRM ansible.builtin.winrm – Run tasks over Microsoft’s WinRM
========================================================
Note
This connection plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `winrm` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same connection plugin name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
Synopsis
--------
* Run commands or put/fetch on a target via WinRM
* This plugin allows extra arguments to be passed that are supported by the protocol but not explicitly defined here. They should take the form of variables declared with the following pattern `ansible_winrm_<option>`.
Requirements
------------
The below requirements are needed on the local controller node that executes this connection.
* pywinrm (python library)
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **connection\_timeout** integer | | var: ansible\_winrm\_connection\_timeout | Sets the operation and read timeout settings for the WinRM connection. Corresponds to the `operation_timeout_sec` and `read_timeout_sec` args in pywinrm so avoid setting these vars with this one. The default value is whatever is set in the installed version of pywinrm. |
| **kerberos\_command** string | **Default:**"kinit" | var: ansible\_winrm\_kinit\_cmd | kerberos command to use to request a authentication ticket |
| **kerberos\_mode** string | **Choices:*** managed
* manual
| var: ansible\_winrm\_kinit\_mode | kerberos usage mode. The managed option means Ansible will obtain kerberos ticket. While the manual one means a ticket must already have been obtained by the user. If having issues with Ansible freezing when trying to obtain the Kerberos ticket, you can either set this to `manual` and obtain it outside Ansible or install `pexpect` through pip and try again. |
| **kinit\_args** string added in 2.11 of ansible.builtin | | var: ansible\_winrm\_kinit\_args | Extra arguments to pass to `kinit` when getting the Kerberos authentication ticket. By default no extra arguments are passed into `kinit` unless *ansible\_winrm\_kerberos\_delegation* is also set. In that case `-f` is added to the `kinit` args so a forwardable ticket is retrieved. If set, the args will overwrite any existing defaults for `kinit`, including `-f` for a delegated ticket. |
| **path** string | **Default:**"/wsman" | var: ansible\_winrm\_path | URI path to connect to |
| **pipelining** boolean | **Choices:*** no
* yes
**Default:**"ANSIBLE\_PIPELINING" | ini entries: [defaults]pipelining = ANSIBLE\_PIPELINING env:ANSIBLE\_PIPELINING var: ansible\_pipelining | Pipelining reduces the number of connection operations required to execute a module on the remote server, by executing many Ansible modules without actual file transfers. This can result in a very significant performance improvement when enabled. However this can conflict with privilege escalation (become). For example, when using sudo operations you must first disable 'requiretty' in the sudoers file for the target hosts, which is why this feature is disabled by default. |
| **port** integer | **Default:**5986 | var: ansible\_port var: ansible\_winrm\_port | port for winrm to connect on remote target The default is the https (5986) port, if using http it should be 5985 |
| **remote\_addr** string | **Default:**"inventory\_hostname" | var: ansible\_host var: ansible\_winrm\_host | Address of the windows machine |
| **remote\_password** string | | var: ansible\_password var: ansible\_winrm\_pass var: ansible\_winrm\_password | Authentication password for the `remote_user`. Can be supplied as CLI option.
aliases: password |
| **remote\_user** string | | var: ansible\_user var: ansible\_winrm\_user | The user to log in as to the Windows machine |
| **scheme** string | **Choices:*** http
* https
| var: ansible\_winrm\_scheme | URI scheme to use If not set, then will default to `https` or `http` if *port* is `5985`. |
| **transport** list / elements=string | | var: ansible\_winrm\_transport | List of winrm transports to attempt to use (ssl, plaintext, kerberos, etc) If None (the default) the plugin will try to automatically guess the correct list The choices available depend on your version of pywinrm |
### Authors
* Ansible Core Team
ansible ansible.builtin.file – Manage files and file properties ansible.builtin.file – Manage files and file properties
=======================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `file` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Set attributes of files, symlinks or directories.
* Alternatively, remove files, symlinks or directories.
* Many other modules support the same options as the `file` module - including [ansible.builtin.copy](copy_module#ansible-collections-ansible-builtin-copy-module), [ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module), and [ansible.builtin.assemble](assemble_module#ansible-collections-ansible-builtin-assemble-module).
* For Windows targets, use the [ansible.windows.win\_file](../windows/win_file_module#ansible-collections-ansible-windows-win-file-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **access\_time** string added in 2.7 of ansible.builtin | | This parameter indicates the time the file's access time should be set to. Should be `preserve` when no modification is required, `YYYYMMDDHHMM.SS` when using default time format, or `now`. Default is `None` meaning that `preserve` is the default for `state=[file,directory,link,hard]` and `now` is default for `state=touch`. |
| **access\_time\_format** string added in 2.7 of ansible.builtin | **Default:**"%Y%m%d%H%M.%S" | When used with `access_time`, indicates the time format that must be used. Based on default Python format (see time.strftime doc). |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **follow** boolean added in 1.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| This flag indicates that filesystem links, if they exist, should be followed. Previous to Ansible 2.5, this was `no` by default. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Force the creation of the symlinks in two cases: the source file does not exist (but will appear later); the destination exists and is a file (so, we need to unlink the `path` file and create symlink to the `src` file in place of it). |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **modification\_time** string added in 2.7 of ansible.builtin | | This parameter indicates the time the file's modification time should be set to. Should be `preserve` when no modification is required, `YYYYMMDDHHMM.SS` when using default time format, or `now`. Default is None meaning that `preserve` is the default for `state=[file,directory,link,hard]` and `now` is default for `state=touch`. |
| **modification\_time\_format** string added in 2.7 of ansible.builtin | **Default:**"%Y%m%d%H%M.%S" | When used with `modification_time`, indicates the time format that must be used. Based on default Python format (see time.strftime doc). |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **path** path / required | | Path to the file being managed.
aliases: dest, name |
| **recurse** boolean added in 1.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| Recursively set the specified file attributes on directory contents. This applies only when `state` is set to `directory`. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **src** path | | Path of the file to link to. This applies only to `state=link` and `state=hard`. For `state=link`, this will also accept a non-existing path. Relative paths are relative to the file being created (`path`) which is how the Unix command `ln -s SRC DEST` treats relative paths. |
| **state** string | **Choices:*** absent
* directory
* **file** ←
* hard
* link
* touch
| If `absent`, directories will be recursively deleted, and files or symlinks will be unlinked. In the case of a directory, if `diff` is declared, you will see the files and folders deleted listed under `path_contents`. Note that `absent` will not cause `file` to fail if the `path` does not exist as the state did not change. If `directory`, all intermediate subdirectories will be created if they do not exist. Since Ansible 1.7 they will be created with the supplied permissions. If `file`, with no other options, returns the current state of `path`. If `file`, even with other options (such as `mode`), the file will be modified if it exists but will NOT be created if it does not exist. Set to `touch` or use the [ansible.builtin.copy](copy_module) or [ansible.builtin.template](template_module) module if you want to create the file if it does not exist. If `hard`, the hard link will be created or changed. If `link`, the symbolic link will be created or changed. If `touch` (new in 1.4), an empty file will be created if the `path` does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way `touch` works from the command line). |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
Notes
-----
Note
* Supports `check_mode`.
See Also
--------
See also
[ansible.builtin.assemble](assemble_module#ansible-collections-ansible-builtin-assemble-module)
The official documentation on the **ansible.builtin.assemble** module.
[ansible.builtin.copy](copy_module#ansible-collections-ansible-builtin-copy-module)
The official documentation on the **ansible.builtin.copy** module.
[ansible.builtin.stat](stat_module#ansible-collections-ansible-builtin-stat-module)
The official documentation on the **ansible.builtin.stat** module.
[ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module)
The official documentation on the **ansible.builtin.template** module.
[ansible.windows.win\_file](../windows/win_file_module#ansible-collections-ansible-windows-win-file-module)
The official documentation on the **ansible.windows.win\_file** module.
Examples
--------
```
- name: Change file ownership, group and permissions
ansible.builtin.file:
path: /etc/foo.conf
owner: foo
group: foo
mode: '0644'
- name: Give insecure permissions to an existing file
ansible.builtin.file:
path: /work
owner: root
group: root
mode: '1777'
- name: Create a symbolic link
ansible.builtin.file:
src: /file/to/link/to
dest: /path/to/symlink
owner: foo
group: foo
state: link
- name: Create two hard links
ansible.builtin.file:
src: '/tmp/{{ item.src }}'
dest: '{{ item.dest }}'
state: hard
loop:
- { src: x, dest: y }
- { src: z, dest: k }
- name: Touch a file, using symbolic modes to set the permissions (equivalent to 0644)
ansible.builtin.file:
path: /etc/foo.conf
state: touch
mode: u=rw,g=r,o=r
- name: Touch the same file, but add/remove some permissions
ansible.builtin.file:
path: /etc/foo.conf
state: touch
mode: u+rw,g-wx,o-rwx
- name: Touch again the same file, but do not change times this makes the task idempotent
ansible.builtin.file:
path: /etc/foo.conf
state: touch
mode: u+rw,g-wx,o-rwx
modification_time: preserve
access_time: preserve
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /etc/some_directory
state: directory
mode: '0755'
- name: Update modification and access time of given file
ansible.builtin.file:
path: /etc/some_file
state: file
modification_time: now
access_time: now
- name: Set access time based on seconds from epoch value
ansible.builtin.file:
path: /etc/another_file
state: file
access_time: '{{ "%Y%m%d%H%M.%S" | strftime(stat_var.stat.atime) }}'
- name: Recursively change ownership of a directory
ansible.builtin.file:
path: /etc/foo
state: directory
recurse: yes
owner: foo
group: foo
- name: Remove file (delete file)
ansible.builtin.file:
path: /etc/foo.txt
state: absent
- name: Recursively remove directory
ansible.builtin.file:
path: /etc/foo
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dest** string | state=touch, state=hard, state=link | Destination file/path, equal to the value passed to *path*. **Sample:** /path/to/file.txt |
| **path** string | state=absent, state=directory, state=file | Destination file/path, equal to the value passed to *path*. **Sample:** /path/to/file.txt |
### Authors
* Ansible Core Team
* Michael DeHaan
| programming_docs |
ansible ansible.builtin.group_by – Create Ansible groups based on facts ansible.builtin.group\_by – Create Ansible groups based on facts
================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `group_by` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Use facts to create ad-hoc groups that can be used later in a playbook.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **key** string / required | | The variables whose values will be used as groups. |
| **parents** list / elements=string added in 2.4 of ansible.builtin | **Default:**"all" | The list of the parent groups. |
Notes
-----
Note
* Spaces in group names are converted to dashes ‘-‘.
* This module is also supported for Windows targets.
* Though this module does not change the remote host, we do provide ‘changed’ status as it can be useful for those trying to track inventory changes.
See Also
--------
See also
[ansible.builtin.add\_host](add_host_module#ansible-collections-ansible-builtin-add-host-module)
The official documentation on the **ansible.builtin.add\_host** module.
Examples
--------
```
- name: Create groups based on the machine architecture
ansible.builtin.group_by:
key: machine_{{ ansible_machine }}
- name: Create groups like 'virt_kvm_host'
ansible.builtin.group_by:
key: virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }}
- name: Create nested groups
ansible.builtin.group_by:
key: el{{ ansible_distribution_major_version }}-{{ ansible_architecture }}
parents:
- el{{ ansible_distribution_major_version }}
- name: Add all active hosts to a static group
ansible.builtin.group_by:
key: done
```
### Authors
* Jeroen Hoekx (@jhoekx)
ansible ansible.builtin.set_fact – Set host variable(s) and fact(s). ansible.builtin.set\_fact – Set host variable(s) and fact(s).
=============================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `set_fact` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* This action allows setting variables associated to the current host.
* These variables will be available to subsequent plays during an ansible-playbook run via the host they were set on.
* Set `cacheable` to `yes` to save variables across executions using a fact cache. Variables will keep the set\_fact precedence for the current run, but will used ‘cached fact’ precedence for subsequent ones.
* Per the standard Ansible variable precedence rules, other types of variables have a higher priority, so this value may be overridden.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cacheable** boolean added in 2.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| This boolean converts the variable into an actual 'fact' which will also be added to the fact cache, if fact caching is enabled. Normally this module creates 'host level variables' and has much higher precedence, this option changes the nature and precedence (by 7 steps) of the variable created. [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_variables.html#variable-precedence-where-should-i-put-a-variable](../../../user_guide/playbooks_variables#variable-precedence-where-should-i-put-a-variable)
This actually creates 2 copies of the variable, a normal 'set\_fact' host variable with high precedence and a lower 'ansible\_fact' one that is available for persistance via the facts cache plugin. This creates a possibly confusing interaction with `meta: clear_facts` as it will remove the 'ansible\_fact' but not the host variable. |
| **key\_value** string / required | | The `set_fact` module takes ``key=value`` pairs or ``key: value``(YAML notation) as variables to set in the playbook scope. The 'key' is the resulting variable name and the value is, of course, the value of said variable. You can create multiple variables at once, by supplying multiple pairs, but do NOT mix notations. |
Notes
-----
Note
* Because of the nature of tasks, set\_fact will produce ‘static’ values for a variable. Unlike normal ‘lazy’ variables, the value gets evaluated and templated on assignment.
* Some boolean values (yes, no, true, false) will always be converted to boolean type, unless `DEFAULT_JINJA2_NATIVE` is enabled. This is done so the `var=value` booleans, otherwise it would only be able to create strings, but it also prevents using those values to create YAML strings. Using the setting will restrict k=v to strings, but will allow you to specify string or boolean in YAML.
* To create lists/arrays or dictionary/hashes use YAML notation `var: [val1, val2]`.
* Since ‘cacheable’ is now a module param, ‘cacheable’ is no longer a valid fact name.
* This action does not use a connection and always executes on the controller.
See Also
--------
See also
[ansible.builtin.include\_vars](include_vars_module#ansible-collections-ansible-builtin-include-vars-module)
The official documentation on the **ansible.builtin.include\_vars** module.
[Variable precedence: Where should I put a variable?](../../../user_guide/playbooks_variables#ansible-variable-precedence)
More information related to variable precedence and which type of variable wins over others.
Examples
--------
```
- name: Setting host facts using key=value pairs, this format can only create strings or booleans
set_fact: one_fact="something" other_fact="{{ local_var }}"
- name: Setting host facts using complex arguments
set_fact:
one_fact: something
other_fact: "{{ local_var * 2 }}"
another_fact: "{{ some_registered_var.results | map(attribute='ansible_facts.some_fact') | list }}"
- name: Setting facts so that they will be persisted in the fact cache
set_fact:
one_fact: something
other_fact: "{{ local_var * 2 }}"
cacheable: yes
- name: Creating list and dictionary variables
set_fact:
one_dict:
something: here
other: there
one_list:
- a
- b
- c
- name: Creating list and dictionary variables using 'shorthand' YAML
set_fact:
two_dict: {'something': here2, 'other': somewhere}
two_list: [1,2,3]
```
### Authors
* Dag Wieers (@dagwieers)
ansible ansible.builtin.package_facts – Package information as facts ansible.builtin.package\_facts – Package information as facts
=============================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `package_facts` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Returned Facts](#returned-facts)
Synopsis
--------
* Return information about installed packages as facts.
Requirements
------------
The below requirements are needed on the host that executes this module.
* For ‘portage’ support it requires the `qlist` utility, which is part of ‘app-portage/portage-utils’.
* For Debian-based systems `python-apt` package must be installed on targeted hosts.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **manager** list / elements=string | **Choices:*** **auto** ←
* rpm
* apt
* portage
* pkg
* pacman
* apk
**Default:**["auto"] | The package manager used by the system so we can query the package information. Since 2.8 this is a list and can support multiple package managers per system. The 'portage' and 'pkg' options were added in version 2.8. The 'apk' option was added in version 2.11. |
| **strategy** string added in 2.8 of ansible.builtin | **Choices:*** **first** ←
* all
| This option controls how the module queries the package managers on the system. `first` means it will return only information for the first supported package manager available. `all` will return information for all supported and available package managers on the system. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto
- name: Print the package facts
ansible.builtin.debug:
var: ansible_facts.packages
- name: Check whether a package called foobar is installed
ansible.builtin.debug:
msg: "{{ ansible_facts.packages['foobar'] | length }} versions of foobar are installed!"
when: "'foobar' in ansible_facts.packages"
```
Returned Facts
--------------
Facts returned by this module are added/updated in the `hostvars` host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
| Fact | Returned | Description |
| --- | --- | --- |
| **packages** dictionary / elements=string | when operating system level package manager is specified or auto detected manager | Maps the package name to a non-empty list of dicts with package information. Every dict in the list corresponds to one installed version of the package. The fields described below are present for all package managers. Depending on the package manager, there might be more fields for a package. **Sample:** { "packages": { "kernel": [ { "name": "kernel", "source": "rpm", "version": "3.10.0", ... }, { "name": "kernel", "source": "rpm", "version": "3.10.0", ... }, ... ], "kernel-tools": [ { "name": "kernel-tools", "source": "rpm", "version": "3.10.0", ... } ], ... } } # Sample rpm { "packages": { "kernel": [ { "arch": "x86\_64", "epoch": null, "name": "kernel", "release": "514.26.2.el7", "source": "rpm", "version": "3.10.0" }, { "arch": "x86\_64", "epoch": null, "name": "kernel", "release": "514.16.1.el7", "source": "rpm", "version": "3.10.0" }, { "arch": "x86\_64", "epoch": null, "name": "kernel", "release": "514.10.2.el7", "source": "rpm", "version": "3.10.0" }, { "arch": "x86\_64", "epoch": null, "name": "kernel", "release": "514.21.1.el7", "source": "rpm", "version": "3.10.0" }, { "arch": "x86\_64", "epoch": null, "name": "kernel", "release": "693.2.2.el7", "source": "rpm", "version": "3.10.0" } ], "kernel-tools": [ { "arch": "x86\_64", "epoch": null, "name": "kernel-tools", "release": "693.2.2.el7", "source": "rpm", "version": "3.10.0" } ], "kernel-tools-libs": [ { "arch": "x86\_64", "epoch": null, "name": "kernel-tools-libs", "release": "693.2.2.el7", "source": "rpm", "version": "3.10.0" } ], } } # Sample deb { "packages": { "libbz2-1.0": [ { "version": "1.0.6-5", "source": "apt", "arch": "amd64", "name": "libbz2-1.0" } ], "patch": [ { "version": "2.7.1-4ubuntu1", "source": "apt", "arch": "amd64", "name": "patch" } ], } } |
| | **name** string / elements=string | always | The package's name. |
| | **source** string / elements=string | always | Where information on the package came from. |
| | **version** string / elements=string | always | The package's version. |
### Authors
* Matthew Jones (@matburt)
* Brian Coca (@bcoca)
* Adam Miller (@maxamillion)
ansible ansible.builtin.script – Runs a local script on a remote node after transferring it ansible.builtin.script – Runs a local script on a remote node after transferring it
===================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `script` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* The `script` module takes the script name followed by a list of space-delimited arguments.
* Either a free form command or `cmd` parameter is required, see the examples.
* The local script at path will be transferred to the remote node and then executed.
* The given script will be processed through the shell environment on the remote node.
* This module does not require python on the remote system, much like the [ansible.builtin.raw](raw_module#ansible-collections-ansible-builtin-raw-module) module.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **chdir** string added in 2.4 of ansible.builtin | | Change into this directory on the remote node before running the script. |
| **cmd** string | | Path to the local script to run followed by optional arguments. |
| **creates** string added in 1.5 of ansible.builtin | | A filename on the remote node, when it already exists, this step will **not** be run. |
| **decrypt** boolean added in 2.4 of ansible.builtin | **Choices:*** no
* **yes** ←
| This option controls the autodecryption of source files using vault. |
| **executable** string added in 2.6 of ansible.builtin | | Name or path of a executable to invoke the script with. |
| **free\_form** string | | Path to the local script file followed by optional arguments. |
| **removes** string added in 1.5 of ansible.builtin | | A filename on the remote node, when it does not exist, this step will **not** be run. |
Notes
-----
Note
* It is usually preferable to write Ansible modules rather than pushing scripts. Convert your script to an Ansible module for bonus points!
* The `ssh` connection plugin will force pseudo-tty allocation via `-tt` when scripts are executed. Pseudo-ttys do not have a stderr channel and all stderr is sent to stdout. If you depend on separated stdout and stderr result keys, please switch to a copy+command set of tasks instead of using script.
* If the path to the local script contains spaces, it needs to be quoted.
* This module is also supported for Windows targets.
* Does not support `check_mode`.
See Also
--------
See also
[ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module)
The official documentation on the **ansible.builtin.shell** module.
[ansible.windows.win\_shell](../windows/win_shell_module#ansible-collections-ansible-windows-win-shell-module)
The official documentation on the **ansible.windows.win\_shell** module.
Examples
--------
```
- name: Run a script with arguments (free form)
ansible.builtin.script: /some/local/script.sh --some-argument 1234
- name: Run a script with arguments (using 'cmd' parameter)
ansible.builtin.script:
cmd: /some/local/script.sh --some-argument 1234
- name: Run a script only if file.txt does not exist on the remote node
ansible.builtin.script: /some/local/create_file.sh --some-argument 1234
args:
creates: /the/created/file.txt
- name: Run a script only if file.txt exists on the remote node
ansible.builtin.script: /some/local/remove_file.sh --some-argument 1234
args:
removes: /the/removed/file.txt
- name: Run a script using an executable in a non-system path
ansible.builtin.script: /some/local/script
args:
executable: /some/remote/executable
- name: Run a script using an executable in a system path
ansible.builtin.script: /some/local/script.py
args:
executable: python3
```
### Authors
* Ansible Core Team
* Michael DeHaan
ansible ansible.builtin.set_stats – Define and display stats for the current ansible run ansible.builtin.set\_stats – Define and display stats for the current ansible run
=================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `set_stats` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.3: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module allows setting/accumulating stats on the current ansible run, either per host or for all hosts in the run.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aggregate** boolean | **Choices:*** no
* **yes** ←
| Whether the provided value is aggregated to the existing stat `yes` or will replace it `no`. |
| **data** dictionary / required | | A dictionary of which each key represents a stat (or variable) you want to keep track of. |
| **per\_host** boolean | **Choices:*** **no** ←
* yes
| whether the stats are per host or for all hosts in the run. |
Notes
-----
Note
* In order for custom stats to be displayed, you must set `show_custom_stats` in section `[defaults]` in `ansible.cfg` or by defining environment variable `ANSIBLE_SHOW_CUSTOM_STATS` to `yes`.
* This module is also supported for Windows targets.
Examples
--------
```
- name: Aggregating packages_installed stat per host
ansible.builtin.set_stats:
data:
packages_installed: 31
per_host: yes
- name: Aggregating random stats for all hosts using complex arguments
ansible.builtin.set_stats:
data:
one_stat: 11
other_stat: "{{ local_var * 2 }}"
another_stat: "{{ some_registered_var.results | map(attribute='ansible_facts.some_fact') | list }}"
per_host: no
- name: Setting stats (not aggregating)
ansible.builtin.set_stats:
data:
the_answer: 42
aggregate: no
```
### Authors
* Brian Coca (@bcoca)
ansible ansible.builtin.git – Deploy software (or files) from git checkouts ansible.builtin.git – Deploy software (or files) from git checkouts
===================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `git` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.0.1: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage *git* checkouts of repositories to deploy files or software.
Requirements
------------
The below requirements are needed on the host that executes this module.
* git>=1.7.1 (the command line tool)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **accept\_hostkey** boolean added in 1.5 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, ensure that "-o StrictHostKeyChecking=no" is present as an ssh option. |
| **archive** path added in 2.4 of ansible.builtin | | Specify archive file path with extension. If specified, creates an archive file of the specified format containing the tree structure for the source tree. Allowed archive formats ["zip", "tar.gz", "tar", "tgz"]. This will clone and perform git archive from local directory as not all git servers support git archive. |
| **archive\_prefix** string added in 2.10 of ansible.builtin | | Specify a prefix to add to each file path in archive. Requires *archive* to be specified. |
| **bare** boolean added in 1.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, repository will be created as a bare repo, otherwise it will be a standard repo with a workspace. |
| **clone** boolean added in 1.9 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, do not clone the repository even if it does not exist locally. |
| **depth** integer added in 1.2 of ansible.builtin | | Create a shallow clone with a history truncated to the specified number or revisions. The minimum possible value is `1`, otherwise ignored. Needs *git>=1.9.1* to work correctly. |
| **dest** path / required | | The path of where the repository should be checked out. This is equivalent to `git clone [repo_url] [directory]`. The repository named in *repo* is not appended to this path and the destination directory must be empty. This parameter is required, unless *clone* is set to `no`. |
| **executable** path added in 1.4 of ansible.builtin | | Path to git executable to use. If not supplied, the normal mechanism for resolving binary paths will be used. |
| **force** boolean added in 0.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, any modified files in the working repository will be discarded. Prior to 0.7, this was always 'yes' and could not be disabled. Prior to 1.9, the default was `yes`. |
| **gpg\_whitelist** list / elements=string added in 2.9 of ansible.builtin | **Default:**[] | A list of trusted GPG fingerprints to compare to the fingerprint of the GPG-signed commit. Only used when *verify\_commit=yes*. Use of this feature requires Git 2.6+ due to its reliance on git's `--raw` flag to `verify-commit` and `verify-tag`. |
| **key\_file** path added in 1.5 of ansible.builtin | | Specify an optional private key file path, on the target host, to use for the checkout. |
| **recursive** boolean added in 1.6 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, repository will be cloned without the --recursive option, skipping sub-modules. |
| **reference** string added in 1.4 of ansible.builtin | | Reference repository (see "git clone --reference ..."). |
| **refspec** string added in 1.9 of ansible.builtin | | Add an additional refspec to be fetched. If version is set to a *SHA-1* not reachable from any branch or tag, this option may be necessary to specify the ref containing the *SHA-1*. Uses the same syntax as the `git fetch` command. An example value could be "refs/meta/config". |
| **remote** string | **Default:**"origin" | Name of the remote. |
| **repo** string / required | | git, SSH, or HTTP(S) protocol address of the git repository.
aliases: name |
| **separate\_git\_dir** path added in 2.7 of ansible.builtin | | The path to place the cloned repository. If specified, Git repository can be separated from working tree. |
| **single\_branch** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| Clone only the history leading to the tip of the specified revision. |
| **ssh\_opts** string added in 1.5 of ansible.builtin | | Creates a wrapper script and exports the path as GIT\_SSH which git then automatically uses to override ssh arguments. An example value could be "-o StrictHostKeyChecking=no" (although this particular option is better set by *accept\_hostkey*). |
| **track\_submodules** boolean added in 1.8 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, submodules will track the latest commit on their master branch (or other branch specified in .gitmodules). If `no`, submodules will be kept at the revision specified by the main project. This is equivalent to specifying the --remote flag to git submodule update. |
| **umask** raw added in 2.2 of ansible.builtin | | The umask to set before doing any checkouts, or any other repository maintenance. |
| **update** boolean added in 1.2 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, do not retrieve new revisions from the origin repository. Operations like archive will work on the existing (old) repository and might not respond to changes to the options version or remote. |
| **verify\_commit** boolean added in 2.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, when cloning or checking out a *version* verify the signature of a GPG signed commit. This requires git version>=2.1.0 to be installed. The commit MUST be signed and the public key MUST be present in the GPG keyring. |
| **version** string | **Default:**"HEAD" | What version of the repository to check out. This can be the literal string `HEAD`, a branch name, a tag name. It can also be a *SHA-1* hash, in which case *refspec* needs to be specified if the given revision is not already available. |
Notes
-----
Note
* If the task seems to be hanging, first verify remote host is in `known_hosts`. SSH will prompt user to authorize the first contact with a remote host. To avoid this prompt, one solution is to use the option accept\_hostkey. Another solution is to add the remote host public key in `/etc/ssh/ssh_known_hosts` before calling the git module, with the following command: ssh-keyscan -H remote\_host.com >> /etc/ssh/ssh\_known\_hosts.
* Supports `check_mode`.
Examples
--------
```
- name: Git checkout
ansible.builtin.git:
repo: 'https://foosball.example.org/path/to/repo.git'
dest: /srv/checkout
version: release-0.22
- name: Read-write git checkout from github
ansible.builtin.git:
repo: [email protected]:mylogin/hello.git
dest: /home/mylogin/hello
- name: Just ensuring the repo checkout exists
ansible.builtin.git:
repo: 'https://foosball.example.org/path/to/repo.git'
dest: /srv/checkout
update: no
- name: Just get information about the repository whether or not it has already been cloned locally
ansible.builtin.git:
repo: 'https://foosball.example.org/path/to/repo.git'
dest: /srv/checkout
clone: no
update: no
- name: Checkout a github repo and use refspec to fetch all pull requests
ansible.builtin.git:
repo: https://github.com/ansible/ansible-examples.git
dest: /src/ansible-examples
refspec: '+refs/pull/*:refs/heads/*'
- name: Create git archive from repo
ansible.builtin.git:
repo: https://github.com/ansible/ansible-examples.git
dest: /src/ansible-examples
archive: /tmp/ansible-examples.zip
- name: Clone a repo with separate git directory
ansible.builtin.git:
repo: https://github.com/ansible/ansible-examples.git
dest: /src/ansible-examples
separate_git_dir: /src/ansible-examples.git
- name: Example clone of a single branch
ansible.builtin.git:
repo: https://github.com/ansible/ansible-examples.git
dest: /src/ansible-examples
single_branch: yes
version: master
- name: Avoid hanging when http(s) password is missing
ansible.builtin.git:
repo: https://github.com/ansible/could-be-a-private-repo
dest: /src/from-private-repo
environment:
GIT_TERMINAL_PROMPT: 0 # reports "terminal prompts disabled" on missing password
# or GIT_ASKPASS: /bin/true # for git before version 2.3.0, reports "Authentication failed" on missing password
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** string | success | Last commit revision of the repository retrieved during the update. **Sample:** 4c020102a9cd6fe908c9a4a326a38f972f63a903 |
| **before** string | success | Commit revision before the repository was updated, "null" for new repository. **Sample:** 67c04ebe40a003bda0efb34eacfb93b0cafdf628 |
| **git\_dir\_before** string | success | Contains the original path of .git directory if it is changed. **Sample:** /path/to/old/git/dir |
| **git\_dir\_now** string | success | Contains the new path of .git directory if it is changed. **Sample:** /path/to/new/git/dir |
| **remote\_url\_changed** boolean | success | Contains True or False whether or not the remote URL was changed. **Sample:** True |
| **warnings** string | error | List of warnings if requested features were not available due to a too old git version. **Sample:** git version is too old to fully support the depth argument. Falling back to full checkouts. |
### Authors
* Ansible Core Team
* Michael DeHaan
| programming_docs |
ansible ansible.builtin.hostname – Manage hostname ansible.builtin.hostname – Manage hostname
==========================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `hostname` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Set system’s hostname. Supports most OSs/Distributions including those using `systemd`.
* Windows, HP-UX, and AIX are not currently supported.
Requirements
------------
The below requirements are needed on the host that executes this module.
* hostname
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name of the host. If the value is a fully qualified domain name that does not resolve from the given host, this will cause the module to hang for a few seconds while waiting for the name resolution attempt to timeout. |
| **use** string added in 2.9 of ansible.builtin | **Choices:*** alpine
* debian
* freebsd
* generic
* macos
* macosx
* darwin
* openbsd
* openrc
* redhat
* sles
* solaris
* systemd
| Which strategy to use to update the hostname. If not set we try to autodetect, but this can be problematic, particularly with containers as they can present misleading information. Note that 'systemd' should be specified for RHEL/EL/CentOS 7+. Older distributions should use 'redhat'. |
Notes
-----
Note
* This module does **NOT** modify `/etc/hosts`. You need to modify it yourself using other modules such as [ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module) or [ansible.builtin.replace](replace_module#ansible-collections-ansible-builtin-replace-module).
* On macOS, this module uses `scutil` to set `HostName`, `ComputerName`, and `LocalHostName`. Since `LocalHostName` cannot contain spaces or most special characters, this module will replace characters when setting `LocalHostName`.
* Supports `check_mode`.
Examples
--------
```
- name: Set a hostname
ansible.builtin.hostname:
name: web01
- name: Set a hostname specifying strategy
ansible.builtin.hostname:
name: web01
use: systemd
```
### Authors
* Adrian Likins (@alikins)
* Hideki Saito (@saito-hideki)
ansible ansible.builtin.items – list of items ansible.builtin.items – list of items
=====================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `items` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* this lookup returns a list of items given to it, if any of the top level items is also a list it will flatten it, but it will not recurse
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | list of items |
Notes
-----
Note
* this is the standard lookup used for loops in most examples
* check out the ‘flattened’ lookup for recursive flattening
* if you do not want flattening nor any other transformation look at the ‘list’ lookup.
Examples
--------
```
- name: "loop through list"
debug:
msg: "An item: {{ item }}"
with_items:
- 1
- 2
- 3
- name: add several users
user:
name: "{{ item }}"
groups: "wheel"
state: present
with_items:
- testuser1
- testuser2
- name: "loop through list from a variable"
debug:
msg: "An item: {{ item }}"
with_items: "{{ somelist }}"
- name: more complex items to add several users
user:
name: "{{ item.name }}"
uid: "{{ item.uid }}"
groups: "{{ item.groups }}"
state: present
with_items:
- { name: testuser1, uid: 1002, groups: "wheel, staff" }
- { name: testuser2, uid: 1003, groups: staff }
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=string | success | once flattened list |
### Authors
* Michael DeHaan
ansible ansible.builtin.nested – composes a list with nested elements of other lists ansible.builtin.nested – composes a list with nested elements of other lists
============================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `nested` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.1: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Takes the input lists and returns a list with elements that are lists composed of the elements of the input lists
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_raw** string / required | | | a set of lists |
Examples
--------
```
- name: give users access to multiple databases
mysql_user:
name: "{{ item[0] }}"
priv: "{{ item[1] }}.*:ALL"
append_privs: yes
password: "foo"
with_nested:
- [ 'alice', 'bob' ]
- [ 'clientdb', 'employeedb', 'providerdb' ]
# As with the case of 'with_items' above, you can use previously defined variables.:
- name: here, 'users' contains the above list of employees
mysql_user:
name: "{{ item[0] }}"
priv: "{{ item[1] }}.*:ALL"
append_privs: yes
password: "foo"
with_nested:
- "{{ users }}"
- [ 'clientdb', 'employeedb', 'providerdb' ]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=string | success | A list composed of lists paring the elements of the input lists |
ansible ansible.builtin.sudo – Substitute User DO ansible.builtin.sudo – Substitute User DO
=========================================
Note
This become plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `sudo` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same become plugin name.
New in version 2.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* This become plugins allows your remote/login user to execute commands as another user via the sudo utility.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **become\_exe** string | **Default:**"sudo" | ini entries: [privilege\_escalation]become\_exe = sudo [sudo\_become\_plugin]executable = sudo env:ANSIBLE\_BECOME\_EXE env:ANSIBLE\_SUDO\_EXE var: ansible\_become\_exe var: ansible\_sudo\_exe | Sudo executable |
| **become\_flags** string | **Default:**"-H -S -n" | ini entries: [privilege\_escalation]become\_flags = -H -S -n [sudo\_become\_plugin]flags = -H -S -n env:ANSIBLE\_BECOME\_FLAGS env:ANSIBLE\_SUDO\_FLAGS var: ansible\_become\_flags var: ansible\_sudo\_flags | Options to pass to sudo |
| **become\_pass** string | | ini entries: [sudo\_become\_plugin]password = None env:ANSIBLE\_BECOME\_PASS env:ANSIBLE\_SUDO\_PASS var: ansible\_become\_password var: ansible\_become\_pass var: ansible\_sudo\_pass | Password to pass to sudo |
| **become\_user** string | **Default:**"root" | ini entries: [privilege\_escalation]become\_user = root [sudo\_become\_plugin]user = root env:ANSIBLE\_BECOME\_USER env:ANSIBLE\_SUDO\_USER var: ansible\_become\_user var: ansible\_sudo\_user | User you 'become' to execute the task |
### Authors
* ansible (@core)
ansible ansible.builtin.cron – Manage cron.d and crontab entries ansible.builtin.cron – Manage cron.d and crontab entries
========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `cron` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Use this module to manage crontab and environment variables entries. This module allows you to create environment variables and named crontab entries, update, or delete them.
* When crontab jobs are managed: the module includes one line with the description of the crontab entry `"#Ansible: <name>"` corresponding to the “name” passed to the module, which is used by future ansible/module calls to find/check the state. The “name” parameter should be unique, and changing the “name” value will result in a new cron task being created (or a different one being removed).
* When environment variables are managed, no comment line is added, but, when the module needs to find/check the state, it uses the “name” parameter to find the environment variable definition line.
* When using symbols such as %, they must be properly escaped.
Requirements
------------
The below requirements are needed on the host that executes this module.
* cron (or cronie on CentOS)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **backup** boolean | **Choices:*** **no** ←
* yes
| If set, create a backup of the crontab before it is modified. The location of the backup is returned in the `backup_file` variable by this module. |
| **cron\_file** string | | If specified, uses this file instead of an individual user's crontab. If this is a relative path, it is interpreted with respect to */etc/cron.d*. If it is absolute, it will typically be `/etc/crontab`. Many linux distros expect (and some require) the filename portion to consist solely of upper- and lower-case letters, digits, underscores, and hyphens. To use the *cron\_file* parameter you must specify the *user* as well. |
| **day** string | **Default:**"\*" | Day of the month the job should run (`1-31`, `*`, `*/2`, and so on).
aliases: dom |
| **disabled** boolean added in 2.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| If the job should be disabled (commented out) in the crontab. Only has effect if *state=present*. |
| **env** boolean added in 2.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| If set, manages a crontab's environment variable. New variables are added on top of crontab.
*name* and *value* parameters are the name and the value of environment variable. |
| **hour** string | **Default:**"\*" | Hour when the job should run (`0-23`, `*`, `*/2`, and so on). |
| **insertafter** string added in 2.1 of ansible.builtin | | Used with *state=present* and *env*. If specified, the environment variable will be inserted after the declaration of specified environment variable. |
| **insertbefore** string added in 2.1 of ansible.builtin | | Used with *state=present* and *env*. If specified, the environment variable will be inserted before the declaration of specified environment variable. |
| **job** string | | The command to execute or, if env is set, the value of environment variable. The command should not contain line breaks. Required if *state=present*.
aliases: value |
| **minute** string | **Default:**"\*" | Minute when the job should run (`0-59`, `*`, `*/2`, and so on). |
| **month** string | **Default:**"\*" | Month of the year the job should run (`1-12`, `*`, `*/2`, and so on). |
| **name** string | | Description of a crontab entry or, if env is set, the name of environment variable. Required if *state=absent*. Note that if name is not set and *state=present*, then a new crontab entry will always be created, regardless of existing ones. This parameter will always be required in future releases. |
| **reboot** boolean added in 1.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| If the job should be run at reboot. This option is deprecated. Users should use *special\_time*. |
| **special\_time** string added in 1.3 of ansible.builtin | **Choices:*** annually
* daily
* hourly
* monthly
* reboot
* weekly
* yearly
| Special time specification nickname. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether to ensure the job or environment variable is present or absent. |
| **user** string | | The specific user whose crontab should be modified. When unset, this parameter defaults to the current user. |
| **weekday** string | **Default:**"\*" | Day of the week that the job should run (`0-6` for Sunday-Saturday, `*`, and so on).
aliases: dow |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
- name: Ensure a job that runs at 2 and 5 exists. Creates an entry like "0 5,2 * * ls -alh > /dev/null"
ansible.builtin.cron:
name: "check dirs"
minute: "0"
hour: "5,2"
job: "ls -alh > /dev/null"
- name: 'Ensure an old job is no longer present. Removes any job that is prefixed by "#Ansible: an old job" from the crontab'
ansible.builtin.cron:
name: "an old job"
state: absent
- name: Creates an entry like "@reboot /some/job.sh"
ansible.builtin.cron:
name: "a job for reboot"
special_time: reboot
job: "/some/job.sh"
- name: Creates an entry like "PATH=/opt/bin" on top of crontab
ansible.builtin.cron:
name: PATH
env: yes
job: /opt/bin
- name: Creates an entry like "APP_HOME=/srv/app" and insert it after PATH declaration
ansible.builtin.cron:
name: APP_HOME
env: yes
job: /srv/app
insertafter: PATH
- name: Creates a cron file under /etc/cron.d
ansible.builtin.cron:
name: yum autoupdate
weekday: "2"
minute: "0"
hour: "12"
user: root
job: "YUMINTERACTIVE=0 /usr/sbin/yum-autoupdate"
cron_file: ansible_yum-autoupdate
- name: Removes a cron file from under /etc/cron.d
ansible.builtin.cron:
name: "yum autoupdate"
cron_file: ansible_yum-autoupdate
state: absent
- name: Removes "APP_HOME" environment variable from crontab
ansible.builtin.cron:
name: APP_HOME
env: yes
state: absent
```
### Authors
* Dane Summers (@dsummersl)
* Mike Grozak (@rhaido)
* Patrick Callahan (@dirtyharrycallahan)
* Evan Kaufman (@EvanK)
* Luca Berruti (@lberruti)
ansible ansible.builtin.varnames – Lookup matching variable names ansible.builtin.varnames – Lookup matching variable names
=========================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `varnames` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 2.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Retrieves a list of matching Ansible variable names.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | List of Python regex patterns to search for in variable names. |
Examples
--------
```
- name: List variables that start with qz_
debug: msg="{{ lookup('varnames', '^qz_.+')}}"
vars:
qz_1: hello
qz_2: world
qa_1: "I won't show"
qz_: "I won't show either"
- name: Show all variables
debug: msg="{{ lookup('varnames', '.+')}}"
- name: Show variables with 'hosts' in their names
debug: msg="{{ lookup('varnames', 'hosts')}}"
- name: Find several related variables that end specific way
debug: msg="{{ lookup('varnames', '.+_zone$', '.+_location$') }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_value** list / elements=string | success | List of the variable names requested. |
### Authors
* Ansible Core Team
ansible ansible.builtin.yum – Manages packages with the yum package manager ansible.builtin.yum – Manages packages with the yum package manager
===================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `yum` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Installs, upgrade, downgrades, removes, and lists packages and groups with the *yum* package manager.
* This module only works on Python 2. If you require Python 3 support see the [ansible.builtin.dnf](dnf_module#ansible-collections-ansible-builtin-dnf-module) module.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* yum
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_downgrade** boolean added in 2.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| Specify if the named package and version is allowed to downgrade a maybe already installed higher version of that package. Note that setting allow\_downgrade=True can make this module behave in a non-idempotent way. The task could end up with a set of packages that does not match the complete list of specified packages to install (because dependencies between the downgraded package and others can cause changes to the packages which were in the earlier transaction). |
| **autoremove** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, removes all "leaf" packages from the system that were originally installed as dependencies of user-installed packages but which are no longer required by any such package. Should be used alone or when state is *absent*
NOTE: This feature requires yum >= 3.4.3 (RHEL/CentOS 7+) |
| **bugfix** boolean added in 2.6 of ansible.builtin | **Choices:*** **no** ←
* yes
| If set to `yes`, and `state=latest` then only installs updates that have been marked bugfix related. |
| **conf\_file** string added in 0.6 of ansible.builtin | | The remote yum configuration file to use for the transaction. |
| **disable\_excludes** string added in 2.7 of ansible.builtin | | Disable the excludes defined in YUM config files. If set to `all`, disables all excludes. If set to `main`, disable excludes defined in [main] in yum.conf. If set to `repoid`, disable excludes defined for given repo id. |
| **disable\_gpg\_check** boolean added in 1.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Whether to disable the GPG checking of signatures of packages being installed. Has an effect only if state is *present* or *latest*. |
| **disable\_plugin** list / elements=string added in 2.5 of ansible.builtin | |
*Plugin* name to disable for the install/update operation. The disabled plugins will not persist beyond the transaction. |
| **disablerepo** list / elements=string added in 0.9 of ansible.builtin | |
*Repoid* of repositories to disable for the install/update operation. These repos will not persist beyond the transaction. When specifying multiple repos, separate them with a `","`. As of Ansible 2.7, this can alternatively be a list instead of `","` separated string |
| **download\_dir** string added in 2.8 of ansible.builtin | | Specifies an alternate directory to store packages. Has an effect only if *download\_only* is specified. |
| **download\_only** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| Only download the packages, do not install them. |
| **enable\_plugin** list / elements=string added in 2.5 of ansible.builtin | |
*Plugin* name to enable for the install/update operation. The enabled plugin will not persist beyond the transaction. |
| **enablerepo** list / elements=string added in 0.9 of ansible.builtin | |
*Repoid* of repositories to enable for the install/update operation. These repos will not persist beyond the transaction. When specifying multiple repos, separate them with a `","`. As of Ansible 2.7, this can alternatively be a list instead of `","` separated string |
| **exclude** list / elements=string added in 2.0 of ansible.builtin | | Package name(s) to exclude when state=present, or latest |
| **install\_repoquery** boolean added in 1.5 of ansible.builtin | **Choices:*** no
* **yes** ←
| If repoquery is not available, install yum-utils. If the system is registered to RHN or an RHN Satellite, repoquery allows for querying all channels assigned to the system. It is also required to use the 'list' parameter. NOTE: This will run and be logged as a separate yum transation which takes place before any other installation or removal. NOTE: This will use the system's default enabled repositories without regard for disablerepo/enablerepo given to the module. |
| **install\_weak\_deps** boolean added in 2.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| Will also install all packages linked by a weak dependency relation. NOTE: This feature requires yum >= 4 (RHEL/CentOS 8+) |
| **installroot** string added in 2.3 of ansible.builtin | **Default:**"/" | Specifies an alternative installroot, relative to which all packages will be installed. |
| **list** string | | Package name to run the equivalent of yum list --show-duplicates <package> against. In addition to listing packages, use can also list the following: `installed`, `updates`, `available` and `repos`. This parameter is mutually exclusive with `name`. |
| **lock\_timeout** integer added in 2.8 of ansible.builtin | **Default:**30 | Amount of time to wait for the yum lockfile to be freed. |
| **name** list / elements=string | | A package name or package specifier with version, like `name-1.0`. Comparison operators for package version are valid here `>`, `<`, `>=`, `<=`. Example - `name>=1.0`
If a previous version is specified, the task also needs to turn `allow_downgrade` on. See the `allow_downgrade` documentation for caveats with downgrading packages. When using state=latest, this can be `'*'` which means run `yum -y update`. You can also pass a url or a local path to a rpm file (using state=present). To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages.
aliases: pkg |
| **releasever** string added in 2.7 of ansible.builtin | | Specifies an alternative release from which all packages will be installed. |
| **security** boolean added in 2.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| If set to `yes`, and `state=latest` then only installs updates that have been marked security related. |
| **skip\_broken** boolean added in 2.3 of ansible.builtin | **Choices:*** **no** ←
* yes
| Skip packages with broken dependencies(devsolve) and are causing problems. |
| **state** string | **Choices:*** absent
* installed
* latest
* present
* removed
| Whether to install (`present` or `installed`, `latest`), or remove (`absent` or `removed`) a package.
`present` and `installed` will simply ensure that a desired package is installed.
`latest` will update the specified package if it's not of the latest available version.
`absent` and `removed` will remove the specified package. Default is `None`, however in effect the default action is `present` unless the `autoremove` option is enabled for this module, then `absent` is inferred. |
| **update\_cache** boolean added in 1.9 of ansible.builtin | **Choices:*** **no** ←
* yes
| Force yum to check if cache is out of date and redownload if needed. Has an effect only if state is *present* or *latest*.
aliases: expire-cache |
| **update\_only** boolean added in 2.5 of ansible.builtin | **Choices:*** **no** ←
* yes
| When using latest, only update installed packages. Do not install packages. Has an effect only if state is *latest*
|
| **use\_backend** string added in 2.7 of ansible.builtin | **Choices:*** **auto** ←
* yum
* yum4
* dnf
| This module supports `yum` (as it always has), this is known as `yum3`/`YUM3`/`yum-deprecated` by upstream yum developers. As of Ansible 2.7+, this module also supports `YUM4`, which is the "new yum" and it has an `dnf` backend. By default, this module will select the backend based on the `ansible_pkg_mgr` fact. |
| **validate\_certs** boolean added in 2.1 of ansible.builtin | **Choices:*** no
* **yes** ←
| This only applies if using a https url as the source of the rpm. e.g. for localinstall. If set to `no`, the SSL certificates will not be validated. This should only set to `no` used on personally controlled sites using self-signed certificates as it avoids verifying the source site. Prior to 2.1 the code worked as if this was set to `yes`. |
Notes
-----
Note
* When used with a `loop:` each package will be processed individually, it is much more efficient to pass the list directly to the `name` option.
* In versions prior to 1.9.2 this module installed and removed each package given to the yum module separately. This caused problems when packages specified by filename or url had to be installed or removed together. In 1.9.2 this was fixed so that packages are installed in one yum transaction. However, if one of the packages adds a new yum repository that the other packages come from (such as epel-release) then that package needs to be installed in a separate task. This mimics yum’s command line behaviour.
* Yum itself has two types of groups. “Package groups” are specified in the rpm itself while “environment groups” are specified in a separate file (usually by the distribution). Unfortunately, this division becomes apparent to ansible users because ansible needs to operate on the group of packages in a single transaction and yum requires groups to be specified in different ways when used in that way. Package groups are specified as “@development-tools” and environment groups are “@^gnome-desktop-environment”. Use the “yum group list hidden ids” command to see which category of group the group you want to install falls into.
* The yum module does not support clearing yum cache in an idempotent way, so it was decided not to implement it, the only method is to use command and call the yum command directly, namely “command: yum clean all” <https://github.com/ansible/ansible/pull/31450#issuecomment-352889579>
Examples
--------
```
- name: Install the latest version of Apache
yum:
name: httpd
state: latest
- name: Install Apache >= 2.4
yum:
name: httpd>=2.4
state: present
- name: Install a list of packages (suitable replacement for 2.11 loop deprecation warning)
yum:
name:
- nginx
- postgresql
- postgresql-server
state: present
- name: Install a list of packages with a list variable
yum:
name: "{{ packages }}"
vars:
packages:
- httpd
- httpd-tools
- name: Remove the Apache package
yum:
name: httpd
state: absent
- name: Install the latest version of Apache from the testing repo
yum:
name: httpd
enablerepo: testing
state: present
- name: Install one specific version of Apache
yum:
name: httpd-2.2.29-1.4.amzn1
state: present
- name: Upgrade all packages
yum:
name: '*'
state: latest
- name: Upgrade all packages, excluding kernel & foo related packages
yum:
name: '*'
state: latest
exclude: kernel*,foo*
- name: Install the nginx rpm from a remote repo
yum:
name: http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
state: present
- name: Install nginx rpm from a local file
yum:
name: /usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm
state: present
- name: Install the 'Development tools' package group
yum:
name: "@Development tools"
state: present
- name: Install the 'Gnome desktop' environment group
yum:
name: "@^gnome-desktop-environment"
state: present
- name: List ansible packages and register result to print with debug later
yum:
list: ansible
register: result
- name: Install package with multiple repos enabled
yum:
name: sos
enablerepo: "epel,ol7_latest"
- name: Install package with multiple repos disabled
yum:
name: sos
disablerepo: "epel,ol7_latest"
- name: Download the nginx package but do not install it
yum:
name:
- nginx
state: latest
download_only: true
```
### Authors
* Ansible Core Team
* Seth Vidal (@skvidal)
* Eduard Snesarev (@verm666)
* Berend De Schouwer (@berenddeschouwer)
* Abhijeet Kasurde (@Akasurde)
* Adam Miller (@maxamillion)
| programming_docs |
ansible ansible.builtin.csvfile – read data from a TSV or CSV file ansible.builtin.csvfile – read data from a TSV or CSV file
==========================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `csvfile` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The csvfile lookup reads the contents of a file in CSV (comma-separated value) format. The lookup looks for the row where the first column matches keyname (which can be multiple words) and returns the value in the `col` column (default 1, which indexed from 0 means the second column in the file).
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **col** string | **Default:**"1" | | column to return (0 indexed). |
| **default** string | **Default:**"" | | what to return if the value is not found in the file. |
| **delimiter** string | **Default:**"TAB" | | field separator in the file, for a tab you can specify `TAB` or `\t`. |
| **encoding** string added in 2.1 of ansible.builtin | **Default:**"utf-8" | | Encoding (character set) of the used CSV file. |
| **file** string | **Default:**"ansible.csv" | | name of the CSV/TSV file to open. |
Notes
-----
Note
* The default is for TSV files (tab delimited) not CSV (comma delimited) … yes the name is misleading.
* As of version 2.11, the search parameter (text that must match the first column of the file) and filename parameter can be multi-word.
* For historical reasons, in the search keyname, quotes are treated literally and cannot be used around the string unless they appear (escaped as required) in the first column of the file you are parsing.
Examples
--------
```
- name: Match 'Li' on the first column, return the second column (0 based index)
debug: msg="The atomic number of Lithium is {{ lookup('csvfile', 'Li file=elements.csv delimiter=,') }}"
- name: msg="Match 'Li' on the first column, but return the 3rd column (columns start counting after the match)"
debug: msg="The atomic mass of Lithium is {{ lookup('csvfile', 'Li file=elements.csv delimiter=, col=2') }}"
- name: Define Values From CSV File
set_fact:
loop_ip: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=1') }}"
int_ip: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=2') }}"
int_mask: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=3') }}"
int_name: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=4') }}"
local_as: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=5') }}"
neighbor_as: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=6') }}"
neigh_int_ip: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=7') }}"
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=string | success | value(s) stored in file column |
### Authors
* Jan-Piet Mens (@jpmens) <jpmens(at)gmail.com>
ansible ansible.builtin.template – retrieve contents of file after templating with Jinja2 ansible.builtin.template – retrieve contents of file after templating with Jinja2
=================================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `template` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Returns a list of strings; for each template in the list of templates you pass in, returns a string containing the results of processing that template.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string | | | list of files to template |
| **convert\_data** boolean | **Choices:*** no
* yes
| | Whether to convert YAML into data. If False, strings that are YAML will be left untouched. Mutually exclusive with the jinja2\_native option. |
| **jinja2\_native** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| | Controls whether to use Jinja2 native types. It is off by default even if global jinja2\_native is True. Has no effect if global jinja2\_native is False. This offers more flexibility than the template module which does not use Jinja2 native types at all. Mutually exclusive with the convert\_data option. |
| **variable\_end\_string** string added in 2.8 of ansible.builtin | **Default:**"}}" | | The string marking the end of a print statement. |
| **variable\_start\_string** string added in 2.8 of ansible.builtin | **Default:**"{{" | | The string marking the beginning of a print statement. |
Examples
--------
```
- name: show templating results
debug:
msg: "{{ lookup('template', './some_template.j2') }}"
- name: show templating results with different variable start and end string
debug:
msg: "{{ lookup('template', './some_template.j2', variable_start_string='[%', variable_end_string='%]') }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=any | success | file(s) content after templating |
### Authors
* Michael DeHaan
ansible ansible.builtin.copy – Copy files to remote locations ansible.builtin.copy – Copy files to remote locations
=====================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `copy` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The `copy` module copies a file from the local or remote machine to a location on the remote machine.
* Use the [ansible.builtin.fetch](fetch_module#ansible-collections-ansible-builtin-fetch-module) module to copy files from remote locations to the local box.
* If you need variable interpolation in copied files, use the [ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module) module. Using a variable in the `content` field will result in unpredictable output.
* For Windows targets, use the [ansible.windows.win\_copy](../windows/win_copy_module#ansible-collections-ansible-windows-win-copy-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **backup** boolean added in 0.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **checksum** string added in 2.5 of ansible.builtin | | SHA1 checksum of the file being transferred. Used to validate that the copy of the file was successful. If this is not provided, ansible will use the local calculated checksum of the src file. |
| **content** string added in 1.1 of ansible.builtin | | When used instead of `src`, sets the contents of a file directly to the specified value. Works only when `dest` is a file. Creates the file if it does not exist. For advanced formatting or if `content` contains a variable, use the [ansible.builtin.template](template_module) module. |
| **decrypt** boolean added in 2.4 of ansible.builtin | **Choices:*** no
* **yes** ←
| This option controls the autodecryption of source files using vault. |
| **dest** path / required | | Remote absolute path where the file should be copied to. If `src` is a directory, this must be a directory too. If `dest` is a non-existent path and if either `dest` ends with "/" or `src` is a directory, `dest` is created. If *dest* is a relative path, the starting directory is determined by the remote host. If `src` and `dest` are files, the parent directory of `dest` is not created and the task fails if it does not already exist. |
| **directory\_mode** raw added in 1.5 of ansible.builtin | | When doing a recursive copy set the mode for the directories. If this is not set we will use the system defaults. The mode is only set on directories which are newly created, and will not affect those that already existed. |
| **follow** boolean added in 1.8 of ansible.builtin | **Choices:*** **no** ←
* yes
| This flag indicates that filesystem links in the destination, if they exist, should be followed. |
| **force** boolean added in 1.1 of ansible.builtin | **Choices:*** no
* **yes** ←
| Influence whether the remote file must always be replaced. If `yes`, the remote file will be replaced when contents are different than the source. If `no`, the file will only be transferred if the destination does not exist. Alias `thirsty` has been deprecated and will be removed in 2.13.
aliases: thirsty |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **local\_follow** boolean added in 2.4 of ansible.builtin | **Choices:*** no
* **yes** ←
| This flag indicates that filesystem links in the source tree, if they exist, should be followed. |
| **mode** raw | | The permissions of the destination file or directory. For those used to `/usr/bin/chmod` remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). As of Ansible 2.3, the mode may also be the special string `preserve`.
`preserve` means that the file will be given the same permissions as the source file. When doing a recursive copy, see also `directory_mode`. If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **remote\_src** boolean added in 2.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence whether `src` needs to be transferred or already is present remotely. If `no`, it will search for `src` on the controller node. If `yes` it will search for `src` on the managed (remote) node.
`remote_src` supports recursive copying as of version 2.8.
`remote_src` only works with `mode=preserve` as of version 2.6. Autodecryption of files does not work when `remote_src=yes`. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **src** path | | Local path to a file to copy to the remote server. This can be absolute or relative. If path is a directory, it is copied recursively. In this case, if path ends with "/", only inside contents of that directory are copied to destination. Otherwise, if it does not end with "/", the directory itself with all contents is copied. This behavior is similar to the `rsync` command line tool. |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **validate** string | | The validation command to run before copying into place. The path to the file to validate is passed in via '%s' which must be present as in the examples below. The command is passed securely so shell features like expansion and pipes will not work. |
Notes
-----
Note
* The [ansible.builtin.copy](#ansible-collections-ansible-builtin-copy-module) module recursively copy facility does not scale to lots (>hundreds) of files.
* Supports `check_mode`.
See Also
--------
See also
[ansible.builtin.assemble](assemble_module#ansible-collections-ansible-builtin-assemble-module)
The official documentation on the **ansible.builtin.assemble** module.
[ansible.builtin.fetch](fetch_module#ansible-collections-ansible-builtin-fetch-module)
The official documentation on the **ansible.builtin.fetch** module.
[ansible.builtin.file](file_module#ansible-collections-ansible-builtin-file-module)
The official documentation on the **ansible.builtin.file** module.
[ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module)
The official documentation on the **ansible.builtin.template** module.
[ansible.posix.synchronize](../posix/synchronize_module#ansible-collections-ansible-posix-synchronize-module)
The official documentation on the **ansible.posix.synchronize** module.
[ansible.windows.win\_copy](../windows/win_copy_module#ansible-collections-ansible-windows-win-copy-module)
The official documentation on the **ansible.windows.win\_copy** module.
Examples
--------
```
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: /srv/myfiles/foo.conf
dest: /etc/foo.conf
owner: foo
group: foo
mode: '0644'
- name: Copy file with owner and permission, using symbolic representation
ansible.builtin.copy:
src: /srv/myfiles/foo.conf
dest: /etc/foo.conf
owner: foo
group: foo
mode: u=rw,g=r,o=r
- name: Another symbolic mode example, adding some permissions and removing others
ansible.builtin.copy:
src: /srv/myfiles/foo.conf
dest: /etc/foo.conf
owner: foo
group: foo
mode: u+rw,g-wx,o-rwx
- name: Copy a new "ntp.conf" file into place, backing up the original if it differs from the copied version
ansible.builtin.copy:
src: /mine/ntp.conf
dest: /etc/ntp.conf
owner: root
group: root
mode: '0644'
backup: yes
- name: Copy a new "sudoers" file into place, after passing validation with visudo
ansible.builtin.copy:
src: /mine/sudoers
dest: /etc/sudoers
validate: /usr/sbin/visudo -csf %s
- name: Copy a "sudoers" file on the remote machine for editing
ansible.builtin.copy:
src: /etc/sudoers
dest: /etc/sudoers.edit
remote_src: yes
validate: /usr/sbin/visudo -csf %s
- name: Copy using inline content
ansible.builtin.copy:
content: '# This file was moved to /etc/other.conf'
dest: /etc/mine.conf
- name: If follow=yes, /path/to/file will be overwritten by contents of foo.conf
ansible.builtin.copy:
src: /etc/foo.conf
dest: /path/to/link # link to /path/to/file
follow: yes
- name: If follow=no, /path/to/link will become a file and be overwritten by contents of foo.conf
ansible.builtin.copy:
src: /etc/foo.conf
dest: /path/to/link # link to /path/to/file
follow: no
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **backup\_file** string | changed and if backup=yes | Name of backup file created. **Sample:** /path/to/file.txt.2015-02-12@22:09~ |
| **checksum** string | success | SHA1 checksum of the file after running copy. **Sample:** 6e642bb8dd5c2e027bf21dd923337cbb4214f827 |
| **dest** string | success | Destination file/path. **Sample:** /path/to/file.txt |
| **gid** integer | success | Group id of the file, after execution. **Sample:** 100 |
| **group** string | success | Group of the file, after execution. **Sample:** httpd |
| **md5sum** string | when supported | MD5 checksum of the file after running copy. **Sample:** 2a5aeecc61dc98c4d780b14b330e3282 |
| **mode** string | success | Permissions of the target, after execution. **Sample:** 420 |
| **owner** string | success | Owner of the file, after execution. **Sample:** httpd |
| **size** integer | success | Size of the target, after execution. **Sample:** 1220 |
| **src** string | changed | Source file used for the copy on the target machine. **Sample:** /home/httpd/.ansible/tmp/ansible-tmp-1423796390.97-147729857856000/source |
| **state** string | success | State of the target, after execution. **Sample:** file |
| **uid** integer | success | Owner id of the file, after execution. **Sample:** 100 |
### Authors
* Ansible Core Team
* Michael DeHaan
| programming_docs |
ansible ansible.builtin.group – Add or remove groups ansible.builtin.group – Add or remove groups
============================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `group` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.0.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage presence of groups on a host.
* For Windows targets, use the [ansible.windows.win\_group](../windows/win_group_module#ansible-collections-ansible-windows-win-group-module) module instead.
Requirements
------------
The below requirements are needed on the host that executes this module.
* groupadd
* groupdel
* groupmod
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **gid** integer | | Optional *GID* to set for the group. |
| **local** boolean added in 2.6 of ansible.builtin | **Choices:*** **no** ←
* yes
| Forces the use of "local" command alternatives on platforms that implement it. This is useful in environments that use centralized authentication when you want to manipulate the local groups. (for example, it uses `lgroupadd` instead of `groupadd`). This requires that these commands exist on the targeted host, otherwise it will be a fatal error. |
| **name** string / required | | Name of the group to manage. |
| **non\_unique** boolean added in 2.8 of ansible.builtin | **Choices:*** **no** ←
* yes
| This option allows to change the group ID to a non-unique value. Requires `gid`. Not supported on macOS or BusyBox distributions. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the group should be present or not on the remote host. |
| **system** boolean | **Choices:*** **no** ←
* yes
| If *yes*, indicates that the group created is a system group. |
Notes
-----
Note
* Supports `check_mode`.
See Also
--------
See also
[ansible.builtin.user](user_module#ansible-collections-ansible-builtin-user-module)
The official documentation on the **ansible.builtin.user** module.
[ansible.windows.win\_group](../windows/win_group_module#ansible-collections-ansible-windows-win-group-module)
The official documentation on the **ansible.windows.win\_group** module.
Examples
--------
```
- name: Ensure group "somegroup" exists
ansible.builtin.group:
name: somegroup
state: present
- name: Ensure group "docker" exists with correct gid
ansible.builtin.group:
name: docker
state: present
gid: 1750
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **gid** integer | When `state` is 'present' | Group ID of the group. **Sample:** 1001 |
| **name** string | always | Group name. **Sample:** users |
| **state** string | always | Whether the group is present or not. **Sample:** absent |
| **system** boolean | When `state` is 'present' | Whether the group is a system group or not. |
### Authors
* Stephen Fromm (@sfromm)
ansible ansible.builtin.yaml – Uses a specific YAML file as an inventory source. ansible.builtin.yaml – Uses a specific YAML file as an inventory source.
========================================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `yaml` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* YAML-based inventory, should start with the `all` group and contain hosts/vars/children entries.
* Host entries can have sub-entries defined, which will be treated as variables.
* Vars entries are normal group vars.
* Children are ‘child groups’, which can also have their own vars/hosts/children and so on.
* File MUST have a valid extension, defined in configuration.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **yaml\_extensions** list / elements=string | **Default:**[".yaml", ".yml", ".json"] | ini entries: [defaults]yaml\_valid\_extensions = ['.yaml', '.yml', '.json'] [inventory\_plugin\_yaml]yaml\_valid\_extensions = ['.yaml', '.yml', '.json'] env:ANSIBLE\_YAML\_FILENAME\_EXT env:ANSIBLE\_INVENTORY\_PLUGIN\_EXTS | list of 'valid' extensions for files containing YAML |
Notes
-----
Note
* If you want to set vars for the `all` group inside the inventory file, the `all` group must be the first entry in the file.
* Whitelisted in configuration by default.
Examples
--------
```
all: # keys must be unique, i.e. only one 'hosts' per group
hosts:
test1:
test2:
host_var: value
vars:
group_all_var: value
children: # key order does not matter, indentation does
other_group:
children:
group_x:
hosts:
test5 # Note that one machine will work without a colon
#group_x:
# hosts:
# test5 # But this won't
# test7 #
group_y:
hosts:
test6: # So always use a colon
vars:
g2_var2: value3
hosts:
test4:
ansible_host: 127.0.0.1
last_group:
hosts:
test1 # same host as above, additional group membership
vars:
group_last_var: value
```
ansible ansible.builtin.assert – Asserts given expressions are true ansible.builtin.assert – Asserts given expressions are true
===========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `assert` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* This module asserts that given expressions are true with an optional custom message.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **fail\_msg** string added in 2.7 of ansible.builtin | | The customized message used for a failing assertion. This argument was called 'msg' before Ansible 2.7, now it is renamed to 'fail\_msg' with alias 'msg'.
aliases: msg |
| **quiet** boolean added in 2.8 of ansible.builtin | **Choices:*** **no** ←
* yes
| Set this to `yes` to avoid verbose output. |
| **success\_msg** string added in 2.7 of ansible.builtin | | The customized message used for a successful assertion. |
| **that** list / elements=string / required | | A list of string expressions of the same form that can be passed to the 'when' statement. |
Notes
-----
Note
* This module is also supported for Windows targets.
See Also
--------
See also
[ansible.builtin.debug](debug_module#ansible-collections-ansible-builtin-debug-module)
The official documentation on the **ansible.builtin.debug** module.
[ansible.builtin.fail](fail_module#ansible-collections-ansible-builtin-fail-module)
The official documentation on the **ansible.builtin.fail** module.
[ansible.builtin.meta](meta_module#ansible-collections-ansible-builtin-meta-module)
The official documentation on the **ansible.builtin.meta** module.
Examples
--------
```
- assert: { that: "ansible_os_family != 'RedHat'" }
- assert:
that:
- "'foo' in some_command_result.stdout"
- number_of_the_counting == 3
- name: After version 2.7 both 'msg' and 'fail_msg' can customize failing assertion message
assert:
that:
- my_param <= 100
- my_param >= 0
fail_msg: "'my_param' must be between 0 and 100"
success_msg: "'my_param' is between 0 and 100"
- name: Please use 'msg' when ansible version is smaller than 2.7
assert:
that:
- my_param <= 100
- my_param >= 0
msg: "'my_param' must be between 0 and 100"
- name: Use quiet to avoid verbose output
assert:
that:
- my_param <= 100
- my_param >= 0
quiet: true
```
### Authors
* Ansible Core Team
* Michael DeHaan
ansible ansible.builtin.host_group_vars – In charge of loading group_vars and host_vars ansible.builtin.host\_group\_vars – In charge of loading group\_vars and host\_vars
===================================================================================
Note
This vars plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `host_group_vars` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same vars plugin name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
Synopsis
--------
* Loads YAML vars into corresponding groups/hosts in group\_vars/ and host\_vars/ directories.
* Files are restricted by extension to one of .yaml, .json, .yml or no extension.
* Hidden (starting with ‘.’) and backup (ending with ‘~’) files and directories are ignored.
* Only applies to inventory sources that are existing paths.
* Starting in 2.10, this plugin requires whitelisting and is whitelisted by default.
Requirements
------------
The below requirements are needed on the local controller node that executes this vars.
* whitelist in configuration
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_valid\_extensions** list / elements=string | **Default:**[".yml", ".yaml", ".json"] | ini entries: [yaml\_valid\_extensions]defaults = ['.yml', '.yaml', '.json'] env:ANSIBLE\_YAML\_FILENAME\_EXT | Check all of these extensions when looking for 'variable' files which should be YAML or JSON or vaulted versions of these. This affects vars\_files, include\_vars, inventory and vars plugins among others. |
| **stage** string added in 2.10 of ansible.builtin | **Choices:*** all
* task
* inventory
| ini entries: [vars\_host\_group\_vars]stage = None env:ANSIBLE\_VARS\_PLUGIN\_STAGE | Control when this vars plugin may be executed. Setting this option to `all` will run the vars plugin after importing inventory and whenever it is demanded by a task. Setting this option to `task` will only run the vars plugin whenever it is demanded by a task. Setting this option to `inventory` will only run the vars plugin after parsing inventory. If this option is omitted, the global *RUN\_VARS\_PLUGINS* configuration is used to determine when to execute the vars plugin. |
ansible ansible.builtin.lines – read lines from command ansible.builtin.lines – read lines from command
===============================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `lines` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Run one or more commands and split the output into lines, returning them as a list
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | command(s) to run |
Notes
-----
Note
* Like all lookups, this runs on the Ansible controller and is unaffected by other keywords such as ‘become’. If you need to use different permissions, you must change the command or run Ansible as another user.
* Alternatively, you can use a shell/command task that runs against localhost and registers the result.
Examples
--------
```
- name: We could read the file directly, but this shows output from command
debug: msg="{{ item }} is an output line from running cat on /etc/motd"
with_lines: cat /etc/motd
- name: More useful example of looping over a command result
shell: "/usr/bin/frobnicate {{ item }}"
with_lines:
- "/usr/bin/frobnications_per_host --param {{ inventory_hostname }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=string | success | lines of stdout from command |
### Authors
* Daniel Hokka Zakrisson (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#96f2f7f8fff3fab0b5a5a1adb0b5a3a4adb0b5a2aeadfef9ecf7f5b0b5a2a0adf5f9fb)>
ansible ansible.builtin.minimal – minimal Ansible screen output ansible.builtin.minimal – minimal Ansible screen output
=======================================================
Note
This callback plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `minimal` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same callback plugin name.
Synopsis
--------
* This is the default output callback used by the ansible command (ad-hoc)
ansible ansible.builtin.memory – RAM backed, non persistent ansible.builtin.memory – RAM backed, non persistent
===================================================
Note
This cache plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `memory` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same cache plugin name.
Synopsis
--------
* RAM backed cache that is not persistent.
* This is the default used if no other plugin is specified.
* There are no options to configure.
### Authors
* core team (@ansible-core)
ansible ansible.builtin.gather_facts – Gathers facts about remote hosts ansible.builtin.gather\_facts – Gathers facts about remote hosts
================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `gather_facts` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module takes care of executing the [configured facts modules](../../../reference_appendices/config#facts-modules), the default is to use the [ansible.builtin.setup](setup_module#ansible-collections-ansible-builtin-setup-module) module.
* This module is automatically called by playbooks to gather useful variables about remote hosts that can be used in playbooks.
* It can also be executed directly by `/usr/bin/ansible` to check what variables are available to a host.
* Ansible provides many *facts* about the system, automatically.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **parallel** boolean | **Choices:*** no
* yes
| A toggle that controls if the fact modules are executed in parallel or serially and in order. This can guarantee the merge order of module facts at the expense of performance. By default it will be true if more than one fact module is used. |
Notes
-----
Note
* This module is mostly a wrapper around other fact gathering modules.
* Options passed to this module must be supported by all the underlying fact modules configured.
* Facts returned by each module will be merged, conflicts will favor ‘last merged’. Order is not guaranteed, when doing parallel gathering on multiple modules.
Examples
--------
```
# Display facts from all hosts and store them indexed by hostname at /tmp/facts.
# ansible all -m gather_facts --tree /tmp/facts
```
### Authors
* Ansible Core Team
ansible ansible.builtin.debug – Executes tasks in interactive debug session. ansible.builtin.debug – Executes tasks in interactive debug session.
====================================================================
Note
This strategy plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `debug` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same strategy plugin name.
New in version 2.1: of ansible.builtin
Synopsis
--------
* Task execution is ‘linear’ but controlled by an interactive debug session.
### Authors
* Kishin Yagami (!UNKNOWN)
ansible ansible.builtin.pipe – read output from a command ansible.builtin.pipe – read output from a command
=================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `pipe` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Run a command and return the output.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | command(s) to run. |
Notes
-----
Note
* Like all lookups this runs on the Ansible controller and is unaffected by other keywords, such as become, so if you need to different permissions you must change the command or run Ansible as another user.
* Alternatively you can use a shell/command task that runs against localhost and registers the result.
* Pipe lookup internally invokes Popen with shell=True (this is required and intentional). This type of invocation is considered as security issue if appropriate care is not taken to sanitize any user provided or variable input. It is strongly recommended to pass user input or variable input via quote filter before using with pipe lookup. See example section for this. Read more about this [Bandit B602 docs](https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html)
Examples
--------
```
- name: raw result of running date command"
debug:
msg: "{{ lookup('pipe', 'date') }}"
- name: Always use quote filter to make sure your variables are safe to use with shell
debug:
msg: "{{ lookup('pipe', 'getent passwd ' + myuser | quote ) }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_string** list / elements=string | success | stdout from command |
### Authors
* Daniel Hokka Zakrisson (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#ddb9bcb3b4b8b1fbfeeeeae6fbfee8efe6fbfee9e5e6b5b2a7bcbefbfee9ebe6beb2b0)>
| programming_docs |
ansible ansible.builtin.assemble – Assemble configuration files from fragments ansible.builtin.assemble – Assemble configuration files from fragments
======================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `assemble` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Assembles a configuration file from fragments.
* Often a particular program will take a single configuration file and does not support a `conf.d` style structure where it is easy to build up the configuration from multiple sources. `assemble` will take a directory of files that can be local or have already been transferred to the system, and concatenate them together to produce a destination file.
* Files are assembled in string sorting order.
* Puppet calls this idea *fragments*.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Create a backup file (if `yes`), including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **decrypt** boolean added in 2.4 of ansible.builtin | **Choices:*** no
* **yes** ←
| This option controls the autodecryption of source files using vault. |
| **delimiter** string added in 1.4 of ansible.builtin | | A delimiter to separate the file contents. |
| **dest** path / required | | A file to create using the concatenation of all of the source files. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **ignore\_hidden** boolean added in 2.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| A boolean that controls if files that start with a '.' will be included or not. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **regexp** string | | Assemble files only if `regex` matches the filename. If not set, all files are assembled. Every "\" (backslash) must be escaped as "\\" to comply to YAML syntax. Uses [Python regular expressions](http://docs.python.org/2/library/re.html). |
| **remote\_src** boolean added in 1.4 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, it will search for src at originating/master machine. If `yes`, it will go to the remote/target machine for the src. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **src** path / required | | An already existing directory full of source files. |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **validate** string added in 2.0 of ansible.builtin | | The validation command to run before copying into place. The path to the file to validate is passed in via '%s' which must be present as in the sshd example below. The command is passed securely so shell features like expansion and pipes won't work. |
See Also
--------
See also
[ansible.builtin.copy](copy_module#ansible-collections-ansible-builtin-copy-module)
The official documentation on the **ansible.builtin.copy** module.
[ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module)
The official documentation on the **ansible.builtin.template** module.
[ansible.windows.win\_copy](../windows/win_copy_module#ansible-collections-ansible-windows-win-copy-module)
The official documentation on the **ansible.windows.win\_copy** module.
Examples
--------
```
- name: Assemble from fragments from a directory
ansible.builtin.assemble:
src: /etc/someapp/fragments
dest: /etc/someapp/someapp.conf
- name: Insert the provided delimiter between fragments
ansible.builtin.assemble:
src: /etc/someapp/fragments
dest: /etc/someapp/someapp.conf
delimiter: '### START FRAGMENT ###'
- name: Assemble a new "sshd_config" file into place, after passing validation with sshd
ansible.builtin.assemble:
src: /etc/ssh/conf.d/
dest: /etc/ssh/sshd_config
validate: /usr/sbin/sshd -t -f %s
```
### Authors
* Stephen Fromm (@sfromm)
ansible ansible.builtin.wait_for – Waits for a condition before continuing ansible.builtin.wait\_for – Waits for a condition before continuing
===================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `wait_for` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.7: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* You can wait for a set amount of time `timeout`, this is the default if nothing is specified or just `timeout` is specified. This does not produce an error.
* Waiting for a port to become available is useful for when services are not immediately available after their init scripts return which is true of certain Java application servers.
* It is also useful when starting guests with the [community.libvirt.virt](../../community/libvirt/virt_module#ansible-collections-community-libvirt-virt-module) module and needing to pause until they are ready.
* This module can also be used to wait for a regex match a string to be present in a file.
* In Ansible 1.6 and later, this module can also be used to wait for a file to be available or absent on the filesystem.
* In Ansible 1.8 and later, this module can also be used to wait for active connections to be closed before continuing, useful if a node is being rotated out of a load balancer pool.
* For Windows targets, use the [ansible.windows.win\_wait\_for](../windows/win_wait_for_module#ansible-collections-ansible-windows-win-wait-for-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **active\_connection\_states** list / elements=string added in 2.3 of ansible.builtin | **Default:**["ESTABLISHED", "FIN\_WAIT1", "FIN\_WAIT2", "SYN\_RECV", "SYN\_SENT", "TIME\_WAIT"] | The list of TCP connection states which are counted as active connections. |
| **connect\_timeout** integer | **Default:**5 | Maximum number of seconds to wait for a connection to happen before closing and retrying. |
| **delay** integer | **Default:**0 | Number of seconds to wait before starting to poll. |
| **exclude\_hosts** list / elements=string added in 1.8 of ansible.builtin | | List of hosts or IPs to ignore when looking for active TCP connections for `drained` state. |
| **host** string | **Default:**"127.0.0.1" | A resolvable hostname or IP address to wait for. |
| **msg** string added in 2.4 of ansible.builtin | | This overrides the normal error message from a failure to meet the required conditions. |
| **path** path added in 1.4 of ansible.builtin | | Path to a file on the filesystem that must exist before continuing.
`path` and `port` are mutually exclusive parameters. |
| **port** integer | | Port number to poll.
`path` and `port` are mutually exclusive parameters. |
| **search\_regex** string added in 1.4 of ansible.builtin | | Can be used to match a string in either a file or a socket connection. Defaults to a multiline regex. |
| **sleep** integer added in 2.3 of ansible.builtin | **Default:**1 | Number of seconds to sleep between checks. Before Ansible 2.3 this was hardcoded to 1 second. |
| **state** string | **Choices:*** absent
* drained
* present
* **started** ←
* stopped
| Either `present`, `started`, or `stopped`, `absent`, or `drained`. When checking a port `started` will ensure the port is open, `stopped` will check that it is closed, `drained` will check for active connections. When checking for a file or a search string `present` or `started` will ensure that the file or string is present before continuing, `absent` will check that file is absent or removed. |
| **timeout** integer | **Default:**300 | Maximum number of seconds to wait for, when used with another condition it will force an error. When used without other conditions it is equivalent of just sleeping. |
Notes
-----
Note
* The ability to use search\_regex with a port connection was added in Ansible 1.7.
* Prior to Ansible 2.4, testing for the absence of a directory or UNIX socket did not work correctly.
* Prior to Ansible 2.4, testing for the presence of a file did not work correctly if the remote user did not have read access to that file.
* Under some circumstances when using mandatory access control, a path may always be treated as being absent even if it exists, but can’t be modified or created by the remote user either.
* When waiting for a path, symbolic links will be followed. Many other modules that manipulate files do not follow symbolic links, so operations on the path using other modules may not work exactly as expected.
See Also
--------
See also
[ansible.builtin.wait\_for\_connection](wait_for_connection_module#ansible-collections-ansible-builtin-wait-for-connection-module)
The official documentation on the **ansible.builtin.wait\_for\_connection** module.
[ansible.windows.win\_wait\_for](../windows/win_wait_for_module#ansible-collections-ansible-windows-win-wait-for-module)
The official documentation on the **ansible.windows.win\_wait\_for** module.
[community.windows.win\_wait\_for\_process](../../community/windows/win_wait_for_process_module#ansible-collections-community-windows-win-wait-for-process-module)
The official documentation on the **community.windows.win\_wait\_for\_process** module.
Examples
--------
```
- name: Sleep for 300 seconds and continue with play
wait_for:
timeout: 300
delegate_to: localhost
- name: Wait for port 8000 to become open on the host, don't start checking for 10 seconds
wait_for:
port: 8000
delay: 10
- name: Waits for port 8000 of any IP to close active connections, don't start checking for 10 seconds
wait_for:
host: 0.0.0.0
port: 8000
delay: 10
state: drained
- name: Wait for port 8000 of any IP to close active connections, ignoring connections for specified hosts
wait_for:
host: 0.0.0.0
port: 8000
state: drained
exclude_hosts: 10.2.1.2,10.2.1.3
- name: Wait until the file /tmp/foo is present before continuing
wait_for:
path: /tmp/foo
- name: Wait until the string "completed" is in the file /tmp/foo before continuing
wait_for:
path: /tmp/foo
search_regex: completed
- name: Wait until regex pattern matches in the file /tmp/foo and print the matched group
wait_for:
path: /tmp/foo
search_regex: completed (?P<task>\w+)
register: waitfor
- debug:
msg: Completed {{ waitfor['match_groupdict']['task'] }}
- name: Wait until the lock file is removed
wait_for:
path: /var/lock/file.lock
state: absent
- name: Wait until the process is finished and pid was destroyed
wait_for:
path: /proc/3466/status
state: absent
- name: Output customized message when failed
wait_for:
path: /tmp/foo
state: present
msg: Timeout to find file /tmp/foo
# Do not assume the inventory_hostname is resolvable and delay 10 seconds at start
- name: Wait 300 seconds for port 22 to become open and contain "OpenSSH"
wait_for:
port: 22
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
search_regex: OpenSSH
delay: 10
connection: local
# Same as above but you normally have ansible_connection set in inventory, which overrides 'connection'
- name: Wait 300 seconds for port 22 to become open and contain "OpenSSH"
wait_for:
port: 22
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
search_regex: OpenSSH
delay: 10
vars:
ansible_connection: local
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **elapsed** integer | always | The number of seconds that elapsed while waiting **Sample:** 23 |
| **match\_groupdict** dictionary | always | Dictionary containing all the named subgroups of the match, keyed by the subgroup name, as returned by <https://docs.python.org/2/library/re.html#re.MatchObject.groupdict>
**Sample:** {'group': 'match'} |
| **match\_groups** list / elements=string | always | Tuple containing all the subgroups of the match as returned by <https://docs.python.org/2/library/re.html#re.MatchObject.groups>
**Sample:** ['match 1', 'match 2'] |
### Authors
* Jeroen Hoekx (@jhoekx)
* John Jarvis (@jarv)
* Andrii Radyk (@AnderEnder)
ansible ansible.builtin.lineinfile – Manage lines in text files ansible.builtin.lineinfile – Manage lines in text files
=======================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `lineinfile` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.7: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* This module ensures a particular line is in a file, or replace an existing line using a back-referenced regular expression.
* This is primarily useful when you want to change a single line in a file only.
* See the [ansible.builtin.replace](replace_module#ansible-collections-ansible-builtin-replace-module) module if you want to change multiple, similar lines or check [ansible.builtin.blockinfile](blockinfile_module#ansible-collections-ansible-builtin-blockinfile-module) if you want to insert/update/remove a block of lines in a file. For other cases, see the [ansible.builtin.copy](copy_module#ansible-collections-ansible-builtin-copy-module) or [ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module) modules.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **backrefs** boolean added in 1.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| Used with `state=present`. If set, `line` can contain backreferences (both positional and named) that will get populated if the `regexp` matches. This parameter changes the operation of the module slightly; `insertbefore` and `insertafter` will be ignored, and if the `regexp` does not match anywhere in the file, the file will be left unchanged. If the `regexp` does match, the last matching line will be replaced by the expanded line parameter. Mutually exclusive with `search_string`. |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **create** boolean | **Choices:*** **no** ←
* yes
| Used with `state=present`. If specified, the file will be created if it does not already exist. By default it will fail if the file is missing. |
| **firstmatch** boolean added in 2.5 of ansible.builtin | **Choices:*** **no** ←
* yes
| Used with `insertafter` or `insertbefore`. If set, `insertafter` and `insertbefore` will work with the first line that matches the given regular expression. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **insertafter** string | **Choices:*** **EOF** ←
* \*regex\*
| Used with `state=present`. If specified, the line will be inserted after the last match of specified regular expression. If the first match is required, use(firstmatch=yes). A special value is available; `EOF` for inserting the line at the end of the file. If specified regular expression has no matches, EOF will be used instead. If `insertbefore` is set, default value `EOF` will be ignored. If regular expressions are passed to both `regexp` and `insertafter`, `insertafter` is only honored if no match for `regexp` is found. May not be used with `backrefs` or `insertbefore`. |
| **insertbefore** string added in 1.1 of ansible.builtin | **Choices:*** BOF
* \*regex\*
| Used with `state=present`. If specified, the line will be inserted before the last match of specified regular expression. If the first match is required, use `firstmatch=yes`. A value is available; `BOF` for inserting the line at the beginning of the file. If specified regular expression has no matches, the line will be inserted at the end of the file. If regular expressions are passed to both `regexp` and `insertbefore`, `insertbefore` is only honored if no match for `regexp` is found. May not be used with `backrefs` or `insertafter`. |
| **line** string | | The line to insert/replace into the file. Required for `state=present`. If `backrefs` is set, may contain backreferences that will get expanded with the `regexp` capture groups if the regexp matches.
aliases: value |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **others** string | | All arguments accepted by the [ansible.builtin.file](file_module) module also work here. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **path** path / required | | The file to modify. Before Ansible 2.3 this option was only usable as *dest*, *destfile* and *name*.
aliases: dest, destfile, name |
| **regexp** string added in 1.7 of ansible.builtin | | The regular expression to look for in every line of the file. For `state=present`, the pattern to replace if found. Only the last line found will be replaced. For `state=absent`, the pattern of the line(s) to remove. If the regular expression is not matched, the line will be added to the file in keeping with `insertbefore` or `insertafter` settings. When modifying a line the regexp should typically match both the initial state of the line as well as its state after replacement by `line` to ensure idempotence. Uses Python regular expressions. See <https://docs.python.org/3/library/re.html>.
aliases: regex |
| **search\_string** string added in 2.11 of ansible.builtin | | The literal string to look for in every line of the file. This does not have to match the entire line. For `state=present`, the line to replace if the string is found in the file. Only the last line found will be replaced. For `state=absent`, the line(s) to remove if the string is in the line. If the literal expression is not matched, the line will be added to the file in keeping with `insertbefore` or `insertafter` settings. Mutually exclusive with `backrefs` and `regexp`. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the line should be there or not. |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **validate** string | | The validation command to run before copying into place. The path to the file to validate is passed in via '%s' which must be present as in the examples below. The command is passed securely so shell features like expansion and pipes will not work. |
Notes
-----
Note
* As of Ansible 2.3, the *dest* option has been changed to *path* as default, but *dest* still works as well.
* Supports `check_mode`.
See Also
--------
See also
[ansible.builtin.blockinfile](blockinfile_module#ansible-collections-ansible-builtin-blockinfile-module)
The official documentation on the **ansible.builtin.blockinfile** module.
[ansible.builtin.copy](copy_module#ansible-collections-ansible-builtin-copy-module)
The official documentation on the **ansible.builtin.copy** module.
[ansible.builtin.file](file_module#ansible-collections-ansible-builtin-file-module)
The official documentation on the **ansible.builtin.file** module.
[ansible.builtin.replace](replace_module#ansible-collections-ansible-builtin-replace-module)
The official documentation on the **ansible.builtin.replace** module.
[ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module)
The official documentation on the **ansible.builtin.template** module.
[community.windows.win\_lineinfile](../../community/windows/win_lineinfile_module#ansible-collections-community-windows-win-lineinfile-module)
The official documentation on the **community.windows.win\_lineinfile** module.
Examples
--------
```
# NOTE: Before 2.3, option 'dest', 'destfile' or 'name' was used instead of 'path'
- name: Ensure SELinux is set to enforcing mode
ansible.builtin.lineinfile:
path: /etc/selinux/config
regexp: '^SELINUX='
line: SELINUX=enforcing
- name: Make sure group wheel is not in the sudoers configuration
ansible.builtin.lineinfile:
path: /etc/sudoers
state: absent
regexp: '^%wheel'
- name: Replace a localhost entry with our own
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: '^127\.0\.0\.1'
line: 127.0.0.1 localhost
owner: root
group: root
mode: '0644'
- name: Replace a localhost entry searching for a literal string to avoid escaping
lineinfile:
path: /etc/hosts
search_string: '127.0.0.1'
line: 127.0.0.1 localhost
owner: root
group: root
mode: '0644'
- name: Ensure the default Apache port is 8080
ansible.builtin.lineinfile:
path: /etc/httpd/conf/httpd.conf
regexp: '^Listen '
insertafter: '^#Listen '
line: Listen 8080
- name: Ensure php extension matches new pattern
lineinfile:
path: /etc/httpd/conf/httpd.conf
search_string: '<FilesMatch ".php[45]?$">'
insertafter: '^\t<Location \/>\n'
line: ' <FilesMatch ".php[34]?$">'
- name: Ensure we have our own comment added to /etc/services
ansible.builtin.lineinfile:
path: /etc/services
regexp: '^# port for http'
insertbefore: '^www.*80/tcp'
line: '# port for http by default'
- name: Add a line to a file if the file does not exist, without passing regexp
ansible.builtin.lineinfile:
path: /tmp/testfile
line: 192.168.1.99 foo.lab.net foo
create: yes
# NOTE: Yaml requires escaping backslashes in double quotes but not in single quotes
- name: Ensure the JBoss memory settings are exactly as needed
ansible.builtin.lineinfile:
path: /opt/jboss-as/bin/standalone.conf
regexp: '^(.*)Xms(\d+)m(.*)$'
line: '\1Xms${xms}m\3'
backrefs: yes
# NOTE: Fully quoted because of the ': ' on the line. See the Gotchas in the YAML docs.
- name: Validate the sudoers file before saving
ansible.builtin.lineinfile:
path: /etc/sudoers
state: present
regexp: '^%ADMIN ALL='
line: '%ADMIN ALL=(ALL) NOPASSWD: ALL'
validate: /usr/sbin/visudo -cf %s
# See https://docs.python.org/3/library/re.html for further details on syntax
- name: Use backrefs with alternative group syntax to avoid conflicts with variable values
ansible.builtin.lineinfile:
path: /tmp/config
regexp: ^(host=).*
line: \g<1>{{ hostname }}
backrefs: yes
```
### Authors
* Daniel Hokka Zakrissoni (@dhozac)
* Ahti Kitsik (@ahtik)
* Jose Angel Munoz (@imjoseangel)
| programming_docs |
ansible ansible.builtin.together – merges lists into synchronized list ansible.builtin.together – merges lists into synchronized list
==============================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `together` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.3: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates a list with the iterated elements of the supplied lists
* To clarify with an example, [ ‘a’, ‘b’ ] and [ 1, 2 ] turn into [ (‘a’,1), (‘b’, 2) ]
* This is basically the same as the ‘zip\_longest’ filter and Python function
* Any ‘unbalanced’ elements will be substituted with ‘None’
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | list of lists to merge |
Examples
--------
```
- name: item.0 returns from the 'a' list, item.1 returns from the '1' list
debug:
msg: "{{ item.0 }} and {{ item.1 }}"
with_together:
- ['a', 'b', 'c', 'd']
- [1, 2, 3, 4]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=list | success | synchronized list |
### Authors
* Bradley Young (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#93eafce6fdf4b5b0a7a5a8f1e1f2f7fff6eab5b0a0a4a8b5b0a6a1a8b5b0a7aba8f4fef2faffb5b0a7a5a8f0fcfe)>
ansible ansible.builtin.uri – Interacts with webservices ansible.builtin.uri – Interacts with webservices
================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `uri` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.1: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Interacts with HTTP and HTTPS web services and supports Digest, Basic and WSSE HTTP authentication mechanisms.
* For Windows targets, use the [ansible.windows.win\_uri](../windows/win_uri_module#ansible-collections-ansible-windows-win-uri-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **body** raw | | The body of the http request/response to the web service. If `body_format` is set to 'json' it will take an already formatted JSON string or convert a data structure into JSON. If `body_format` is set to 'form-urlencoded' it will convert a dictionary or list of tuples into an 'application/x-www-form-urlencoded' string. (Added in v2.7) If `body_format` is set to 'form-multipart' it will convert a dictionary into 'multipart/form-multipart' body. (Added in v2.10) |
| **body\_format** string added in 2.0 of ansible.builtin | **Choices:*** form-urlencoded
* json
* **raw** ←
* form-multipart
| The serialization format of the body. When set to `json`, `form-multipart`, or `form-urlencoded`, encodes the body argument, if needed, and automatically sets the Content-Type header accordingly. As of `2.3` it is possible to override the `Content-Type` header, when set to `json` or `form-urlencoded` via the *headers* option. The 'Content-Type' header cannot be overridden when using `form-multipart`
`form-urlencoded` was added in v2.7.
`form-multipart` was added in v2.10. |
| **ca\_path** path added in 2.11 of ansible.builtin | | PEM formatted file that contains a CA certificate to be used for validation |
| **client\_cert** path added in 2.4 of ansible.builtin | | PEM formatted certificate chain file to be used for SSL client authentication. This file can also include the key as well, and if the key is included, *client\_key* is not required |
| **client\_key** path added in 2.4 of ansible.builtin | | PEM formatted file that contains your private key to be used for SSL client authentication. If *client\_cert* contains both the certificate and key, this option is not required. |
| **creates** path | | A filename, when it already exists, this step will not be run. |
| **dest** path | | A path of where to download the file to (if desired). If *dest* is a directory, the basename of the file on the remote server will be used. |
| **follow\_redirects** string | **Choices:*** all
* no
* none
* **safe** ←
* urllib2
* yes
| Whether or not the URI module should follow redirects. `all` will follow all redirects. `safe` will follow only "safe" redirects, where "safe" means that the client is only doing a GET or HEAD on the URI to which it is being redirected. `none` will not follow any redirects. Note that `yes` and `no` choices are accepted for backwards compatibility, where `yes` is the equivalent of `all` and `no` is the equivalent of `safe`. `yes` and `no` are deprecated and will be removed in some future version of Ansible. |
| **force** boolean | **Choices:*** **no** ←
* yes
| If `yes` do not get a cached copy. Alias `thirsty` has been deprecated and will be removed in 2.13.
aliases: thirsty |
| **force\_basic\_auth** boolean | **Choices:*** **no** ←
* yes
| Force the sending of the Basic authentication header upon initial request. The library used by the uri module only sends authentication information when a webservice responds to an initial request with a 401 status. Since some basic auth services do not properly send a 401, logins will fail. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **headers** dictionary added in 2.1 of ansible.builtin | | Add custom HTTP headers to a request in the format of a YAML hash. As of `2.3` supplying `Content-Type` here will override the header generated by supplying `json` or `form-urlencoded` for *body\_format*. |
| **http\_agent** string | **Default:**"ansible-httpget" | Header to identify as, generally appears in web server logs. |
| **method** string | **Default:**"GET" | The HTTP method of the request or response. In more recent versions we do not restrict the method at the module level anymore but it still must be a valid method accepted by the service handling the request. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **remote\_src** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `no`, the module will search for the `src` on the controller node. If `yes`, the module will search for the `src` on the managed (remote) node. |
| **removes** path | | A filename, when it does not exist, this step will not be run. |
| **return\_content** boolean | **Choices:*** **no** ←
* yes
| Whether or not to return the body of the response as a "content" key in the dictionary result no matter it succeeded or failed. Independently of this option, if the reported Content-type is "application/json", then the JSON is always loaded into a key called `json` in the dictionary results. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **src** path added in 2.7 of ansible.builtin | | Path to file to be submitted to the remote server. Cannot be used with *body*. |
| **status\_code** list / elements=integer | **Default:**[200] | A list of valid, numeric, HTTP status codes that signifies success of the request. |
| **timeout** integer | **Default:**30 | The socket level timeout in seconds |
| **unix\_socket** path added in 2.8 of ansible.builtin | | Path to Unix domain socket to use for connection |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **url** string / required | | HTTP or HTTPS URL in the form (http|https)://host.domain[:port]/path |
| **url\_password** string | | A password for the module to use for Digest, Basic or WSSE authentication.
aliases: password |
| **url\_username** string | | A username for the module to use for Digest, Basic or WSSE authentication.
aliases: user |
| **use\_gssapi** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. Requires the Python library [gssapi](https://github.com/pythongssapi/python-gssapi) to be installed. Credentials for GSSAPI can be specified with *url\_username*/*url\_password* or with the GSSAPI env var `KRB5CCNAME` that specified a custom Kerberos credential cache. NTLM authentication is `not` supported even if the GSSAPI mech for NTLM has been installed. |
| **use\_proxy** boolean | **Choices:*** no
* **yes** ←
| If `no`, it will not use a proxy, even if one is defined in an environment variable on the target hosts. |
| **validate\_certs** boolean added in 1.9.2 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, SSL certificates will not be validated. This should only set to `no` used on personally controlled sites using self-signed certificates. Prior to 1.9.2 the code defaulted to `no`. |
Notes
-----
Note
* The dependency on httplib2 was removed in Ansible 2.1.
* The module returns all the HTTP headers in lower-case.
* For Windows targets, use the [ansible.windows.win\_uri](../windows/win_uri_module#ansible-collections-ansible-windows-win-uri-module) module instead.
See Also
--------
See also
[ansible.builtin.get\_url](get_url_module#ansible-collections-ansible-builtin-get-url-module)
The official documentation on the **ansible.builtin.get\_url** module.
[ansible.windows.win\_uri](../windows/win_uri_module#ansible-collections-ansible-windows-win-uri-module)
The official documentation on the **ansible.windows.win\_uri** module.
Examples
--------
```
- name: Check that you can connect (GET) to a page and it returns a status 200
uri:
url: http://www.example.com
- name: Check that a page returns a status 200 and fail if the word AWESOME is not in the page contents
uri:
url: http://www.example.com
return_content: yes
register: this
failed_when: "'AWESOME' not in this.content"
- name: Create a JIRA issue
uri:
url: https://your.jira.example.com/rest/api/2/issue/
user: your_username
password: your_pass
method: POST
body: "{{ lookup('file','issue.json') }}"
force_basic_auth: yes
status_code: 201
body_format: json
- name: Login to a form based webpage, then use the returned cookie to access the app in later tasks
uri:
url: https://your.form.based.auth.example.com/index.php
method: POST
body_format: form-urlencoded
body:
name: your_username
password: your_password
enter: Sign in
status_code: 302
register: login
- name: Login to a form based webpage using a list of tuples
uri:
url: https://your.form.based.auth.example.com/index.php
method: POST
body_format: form-urlencoded
body:
- [ name, your_username ]
- [ password, your_password ]
- [ enter, Sign in ]
status_code: 302
register: login
- name: Upload a file via multipart/form-multipart
uri:
url: https://httpbin.org/post
method: POST
body_format: form-multipart
body:
file1:
filename: /bin/true
mime_type: application/octet-stream
file2:
content: text based file content
filename: fake.txt
mime_type: text/plain
text_form_field: value
- name: Connect to website using a previously stored cookie
uri:
url: https://your.form.based.auth.example.com/dashboard.php
method: GET
return_content: yes
headers:
Cookie: "{{ login.cookies_string }}"
- name: Queue build of a project in Jenkins
uri:
url: http://{{ jenkins.host }}/job/{{ jenkins.job }}/build?token={{ jenkins.token }}
user: "{{ jenkins.user }}"
password: "{{ jenkins.password }}"
method: GET
force_basic_auth: yes
status_code: 201
- name: POST from contents of local file
uri:
url: https://httpbin.org/post
method: POST
src: file.json
- name: POST from contents of remote file
uri:
url: https://httpbin.org/post
method: POST
src: /path/to/my/file.json
remote_src: yes
- name: Create workspaces in Log analytics Azure
uri:
url: https://www.mms.microsoft.com/Embedded/Api/ConfigDataSources/LogManagementData/Save
method: POST
body_format: json
status_code: [200, 202]
return_content: true
headers:
Content-Type: application/json
x-ms-client-workspace-path: /subscriptions/{{ sub_id }}/resourcegroups/{{ res_group }}/providers/microsoft.operationalinsights/workspaces/{{ w_spaces }}
x-ms-client-platform: ibiza
x-ms-client-auth-token: "{{ token_az }}"
body:
- name: Pause play until a URL is reachable from this host
uri:
url: "http://192.0.2.1/some/test"
follow_redirects: none
method: GET
register: _result
until: _result.status == 200
retries: 720 # 720 * 5 seconds = 1hour (60*60/5)
delay: 5 # Every 5 seconds
# There are issues in a supporting Python library that is discussed in
# https://github.com/ansible/ansible/issues/52705 where a proxy is defined
# but you want to bypass proxy use on CIDR masks by using no_proxy
- name: Work around a python issue that doesn't support no_proxy envvar
uri:
follow_redirects: none
validate_certs: false
timeout: 5
url: "http://{{ ip_address }}:{{ port | default(80) }}"
register: uri_data
failed_when: false
changed_when: false
vars:
ip_address: 192.0.2.1
environment: |
{
{% for no_proxy in (lookup('env', 'no_proxy') | regex_replace('\s*,\s*', ' ') ).split() %}
{% if no_proxy | regex_search('\/') and
no_proxy | ipaddr('net') != '' and
no_proxy | ipaddr('net') != false and
ip_address | ipaddr(no_proxy) is not none and
ip_address | ipaddr(no_proxy) != false %}
'no_proxy': '{{ ip_address }}'
{% elif no_proxy | regex_search(':') != '' and
no_proxy | regex_search(':') != false and
no_proxy == ip_address + ':' + (port | default(80)) %}
'no_proxy': '{{ ip_address }}:{{ port | default(80) }}'
{% elif no_proxy | ipaddr('host') != '' and
no_proxy | ipaddr('host') != false and
no_proxy == ip_address %}
'no_proxy': '{{ ip_address }}'
{% elif no_proxy | regex_search('^(\*|)\.') != '' and
no_proxy | regex_search('^(\*|)\.') != false and
no_proxy | regex_replace('\*', '') in ip_address %}
'no_proxy': '{{ ip_address }}'
{% endif %}
{% endfor %}
}
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **content** string | status not in status\_code or return\_content is true | The response body content. **Sample:** {} |
| **cookies** dictionary added in 2.4 of ansible.builtin | on success | The cookie values placed in cookie jar. **Sample:** {'SESSIONID': '[SESSIONID]'} |
| **cookies\_string** string added in 2.6 of ansible.builtin | on success | The value for future request Cookie headers. **Sample:** SESSIONID=[SESSIONID] |
| **elapsed** integer | on success | The number of seconds that elapsed while performing the download. **Sample:** 23 |
| **msg** string | always | The HTTP message from the request. **Sample:** OK (unknown bytes) |
| **redirected** boolean | on success | Whether the request was redirected. |
| **status** integer | always | The HTTP status code from the request. **Sample:** 200 |
| **url** string | always | The actual URL used for the request. **Sample:** https://www.ansible.com/ |
### Authors
* Romeo Theriault (@romeotheriault)
ansible ansible.builtin.inventory_hostnames – list of inventory hosts matching a host pattern ansible.builtin.inventory\_hostnames – list of inventory hosts matching a host pattern
======================================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `inventory_hostnames` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.3: of ansible.builtin
* [Synopsis](#synopsis)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This lookup understands ‘host patterns’ as used by the `hosts:` keyword in plays and can return a list of matching hosts from inventory
Notes
-----
Note
* this is only worth for ‘hostname patterns’ it is easier to loop over the group/group\_names variables otherwise.
Examples
--------
```
- name: show all the hosts matching the pattern, i.e. all but the group www
debug:
msg: "{{ item }}"
with_inventory_hostnames:
- all:!www
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_hostnames** list / elements=string | success | list of hostnames that matched the host pattern in inventory |
### Authors
* Michael DeHaan
* Steven Dossett (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#c2b1a6adb1b1a7b6b6e4e1f1f5f9e4e1f7f0f9e4e1f6faf9b2a3aca3b6aae4e1f6f4f9a1adaf)>
| programming_docs |
ansible ansible.builtin.slurp – Slurps a file from remote nodes ansible.builtin.slurp – Slurps a file from remote nodes
=======================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `slurp` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module works like [ansible.builtin.fetch](fetch_module#ansible-collections-ansible-builtin-fetch-module). It is used for fetching a base64- encoded blob containing the data in a remote file.
* This module is also supported for Windows targets.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **src** path / required | | The file on the remote system to fetch. This *must* be a file, not a directory.
aliases: path |
Notes
-----
Note
* This module returns an ‘in memory’ base64 encoded version of the file, take into account that this will require at least twice the RAM as the original file size.
* This module is also supported for Windows targets.
* Supports `check_mode`.
See Also
--------
See also
[ansible.builtin.fetch](fetch_module#ansible-collections-ansible-builtin-fetch-module)
The official documentation on the **ansible.builtin.fetch** module.
Examples
--------
```
- name: Find out what the remote machine's mounts are
ansible.builtin.slurp:
src: /proc/mounts
register: mounts
- name: Print returned information
ansible.builtin.debug:
msg: "{{ mounts['content'] | b64decode }}"
# From the commandline, find the pid of the remote machine's sshd
# $ ansible host -m slurp -a 'src=/var/run/sshd.pid'
# host | SUCCESS => {
# "changed": false,
# "content": "MjE3OQo=",
# "encoding": "base64",
# "source": "/var/run/sshd.pid"
# }
# $ echo MjE3OQo= | base64 -d
# 2179
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **content** string | success | Encoded file content **Sample:** MjE3OQo= |
| **encoding** string | success | Type of encoding used for file **Sample:** base64 |
| **source** string | success | Actual path of file slurped **Sample:** /var/run/sshd.pid |
### Authors
* Ansible Core Team
* Michael DeHaan (@mpdehaan)
ansible ansible.builtin.linear – Executes tasks in a linear fashion ansible.builtin.linear – Executes tasks in a linear fashion
===========================================================
Note
This strategy plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `linear` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same strategy plugin name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Notes](#notes)
Synopsis
--------
* Task execution is in lockstep per host batch as defined by `serial` (default all). Up to the fork limit of hosts will execute each task at the same time and then the next series of hosts until the batch is done, before going on to the next task.
Notes
-----
Note
* This was the default Ansible behaviour before ‘strategy plugins’ were introduced in 2.0.
### Authors
* Ansible Core Team
ansible ansible.builtin.pip – Manages Python library dependencies ansible.builtin.pip – Manages Python library dependencies
=========================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `pip` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.7: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Python library dependencies. To use this module, one of the following keys is required: `name` or `requirements`.
Requirements
------------
The below requirements are needed on the host that executes this module.
* pip
* virtualenv
* setuptools
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **chdir** path added in 1.3 of ansible.builtin | | cd into this directory before running the command |
| **editable** boolean added in 2.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| Pass the editable flag. |
| **executable** path added in 1.3 of ansible.builtin | | The explicit executable or pathname for the pip executable, if different from the Ansible Python interpreter. For example `pip3.3`, if there are both Python 2.7 and 3.3 installations in the system and you want to run pip for the Python 3.3 installation. Mutually exclusive with *virtualenv* (added in 2.1). Does not affect the Ansible Python interpreter. The setuptools package must be installed for both the Ansible Python interpreter and for the version of Python specified by this option. |
| **extra\_args** string added in 1.0 of ansible.builtin | | Extra arguments passed to pip. |
| **name** list / elements=string | | The name of a Python library to install or the url(bzr+,hg+,git+,svn+) of the remote package. This can be a list (since 2.2) and contain version specifiers (since 2.7). |
| **requirements** string | | The path to a pip requirements file, which should be local to the remote system. File can be specified as a relative path if using the chdir option. |
| **state** string | **Choices:*** absent
* forcereinstall
* latest
* **present** ←
| The state of module The 'forcereinstall' option is only available in Ansible 2.1 and above. |
| **umask** string added in 2.1 of ansible.builtin | | The system umask to apply before installing the pip package. This is useful, for example, when installing on systems that have a very restrictive umask by default (e.g., "0077") and you want to pip install packages which are to be used by all users. Note that this requires you to specify desired umask mode as an octal string, (e.g., "0022"). |
| **version** string | | The version number to install of the Python library specified in the *name* parameter. |
| **virtualenv** path | | An optional path to a *virtualenv* directory to install into. It cannot be specified together with the 'executable' parameter (added in 2.1). If the virtualenv does not exist, it will be created before installing packages. The optional virtualenv\_site\_packages, virtualenv\_command, and virtualenv\_python options affect the creation of the virtualenv. |
| **virtualenv\_command** path added in 1.1 of ansible.builtin | **Default:**"virtualenv" | The command or a pathname to the command to create the virtual environment with. For example `pyvenv`, `virtualenv`, `virtualenv2`, `~/bin/virtualenv`, `/usr/local/bin/virtualenv`. |
| **virtualenv\_python** string added in 2.0 of ansible.builtin | | The Python executable used for creating the virtual environment. For example `python3.5`, `python2.7`. When not specified, the Python version used to run the ansible module is used. This parameter should not be used when `virtualenv_command` is using `pyvenv` or the `-m venv` module. |
| **virtualenv\_site\_packages** boolean added in 1.0 of ansible.builtin | **Choices:*** **no** ←
* yes
| Whether the virtual environment will inherit packages from the global site-packages directory. Note that if this setting is changed on an already existing virtual environment it will not have any effect, the environment must be deleted and newly created. |
Notes
-----
Note
* The virtualenv (<http://www.virtualenv.org/>) must be installed on the remote host if the virtualenv parameter is specified and the virtualenv needs to be created.
* Although it executes using the Ansible Python interpreter, the pip module shells out to run the actual pip command, so it can use any pip version you specify with *executable*. By default, it uses the pip version for the Ansible Python interpreter. For example, pip3 on python 3, and pip2 or pip on python 2.
* The interpreter used by Ansible (see [ansible\_python\_interpreter](../../../user_guide/intro_inventory#ansible-python-interpreter)) requires the setuptools package, regardless of the version of pip set with the *executable* option.
Examples
--------
```
- name: Install bottle python package
pip:
name: bottle
- name: Install bottle python package on version 0.11
pip:
name: bottle==0.11
- name: Install bottle python package with version specifiers
pip:
name: bottle>0.10,<0.20,!=0.11
- name: Install multi python packages with version specifiers
pip:
name:
- django>1.11.0,<1.12.0
- bottle>0.10,<0.20,!=0.11
- name: Install python package using a proxy
# Pip doesn't use the standard environment variables, please use the CAPITALIZED ones below
pip:
name: six
environment:
HTTP_PROXY: '127.0.0.1:8080'
HTTPS_PROXY: '127.0.0.1:8080'
# You do not have to supply '-e' option in extra_args
- name: Install MyApp using one of the remote protocols (bzr+,hg+,git+,svn+)
pip:
name: svn+http://myrepo/svn/MyApp#egg=MyApp
- name: Install MyApp using one of the remote protocols (bzr+,hg+,git+)
pip:
name: git+http://myrepo/app/MyApp
- name: Install MyApp from local tarball
pip:
name: file:///path/to/MyApp.tar.gz
- name: Install bottle into the specified (virtualenv), inheriting none of the globally installed modules
pip:
name: bottle
virtualenv: /my_app/venv
- name: Install bottle into the specified (virtualenv), inheriting globally installed modules
pip:
name: bottle
virtualenv: /my_app/venv
virtualenv_site_packages: yes
- name: Install bottle into the specified (virtualenv), using Python 2.7
pip:
name: bottle
virtualenv: /my_app/venv
virtualenv_command: virtualenv-2.7
- name: Install bottle within a user home directory
pip:
name: bottle
extra_args: --user
- name: Install specified python requirements
pip:
requirements: /my_app/requirements.txt
- name: Install specified python requirements in indicated (virtualenv)
pip:
requirements: /my_app/requirements.txt
virtualenv: /my_app/venv
- name: Install specified python requirements and custom Index URL
pip:
requirements: /my_app/requirements.txt
extra_args: -i https://example.com/pypi/simple
- name: Install specified python requirements offline from a local directory with downloaded packages
pip:
requirements: /my_app/requirements.txt
extra_args: "--no-index --find-links=file:///my_downloaded_packages_dir"
- name: Install bottle for Python 3.3 specifically, using the 'pip3.3' executable
pip:
name: bottle
executable: pip3.3
- name: Install bottle, forcing reinstallation if it's already installed
pip:
name: bottle
state: forcereinstall
- name: Install bottle while ensuring the umask is 0022 (to ensure other users can use it)
pip:
name: bottle
umask: "0022"
become: True
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cmd** string | success | pip command used by the module **Sample:** pip2 install ansible six |
| **name** list / elements=string | success | list of python modules targetted by pip **Sample:** ['ansible', 'six'] |
| **requirements** string | success, if a requirements file was provided | Path to the requirements file **Sample:** /srv/git/project/requirements.txt |
| **version** string | success, if a name and version were provided | Version of the package specified in 'name' **Sample:** 2.5.1 |
| **virtualenv** string | success, if a virtualenv path was provided | Path to the virtualenv **Sample:** /tmp/virtualenv |
### Authors
* Matt Wright (@mattupstate)
ansible ansible.builtin.psrp – Run tasks over Microsoft PowerShell Remoting Protocol ansible.builtin.psrp – Run tasks over Microsoft PowerShell Remoting Protocol
============================================================================
Note
This connection plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `psrp` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same connection plugin name.
New in version 2.7: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
Synopsis
--------
* Run commands or put/fetch on a target via PSRP (WinRM plugin)
* This is similar to the *winrm* connection plugin which uses the same underlying transport but instead runs in a PowerShell interpreter.
Requirements
------------
The below requirements are needed on the local controller node that executes this connection.
* pypsrp>=0.4.0 (Python library)
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **auth** string | **Choices:*** basic
* certificate
* **negotiate** ←
* kerberos
* ntlm
* credssp
| var: ansible\_psrp\_auth | The authentication protocol to use when authenticating the remote user. The default, `negotiate`, will attempt to use `Kerberos` if it is available and fall back to `NTLM` if it isn't. |
| **ca\_cert** path | | var: ansible\_psrp\_cert\_trust\_path var: ansible\_psrp\_ca\_cert | The path to a PEM certificate chain to use when validating the server's certificate. This value is ignored if *cert\_validation* is set to `ignore`.
aliases: cert\_trust\_path |
| **cert\_validation** string | **Choices:*** **validate** ←
* ignore
| var: ansible\_psrp\_cert\_validation | Whether to validate the remote server's certificate or not. Set to `ignore` to not validate any certificates.
*ca\_cert* can be set to the path of a PEM certificate chain to use in the validation. |
| **certificate\_key\_pem** path | | var: ansible\_psrp\_certificate\_key\_pem | The local path to an X509 certificate key to use with certificate auth. |
| **certificate\_pem** path | | var: ansible\_psrp\_certificate\_pem | The local path to an X509 certificate to use with certificate auth. |
| **configuration\_name** string | **Default:**"Microsoft.PowerShell" | var: ansible\_psrp\_configuration\_name | The name of the PowerShell configuration endpoint to connect to. |
| **connection\_timeout** integer | **Default:**30 | var: ansible\_psrp\_connection\_timeout | The connection timeout for making the request to the remote host. This is measured in seconds. |
| **credssp\_auth\_mechanism** string | **Choices:*** **auto** ←
* kerberos
* ntlm
| var: ansible\_psrp\_credssp\_auth\_mechanism | The sub authentication mechanism to use with CredSSP auth. When `auto`, both Kerberos and NTLM is attempted with kerberos being preferred. |
| **credssp\_disable\_tlsv1\_2** boolean | **Choices:*** **no** ←
* yes
| var: ansible\_psrp\_credssp\_disable\_tlsv1\_2 | Disables the use of TLSv1.2 on the CredSSP authentication channel. This should not be set to `yes` unless dealing with a host that does not have TLSv1.2. |
| **credssp\_minimum\_version** integer | **Default:**2 | var: ansible\_psrp\_credssp\_minimum\_version | The minimum CredSSP server authentication version that will be accepted. Set to `5` to ensure the server has been patched and is not vulnerable to CVE 2018-0886. |
| **ignore\_proxy** boolean | **Choices:*** **no** ←
* yes
| var: ansible\_psrp\_ignore\_proxy | Will disable any environment proxy settings and connect directly to the remote host. This option is ignored if `proxy` is set. |
| **max\_envelope\_size** integer | **Default:**153600 | var: ansible\_psrp\_max\_envelope\_size | Sets the maximum size of each WSMan message sent to the remote host. This is measured in bytes. Defaults to `150KiB` for compatibility with older hosts. |
| **message\_encryption** string | **Choices:*** **auto** ←
* always
* never
| var: ansible\_psrp\_message\_encryption | Controls the message encryption settings, this is different from TLS encryption when *ansible\_psrp\_protocol* is `https`. Only the auth protocols `negotiate`, `kerberos`, `ntlm`, and `credssp` can do message encryption. The other authentication protocols only support encryption when `protocol` is set to `https`.
`auto` means means message encryption is only used when not using TLS/HTTPS.
`always` is the same as `auto` but message encryption is always used even when running over TLS/HTTPS.
`never` disables any encryption checks that are in place when running over HTTP and disables any authentication encryption processes. |
| **negotiate\_delegate** boolean | **Choices:*** no
* yes
| var: ansible\_psrp\_negotiate\_delegate | Allow the remote user the ability to delegate it's credentials to another server, i.e. credential delegation. Only valid when Kerberos was the negotiated auth or was explicitly set as the authentication. Ignored when NTLM was the negotiated auth. |
| **negotiate\_hostname\_override** string | | var: ansible\_psrp\_negotiate\_hostname\_override | Override the remote hostname when searching for the host in the Kerberos lookup. This allows Ansible to connect over IP but authenticate with the remote server using it's DNS name. Only valid when Kerberos was the negotiated auth or was explicitly set as the authentication. Ignored when NTLM was the negotiated auth. |
| **negotiate\_send\_cbt** boolean | **Choices:*** no
* **yes** ←
| var: ansible\_psrp\_negotiate\_send\_cbt | Send the Channel Binding Token (CBT) structure when authenticating. CBT is used to provide extra protection against Man in the Middle `MitM` attacks by binding the outer transport channel to the auth channel. CBT is not used when using just `HTTP`, only `HTTPS`. |
| **negotiate\_service** string | **Default:**"WSMAN" | var: ansible\_psrp\_negotiate\_service | Override the service part of the SPN used during Kerberos authentication. Only valid when Kerberos was the negotiated auth or was explicitly set as the authentication. Ignored when NTLM was the negotiated auth. |
| **operation\_timeout** integer | **Default:**20 | var: ansible\_psrp\_operation\_timeout | Sets the WSMan timeout for each operation. This is measured in seconds. This should not exceed the value for `connection_timeout`. |
| **path** string | **Default:**"wsman" | var: ansible\_psrp\_path | The URI path to connect to. |
| **pipelining** boolean | **Choices:*** no
* yes
**Default:**"ANSIBLE\_PIPELINING" | ini entries: [defaults]pipelining = ANSIBLE\_PIPELINING env:ANSIBLE\_PIPELINING var: ansible\_pipelining | Pipelining reduces the number of connection operations required to execute a module on the remote server, by executing many Ansible modules without actual file transfers. This can result in a very significant performance improvement when enabled. However this can conflict with privilege escalation (become). For example, when using sudo operations you must first disable 'requiretty' in the sudoers file for the target hosts, which is why this feature is disabled by default. |
| **port** integer | | var: ansible\_port var: ansible\_psrp\_port | The port for PSRP to connect on the remote target. Default is `5986` if *protocol* is not defined or is `https`, otherwise the port is `5985`. |
| **protocol** string | **Choices:*** http
* https
| var: ansible\_psrp\_protocol | Set the protocol to use for the connection. Default is `https` if *port* is not defined or *port* is not `5985`. |
| **proxy** string | | var: ansible\_psrp\_proxy | Set the proxy URL to use when connecting to the remote host. |
| **read\_timeout** integer added in 2.8 of ansible.builtin | **Default:**30 | var: ansible\_psrp\_read\_timeout | The read timeout for receiving data from the remote host. This value must always be greater than *operation\_timeout*. This option requires pypsrp >= 0.3. This is measured in seconds. |
| **reconnection\_backoff** integer added in 2.8 of ansible.builtin | **Default:**2 | var: ansible\_psrp\_connection\_backoff var: ansible\_psrp\_reconnection\_backoff | The backoff time to use in between reconnection attempts. (First sleeps X, then sleeps 2\*X, then sleeps 4\*X, ...) This is measured in seconds. The `ansible_psrp_reconnection_backoff` variable was added in Ansible 2.9. |
| **reconnection\_retries** integer added in 2.8 of ansible.builtin | **Default:**0 | var: ansible\_psrp\_reconnection\_retries | The number of retries on connection errors. |
| **remote\_addr** string | **Default:**"inventory\_hostname" | var: ansible\_host var: ansible\_psrp\_host | The hostname or IP address of the remote host. |
| **remote\_password** string | | var: ansible\_password var: ansible\_winrm\_pass var: ansible\_winrm\_password | Authentication password for the `remote_user`. Can be supplied as CLI option.
aliases: password |
| **remote\_user** string | | var: ansible\_user var: ansible\_psrp\_user | The user to log in as. |
### Authors
* Ansible Core Team
| programming_docs |
ansible ansible.builtin.subelements – traverse nested key from a list of dictionaries ansible.builtin.subelements – traverse nested key from a list of dictionaries
=============================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `subelements` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Subelements walks a list of hashes (aka dictionaries) and then traverses a list with a given (nested sub-)key inside of those records.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | tuple of list of dictionaries and dictionary key to extract |
| **skip\_missing** string | **Default:**"no" | | Lookup accepts this flag from a dictionary as optional. See Example section for more information. If set to `True`, the lookup plugin will skip the lists items that do not contain the given subkey. If set to `False`, the plugin will yield an error and complain about the missing subkey. |
Examples
--------
```
- name: show var structure as it is needed for example to make sense
hosts: all
vars:
users:
- name: alice
authorized:
- /tmp/alice/onekey.pub
- /tmp/alice/twokey.pub
mysql:
password: mysql-password
hosts:
- "%"
- "127.0.0.1"
- "::1"
- "localhost"
privs:
- "*.*:SELECT"
- "DB1.*:ALL"
groups:
- wheel
- name: bob
authorized:
- /tmp/bob/id_rsa.pub
mysql:
password: other-mysql-password
hosts:
- "db1"
privs:
- "*.*:SELECT"
- "DB2.*:ALL"
tasks:
- name: Set authorized ssh key, extracting just that data from 'users'
authorized_key:
user: "{{ item.0.name }}"
key: "{{ lookup('file', item.1) }}"
with_subelements:
- "{{ users }}"
- authorized
- name: Setup MySQL users, given the mysql hosts and privs subkey lists
mysql_user:
name: "{{ item.0.name }}"
password: "{{ item.0.mysql.password }}"
host: "{{ item.1 }}"
priv: "{{ item.0.mysql.privs | join('/') }}"
with_subelements:
- "{{ users }}"
- mysql.hosts
- name: list groups for users that have them, don't error if groups key is missing
debug: var=item
loop: "{{ q('subelements', users, 'groups', {'skip_missing': True}) }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** string | success | list of subelements extracted |
### Authors
* Serge van Ginderachter (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#b3c0d6c1d4d6959080848895908681889590878b88c5d2ddd4daddd7d6c1d2d0dbc7d6c19590878588d1d6)>
ansible ansible.builtin.wait_for_connection – Waits until remote system is reachable/usable ansible.builtin.wait\_for\_connection – Waits until remote system is reachable/usable
=====================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `wait_for_connection` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.3: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Waits for a total of `timeout` seconds.
* Retries the transport connection after a timeout of `connect_timeout`.
* Tests the transport connection every `sleep` seconds.
* This module makes use of internal ansible transport (and configuration) and the ping/win\_ping module to guarantee correct end-to-end functioning.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **connect\_timeout** integer | **Default:**5 | Maximum number of seconds to wait for a connection to happen before closing and retrying. |
| **delay** integer | **Default:**0 | Number of seconds to wait before starting to poll. |
| **sleep** integer | **Default:**1 | Number of seconds to sleep between checks. |
| **timeout** integer | **Default:**600 | Maximum number of seconds to wait for. |
Notes
-----
Note
* This module is also supported for Windows targets.
See Also
--------
See also
[ansible.builtin.wait\_for](wait_for_module#ansible-collections-ansible-builtin-wait-for-module)
The official documentation on the **ansible.builtin.wait\_for** module.
[ansible.windows.win\_wait\_for](../windows/win_wait_for_module#ansible-collections-ansible-windows-win-wait-for-module)
The official documentation on the **ansible.windows.win\_wait\_for** module.
[community.windows.win\_wait\_for\_process](../../community/windows/win_wait_for_process_module#ansible-collections-community-windows-win-wait-for-process-module)
The official documentation on the **community.windows.win\_wait\_for\_process** module.
Examples
--------
```
- name: Wait 600 seconds for target connection to become reachable/usable
wait_for_connection:
- name: Wait 300 seconds, but only start checking after 60 seconds
wait_for_connection:
delay: 60
timeout: 300
# Wake desktops, wait for them to become ready and continue playbook
- hosts: all
gather_facts: no
tasks:
- name: Send magic Wake-On-Lan packet to turn on individual systems
wakeonlan:
mac: '{{ mac }}'
broadcast: 192.168.0.255
delegate_to: localhost
- name: Wait for system to become reachable
wait_for_connection:
- name: Gather facts for first time
setup:
# Build a new VM, wait for it to become ready and continue playbook
- hosts: all
gather_facts: no
tasks:
- name: Clone new VM, if missing
vmware_guest:
hostname: '{{ vcenter_ipaddress }}'
name: '{{ inventory_hostname_short }}'
template: Windows 2012R2
customization:
hostname: '{{ vm_shortname }}'
runonce:
- powershell.exe -ExecutionPolicy Unrestricted -File C:\Windows\Temp\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert -EnableCredSSP
delegate_to: localhost
- name: Wait for system to become reachable over WinRM
wait_for_connection:
timeout: 900
- name: Gather facts for first time
setup:
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **elapsed** float | always | The number of seconds that elapsed waiting for the connection to appear. **Sample:** 23.1 |
### Authors
* Dag Wieers (@dagwieers)
ansible ansible.builtin.fail – Fail with custom message ansible.builtin.fail – Fail with custom message
===============================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `fail` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.8: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* This module fails the progress with a custom message.
* It can be useful for bailing out when a certain condition is met using `when`.
* This module is also supported for Windows targets.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **msg** string | **Default:**"Failed as requested from task" | The customized message used for failing execution. If omitted, fail will simply bail out with a generic message. |
Notes
-----
Note
* This module is also supported for Windows targets.
See Also
--------
See also
[ansible.builtin.assert](assert_module#ansible-collections-ansible-builtin-assert-module)
The official documentation on the **ansible.builtin.assert** module.
[ansible.builtin.debug](debug_module#ansible-collections-ansible-builtin-debug-module)
The official documentation on the **ansible.builtin.debug** module.
[ansible.builtin.meta](meta_module#ansible-collections-ansible-builtin-meta-module)
The official documentation on the **ansible.builtin.meta** module.
Examples
--------
```
- name: Example using fail and when together
fail:
msg: The system may not be provisioned according to the CMDB status.
when: cmdb_status != "to-be-staged"
```
### Authors
* Dag Wieers (@dagwieers)
ansible ansible.builtin.include_vars – Load variables from files, dynamically within a task ansible.builtin.include\_vars – Load variables from files, dynamically within a task
====================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `include_vars` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Loads YAML/JSON variables dynamically from a file or directory, recursively, during task runtime.
* If loading a directory, the files are sorted alphabetically before being loaded.
* This module is also supported for Windows targets.
* To assign included variables to a different host than `inventory_hostname`, use `delegate_to` and set `delegate_facts=yes`.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **depth** integer added in 2.2 of ansible.builtin | **Default:**0 | When using `dir`, this module will, by default, recursively go through each sub directory and load up the variables. By explicitly setting the depth, this module will only go as deep as the depth. |
| **dir** path added in 2.2 of ansible.builtin | | The directory name from which the variables should be loaded. If the path is relative and the task is inside a role, it will look inside the role's vars/ subdirectory. If the path is relative and not inside a role, it will be parsed relative to the playbook. |
| **extensions** list / elements=string added in 2.3 of ansible.builtin | **Default:**["json", "yaml", "yml"] | List of file extensions to read when using `dir`. |
| **file** path added in 2.2 of ansible.builtin | | The file name from which variables should be loaded. If the path is relative, it will look for the file in vars/ subdirectory of a role or relative to playbook. |
| **files\_matching** string added in 2.2 of ansible.builtin | | Limit the files that are loaded within any directory to this regular expression. |
| **free-form** string | | This module allows you to specify the 'file' option directly without any other options. There is no 'free-form' option, this is just an indicator, see example below. |
| **ignore\_files** list / elements=string added in 2.2 of ansible.builtin | | List of file names to ignore. |
| **ignore\_unknown\_extensions** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| Ignore unknown file extensions within the directory. This allows users to specify a directory containing vars files that are intermingled with non-vars files extension types (e.g. a directory with a README in it and vars files). |
| **name** string added in 2.2 of ansible.builtin | | The name of a variable into which assign the included vars. If omitted (null) they will be made top level vars. |
Notes
-----
Note
* This module is also supported for Windows targets.
See Also
--------
See also
[ansible.builtin.set\_fact](set_fact_module#ansible-collections-ansible-builtin-set-fact-module)
The official documentation on the **ansible.builtin.set\_fact** module.
[Controlling where tasks run: delegation and local actions](../../../user_guide/playbooks_delegation#playbooks-delegation)
More information related to task delegation.
Examples
--------
```
- name: Include vars of stuff.yaml into the 'stuff' variable (2.2).
include_vars:
file: stuff.yaml
name: stuff
- name: Conditionally decide to load in variables into 'plans' when x is 0, otherwise do not. (2.2)
include_vars:
file: contingency_plan.yaml
name: plans
when: x == 0
- name: Load a variable file based on the OS type, or a default if not found. Using free-form to specify the file.
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- '{{ansible_distribution}}.yaml'
- '{{ansible_os_family}}.yaml'
- default.yaml
paths:
- 'vars'
- name: Bare include (free-form)
include_vars: myvars.yaml
- name: Include all .json and .jsn files in vars/all and all nested directories (2.3)
include_vars:
dir: vars/all
extensions:
- 'json'
- 'jsn'
- name: Include all default extension files in vars/all and all nested directories and save the output in test. (2.2)
include_vars:
dir: vars/all
name: test
- name: Include default extension files in vars/services (2.2)
include_vars:
dir: vars/services
depth: 1
- name: Include only files matching bastion.yaml (2.2)
include_vars:
dir: vars
files_matching: bastion.yaml
- name: Include all .yaml files except bastion.yaml (2.3)
include_vars:
dir: vars
ignore_files:
- 'bastion.yaml'
extensions:
- 'yaml'
- name: Ignore warnings raised for files with unknown extensions while loading (2.7)
include_vars:
dir: vars
ignore_unknown_extensions: True
extensions:
- ''
- 'yaml'
- 'yml'
- 'json'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **ansible\_included\_var\_files** list / elements=string added in 2.4 of ansible.builtin | success | A list of files that were successfully included **Sample:** ['/path/to/file.json', '/path/to/file.yaml'] |
### Authors
* Allen Sanabria (@linuxdynasty)
ansible ansible.builtin.indexed_items – rewrites lists to return ‘indexed items’ ansible.builtin.indexed\_items – rewrites lists to return ‘indexed items’
=========================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `indexed_items` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.3: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* use this lookup if you want to loop over an array and also get the numeric index of where you are in the array as you go
* any list given will be transformed with each resulting element having the it’s previous position in item.0 and its value in item.1
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | list of items |
Examples
--------
```
- name: indexed loop demo
debug:
msg: "at array position {{ item.0 }} there is a value {{ item.1 }}"
with_indexed_items:
- "{{ some_list }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=list | success | list with each item.0 giving you the position and item.1 the value |
### Authors
* Michael DeHaan
ansible ansible.builtin.sysvinit – Manage SysV services. ansible.builtin.sysvinit – Manage SysV services.
================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `sysvinit` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.6: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Controls services on target hosts that use the SysV init system.
Requirements
------------
The below requirements are needed on the host that executes this module.
* That the service managed has a corresponding init script.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **arguments** string | | Additional arguments provided on the command line that some init scripts accept.
aliases: args |
| **daemonize** boolean | **Choices:*** **no** ←
* yes
| Have the module daemonize as the service itself might not do so properly. This is useful with badly written init scripts or daemons, which commonly manifests as the task hanging as it is still holding the tty or the service dying when the task is over as the connection closes the session. |
| **enabled** boolean | **Choices:*** no
* yes
| Whether the service should start on boot. **At least one of state and enabled are required.**
|
| **name** string / required | | Name of the service.
aliases: service |
| **pattern** string | | A substring to look for as would be found in the output of the *ps* command as a stand-in for a status result. If the string is found, the service will be assumed to be running. This option is mainly for use with init scripts that don't support the 'status' option. |
| **runlevels** list / elements=string | | The runlevels this script should be enabled/disabled from. Use this to override the defaults set by the package or init script itself. |
| **sleep** integer | **Default:**1 | If the service is being `restarted` or `reloaded` then sleep this many seconds between the stop and start command. This helps to workaround badly behaving services. |
| **state** string | **Choices:*** started
* stopped
* restarted
* reloaded
|
`started`/`stopped` are idempotent actions that will not run commands unless necessary. Not all init scripts support `restarted` nor `reloaded` natively, so these will both trigger a stop and start as needed. |
Notes
-----
Note
* One option other than name is required.
Examples
--------
```
- name: Make sure apache2 is started
sysvinit:
name: apache2
state: started
enabled: yes
- name: Make sure apache2 is started on runlevels 3 and 5
sysvinit:
name: apache2
state: started
enabled: yes
runlevels:
- 3
- 5
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **results** complex | always | results from actions taken **Sample:** {'attempts': 1, 'changed': True, 'name': 'apache2', 'status': {'enabled': {'changed': True, 'rc': 0, 'stderr': '', 'stdout': ''}, 'stopped': {'changed': True, 'rc': 0, 'stderr': '', 'stdout': 'Stopping web server: apache2.\n'}}} |
### Authors
* Ansible Core Team
| programming_docs |
ansible ansible.builtin.include_role – Load and execute a role ansible.builtin.include\_role – Load and execute a role
=======================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `include_role` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Dynamically loads and executes a specified role as a task.
* May be used only where Ansible tasks are allowed - inside `pre_tasks`, `tasks`, or `post_tasks` play objects, or as a task inside a role.
* Task-level keywords, loops, and conditionals apply only to the `include_role` statement itself.
* To apply keywords to the tasks within the role, pass them using the `apply` option or use [ansible.builtin.import\_role](import_role_module#ansible-collections-ansible-builtin-import-role-module) instead.
* Ignores some keywords, like `until` and `retries`.
* This module is also supported for Windows targets.
* Does not work in handlers.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_duplicates** boolean | **Choices:*** no
* **yes** ←
| Overrides the role's metadata setting to allow using a role more than once with the same parameters. |
| **apply** string added in 2.7 of ansible.builtin | | Accepts a hash of task keywords (e.g. `tags`, `become`) that will be applied to all tasks within the included role. |
| **defaults\_from** string | **Default:**"main" | File to load from a role's `defaults/` directory. |
| **handlers\_from** string added in 2.8 of ansible.builtin | **Default:**"main" | File to load from a role's `handlers/` directory. |
| **name** string / required | | The name of the role to be executed. |
| **public** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| This option dictates whether the role's `vars` and `defaults` are exposed to the play. If set to `yes` the variables will be available to tasks following the `include_role` task. This functionality differs from standard variable exposure for roles listed under the `roles` header or `import_role` as they are exposed to the play at playbook parsing time, and available to earlier roles and tasks as well. |
| **rolespec\_validate** boolean added in 2.11 of ansible.builtin | **Choices:*** no
* **yes** ←
| Perform role argument spec validation if an argument spec is defined. |
| **tasks\_from** string | **Default:**"main" | File to load from a role's `tasks/` directory. |
| **vars\_from** string | **Default:**"main" | File to load from a role's `vars/` directory. |
Notes
-----
Note
* Handlers are made available to the whole play.
* Before Ansible 2.4, as with `include`, this task could be static or dynamic, If static, it implied that it won’t need templating, loops or conditionals and will show included tasks in the `--list` options. Ansible would try to autodetect what is needed, but you can set `static` to `yes` or `no` at task level to control this.
* After Ansible 2.4, you can use [ansible.builtin.import\_role](import_role_module#ansible-collections-ansible-builtin-import-role-module) for `static` behaviour and this action for `dynamic` one.
See Also
--------
See also
[ansible.builtin.import\_playbook](import_playbook_module#ansible-collections-ansible-builtin-import-playbook-module)
The official documentation on the **ansible.builtin.import\_playbook** module.
[ansible.builtin.import\_role](import_role_module#ansible-collections-ansible-builtin-import-role-module)
The official documentation on the **ansible.builtin.import\_role** module.
[ansible.builtin.import\_tasks](import_tasks_module#ansible-collections-ansible-builtin-import-tasks-module)
The official documentation on the **ansible.builtin.import\_tasks** module.
[ansible.builtin.include\_tasks](include_tasks_module#ansible-collections-ansible-builtin-include-tasks-module)
The official documentation on the **ansible.builtin.include\_tasks** module.
[Including and importing](../../../user_guide/playbooks_reuse_includes#playbooks-reuse-includes)
More information related to including and importing playbooks, roles and tasks.
Examples
--------
```
- include_role:
name: myrole
- name: Run tasks/other.yaml instead of 'main'
include_role:
name: myrole
tasks_from: other
- name: Pass variables to role
include_role:
name: myrole
vars:
rolevar1: value from task
- name: Use role in loop
include_role:
name: '{{ roleinputvar }}'
loop:
- '{{ roleinput1 }}'
- '{{ roleinput2 }}'
loop_control:
loop_var: roleinputvar
- name: Conditional role
include_role:
name: myrole
when: not idontwanttorun
- name: Apply tags to tasks within included file
include_role:
name: install
apply:
tags:
- install
tags:
- always
```
### Authors
* Ansible Core Team (@ansible)
ansible ansible.builtin.vars – Lookup templated value of variables ansible.builtin.vars – Lookup templated value of variables
==========================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `vars` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 2.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Retrieves the value of an Ansible variable. Note: Only returns top level variable names.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | The variable names to look up. |
| **default** string | | | What to return if a variable is undefined. If no default is set, it will result in an error if any of the variables is undefined. |
Examples
--------
```
- name: Show value of 'variablename'
debug: msg="{{ lookup('vars', 'variabl' + myvar) }}"
vars:
variablename: hello
myvar: ename
- name: Show default empty since i dont have 'variablnotename'
debug: msg="{{ lookup('vars', 'variabl' + myvar, default='')}}"
vars:
variablename: hello
myvar: notename
- name: Produce an error since i dont have 'variablnotename'
debug: msg="{{ lookup('vars', 'variabl' + myvar)}}"
ignore_errors: True
vars:
variablename: hello
myvar: notename
- name: find several related variables
debug: msg="{{ lookup('vars', 'ansible_play_hosts', 'ansible_play_batch', 'ansible_play_hosts_all') }}"
- name: Access nested variables
debug: msg="{{ lookup('vars', 'variabl' + myvar).sub_var }}"
ignore_errors: True
vars:
variablename:
sub_var: 12
myvar: ename
- name: alternate way to find some 'prefixed vars' in loop
debug: msg="{{ lookup('vars', 'ansible_play_' + item) }}"
loop:
- hosts
- batch
- hosts_all
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_value** list / elements=any | success | value of the variables requested. |
### Authors
* Ansible Core Team
ansible ansible.builtin.find – Return a list of files based on specific criteria ansible.builtin.find – Return a list of files based on specific criteria
========================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `find` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Return a list of files based on specific criteria. Multiple criteria are AND’d together.
* For Windows targets, use the [ansible.windows.win\_find](../windows/win_find_module#ansible-collections-ansible-windows-win-find-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **age** string | | Select files whose age is equal to or greater than the specified time. Use a negative age to find files equal to or less than the specified time. You can choose seconds, minutes, hours, days, or weeks by specifying the first letter of any of those words (e.g., "1w"). |
| **age\_stamp** string | **Choices:*** atime
* ctime
* **mtime** ←
| Choose the file property against which we compare age. |
| **contains** string | | A regular expression or pattern which should be matched against the file content. Works only when *file\_type* is `file`. |
| **depth** integer added in 2.6 of ansible.builtin | | Set the maximum number of levels to descend into. Setting recurse to `no` will override this value, which is effectively depth 1. Default is unlimited depth. |
| **excludes** list / elements=string added in 2.5 of ansible.builtin | | One or more (shell or regex) patterns, which type is controlled by `use_regex` option. Items whose basenames match an `excludes` pattern are culled from `patterns` matches. Multiple patterns can be specified using a list.
aliases: exclude |
| **file\_type** string | **Choices:*** any
* directory
* **file** ←
* link
| Type of file to select. The 'link' and 'any' choices were added in Ansible 2.3. |
| **follow** boolean | **Choices:*** **no** ←
* yes
| Set this to `yes` to follow symlinks in path for systems with python 2.6+. |
| **get\_checksum** boolean | **Choices:*** **no** ←
* yes
| Set this to `yes` to retrieve a file's SHA1 checksum. |
| **hidden** boolean | **Choices:*** **no** ←
* yes
| Set this to `yes` to include hidden files, otherwise they will be ignored. |
| **paths** list / elements=string / required | | List of paths of directories to search. All paths must be fully qualified.
aliases: name, path |
| **patterns** list / elements=string | **Default:**[] | One or more (shell or regex) patterns, which type is controlled by `use_regex` option. The patterns restrict the list of files to be returned to those whose basenames match at least one of the patterns specified. Multiple patterns can be specified using a list. The pattern is matched against the file base name, excluding the directory. When using regexen, the pattern MUST match the ENTIRE file name, not just parts of it. So if you are looking to match all files ending in .default, you'd need to use '.\*\.default' as a regexp and not just '\.default'. This parameter expects a list, which can be either comma separated or YAML. If any of the patterns contain a comma, make sure to put them in a list to avoid splitting the patterns in undesirable ways. Defaults to '\*' when `use_regex=False`, or '.\*' when `use_regex=True`.
aliases: pattern |
| **read\_whole\_file** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| When doing a `contains` search, determines whether the whole file should be read into memory or if the regex should be applied to the file line-by-line. Setting this to `true` can have performance and memory implications for large files. This uses `re.search(`) instead of `re.match(`). |
| **recurse** boolean | **Choices:*** **no** ←
* yes
| If target is a directory, recursively descend into the directory looking for files. |
| **size** string | | Select files whose size is equal to or greater than the specified size. Use a negative size to find files equal to or less than the specified size. Unqualified values are in bytes but b, k, m, g, and t can be appended to specify bytes, kilobytes, megabytes, gigabytes, and terabytes, respectively. Size is not evaluated for directories. |
| **use\_regex** boolean | **Choices:*** **no** ←
* yes
| If `no`, the patterns are file globs (shell). If `yes`, they are python regexes. |
See Also
--------
See also
[ansible.windows.win\_find](../windows/win_find_module#ansible-collections-ansible-windows-win-find-module)
The official documentation on the **ansible.windows.win\_find** module.
Examples
--------
```
- name: Recursively find /tmp files older than 2 days
find:
paths: /tmp
age: 2d
recurse: yes
- name: Recursively find /tmp files older than 4 weeks and equal or greater than 1 megabyte
find:
paths: /tmp
age: 4w
size: 1m
recurse: yes
- name: Recursively find /var/tmp files with last access time greater than 3600 seconds
find:
paths: /var/tmp
age: 3600
age_stamp: atime
recurse: yes
- name: Find /var/log files equal or greater than 10 megabytes ending with .old or .log.gz
find:
paths: /var/log
patterns: '*.old,*.log.gz'
size: 10m
# Note that YAML double quotes require escaping backslashes but yaml single quotes do not.
- name: Find /var/log files equal or greater than 10 megabytes ending with .old or .log.gz via regex
find:
paths: /var/log
patterns: "^.*?\\.(?:old|log\\.gz)$"
size: 10m
use_regex: yes
- name: Find /var/log all directories, exclude nginx and mysql
find:
paths: /var/log
recurse: no
file_type: directory
excludes: 'nginx,mysql'
# When using patterns that contain a comma, make sure they are formatted as lists to avoid splitting the pattern
- name: Use a single pattern that contains a comma formatted as a list
find:
paths: /var/log
file_type: file
use_regex: yes
patterns: ['^_[0-9]{2,4}_.*.log$']
- name: Use multiple patterns that contain a comma formatted as a YAML list
find:
paths: /var/log
file_type: file
use_regex: yes
patterns:
- '^_[0-9]{2,4}_.*.log$'
- '^[a-z]{1,5}_.*log$'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **examined** integer | success | Number of filesystem objects looked at **Sample:** 34 |
| **files** list / elements=string | success | All matches found with the specified criteria (see stat module for full output of each dictionary) **Sample:** [{'...': '...', 'checksum': '16fac7be61a6e4591a33ef4b729c5c3302307523', 'mode': '0644', 'path': '/var/tmp/test1'}, {'...': '...', 'path': '/var/tmp/test2'}] |
| **matched** integer | success | Number of matches **Sample:** 14 |
### Authors
* Brian Coca (@bcoca)
ansible ansible.builtin.replace – Replace all instances of a particular string in a file using a back-referenced regular expression ansible.builtin.replace – Replace all instances of a particular string in a file using a back-referenced regular expression
===========================================================================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `replace` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.6: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module will replace all instances of a pattern within a file.
* It is up to the user to maintain idempotence by ensuring that the same pattern would never match any replacements made.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **after** string added in 2.4 of ansible.builtin | | If specified, only content after this match will be replaced/removed. Can be used in combination with `before`. Uses Python regular expressions; see <http://docs.python.org/2/library/re.html>. Uses DOTALL, which means the `.` special character *can match newlines*. |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **before** string added in 2.4 of ansible.builtin | | If specified, only content before this match will be replaced/removed. Can be used in combination with `after`. Uses Python regular expressions; see <http://docs.python.org/2/library/re.html>. Uses DOTALL, which means the `.` special character *can match newlines*. |
| **encoding** string added in 2.4 of ansible.builtin | **Default:**"utf-8" | The character encoding for reading and writing the file. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **others** string | | All arguments accepted by the [ansible.builtin.file](file_module) module also work here. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **path** path / required | | The file to modify. Before Ansible 2.3 this option was only usable as *dest*, *destfile* and *name*.
aliases: dest, destfile, name |
| **regexp** string / required | | The regular expression to look for in the contents of the file. Uses Python regular expressions; see <http://docs.python.org/2/library/re.html>. Uses MULTILINE mode, which means `^` and `$` match the beginning and end of the file, as well as the beginning and end respectively of *each line* of the file. Does not use DOTALL, which means the `.` special character matches any character *except newlines*. A common mistake is to assume that a negated character set like `[^#]` will also not match newlines. In order to exclude newlines, they must be added to the set like `[^#\n]`. Note that, as of Ansible 2.0, short form tasks should have any escape sequences backslash-escaped in order to prevent them being parsed as string literal escapes. See the examples. |
| **replace** string | | The string to replace regexp matches. May contain backreferences that will get expanded with the regexp capture groups if the regexp matches. If not set, matches are removed entirely. Backreferences can be used ambiguously like `\1`, or explicitly like `\g<1>`. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **validate** string | | The validation command to run before copying into place. The path to the file to validate is passed in via '%s' which must be present as in the examples below. The command is passed securely so shell features like expansion and pipes will not work. |
Notes
-----
Note
* As of Ansible 2.3, the *dest* option has been changed to *path* as default, but *dest* still works as well.
* As of Ansible 2.7.10, the combined use of *before* and *after* works properly. If you were relying on the previous incorrect behavior, you may be need to adjust your tasks. See <https://github.com/ansible/ansible/issues/31354> for details.
* Option *follow* has been removed in Ansible 2.5, because this module modifies the contents of the file so *follow=no* doesn’t make sense.
* Supports `check_mode`.
Examples
--------
```
- name: Before Ansible 2.3, option 'dest', 'destfile' or 'name' was used instead of 'path'
ansible.builtin.replace:
path: /etc/hosts
regexp: '(\s+)old\.host\.name(\s+.*)?$'
replace: '\1new.host.name\2'
- name: Replace after the expression till the end of the file (requires Ansible >= 2.4)
ansible.builtin.replace:
path: /etc/apache2/sites-available/default.conf
after: 'NameVirtualHost [*]'
regexp: '^(.+)$'
replace: '# \1'
- name: Replace before the expression till the begin of the file (requires Ansible >= 2.4)
ansible.builtin.replace:
path: /etc/apache2/sites-available/default.conf
before: '# live site config'
regexp: '^(.+)$'
replace: '# \1'
# Prior to Ansible 2.7.10, using before and after in combination did the opposite of what was intended.
# see https://github.com/ansible/ansible/issues/31354 for details.
- name: Replace between the expressions (requires Ansible >= 2.4)
ansible.builtin.replace:
path: /etc/hosts
after: '<VirtualHost [*]>'
before: '</VirtualHost>'
regexp: '^(.+)$'
replace: '# \1'
- name: Supports common file attributes
ansible.builtin.replace:
path: /home/jdoe/.ssh/known_hosts
regexp: '^old\.host\.name[^\n]*\n'
owner: jdoe
group: jdoe
mode: '0644'
- name: Supports a validate command
ansible.builtin.replace:
path: /etc/apache/ports
regexp: '^(NameVirtualHost|Listen)\s+80\s*$'
replace: '\1 127.0.0.1:8080'
validate: '/usr/sbin/apache2ctl -f %s -t'
- name: Short form task (in ansible 2+) necessitates backslash-escaped sequences
ansible.builtin.replace: path=/etc/hosts regexp='\\b(localhost)(\\d*)\\b' replace='\\1\\2.localdomain\\2 \\1\\2'
- name: Long form task does not
ansible.builtin.replace:
path: /etc/hosts
regexp: '\b(localhost)(\d*)\b'
replace: '\1\2.localdomain\2 \1\2'
- name: Explicitly specifying positional matched groups in replacement
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: '^(ListenAddress[ ]+)[^\n]+$'
replace: '\g<1>0.0.0.0'
- name: Explicitly specifying named matched groups
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: '^(?P<dctv>ListenAddress[ ]+)(?P<host>[^\n]+)$'
replace: '#\g<dctv>\g<host>\n\g<dctv>0.0.0.0'
```
### Authors
* Evan Kaufman (@EvanK)
| programming_docs |
ansible ansible.builtin.command – Execute commands on targets ansible.builtin.command – Execute commands on targets
=====================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `command` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The `command` module takes the command name followed by a list of space-delimited arguments.
* The given command will be executed on all selected nodes.
* The command(s) will not be processed through the shell, so variables like `$HOSTNAME` and operations like `"*"`, `"<"`, `">"`, `"|"`, `";"` and `"&"` will not work. Use the [ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module) module if you need these features.
* To create `command` tasks that are easier to read than the ones using space-delimited arguments, pass parameters using the `args` [task keyword](../reference_appendices/playbooks_keywords#task) or use `cmd` parameter.
* Either a free form command or `cmd` parameter is required, see the examples.
* For Windows targets, use the [ansible.windows.win\_command](../windows/win_command_module#ansible-collections-ansible-windows-win-command-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **argv** list / elements=string added in 2.6 of ansible.builtin | | Passes the command as a list rather than a string. Use `argv` to avoid quoting values that would otherwise be interpreted incorrectly (for example "user name"). Only the string (free form) or the list (argv) form can be provided, not both. One or the other must be provided. |
| **chdir** path added in 0.6 of ansible.builtin | | Change into this directory before running the command. |
| **cmd** string | | The command to run. |
| **creates** path | | A filename or (since 2.0) glob pattern. If a matching file already exists, this step **will not** be run. This is checked before *removes* is checked. |
| **free\_form** string | | The command module takes a free form string as a command to run. There is no actual parameter named 'free form'. |
| **removes** path added in 0.8 of ansible.builtin | | A filename or (since 2.0) glob pattern. If a matching file exists, this step **will** be run. This is checked after *creates* is checked. |
| **stdin** string added in 2.4 of ansible.builtin | | Set the stdin of the command directly to the specified value. |
| **stdin\_add\_newline** boolean added in 2.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| If set to `yes`, append a newline to stdin data. |
| **strip\_empty\_ends** boolean added in 2.8 of ansible.builtin | **Choices:*** no
* **yes** ←
| Strip empty lines from the end of stdout/stderr in result. |
| **warn** boolean added in 1.8 of ansible.builtin | **Choices:*** **no** ←
* yes
| (deprecated) Enable or disable task warnings. This feature is deprecated and will be removed in 2.14. As of version 2.11, this option is now disabled by default. |
Notes
-----
Note
* If you want to run a command through the shell (say you are using `<`, `>`, `|`, and so on), you actually want the [ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module) module instead. Parsing shell metacharacters can lead to unexpected commands being executed if quoting is not done correctly so it is more secure to use the `command` module when possible.
* `creates`, `removes`, and `chdir` can be specified after the command. For instance, if you only want to run a command if a certain file does not exist, use this.
* Check mode is supported when passing `creates` or `removes`. If running in check mode and either of these are specified, the module will check for the existence of the file and report the correct changed status. If these are not supplied, the task will be skipped.
* The `executable` parameter is removed since version 2.4. If you have a need for this parameter, use the [ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module) module instead.
* For Windows targets, use the [ansible.windows.win\_command](../windows/win_command_module#ansible-collections-ansible-windows-win-command-module) module instead.
* For rebooting systems, use the [ansible.builtin.reboot](reboot_module#ansible-collections-ansible-builtin-reboot-module) or [ansible.windows.win\_reboot](../windows/win_reboot_module#ansible-collections-ansible-windows-win-reboot-module) module.
See Also
--------
See also
[ansible.builtin.raw](raw_module#ansible-collections-ansible-builtin-raw-module)
The official documentation on the **ansible.builtin.raw** module.
[ansible.builtin.script](script_module#ansible-collections-ansible-builtin-script-module)
The official documentation on the **ansible.builtin.script** module.
[ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module)
The official documentation on the **ansible.builtin.shell** module.
[ansible.windows.win\_command](../windows/win_command_module#ansible-collections-ansible-windows-win-command-module)
The official documentation on the **ansible.windows.win\_command** module.
Examples
--------
```
- name: Return motd to registered var
ansible.builtin.command: cat /etc/motd
register: mymotd
# free-form (string) arguments, all arguments on one line
- name: Run command if /path/to/database does not exist (without 'args')
ansible.builtin.command: /usr/bin/make_database.sh db_user db_name creates=/path/to/database
# free-form (string) arguments, some arguments on separate lines with the 'args' keyword
# 'args' is a task keyword, passed at the same level as the module
- name: Run command if /path/to/database does not exist (with 'args' keyword)
ansible.builtin.command: /usr/bin/make_database.sh db_user db_name
args:
creates: /path/to/database
# 'cmd' is module parameter
- name: Run command if /path/to/database does not exist (with 'cmd' parameter)
ansible.builtin.command:
cmd: /usr/bin/make_database.sh db_user db_name
creates: /path/to/database
- name: Change the working directory to somedir/ and run the command as db_owner if /path/to/database does not exist
ansible.builtin.command: /usr/bin/make_database.sh db_user db_name
become: yes
become_user: db_owner
args:
chdir: somedir/
creates: /path/to/database
# argv (list) arguments, each argument on a separate line, 'args' keyword not necessary
# 'argv' is a parameter, indented one level from the module
- name: Use 'argv' to send a command as a list - leave 'command' empty
ansible.builtin.command:
argv:
- /usr/bin/make_database.sh
- Username with whitespace
- dbname with whitespace
creates: /path/to/database
- name: Safely use templated variable to run command. Always use the quote filter to avoid injection issues
ansible.builtin.command: cat {{ myfile|quote }}
register: myoutput
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cmd** list / elements=string | always | The command executed by the task. **Sample:** ['echo', 'hello'] |
| **delta** string | always | The command execution delta time. **Sample:** 0:00:00.001529 |
| **end** string | always | The command execution end time. **Sample:** 2017-09-29 22:03:48.084657 |
| **msg** boolean | always | changed **Sample:** True |
| **rc** integer | always | The command return code (0 means success). |
| **start** string | always | The command execution start time. **Sample:** 2017-09-29 22:03:48.083128 |
| **stderr** string | always | The command standard error. **Sample:** ls cannot access foo: No such file or directory |
| **stderr\_lines** list / elements=string | always | The command standard error split in lines. **Sample:** [{"u'ls cannot access foo": "No such file or directory'"}, "u'ls …'"] |
| **stdout** string | always | The command standard output. **Sample:** Clustering node rabbit@slave1 with rabbit@master … |
| **stdout\_lines** list / elements=string | always | The command standard output split in lines. **Sample:** ["u'Clustering node rabbit@slave1 with rabbit@master …'"] |
### Authors
* Ansible Core Team
* Michael DeHaan
ansible ansible.builtin.env – Read the value of environment variables ansible.builtin.env – Read the value of environment variables
=============================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `env` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allows you to query the environment variables available on the controller when you invoked Ansible.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | Environment variable or list of them to lookup the values for. |
Notes
-----
Note
* The module returns an empty string if the environment variable is not defined. This makes it impossbile to differentiate between the case the variable is not defined and the case the variable is defined but it contains an empty string.
* The `default` filter requires second parameter to be set to `True` in order to set a default value in the case the variable is not defined (see examples).
Examples
--------
```
- name: Basic usage
debug:
msg: "'{{ lookup('env', 'HOME') }}' is the HOME environment variable."
- name: Example how to set default value if the variable is not defined
debug:
msg: "'{{ lookup('env', 'USR') | default('nobody', True) }}' is the user."
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=string | success | Values from the environment variables. |
### Authors
* Jan-Piet Mens (@jpmens) <jpmens(at)gmail.com>
ansible ansible.builtin.service_facts – Return service state information as fact data ansible.builtin.service\_facts – Return service state information as fact data
==============================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `service_facts` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Notes](#notes)
* [Examples](#examples)
* [Returned Facts](#returned-facts)
Synopsis
--------
* Return service state information as fact data for various service management utilities.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Any of the following supported init systems: systemd, sysv, upstart, AIX SRC
Notes
-----
Note
* When accessing the `ansible_facts.services` facts collected by this module, it is recommended to not use “dot notation” because services can have a `-` character in their name which would result in invalid “dot notation”, such as `ansible_facts.services.zuul-gateway`. It is instead recommended to using the string value of the service name as the key in order to obtain the fact data value like `ansible_facts.services['zuul-gateway']`
* AIX SRC was added in version 2.11.
* Supports `check_mode`.
Examples
--------
```
- name: Populate service facts
ansible.builtin.service_facts:
- name: Print service facts
ansible.builtin.debug:
var: ansible_facts.services
```
Returned Facts
--------------
Facts returned by this module are added/updated in the `hostvars` host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
| Fact | Returned | Description |
| --- | --- | --- |
| **services** complex / elements=string | always | States of the services with service name as key. |
| | **name** string / elements=string | always | Name of the service. **Sample:** arp-ethers.service |
| | **source** string / elements=string | always | Init system of the service. One of `rcctl`, `systemd`, `sysv`, `upstart`, `src`. **Sample:** sysv |
| | **state** string / elements=string | always | State of the service. Either `failed`, `running`, `stopped`, or `unknown`. **Sample:** running |
| | **status** string / elements=string | systemd systems or RedHat/SUSE flavored sysvinit/upstart or OpenBSD | State of the service. Either `enabled`, `disabled`, `static`, `indirect` or `unknown`. **Sample:** enabled |
### Authors
* Adam Miller (@maxamillion)
ansible ansible.builtin.default – default Ansible screen output ansible.builtin.default – default Ansible screen output
=======================================================
Note
This callback plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `default` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same callback plugin name.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
Synopsis
--------
* This is the default output callback for ansible-playbook.
Requirements
------------
The below requirements are needed on the local controller node that executes this callback.
* set as stdout in configuration
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **check\_mode\_markers** boolean added in 2.9 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [defaults]check\_mode\_markers = no env:ANSIBLE\_CHECK\_MODE\_MARKERS | Toggle to control displaying markers when running in check mode. The markers are `DRY RUN` at the beggining and ending of playbook execution (when calling `ansible-playbook --check`) and `CHECK MODE` as a suffix at every play and task that is run in check mode. |
| **display\_failed\_stderr** boolean added in 2.7 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [defaults]display\_failed\_stderr = no env:ANSIBLE\_DISPLAY\_FAILED\_STDERR | Toggle to control whether failed and unreachable tasks are displayed to STDERR (vs. STDOUT) |
| **display\_ok\_hosts** boolean added in 2.7 of ansible.builtin | **Choices:*** no
* **yes** ←
| ini entries: [defaults]display\_ok\_hosts = yes env:ANSIBLE\_DISPLAY\_OK\_HOSTS | Toggle to control displaying 'ok' task/host results in a task |
| **display\_skipped\_hosts** boolean | **Choices:*** no
* **yes** ←
| ini entries: [defaults]display\_skipped\_hosts = yes env:DISPLAY\_SKIPPED\_HOSTS Removed in: version 2.12 Why: environment variables without "ANSIBLE\_" prefix are deprecated Alternative: the "ANSIBLE\_DISPLAY\_SKIPPED\_HOSTS" environment variable env:ANSIBLE\_DISPLAY\_SKIPPED\_HOSTS | Toggle to control displaying skipped task/host results in a task |
| **show\_custom\_stats** boolean | **Choices:*** **no** ←
* yes
| ini entries: [defaults]show\_custom\_stats = no env:ANSIBLE\_SHOW\_CUSTOM\_STATS | This adds the custom stats set via the set\_stats plugin to the play recap |
| **show\_per\_host\_start** boolean added in 2.9 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [defaults]show\_per\_host\_start = no env:ANSIBLE\_SHOW\_PER\_HOST\_START | This adds output that shows when a task is started to execute for each host |
| **show\_task\_path\_on\_failure** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [defaults]show\_task\_path\_on\_failure = no env:ANSIBLE\_SHOW\_TASK\_PATH\_ON\_FAILURE | When a task fails, display the path to the file containing the failed task and the line number. This information is displayed automatically for every task when running with `-vv` or greater verbosity. |
ansible ansible.builtin.dpkg_selections – Dpkg package selection selections ansible.builtin.dpkg\_selections – Dpkg package selection selections
====================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `dpkg_selections` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Change dpkg package selection state via –get-selections and –set-selections.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name of the package. |
| **selection** string / required | **Choices:*** install
* hold
* deinstall
* purge
| The selection state to set the package to. |
Notes
-----
Note
* This module won’t cause any packages to be installed/removed/purged, use the `apt` module for that.
Examples
--------
```
- name: Prevent python from being upgraded
dpkg_selections:
name: python
selection: hold
```
### Authors
* Brian Brazil (@brian-brazil) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#80e2f2e9e1eea6a3b4b6bbe2f2e1fae9eca6a3b3b7bba6a3b5b2bba6a3b4b8bbe2eff8e5f6e5f2a6a3b4b6bbe3efed)>
ansible ansible.builtin.known_hosts – Add or remove a host from the known_hosts file ansible.builtin.known\_hosts – Add or remove a host from the known\_hosts file
==============================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `known_hosts` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* The `known_hosts` module lets you add or remove a host keys from the `known_hosts` file.
* Starting at Ansible 2.2, multiple entries per host are allowed, but only one for each key type supported by ssh. This is useful if you’re going to want to use the [ansible.builtin.git](git_module#ansible-collections-ansible-builtin-git-module) module over ssh, for example.
* If you have a very large number of host keys to manage, you will find the [ansible.builtin.template](template_module#ansible-collections-ansible-builtin-template-module) module more useful.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **hash\_host** boolean added in 2.3 of ansible.builtin | **Choices:*** **no** ←
* yes
| Hash the hostname in the known\_hosts file. |
| **key** string | | The SSH public host key, as a string. Required if `state=present`, optional when `state=absent`, in which case all keys for the host are removed. The key must be in the right format for SSH (see sshd(8), section "SSH\_KNOWN\_HOSTS FILE FORMAT"). Specifically, the key should not match the format that is found in an SSH pubkey file, but should rather have the hostname prepended to a line that includes the pubkey, the same way that it would appear in the known\_hosts file. The value prepended to the line must also match the value of the name parameter. Should be of format `<hostname[,IP]> ssh-rsa <pubkey>`. For custom SSH port, `key` needs to specify port as well. See example section. |
| **name** string / required | | The host to add or remove (must match a host specified in key). It will be converted to lowercase so that ssh-keygen can find it. Must match with <hostname> or <ip> present in key attribute. For custom SSH port, `name` needs to specify port as well. See example section.
aliases: host |
| **path** path | **Default:**"~/.ssh/known\_hosts" | The known\_hosts file to edit. |
| **state** string | **Choices:*** absent
* **present** ←
|
*present* to add the host key.
*absent* to remove it. |
Examples
--------
```
- name: Tell the host about our servers it might want to ssh to
known_hosts:
path: /etc/ssh/ssh_known_hosts
name: foo.com.invalid
key: "{{ lookup('file', 'pubkeys/foo.com.invalid') }}"
- name: Another way to call known_hosts
known_hosts:
name: host1.example.com # or 10.9.8.77
key: host1.example.com,10.9.8.77 ssh-rsa ASDeararAIUHI324324 # some key gibberish
path: /etc/ssh/ssh_known_hosts
state: present
- name: Add host with custom SSH port
known_hosts:
name: '[host1.example.com]:2222'
key: '[host1.example.com]:2222 ssh-rsa ASDeararAIUHI324324' # some key gibberish
path: /etc/ssh/ssh_known_hosts
state: present
```
### Authors
* Matthew Vernon (@mcv21)
| programming_docs |
ansible ansible.builtin.subversion – Deploys a subversion repository ansible.builtin.subversion – Deploys a subversion repository
============================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `subversion` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.7: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Deploy given repository URL / revision to dest. If dest exists, update to the specified revision, otherwise perform a checkout.
Requirements
------------
The below requirements are needed on the host that executes this module.
* subversion (the command line tool with `svn` entrypoint)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **checkout** boolean added in 2.3 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, do not check out the repository if it does not exist locally. |
| **dest** path | | Absolute path where the repository should be deployed. The destination directory must be specified unless *checkout=no*, *update=no*, and *export=no*. |
| **executable** path added in 1.4 of ansible.builtin | | Path to svn executable to use. If not supplied, the normal mechanism for resolving binary paths will be used. |
| **export** boolean added in 1.6 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `yes`, do export instead of checkout/update. |
| **force** boolean | **Choices:*** **no** ←
* yes
| If `yes`, modified files will be discarded. If `no`, module will fail if it encounters modified files. Prior to 1.9 the default was `yes`. |
| **in\_place** boolean added in 2.6 of ansible.builtin | **Choices:*** **no** ←
* yes
| If the directory exists, then the working copy will be checked-out over-the-top using svn checkout --force; if force is specified then existing files with different content are reverted. |
| **password** string | |
`--password` parameter passed to svn when svn is less than version 1.10.0. This is not secure and the password will be leaked to argv.
`--password-from-stdin` parameter when svn is greater or equal to version 1.10.0. |
| **repo** string / required | | The subversion URL to the repository.
aliases: name, repository |
| **revision** string | **Default:**"HEAD" | Specific revision to checkout.
aliases: rev, version |
| **switch** boolean added in 2.0 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, do not call svn switch before update. |
| **update** boolean added in 2.3 of ansible.builtin | **Choices:*** no
* **yes** ←
| If `no`, do not retrieve new revisions from the origin repository. |
| **username** string | |
`--username` parameter passed to svn. |
| **validate\_certs** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| If `no`, passes the `--trust-server-cert` flag to svn. If `yes`, does not pass the flag. |
Notes
-----
Note
* This module does not handle externals.
* Supports `check_mode`.
Examples
--------
```
- name: Checkout subversion repository to specified folder
ansible.builtin.subversion:
repo: svn+ssh://an.example.org/path/to/repo
dest: /src/checkout
- name: Export subversion directory to folder
ansible.builtin.subversion:
repo: svn+ssh://an.example.org/path/to/repo
dest: /src/export
export: yes
- name: Get information about the repository whether or not it has already been cloned locally
ansible.builtin.subversion:
repo: svn+ssh://an.example.org/path/to/repo
dest: /src/checkout
checkout: no
update: no
```
### Authors
* Dane Summers (@dsummersl) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#1c7276747d6e717d723a3f2f2b273a3f292e273a3f2824277b717d75703a3f282a277f7371)>
ansible ansible.builtin.template – Template a file out to a target host ansible.builtin.template – Template a file out to a target host
===============================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `template` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Templates are processed by the [Jinja2 templating language](http://jinja.pocoo.org/docs/).
* Documentation on the template formatting can be found in the [Template Designer Documentation](http://jinja.pocoo.org/docs/templates/).
* Additional variables listed below can be used in templates.
* `ansible_managed` (configurable via the `defaults` section of `ansible.cfg`) contains a string which can be used to describe the template name, host, modification time of the template file and the owner uid.
* `template_host` contains the node name of the template’s machine.
* `template_uid` is the numeric user id of the owner.
* `template_path` is the path of the template.
* `template_fullpath` is the absolute path of the template.
* `template_destpath` is the path of the template on the remote system (added in 2.8).
* `template_run_date` is the date that the template was rendered.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **block\_end\_string** string added in 2.4 of ansible.builtin | **Default:**"%}" | The string marking the end of a block. |
| **block\_start\_string** string added in 2.4 of ansible.builtin | **Default:**"{%" | The string marking the beginning of a block. |
| **dest** path / required | | Location to render the template to on the remote machine. |
| **follow** boolean added in 2.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| Determine whether symbolic links should be followed. When set to `yes` symbolic links will be followed, if they exist. When set to `no` symbolic links will not be followed. Previous to Ansible 2.4, this was hardcoded as `yes`. |
| **force** boolean | **Choices:*** no
* **yes** ←
| Determine when the file is being transferred if the destination already exists. When set to `yes`, replace the remote file when contents are different than the source. When set to `no`, the file will only be transferred if the destination does not exist. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **lstrip\_blocks** boolean added in 2.6 of ansible.builtin | **Choices:*** **no** ←
* yes
| Determine when leading spaces and tabs should be stripped. When set to `yes` leading spaces and tabs are stripped from the start of a line to a block. This functionality requires Jinja 2.7 or newer. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **newline\_sequence** string added in 2.4 of ansible.builtin | **Choices:*** **\n** ←
* \r
* \r\n
| Specify the newline sequence to use for templating files. |
| **output\_encoding** string added in 2.7 of ansible.builtin | **Default:**"utf-8" | Overrides the encoding used to write the template file defined by `dest`. It defaults to `utf-8`, but any encoding supported by python can be used. The source template file must always be encoded using `utf-8`, for homogeneity. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **src** path / required | | Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or an absolute path. The file must be encoded with `utf-8` but *output\_encoding* can be used to control the encoding of the output template. |
| **trim\_blocks** boolean added in 2.4 of ansible.builtin | **Choices:*** no
* **yes** ←
| Determine when newlines should be removed from blocks. When set to `yes` the first newline after a block is removed (block, not variable tag!). |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| **validate** string | | The validation command to run before copying into place. The path to the file to validate is passed in via '%s' which must be present as in the examples below. The command is passed securely so shell features like expansion and pipes will not work. |
| **variable\_end\_string** string added in 2.4 of ansible.builtin | **Default:**"}}" | The string marking the end of a print statement. |
| **variable\_start\_string** string added in 2.4 of ansible.builtin | **Default:**"{{" | The string marking the beginning of a print statement. |
Notes
-----
Note
* For Windows you can use [ansible.windows.win\_template](../windows/win_template_module#ansible-collections-ansible-windows-win-template-module) which uses ‘\r\n’ as `newline_sequence` by default.
* Including a string that uses a date in the template will result in the template being marked ‘changed’ each time.
* Since Ansible 0.9, templates are loaded with `trim_blocks=True`.
* Also, you can override jinja2 settings by adding a special header to template file. i.e. `#jinja2:variable_start_string:'[%', variable_end_string:'%]', trim_blocks: False` which changes the variable interpolation markers to `[% var %]` instead of `{{ var }}`. This is the best way to prevent evaluation of things that look like, but should not be Jinja2.
* Using raw/endraw in Jinja2 will not work as you expect because templates in Ansible are recursively evaluated.
* To find Byte Order Marks in files, use `Format-Hex <file> -Count 16` on Windows, and use `od -a -t x1 -N 16 <file>` on Linux.
See Also
--------
See also
[ansible.builtin.copy](copy_module#ansible-collections-ansible-builtin-copy-module)
The official documentation on the **ansible.builtin.copy** module.
[ansible.windows.win\_copy](../windows/win_copy_module#ansible-collections-ansible-windows-win-copy-module)
The official documentation on the **ansible.windows.win\_copy** module.
[ansible.windows.win\_template](../windows/win_template_module#ansible-collections-ansible-windows-win-template-module)
The official documentation on the **ansible.windows.win\_template** module.
Examples
--------
```
- name: Template a file to /etc/file.conf
ansible.builtin.template:
src: /mytemplates/foo.j2
dest: /etc/file.conf
owner: bin
group: wheel
mode: '0644'
- name: Template a file, using symbolic modes (equivalent to 0644)
ansible.builtin.template:
src: /mytemplates/foo.j2
dest: /etc/file.conf
owner: bin
group: wheel
mode: u=rw,g=r,o=r
- name: Copy a version of named.conf that is dependent on the OS. setype obtained by doing ls -Z /etc/named.conf on original file
ansible.builtin.template:
src: named.conf_{{ ansible_os_family }}.j2
dest: /etc/named.conf
group: named
setype: named_conf_t
mode: 0640
- name: Create a DOS-style text file from a template
ansible.builtin.template:
src: config.ini.j2
dest: /share/windows/config.ini
newline_sequence: '\r\n'
- name: Copy a new sudoers file into place, after passing validation with visudo
ansible.builtin.template:
src: /mine/sudoers
dest: /etc/sudoers
validate: /usr/sbin/visudo -cf %s
- name: Update sshd configuration safely, avoid locking yourself out
ansible.builtin.template:
src: etc/ssh/sshd_config.j2
dest: /etc/ssh/sshd_config
owner: root
group: root
mode: '0600'
validate: /usr/sbin/sshd -t -f %s
backup: yes
```
### Authors
* Ansible Core Team
* Michael DeHaan
ansible ansible.builtin.import_playbook – Import a playbook ansible.builtin.import\_playbook – Import a playbook
====================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `import_playbook` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Includes a file with a list of plays to be executed.
* Files with a list of plays can only be included at the top level.
* You cannot use this action inside a play.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **free-form** string | | The name of the imported playbook is specified directly without any other option. |
Notes
-----
Note
* This is a core feature of Ansible, rather than a module, and cannot be overridden like a module.
See Also
--------
See also
[ansible.builtin.import\_role](import_role_module#ansible-collections-ansible-builtin-import-role-module)
The official documentation on the **ansible.builtin.import\_role** module.
[ansible.builtin.import\_tasks](import_tasks_module#ansible-collections-ansible-builtin-import-tasks-module)
The official documentation on the **ansible.builtin.import\_tasks** module.
[ansible.builtin.include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module)
The official documentation on the **ansible.builtin.include\_role** module.
[ansible.builtin.include\_tasks](include_tasks_module#ansible-collections-ansible-builtin-include-tasks-module)
The official documentation on the **ansible.builtin.include\_tasks** module.
[Including and importing](../../../user_guide/playbooks_reuse_includes#playbooks-reuse-includes)
More information related to including and importing playbooks, roles and tasks.
Examples
--------
```
- hosts: localhost
tasks:
- debug:
msg: play1
- name: Include a play after another play
import_playbook: otherplays.yaml
- name: Set variables on an imported playbook
import_playbook: otherplays.yml
vars:
service: httpd
- name: This DOES NOT WORK
hosts: all
tasks:
- debug:
msg: task1
- name: This fails because I'm inside a play already
import_playbook: stuff.yaml
```
### Authors
* Ansible Core Team (@ansible)
ansible ansible.builtin.first_found – return first file found from list ansible.builtin.first\_found – return first file found from list
================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `first_found` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This lookup checks a list of files and paths and returns the full path to the first combination found.
* As all lookups, when fed relative paths it will try use the current task’s location first and go up the chain to the containing locations of role / play / include and so on.
* The list of files has precedence over the paths searched. For example, A task in a role has a ‘file1’ in the play’s relative path, this will be used, ‘file2’ in role’s relative path will not.
* Either a list of files `_terms` or a key `files` with a list of files is required for this plugin to operate.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string | | | A list of file names. |
| **files** list / elements=string | **Default:**[] | | A list of file names. |
| **paths** list / elements=string | **Default:**[] | | A list of paths in which to look for the files. |
| **skip** boolean | **Choices:*** **no** ←
* yes
| | Return an empty list if no file is found, instead of an error. |
Notes
-----
Note
* This lookup can be used in ‘dual mode’, either passing a list of file names or a dictionary that has `files` and `paths`.
Examples
--------
```
- name: show first existing file or ignore if none do
debug:
msg: "{{ lookup('first_found', findme, errors='ignore') }}"
vars:
findme:
- /path/to/foo.txt
- bar.txt # will be looked in files/ dir relative to role and/or play
- /path/to/biz.txt
- name: include tasks only if files exist.
include_tasks:
file: "{{ query('first_found', params) }}"
vars:
params:
files:
- path/tasks.yaml
- path/other_tasks.yaml
- name: |
copy first existing file found to /some/file,
looking in relative directories from where the task is defined and
including any play objects that contain it
copy:
src: "{{ lookup('first_found', findme) }}"
dest: /some/file
vars:
findme:
- foo
- "{{ inventory_hostname }}"
- bar
- name: same copy but specific paths
copy:
src: "{{ lookup('first_found', params) }}"
dest: /some/file
vars:
params:
files:
- foo
- "{{ inventory_hostname }}"
- bar
paths:
- /tmp/production
- /tmp/staging
- name: INTERFACES | Create Ansible header for /etc/network/interfaces
template:
src: "{{ lookup('first_found', findme) }}"
dest: "/etc/foo.conf"
vars:
findme:
- "{{ ansible_virtualization_type }}_foo.conf"
- "default_foo.conf"
- name: read vars from first file found, use 'vars/' relative subdir
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- default.yml
paths:
- 'vars'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=path | success | path to file found |
### Authors
* Seth Vidal (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#55263e233c313439737666626e737660676e7376616d6e3330313a273425273a3f303621737661636e3a2732)>
| programming_docs |
ansible ansible.builtin.user – Manage user accounts ansible.builtin.user – Manage user accounts
===========================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `user` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage user accounts and user attributes.
* For Windows targets, use the [ansible.windows.win\_user](../windows/win_user_module#ansible-collections-ansible-windows-win-user-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **append** boolean | **Choices:*** **no** ←
* yes
| If `yes`, add the user to the groups specified in `groups`. If `no`, user will only be added to the groups specified in `groups`, removing them from all other groups. |
| **authorization** string added in 2.8 of ansible.builtin | | Sets the authorization of the user. Does nothing when used with other platforms. Can set multiple authorizations using comma separation. To delete all authorizations, use `authorization=''`. Currently supported on Illumos/Solaris. |
| **comment** string | | Optionally sets the description (aka *GECOS*) of user account. |
| **create\_home** boolean | **Choices:*** no
* **yes** ←
| Unless set to `no`, a home directory will be made for the user when the account is created or if the home directory does not exist. Changed from `createhome` to `create_home` in Ansible 2.5.
aliases: createhome |
| **expires** float added in 1.9 of ansible.builtin | | An expiry time for the user in epoch, it will be ignored on platforms that do not support this. Currently supported on GNU/Linux, FreeBSD, and DragonFlyBSD. Since Ansible 2.6 you can remove the expiry time by specifying a negative value. Currently supported on GNU/Linux and FreeBSD. |
| **force** boolean | **Choices:*** **no** ←
* yes
| This only affects `state=absent`, it forces removal of the user and associated directories on supported platforms. The behavior is the same as `userdel --force`, check the man page for `userdel` on your system for details and support. When used with `generate_ssh_key=yes` this forces an existing key to be overwritten. |
| **generate\_ssh\_key** boolean added in 0.9 of ansible.builtin | **Choices:*** **no** ←
* yes
| Whether to generate a SSH key for the user in question. This will **not** overwrite an existing SSH key unless used with `force=yes`. |
| **group** string | | Optionally sets the user's primary group (takes a group name). |
| **groups** list / elements=string | | List of groups user will be added to. When set to an empty string `''`, the user is removed from all groups except the primary group. Before Ansible 2.3, the only input format allowed was a comma separated string. |
| **hidden** boolean added in 2.6 of ansible.builtin | **Choices:*** no
* yes
| macOS only, optionally hide the user from the login window and system preferences. The default will be `yes` if the *system* option is used. |
| **home** path | | Optionally set the user's home directory. |
| **local** boolean added in 2.4 of ansible.builtin | **Choices:*** **no** ←
* yes
| Forces the use of "local" command alternatives on platforms that implement it. This is useful in environments that use centralized authentication when you want to manipulate the local users (in other words, it uses `luseradd` instead of `useradd`). This will check `/etc/passwd` for an existing account before invoking commands. If the local account database exists somewhere other than `/etc/passwd`, this setting will not work properly. This requires that the above commands as well as `/etc/passwd` must exist on the target host, otherwise it will be a fatal error. |
| **login\_class** string | | Optionally sets the user's login class, a feature of most BSD OSs. |
| **move\_home** boolean | **Choices:*** **no** ←
* yes
| If set to `yes` when used with `home:` , attempt to move the user's old home directory to the specified directory if it isn't there already and the old home exists. |
| **name** string / required | | Name of the user to create, remove or modify.
aliases: user |
| **non\_unique** boolean added in 1.1 of ansible.builtin | **Choices:*** **no** ←
* yes
| Optionally when used with the -u option, this option allows to change the user ID to a non-unique value. |
| **password** string | | Optionally set the user's password to this crypted value. On macOS systems, this value has to be cleartext. Beware of security issues. To create a disabled account on Linux systems, set this to `'!'` or `'*'`. To create a disabled account on OpenBSD, set this to `'*************'`. See [FAQ entry](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) for details on various ways to generate these password values. |
| **password\_expire\_max** integer added in 2.11 of ansible.builtin | | Maximum number of days between password change. Supported on Linux only. |
| **password\_expire\_min** integer added in 2.11 of ansible.builtin | | Minimum number of days between password change. Supported on Linux only. |
| **password\_lock** boolean added in 2.6 of ansible.builtin | **Choices:*** no
* yes
| Lock the password (`usermod -L`, `usermod -U`, `pw lock`). Implementation differs by platform. This option does not always mean the user cannot login using other methods. This option does not disable the user, only lock the password. This must be set to `False` in order to unlock a currently locked password. The absence of this parameter will not unlock a password. Currently supported on Linux, FreeBSD, DragonFlyBSD, NetBSD, OpenBSD. |
| **profile** string added in 2.8 of ansible.builtin | | Sets the profile of the user. Does nothing when used with other platforms. Can set multiple profiles using comma separation. To delete all the profiles, use `profile=''`. Currently supported on Illumos/Solaris. |
| **remove** boolean | **Choices:*** **no** ←
* yes
| This only affects `state=absent`, it attempts to remove directories associated with the user. The behavior is the same as `userdel --remove`, check the man page for details and support. |
| **role** string added in 2.8 of ansible.builtin | | Sets the role of the user. Does nothing when used with other platforms. Can set multiple roles using comma separation. To delete all roles, use `role=''`. Currently supported on Illumos/Solaris. |
| **seuser** string added in 2.1 of ansible.builtin | | Optionally sets the seuser type (user\_u) on selinux enabled systems. |
| **shell** string | | Optionally set the user's shell. On macOS, before Ansible 2.5, the default shell for non-system users was `/usr/bin/false`. Since Ansible 2.5, the default shell for non-system users on macOS is `/bin/bash`. See notes for details on how other operating systems determine the default shell by the underlying tool. |
| **skeleton** string added in 2.0 of ansible.builtin | | Optionally set a home skeleton directory. Requires `create_home` option! |
| **ssh\_key\_bits** integer added in 0.9 of ansible.builtin | **Default:**"default set by ssh-keygen" | Optionally specify number of bits in SSH key to create. |
| **ssh\_key\_comment** string added in 0.9 of ansible.builtin | **Default:**"ansible-generated on $HOSTNAME" | Optionally define the comment for the SSH key. |
| **ssh\_key\_file** path added in 0.9 of ansible.builtin | | Optionally specify the SSH key filename. If this is a relative filename then it will be relative to the user's home directory. This parameter defaults to *.ssh/id\_rsa*. |
| **ssh\_key\_passphrase** string added in 0.9 of ansible.builtin | | Set a passphrase for the SSH key. If no passphrase is provided, the SSH key will default to having no passphrase. |
| **ssh\_key\_type** string added in 0.9 of ansible.builtin | **Default:**"rsa" | Optionally specify the type of SSH key to generate. Available SSH key types will depend on implementation present on target host. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the account should exist or not, taking action if the state is different from what is stated. |
| **system** boolean | **Choices:*** **no** ←
* yes
| When creating an account `state=present`, setting this to `yes` makes the user a system account. This setting cannot be changed on existing users. |
| **uid** integer | | Optionally sets the *UID* of the user. |
| **update\_password** string added in 1.3 of ansible.builtin | **Choices:*** **always** ←
* on\_create
|
`always` will update passwords if they differ.
`on_create` will only set the password for newly created users. |
Notes
-----
Note
* There are specific requirements per platform on user management utilities. However they generally come pre-installed with the system and Ansible will require they are present at runtime. If they are not, a descriptive error message will be shown.
* On SunOS platforms, the shadow file is backed up automatically since this module edits it directly. On other platforms, the shadow file is backed up by the underlying tools used by this module.
* On macOS, this module uses `dscl` to create, modify, and delete accounts. `dseditgroup` is used to modify group membership. Accounts are hidden from the login window by modifying `/Library/Preferences/com.apple.loginwindow.plist`.
* On FreeBSD, this module uses `pw useradd` and `chpass` to create, `pw usermod` and `chpass` to modify, `pw userdel` remove, `pw lock` to lock, and `pw unlock` to unlock accounts.
* On all other platforms, this module uses `useradd` to create, `usermod` to modify, and `userdel` to remove accounts.
* Supports `check_mode`.
See Also
--------
See also
[ansible.posix.authorized\_key](../posix/authorized_key_module#ansible-collections-ansible-posix-authorized-key-module)
The official documentation on the **ansible.posix.authorized\_key** module.
[ansible.builtin.group](group_module#ansible-collections-ansible-builtin-group-module)
The official documentation on the **ansible.builtin.group** module.
[ansible.windows.win\_user](../windows/win_user_module#ansible-collections-ansible-windows-win-user-module)
The official documentation on the **ansible.windows.win\_user** module.
Examples
--------
```
- name: Add the user 'johnd' with a specific uid and a primary group of 'admin'
ansible.builtin.user:
name: johnd
comment: John Doe
uid: 1040
group: admin
- name: Add the user 'james' with a bash shell, appending the group 'admins' and 'developers' to the user's groups
ansible.builtin.user:
name: james
shell: /bin/bash
groups: admins,developers
append: yes
- name: Remove the user 'johnd'
ansible.builtin.user:
name: johnd
state: absent
remove: yes
- name: Create a 2048-bit SSH key for user jsmith in ~jsmith/.ssh/id_rsa
ansible.builtin.user:
name: jsmith
generate_ssh_key: yes
ssh_key_bits: 2048
ssh_key_file: .ssh/id_rsa
- name: Added a consultant whose account you want to expire
ansible.builtin.user:
name: james18
shell: /bin/zsh
groups: developers
expires: 1422403387
- name: Starting at Ansible 2.6, modify user, remove expiry time
ansible.builtin.user:
name: james18
expires: -1
- name: Set maximum expiration date for password
user:
name: ram19
password_expire_max: 10
- name: Set minimum expiration date for password
user:
name: pushkar15
password_expire_min: 5
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **append** boolean | When state is `present` and the user exists | Whether or not to append the user to groups. **Sample:** True |
| **comment** string | When user exists | Comment section from passwd file, usually the user name. **Sample:** Agent Smith |
| **create\_home** boolean | When user does not exist and not check mode | Whether or not to create the home directory. **Sample:** True |
| **force** boolean | When *state* is `absent` and user exists | Whether or not a user account was forcibly deleted. |
| **group** integer | When user exists | Primary user group ID **Sample:** 1001 |
| **groups** string | When *groups* is not empty and *state* is `present` | List of groups of which the user is a member. **Sample:** chrony,apache |
| **home** string | When *state* is `present` | Path to user's home directory. **Sample:** /home/asmith |
| **move\_home** boolean | When *state* is `present` and user exists | Whether or not to move an existing home directory. |
| **name** string | always | User account name. **Sample:** asmith |
| **password** string | When *state* is `present` and *password* is not empty | Masked value of the password. **Sample:** NOT\_LOGGING\_PASSWORD |
| **password\_expire\_max** integer | When user exists | Maximum number of days during which a password is valid. **Sample:** 20 |
| **password\_expire\_min** integer | When user exists | Minimum number of days between password change **Sample:** 20 |
| **remove** boolean | When *state* is `absent` and user exists | Whether or not to remove the user account. **Sample:** True |
| **shell** string | When *state* is `present` | User login shell. **Sample:** /bin/bash |
| **ssh\_fingerprint** string | When *generate\_ssh\_key* is `True` | Fingerprint of generated SSH key. **Sample:** 2048 SHA256:aYNHYcyVm87Igh0IMEDMbvW0QDlRQfE0aJugp684ko8 ansible-generated on host (RSA) |
| **ssh\_key\_file** string | When *generate\_ssh\_key* is `True` | Path to generated SSH private key file. **Sample:** /home/asmith/.ssh/id\_rsa |
| **ssh\_public\_key** string | When *generate\_ssh\_key* is `True` | Generated SSH public key file. **Sample:** 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC95opt4SPEC06tOYsJQJIuN23BbLMGmYo8ysVZQc4h2DZE9ugbjWWGS1/pweUGjVstgzMkBEeBCByaEf/RJKNecKRPeGd2Bw9DCj/bn5Z6rGfNENKBmo 618mUJBvdlEgea96QGjOwSB7/gmonduC7gsWDMNcOdSE3wJMTim4lddiBx4RgC9yXsJ6Tkz9BHD73MXPpT5ETnse+A3fw3IGVSjaueVnlUyUmOBf7fzmZbhlFVXf2Zi2rFTXqvbdGHKkzpw1U8eB8xFPP7y d5u1u0e6Acju/8aZ/l17IDFiLke5IzlqIMRTEbDwLNeO84YQKWTm9fODHzhYe0yvxqLiK07 ansible-generated on host' |
| **stderr** string | When stderr is returned by a command that is run | Standard error from running commands. **Sample:** Group wheels does not exist |
| **stdout** string | When standard output is returned by the command that is run | Standard output from running commands. |
| **system** boolean | When *system* is passed to the module and the account does not exist | Whether or not the account is a system account. **Sample:** True |
| **uid** integer | When *uid* is passed to the module | User ID of the user account. **Sample:** 1044 |
### Authors
* Stephen Fromm (@sfromm)
ansible ansible.builtin.dict – returns key/value pair items from dictionaries ansible.builtin.dict – returns key/value pair items from dictionaries
=====================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `dict` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.5: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Takes dictionaries as input and returns a list with each item in the list being a dictionary with ‘key’ and ‘value’ as keys to the previous dictionary’s structure.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | A list of dictionaries |
Examples
--------
```
vars:
users:
alice:
name: Alice Appleworth
telephone: 123-456-7890
bob:
name: Bob Bananarama
telephone: 987-654-3210
tasks:
# with predefined vars
- name: Print phone records
debug:
msg: "User {{ item.key }} is {{ item.value.name }} ({{ item.value.telephone }})"
loop: "{{ lookup('dict', users) }}"
# with inline dictionary
- name: show dictionary
debug:
msg: "{{item.key}}: {{item.value}}"
with_dict: {a: 1, b: 2, c: 3}
# Items from loop can be used in when: statements
- name: set_fact when alice in key
set_fact:
alice_exists: true
loop: "{{ lookup('dict', users) }}"
when: "'alice' in item.key"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=string | success | list of composed dictonaries with key and value |
ansible ansible.builtin.include_tasks – Dynamically include a task list ansible.builtin.include\_tasks – Dynamically include a task list
================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `include_tasks` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Includes a file with a list of tasks to be executed in the current playbook.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **apply** string added in 2.7 of ansible.builtin | | Accepts a hash of task keywords (e.g. `tags`, `become`) that will be applied to the tasks within the include. |
| **file** string added in 2.7 of ansible.builtin | | The name of the imported file is specified directly without any other option. Unlike [ansible.builtin.import\_tasks](import_tasks_module), most keywords, including loop, with\_items, and conditionals, apply to this statement. The do until loop is not supported on [ansible.builtin.include\_tasks](include_tasks_module). |
| **free-form** string | | Supplying a file name via free-form `- include_tasks: file.yml` of a file to be included is the equivalent of specifying an argument of *file*. |
Notes
-----
Note
* This is a core feature of the Ansible, rather than a module, and cannot be overridden like a module.
See Also
--------
See also
[ansible.builtin.import\_playbook](import_playbook_module#ansible-collections-ansible-builtin-import-playbook-module)
The official documentation on the **ansible.builtin.import\_playbook** module.
[ansible.builtin.import\_role](import_role_module#ansible-collections-ansible-builtin-import-role-module)
The official documentation on the **ansible.builtin.import\_role** module.
[ansible.builtin.import\_tasks](import_tasks_module#ansible-collections-ansible-builtin-import-tasks-module)
The official documentation on the **ansible.builtin.import\_tasks** module.
[ansible.builtin.include\_role](include_role_module#ansible-collections-ansible-builtin-include-role-module)
The official documentation on the **ansible.builtin.include\_role** module.
[Including and importing](../../../user_guide/playbooks_reuse_includes#playbooks-reuse-includes)
More information related to including and importing playbooks, roles and tasks.
Examples
--------
```
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play
include_tasks: stuff.yaml
- debug:
msg: task10
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play only if the condition is true
include_tasks: "{{ hostvar }}.yaml"
when: hostvar is defined
- name: Apply tags to tasks within included file
include_tasks:
file: install.yml
apply:
tags:
- install
tags:
- always
- name: Apply tags to tasks within included file when using free-form
include_tasks: install.yml
args:
apply:
tags:
- install
tags:
- always
```
### Authors
* Ansible Core Team (@ansible)
| programming_docs |
ansible ansible.builtin.file – read file contents ansible.builtin.file – read file contents
=========================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `file` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 0.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This lookup returns the contents from a file on the Ansible controller’s file system.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | path(s) of files to read |
| **lstrip** boolean | **Choices:*** **no** ←
* yes
| | whether or not to remove whitespace from the beginning of the looked-up file |
| **rstrip** boolean | **Choices:*** no
* **yes** ←
| | whether or not to remove whitespace from the ending of the looked-up file |
Notes
-----
Note
* if read in variable context, the file can be interpreted as YAML if the content is valid to the parser.
* this lookup does not understand ‘globing’, use the fileglob lookup instead.
Examples
--------
```
- debug: msg="the value of foo.txt is {{lookup('file', '/etc/foo.txt') }}"
- name: display multiple file contents
debug: var=item
with_file:
- "/path/to/foo.txt"
- "bar.txt" # will be looked in files/ dir relative to play or in role
- "/path/to/biz.txt"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=string | success | content of file(s) |
### Authors
* Daniel Hokka Zakrisson (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#98fcf9f6f1fdf4bebbabafa3bebbadaaa3bebbaca0a3f0f7e2f9fbbebbacaea3fbf7f5)>
ansible ansible.builtin.meta – Execute Ansible ‘actions’ ansible.builtin.meta – Execute Ansible ‘actions’
================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `meta` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.2: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Meta tasks are a special kind of task which can influence Ansible internal execution or state.
* Meta tasks can be used anywhere within your playbook.
* This module is also supported for Windows targets.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **free\_form** string / required | **Choices:*** clear\_facts
* clear\_host\_errors
* end\_host
* end\_play
* flush\_handlers
* noop
* refresh\_inventory
* reset\_connection
| This module takes a free form command, as a string. There is not an actual option named "free form". See the examples!
`flush_handlers` makes Ansible run any handler tasks which have thus far been notified. Ansible inserts these tasks internally at certain points to implicitly trigger handler runs (after pre/post tasks, the final role execution, and the main tasks section of your plays).
`refresh_inventory` (added in Ansible 2.0) forces the reload of the inventory, which in the case of dynamic inventory scripts means they will be re-executed. If the dynamic inventory script is using a cache, Ansible cannot know this and has no way of refreshing it (you can disable the cache or, if available for your specific inventory datasource (e.g. aws), you can use the an inventory plugin instead of an inventory script). This is mainly useful when additional hosts are created and users wish to use them instead of using the [ansible.builtin.add\_host](add_host_module) module.
`noop` (added in Ansible 2.0) This literally does 'nothing'. It is mainly used internally and not recommended for general use.
`clear_facts` (added in Ansible 2.1) causes the gathered facts for the hosts specified in the play's list of hosts to be cleared, including the fact cache.
`clear_host_errors` (added in Ansible 2.1) clears the failed state (if any) from hosts specified in the play's list of hosts.
`end_play` (added in Ansible 2.2) causes the play to end without failing the host(s). Note that this affects all hosts.
`reset_connection` (added in Ansible 2.3) interrupts a persistent connection (i.e. ssh + control persist)
`end_host` (added in Ansible 2.8) is a per-host variation of `end_play`. Causes the play to end for the current host without failing it. |
Notes
-----
Note
* `meta` is not really a module nor action\_plugin as such it cannot be overwritten.
* `clear_facts` will remove the persistent facts from [ansible.builtin.set\_fact](set_fact_module#ansible-collections-ansible-builtin-set-fact-module) using `cacheable=True`, but not the current host variable it creates for the current run.
* Looping on meta tasks is not supported.
* Skipping `meta` tasks with tags is not supported before Ansible 2.11.
* This module is also supported for Windows targets.
See Also
--------
See also
[ansible.builtin.assert](assert_module#ansible-collections-ansible-builtin-assert-module)
The official documentation on the **ansible.builtin.assert** module.
[ansible.builtin.fail](fail_module#ansible-collections-ansible-builtin-fail-module)
The official documentation on the **ansible.builtin.fail** module.
Examples
--------
```
# Example showing flushing handlers on demand, not at end of play
- template:
src: new.j2
dest: /etc/config.txt
notify: myhandler
- name: Force all notified handlers to run at this point, not waiting for normal sync points
meta: flush_handlers
# Example showing how to refresh inventory during play
- name: Reload inventory, useful with dynamic inventories when play makes changes to the existing hosts
cloud_guest: # this is fake module
name: newhost
state: present
- name: Refresh inventory to ensure new instances exist in inventory
meta: refresh_inventory
# Example showing how to clear all existing facts of targetted hosts
- name: Clear gathered facts from all currently targeted hosts
meta: clear_facts
# Example showing how to continue using a failed target
- name: Bring host back to play after failure
copy:
src: file
dest: /etc/file
remote_user: imightnothavepermission
- meta: clear_host_errors
# Example showing how to reset an existing connection
- user:
name: '{{ ansible_user }}'
groups: input
- name: Reset ssh connection to allow user changes to affect 'current login user'
meta: reset_connection
# Example showing how to end the play for specific targets
- name: End the play for hosts that run CentOS 6
meta: end_host
when:
- ansible_distribution == 'CentOS'
- ansible_distribution_major_version == '6'
```
### Authors
* Ansible Core Team
ansible ansible.builtin.password – retrieve or generate a random password, stored in a file ansible.builtin.password – retrieve or generate a random password, stored in a file
===================================================================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `password` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.1: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Generates a random plaintext password and stores it in a file at a given filepath.
* If the file exists previously, it will retrieve its contents, behaving just like with\_file.
* Usage of variables like `"{{ inventory_hostname }}"` in the filepath can be used to set up random passwords per host, which simplifies password management in `"host_vars"` variables.
* A special case is using /dev/null as a path. The password lookup will generate a new random password each time, but will not write it to /dev/null. This can be used when you need a password without storing it on the controller.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | path to the file that stores/will store the passwords |
| **chars** string added in 1.4 of ansible.builtin | | | Define comma separated list of names that compose a custom character set in the generated passwords. By default generated passwords contain a random mix of upper and lowercase ASCII letters, the numbers 0-9, and punctuation (". , : - \_"). They can be either parts of Python's string module attributes or represented literally ( :, -). Though string modules can vary by Python version, valid values for both major releases include: 'ascii\_lowercase', 'ascii\_uppercase', 'digits', 'hexdigits', 'octdigits', 'printable', 'punctuation' and 'whitespace'. Be aware that Python's 'hexdigits' includes lower and upper case versions of a-f, so it is not a good choice as it doubles the chances of those values for systems that won't distinguish case, distorting the expected entropy. To enter comma use two commas ',,' somewhere - preferably at the end. Quotes and double quotes are not supported. |
| **encrypt** string | | | Which hash scheme to encrypt the returning password, should be one hash scheme from `passlib.hash; md5_crypt, bcrypt, sha256_crypt, sha512_crypt`. If not provided, the password will be returned in plain text. Note that the password is always stored as plain text, only the returning password is encrypted. Encrypt also forces saving the salt value for idempotence. Note that before 2.6 this option was incorrectly labeled as a boolean for a long time. |
| **length** integer | **Default:**20 | | The length of the generated password. |
Notes
-----
Note
* A great alternative to the password lookup plugin, if you don’t need to generate random passwords on a per-host basis, would be to use Vault in playbooks. Read the documentation there and consider using it first, it will be more desirable for most applications.
* If the file already exists, no data will be written to it. If the file has contents, those contents will be read in as the password. Empty files cause the password to return as an empty string.
* As all lookups, this runs on the Ansible host as the user running the playbook, and “become” does not apply, the target file must be readable by the playbook user, or, if it does not exist, the playbook user must have sufficient privileges to create it. (So, for example, attempts to write into areas such as /etc will fail unless the entire playbook is being run as root).
Examples
--------
```
- name: create a mysql user with a random password
mysql_user:
name: "{{ client }}"
password: "{{ lookup('password', 'credentials/' + client + '/' + tier + '/' + role + '/mysqlpassword length=15') }}"
priv: "{{ client }}_{{ tier }}_{{ role }}.*:ALL"
- name: create a mysql user with a random password using only ascii letters
mysql_user:
name: "{{ client }}"
password: "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters') }}"
priv: '{{ client }}_{{ tier }}_{{ role }}.*:ALL'
- name: create a mysql user with an 8 character random password using only digits
mysql_user:
name: "{{ client }}"
password: "{{ lookup('password', '/tmp/passwordfile length=8 chars=digits') }}"
priv: "{{ client }}_{{ tier }}_{{ role }}.*:ALL"
- name: create a mysql user with a random password using many different char sets
mysql_user:
name: "{{ client }}"
password: "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters,digits,punctuation') }}"
priv: "{{ client }}_{{ tier }}_{{ role }}.*:ALL"
- name: create lowercase 8 character name for Kubernetes pod name
set_fact:
random_pod_name: "web-{{ lookup('password', '/dev/null chars=ascii_lowercase,digits length=8') }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=string | success | a password |
### Authors
* Daniel Hokka Zakrisson (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#365257585f535a101505010d101503040d1015020e0d5e594c5755101502000d55595b)>
* Javier Candeira (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#563c37203f3324707565616d707563646d7075626e6d35373832333f2437707562606d35393b)>
* Maykel Moya (!UNKNOWN) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#0964646670682f2a3a3e322f2a3c3b322f2a3d31327a796c6c6d707b6860657a2f2a3d3f326a6664)>
ansible ansible.builtin.reboot – Reboot a machine ansible.builtin.reboot – Reboot a machine
=========================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `reboot` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.7: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Reboot a machine, wait for it to go down, come back up, and respond to commands.
* For Windows targets, use the [ansible.windows.win\_reboot](../windows/win_reboot_module#ansible-collections-ansible-windows-win-reboot-module) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **boot\_time\_command** string added in 2.10 of ansible.builtin | **Default:**"cat /proc/sys/kernel/random/boot\_id" | Command to run that returns a unique string indicating the last time the system was booted. Setting this to a command that has different output each time it is run will cause the task to fail. |
| **connect\_timeout** integer | | Maximum seconds to wait for a successful connection to the managed hosts before trying again. If unspecified, the default setting for the underlying connection plugin is used. |
| **msg** string | **Default:**"Reboot initiated by Ansible" | Message to display to users before reboot. |
| **post\_reboot\_delay** integer | **Default:**0 | Seconds to wait after the reboot command was successful before attempting to validate the system rebooted successfully. This is useful if you want wait for something to settle despite your connection already working. |
| **pre\_reboot\_delay** integer | **Default:**0 | Seconds to wait before reboot. Passed as a parameter to the reboot command. On Linux, macOS and OpenBSD, this is converted to minutes and rounded down. If less than 60, it will be set to 0. On Solaris and FreeBSD, this will be seconds. |
| **reboot\_command** string added in 2.11 of ansible.builtin | **Default:**"[determined based on target OS]" | Command to run that reboots the system, including any parameters passed to the command. Can be an absolute path to the command or just the command name. If an absolute path to the command is not given, `search_paths` on the target system will be searched to find the absolute path. This will cause `pre_reboot_delay`, `post_reboot_delay`, and `msg` to be ignored. |
| **reboot\_timeout** integer | **Default:**600 | Maximum seconds to wait for machine to reboot and respond to a test command. This timeout is evaluated separately for both reboot verification and test command success so the maximum execution time for the module is twice this amount. |
| **search\_paths** list / elements=string added in 2.8 of ansible.builtin | **Default:**["/sbin", "/bin", "/usr/sbin", "/usr/bin", "/usr/local/sbin"] | Paths to search on the remote machine for the `shutdown` command.
*Only* these paths will be searched for the `shutdown` command. `PATH` is ignored in the remote node when searching for the `shutdown` command. |
| **test\_command** string | **Default:**"whoami" | Command to run on the rebooted host and expect success from to determine the machine is ready for further tasks. |
Notes
-----
Note
* `PATH` is ignored on the remote node when searching for the `shutdown` command. Use `search_paths` to specify locations to search if the default paths do not work.
See Also
--------
See also
[ansible.windows.win\_reboot](../windows/win_reboot_module#ansible-collections-ansible-windows-win-reboot-module)
The official documentation on the **ansible.windows.win\_reboot** module.
Examples
--------
```
- name: Unconditionally reboot the machine with all defaults
reboot:
- name: Reboot a slow machine that might have lots of updates to apply
reboot:
reboot_timeout: 3600
- name: Reboot a machine with shutdown command in unusual place
reboot:
search_paths:
- '/lib/molly-guard'
- name: Reboot machine using a custom reboot command
reboot:
reboot_command: launchctl reboot userspace
boot_time_command: uptime | cut -d ' ' -f 5
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **elapsed** integer | always | The number of seconds that elapsed waiting for the system to be rebooted. **Sample:** 23 |
| **rebooted** boolean | always | true if the machine was rebooted **Sample:** True |
### Authors
* Matt Davis (@nitzmahone)
* Sam Doran (@samdoran)
ansible ansible.builtin.host_list – Parses a ‘host list’ string ansible.builtin.host\_list – Parses a ‘host list’ string
========================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `host_list` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.4: of ansible.builtin
* [Synopsis](#synopsis)
* [Examples](#examples)
Synopsis
--------
* Parses a host list string as a comma separated values of hosts
* This plugin only applies to inventory strings that are not paths and contain a comma.
Examples
--------
```
# define 2 hosts in command line
# ansible -i '10.10.2.6, 10.10.2.4' -m ping all
# DNS resolvable names
# ansible -i 'host1.example.com, host2' -m user -a 'name=me state=absent' all
# just use localhost
# ansible-playbook -i 'localhost,' play.yml -c local
```
| programming_docs |
ansible ansible.builtin.expect – Executes a command and responds to prompts ansible.builtin.expect – Executes a command and responds to prompts
===================================================================
Note
This module is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short module name `expect` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.0: of ansible.builtin
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* The `expect` module executes a command and responds to prompts.
* The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like `$HOME` and operations like `"<"`, `">"`, `"|"`, and `"&"` will not work.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* pexpect >= 3.3
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **chdir** path | | Change into this directory before running the command. |
| **command** string / required | | The command module takes command to run. |
| **creates** path | | A filename, when it already exists, this step will **not** be run. |
| **echo** boolean | **Choices:*** **no** ←
* yes
| Whether or not to echo out your response strings. |
| **removes** path | | A filename, when it does not exist, this step will **not** be run. |
| **responses** dictionary / required | | Mapping of expected string/regex and string to respond with. If the response is a list, successive matches return successive responses. List functionality is new in 2.1. |
| **timeout** integer | **Default:**30 | Amount of time in seconds to wait for the expected strings. Use `null` to disable timeout. |
Notes
-----
Note
* If you want to run a command through the shell (say you are using `<`, `>`, `|`, and so on), you must specify a shell in the command such as `/bin/bash -c "/path/to/something | grep else"`.
* The question, or key, under *responses* is a python regex match. Case insensitive searches are indicated with a prefix of `?i`.
* The `pexpect` library used by this module operates with a search window of 2000 bytes, and does not use a multiline regex match. To perform a start of line bound match, use a pattern like `(?m)^pattern`
* By default, if a question is encountered multiple times, its string response will be repeated. If you need different responses for successive question matches, instead of a string response, use a list of strings as the response. The list functionality is new in 2.1.
* The [ansible.builtin.expect](#ansible-collections-ansible-builtin-expect-module) module is designed for simple scenarios. For more complex needs, consider the use of expect code with the [ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module) or [ansible.builtin.script](script_module#ansible-collections-ansible-builtin-script-module) modules. (An example is part of the [ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module) module documentation).
See Also
--------
See also
[ansible.builtin.script](script_module#ansible-collections-ansible-builtin-script-module)
The official documentation on the **ansible.builtin.script** module.
[ansible.builtin.shell](shell_module#ansible-collections-ansible-builtin-shell-module)
The official documentation on the **ansible.builtin.shell** module.
Examples
--------
```
- name: Case insensitive password string match
ansible.builtin.expect:
command: passwd username
responses:
(?i)password: "MySekretPa$$word"
# you don't want to show passwords in your logs
no_log: true
- name: Generic question with multiple different responses
ansible.builtin.expect:
command: /path/to/custom/command
responses:
Question:
- response1
- response2
- response3
```
### Authors
* Matt Martz (@sivel)
ansible ansible.builtin.url – return contents from URL ansible.builtin.url – return contents from URL
==============================================
Note
This lookup plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `url` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same lookup plugin name.
New in version 1.9: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Returns the content of the URL requested to be used as data in play.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string | | | urls to query |
| **ca\_path** string added in 2.10 of ansible.builtin | | ini entries: [url\_lookup]ca\_path = None env:ANSIBLE\_LOOKUP\_URL\_CA\_PATH var: ansible\_lookup\_url\_ca\_path | String of file system path to CA cert bundle to use |
| **follow\_redirects** string added in 2.10 of ansible.builtin | **Default:**"urllib2" | ini entries: [url\_lookup]follow\_redirects = urllib2 env:ANSIBLE\_LOOKUP\_URL\_FOLLOW\_REDIRECTS var: ansible\_lookup\_url\_follow\_redirects | String of urllib2, all/yes, safe, none to determine how redirects are followed, see RedirectHandlerFactory for more information |
| **force** boolean added in 2.10 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [url\_lookup]force = no env:ANSIBLE\_LOOKUP\_URL\_FORCE var: ansible\_lookup\_url\_force | Whether or not to set "cache-control" header with value "no-cache" |
| **force\_basic\_auth** boolean added in 2.10 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [url\_lookup]agent = no env:ANSIBLE\_LOOKUP\_URL\_AGENT var: ansible\_lookup\_url\_agent | Force basic authentication |
| **headers** dictionary added in 2.9 of ansible.builtin | **Default:**{} | | HTTP request headers |
| **http\_agent** string added in 2.10 of ansible.builtin | **Default:**"ansible-httpget" | ini entries: [url\_lookup]agent = ansible-httpget env:ANSIBLE\_LOOKUP\_URL\_AGENT var: ansible\_lookup\_url\_agent | User-Agent to use in the request. The default was changed in 2.11 to `ansible-httpget`. |
| **password** string added in 2.8 of ansible.builtin | | | Password to use for HTTP authentication. |
| **split\_lines** boolean | **Choices:*** no
* **yes** ←
| | Flag to control if content is returned as a list of lines or as a single text blob |
| **timeout** float added in 2.10 of ansible.builtin | **Default:**10 | ini entries: [url\_lookup]timeout = 10 env:ANSIBLE\_LOOKUP\_URL\_TIMEOUT var: ansible\_lookup\_url\_timeout | How long to wait for the server to send data before giving up |
| **unix\_socket** string added in 2.10 of ansible.builtin | | ini entries: [url\_lookup]unix\_socket = None env:ANSIBLE\_LOOKUP\_URL\_UNIX\_SOCKET var: ansible\_lookup\_url\_unix\_socket | String of file system path to unix socket file to use when establishing connection to the provided url |
| **unredirected\_headers** list / elements=string added in 2.10 of ansible.builtin | | ini entries: [url\_lookup]unredirected\_headers = None env:ANSIBLE\_LOOKUP\_URL\_UNREDIR\_HEADERS var: ansible\_lookup\_url\_unredir\_headers | A list of headers to not attach on a redirected request |
| **use\_gssapi** boolean added in 2.10 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [url\_lookup]use\_gssapi = no env:ANSIBLE\_LOOKUP\_URL\_USE\_GSSAPI var: ansible\_lookup\_url\_use\_gssapi | Use GSSAPI handler of requests As of Ansible 2.11, GSSAPI credentials can be specified with *username* and *password*. |
| **use\_proxy** boolean | **Choices:*** no
* **yes** ←
| | Flag to control if the lookup will observe HTTP proxy environment variables when present. |
| **username** string added in 2.8 of ansible.builtin | | | Username to use for HTTP authentication. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| | Flag to control SSL certificate validation |
Examples
--------
```
- name: url lookup splits lines by default
debug: msg="{{item}}"
loop: "{{ lookup('url', 'https://github.com/gremlin.keys', wantlist=True) }}"
- name: display ip ranges
debug: msg="{{ lookup('url', 'https://ip-ranges.amazonaws.com/ip-ranges.json', split_lines=False) }}"
- name: url lookup using authentication
debug: msg="{{ lookup('url', 'https://some.private.site.com/file.txt', username='bob', password='hunter2') }}"
- name: url lookup using basic authentication
debug: msg="{{ lookup('url', 'https://some.private.site.com/file.txt', username='bob', password='hunter2', force_basic_auth='True') }}"
- name: url lookup using headers
debug: msg="{{ lookup('url', 'https://some.private.site.com/api/service', headers={'header1':'value1', 'header2':'value2'} ) }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=string | success | list of list of lines or content of url(s) |
### Authors
* Brian Coca (@bcoca)
ansible ansible.builtin.generator – Uses Jinja2 to construct hosts and groups from patterns ansible.builtin.generator – Uses Jinja2 to construct hosts and groups from patterns
===================================================================================
Note
This inventory plugin is part of `ansible-core` and included in all Ansible installations. In most cases, you can use the short plugin name `generator` even without specifying the `collections:` keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same inventory plugin name.
New in version 2.6: of ansible.builtin
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Uses a YAML configuration file with a valid YAML or `.config` extension to define var expressions and group conditionals
* Create a template pattern that describes each host, and then use independent configuration layers
* Every element of every layer is combined to create a host for every layer combination
* Parent groups can be defined with reference to hosts and other groups using the same template variables
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **hosts** string | | | The `name` key is a template used to generate hostnames based on the `layers` option. Each variable in the name is expanded to create a cartesian product of all possible layer combinations. The `parents` are a list of parent groups that the host belongs to. Each `parent` item contains a `name` key, again expanded from the template, and an optional `parents` key that lists its parents. Parents can also contain `vars`, which is a dictionary of vars that is then always set for that variable. This can provide easy access to the group name. E.g set an `application` variable that is set to the value of the `application` layer name. |
| **layers** string | | | A dictionary of layers, with the key being the layer name, used as a variable name in the `host` `name` and `parents` keys. Each layer value is a list of possible values for that layer. |
| **plugin** string / required | **Choices:*** generator
| | token that ensures this is a source file for the 'generator' plugin. |
Examples
--------
```
# inventory.config file in YAML format
# remember to enable this inventory plugin in the ansible.cfg before using
# View the output using `ansible-inventory -i inventory.config --list`
plugin: generator
hosts:
name: "{{ operation }}_{{ application }}_{{ environment }}_runner"
parents:
- name: "{{ operation }}_{{ application }}_{{ environment }}"
parents:
- name: "{{ operation }}_{{ application }}"
parents:
- name: "{{ operation }}"
- name: "{{ application }}"
- name: "{{ application }}_{{ environment }}"
parents:
- name: "{{ application }}"
vars:
application: "{{ application }}"
- name: "{{ environment }}"
vars:
environment: "{{ environment }}"
- name: runner
layers:
operation:
- build
- launch
environment:
- dev
- test
- prod
application:
- web
- api
```
ansible Collections in the Infinidat Namespace Collections in the Infinidat Namespace
======================================
These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **infinidat** namespace.
* [infinidat.infinibox](infinibox/index#plugins-in-infinidat-infinibox)
ansible Infinidat.Infinibox Infinidat.Infinibox
===================
Collection version 1.2.4
Plugin Index
------------
These are the plugins in the infinidat.infinibox collection
### Modules
* [infini\_cluster](infini_cluster_module#ansible-collections-infinidat-infinibox-infini-cluster-module) – Create, Delete and Modify Host Cluster on Infinibox
* [infini\_export](infini_export_module#ansible-collections-infinidat-infinibox-infini-export-module) – Create, Delete or Modify NFS Exports on Infinibox
* [infini\_export\_client](infini_export_client_module#ansible-collections-infinidat-infinibox-infini-export-client-module) – Create, Delete or Modify NFS Client(s) for existing exports on Infinibox
* [infini\_fs](infini_fs_module#ansible-collections-infinidat-infinibox-infini-fs-module) – Create, Delete or Modify filesystems on Infinibox
* [infini\_host](infini_host_module#ansible-collections-infinidat-infinibox-infini-host-module) – Create, Delete and Modify Hosts on Infinibox
* [infini\_map](infini_map_module#ansible-collections-infinidat-infinibox-infini-map-module) – Create and Delete mapping of a volume to a host on Infinibox
* [infini\_pool](infini_pool_module#ansible-collections-infinidat-infinibox-infini-pool-module) – Create, Delete and Modify Pools on Infinibox
* [infini\_port](infini_port_module#ansible-collections-infinidat-infinibox-infini-port-module) – Add and Delete fiber channel and iSCSI ports to a host on Infinibox
* [infini\_user](infini_user_module#ansible-collections-infinidat-infinibox-infini-user-module) – Create, Delete and Modify a User on Infinibox
* [infini\_vol](infini_vol_module#ansible-collections-infinidat-infinibox-infini-vol-module) – Create, Delete or Modify volumes on Infinibox
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible infinidat.infinibox.infini_map – Create and Delete mapping of a volume to a host on Infinibox infinidat.infinibox.infini\_map – Create and Delete mapping of a volume to a host on Infinibox
==============================================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_map`.
New in version 2.10: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module creates or deletes mappings of volumes to hosts on Infinibox. infini\_map is implemented separately from infini\_host to allow ansible plays to remove, or make absent, a mapping without removing the host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python2 >= 2.7 or python3 >= 3.6
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **host** string / required | | Host Name |
| **password** string | | Infinibox User password. |
| **state** string | **Choices:*** stat
* **present** ←
* absent
| Creates mapping when present or removes when absent, or provides details of a mapping when stat. |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
| **volume** string / required | | Volume name to map to the host |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Map a volume to an existing host
infini_map:
host: foo.example.com
volume: bar
state: present # Default
user: admin
password: secret
system: ibox001
- name: Unmap volume bar from host foo.example.com
infini_map:
host: foo.example.com
volume: bar
state: absent
system: ibox01
user: admin
password: secret
- name: Stat mapping of volume bar to host foo.example.com
infini_map:
host: foo.example.com
volume: bar
state: stat
system: ibox01
user: admin
password: secret
```
### Authors
* David Ohlemacher (@ohlemacher)
ansible infinidat.infinibox.infini_user – Create, Delete and Modify a User on Infinibox infinidat.infinibox.infini\_user – Create, Delete and Modify a User on Infinibox
================================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_user`.
New in version 2.10: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module creates, deletes or modifies a user on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python2 >= 2.7 or python3 >= 3.6
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **password** string | | Infinibox User password. |
| **state** string | **Choices:*** stat
* reset\_password
* **present** ←
* absent
| Creates/Modifies user when present or removes when absent |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
| **user\_email** string / required | | The new user's Email address |
| **user\_enabled** boolean | **Choices:*** no
* **yes** ←
| Specify whether to enable the user |
| **user\_name** string / required | | The new user's Name. Once a user is created, the user\_name may not be changed from this module. It may be changed from the UI or from infinishell. |
| **user\_password** string / required | | The new user's password |
| **user\_pool** string | | Use with role==pool\_admin. Specify the new user's pool. |
| **user\_role** string / required | **Choices:*** admin
* pool\_admin
* read\_only
| The user's role |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Create new user
infini_user:
user_name: foo_user
user_email: [email protected]
user_password: secret2
user_role: pool_admin
user_enabled: false
pool: foo_pool
state: present
password: secret1
system: ibox001
```
### Authors
* David Ohlemacher (@ohlemacher)
| programming_docs |
ansible infinidat.infinibox.infini_cluster – Create, Delete and Modify Host Cluster on Infinibox infinidat.infinibox.infini\_cluster – Create, Delete and Modify Host Cluster on Infinibox
=========================================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_cluster`.
New in version 2.9: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module creates, deletes or modifies host clusters on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python2 >= 2.7 or python3 >= 3.6
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Cluster Name |
| **password** string | | Infinibox User password. |
| **state** string | **Choices:*** stat
* **present** ←
* absent
| Creates/Modifies Cluster when present, removes when absent, or provides details of a cluster when stat. |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Create new cluster
infini_cluster:
name: foo_cluster
user: admin
password: secret
system: ibox001
```
### Authors
* David Ohlemacher (@ohlemacher)
ansible infinidat.infinibox.infini_host – Create, Delete and Modify Hosts on Infinibox infinidat.infinibox.infini\_host – Create, Delete and Modify Hosts on Infinibox
===============================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_host`.
New in version 2.3: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module creates, deletes or modifies hosts on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python2 >= 2.7 or python3 >= 3.6
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Host Name |
| **password** string | | Infinibox User password. |
| **state** string | **Choices:*** stat
* **present** ←
* absent
| Creates/Modifies Host when present or removes when absent |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Create new host
infini_host:
name: foo.example.com
user: admin
password: secret
system: ibox001
```
### Authors
* Gregory Shulov (@GR360RY)
ansible infinidat.infinibox.infini_export_client – Create, Delete or Modify NFS Client(s) for existing exports on Infinibox infinidat.infinibox.infini\_export\_client – Create, Delete or Modify NFS Client(s) for existing exports on Infinibox
=====================================================================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_export_client`.
New in version 2.3: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module creates, deletes or modifys NFS client(s) for existing exports on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
* munch
* python2 >= 2.7 or python3 >= 3.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **access\_mode** string | **Choices:*** **RW** ←
* RO
| Read Write or Read Only Access. |
| **client** string / required | | Client IP or Range. Ranges can be defined as follows 192.168.0.1-192.168.0.254.
aliases: name |
| **export** string / required | | Name of the export. |
| **no\_root\_squash** boolean | **Choices:*** **no** ←
* yes
| Don't squash root user to anonymous. Will be set to "no" on creation if not specified explicitly. |
| **password** string | | Infinibox User password. |
| **state** string | **Choices:*** **present** ←
* absent
| Creates/Modifies client when present and removes when absent. |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Make sure nfs client 10.0.0.1 is configured for export. Allow root access
infini_export_client:
client: 10.0.0.1
access_mode: RW
no_root_squash: yes
export: /data
state: present # Default
user: admin
password: secret
system: ibox001
- name: Add multiple clients with RO access. Squash root privileges
infini_export_client:
client: "{{ item }}"
access_mode: RO
no_root_squash: no
export: /data
user: admin
password: secret
system: ibox001
with_items:
- 10.0.0.2
- 10.0.0.3
```
### Authors
* Gregory Shulov (@GR360RY)
ansible infinidat.infinibox.infini_vol – Create, Delete or Modify volumes on Infinibox infinidat.infinibox.infini\_vol – Create, Delete or Modify volumes on Infinibox
===============================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_vol`.
New in version 2.3: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module creates, deletes or modifies a volume on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* capacity
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
* python2 >= 2.7 or python3 >= 3.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Volume Name |
| **parent\_volume\_name** string | | Specify a volume name. This is the volume parent for creating a snapshot. Required if volume\_type is snapshot. |
| **password** string | | Infinibox User password. |
| **pool** string | | Pool that master volume will reside within. Required for creating a master volume, but not a snapshot. |
| **size** string | | Volume size in MB, GB or TB units. Required for creating a master volume, but not a snapshot |
| **snapshot\_lock\_expires\_at** string | | This will cause a snapshot to be locked at the specified date-time. Uses python's datetime format YYYY-mm-dd HH:MM:SS.ffffff, e.g. 2020-02-13 16:21:59.699700 |
| **snapshot\_lock\_only** boolean | **Choices:*** **no** ←
* yes
| This will lock an existing snapshot but will suppress refreshing the snapshot. |
| **state** string | **Choices:*** stat
* **present** ←
* absent
| Creates/Modifies master volume or snapshot when present or removes when absent. |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **thin\_provision** boolean added in 2.8 of infinidat.infinibox | **Choices:*** no
* **yes** ←
| Whether the master volume should be thin provisioned. Required for creating a master volume, but not a snapshot. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
| **volume\_type** string | **Choices:*** **master** ←
* snapshot
| Specifies the volume type, regular volume or snapshot. |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Create new volume named foo under pool named bar
infini_vol:
name: foo
# volume_type: master # Default
size: 1TB
thin_provision: yes
pool: bar
state: present
user: admin
password: secret
system: ibox001
- name: Create snapshot named foo_snap from volume named foo
infini_vol:
name: foo_snap
volume_type: snapshot
parent_volume_name: foo
state: present
user: admin
password: secret
system: ibox001
- name: Stat snapshot, also a volume, named foo_snap
infini_vol:
name: foo_snap
state: present
user: admin
password: secret
system: ibox001
- name: Remove snapshot, also a volume, named foo_snap
infini_vol:
name: foo_snap
state: absent
user: admin
password: secret
system: ibox001
```
### Authors
* Gregory Shulov (@GR360RY)
ansible infinidat.infinibox.infini_export – Create, Delete or Modify NFS Exports on Infinibox infinidat.infinibox.infini\_export – Create, Delete or Modify NFS Exports on Infinibox
======================================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_export`.
New in version 2.3: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module creates, deletes or modifies NFS exports on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
* munch
* python2 >= 2.7 or python3 >= 3.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **client\_list** string | **Default:**"All Hosts(\*), RW, no\_root\_squash: True" | List of dictionaries with client entries. See examples. Check infini\_export\_client module to modify individual NFS client entries for export. |
| **filesystem** string / required | | Name of exported file system. |
| **name** string / required | | Export name. Must start with a forward slash, e.g. name=/data. |
| **password** string | | Infinibox User password. |
| **state** string | **Choices:*** stat
* **present** ←
* absent
| Creates/Modifies export when present, removes when absent, or provides export details with stat. |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Export bar filesystem under foo pool as /data
infini_export:
name: /data01
filesystem: foo
state: present # Default
user: admin
password: secret
system: ibox001
- name: Get status of export bar filesystem under foo pool as /data
infini_export:
name: /data01
filesystem: foo
state: stat
user: admin
password: secret
system: ibox001
- name: Remove export bar filesystem under foo pool as /data
infini_export:
name: /data01
filesystem: foo
state: absent
user: admin
password: secret
system: ibox001
- name: Export and specify client list explicitly
infini_export:
name: /data02
filesystem: foo
client_list:
- client: 192.168.0.2
access: RW
no_root_squash: True
- client: 192.168.0.100
access: RO
no_root_squash: False
- client: 192.168.0.10-192.168.0.20
access: RO
no_root_squash: False
system: ibox001
user: admin
password: secret
```
### Authors
* Gregory Shulov (@GR360RY)
ansible infinidat.infinibox.infini_pool – Create, Delete and Modify Pools on Infinibox infinidat.infinibox.infini\_pool – Create, Delete and Modify Pools on Infinibox
===============================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_pool`.
New in version 2.3: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module to creates, deletes or modifies pools on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* capacity
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
* python2 >= 2.7 or python3 >= 3.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **compression** boolean added in 2.8 of infinidat.infinibox | **Choices:*** no
* **yes** ←
| Enable/Disable Compression on Pool |
| **name** string / required | | Pool Name |
| **password** string | | Infinibox User password. |
| **size** string | | Pool Physical Capacity in MB, GB or TB units. If pool size is not set on pool creation, size will be equal to 1TB. See examples. |
| **ssd\_cache** boolean | **Choices:*** no
* **yes** ←
| Enable/Disable SSD Cache on Pool |
| **state** string | **Choices:*** **present** ←
* absent
| Creates/Modifies Pool when present or removes when absent |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
| **vsize** string | | Pool Virtual Capacity in MB, GB or TB units. If pool vsize is not set on pool creation, Virtual Capacity will be equal to Physical Capacity. See examples. |
Notes
-----
Note
* Infinibox Admin level access is required for pool modifications
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Make sure pool foo exists. Set pool physical capacity to 10TB
infini_pool:
name: foo
size: 10TB
vsize: 10TB
user: admin
password: secret
system: ibox001
- name: Disable SSD Cache on pool
infini_pool:
name: foo
ssd_cache: no
user: admin
password: secret
system: ibox001
- name: Disable Compression on pool
infini_pool:
name: foo
compression: no
user: admin
password: secret
system: ibox001
```
### Authors
* Gregory Shulov (@GR360RY)
| programming_docs |
ansible infinidat.infinibox.infini_port – Add and Delete fiber channel and iSCSI ports to a host on Infinibox infinidat.infinibox.infini\_port – Add and Delete fiber channel and iSCSI ports to a host on Infinibox
======================================================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_port`.
New in version 2.1: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module adds or deletes fiber channel or iSCSI ports to hosts on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python2 >= 2.7 or python3 >= 3.6
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **iqns** string | **Default:**[] | List of iqns of the host |
| **name** string / required | | Host Name |
| **password** string | | Infinibox User password. |
| **state** string | **Choices:*** stat
* **present** ←
* absent
| Creates mapping when present, removes when absent, or provides details of a mapping when stat. |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
| **wwns** string | **Default:**[] | List of wwns of the host |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Make sure host bar is available with wwn/iqn ports
infini_host:
name: bar.example.com
state: present
wwns:
- "00:00:00:00:00:00:00"
- "11:11:11:11:11:11:11"
iqns:
- "iqn.yyyy-mm.reverse-domain:unique-string"
system: ibox01
user: admin
password: secret
```
### Authors
* David Ohlemacher (@ohlemacher)
ansible infinidat.infinibox.infini_fs – Create, Delete or Modify filesystems on Infinibox infinidat.infinibox.infini\_fs – Create, Delete or Modify filesystems on Infinibox
==================================================================================
Note
This plugin is part of the [infinidat.infinibox collection](https://galaxy.ansible.com/infinidat/infinibox) (version 1.2.4).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install infinidat.infinibox`.
To use it in a playbook, specify: `infinidat.infinibox.infini_fs`.
New in version 2.3: of infinidat.infinibox
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module creates, deletes or modifies filesystems on Infinibox.
Requirements
------------
The below requirements are needed on the host that executes this module.
* capacity
* infinisdk (<https://infinisdk.readthedocs.io/en/latest/>)
* python2 >= 2.7 or python3 >= 3.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | File system name. |
| **password** string | | Infinibox User password. |
| **pool** string / required | | Pool that will host file system. |
| **size** string | | File system size in MB, GB or TB units. See examples. |
| **state** string | **Choices:*** **present** ←
* absent
| Creates/Modifies file system when present or removes when absent. |
| **system** string / required | | Infinibox Hostname or IPv4 Address. |
| **user** string | | Infinibox User username with sufficient priveledges ( see notes ). |
Notes
-----
Note
* This module requires infinisdk python library
* You must set INFINIBOX\_USER and INFINIBOX\_PASSWORD environment variables if user and password arguments are not passed to the module directly
* Ansible uses the infinisdk configuration file `~/.infinidat/infinisdk.ini` if no credentials are provided. See <http://infinisdk.readthedocs.io/en/latest/getting_started.html>
* All Infinidat modules support check mode (–check). However, a dryrun that creates resources may fail if the resource dependencies are not met for a task. For example, consider a task that creates a volume in a pool. If the pool does not exist, the volume creation task will fail. It will fail even if there was a previous task in the playbook that would have created the pool but did not because the pool creation was also part of the dry run.
Examples
--------
```
- name: Create new file system named foo under pool named bar
infini_fs:
name: foo
size: 1TB
pool: bar
state: present
user: admin
password: secret
system: ibox001
```
### Authors
* Gregory Shulov (@GR360RY)
ansible Collections in the Vyos Namespace Collections in the Vyos Namespace
=================================
These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **vyos** namespace.
* [vyos.vyos](vyos/index#plugins-in-vyos-vyos)
ansible vyos.vyos.vyos_user – Manage the collection of local users on VyOS device vyos.vyos.vyos\_user – Manage the collection of local users on VyOS device
==========================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_user`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides declarative management of the local usernames configured on network devices. It allows playbooks to manage either individual usernames or the collection of usernames in the current running config. It also supports purging usernames from the configuration that are not explicitly defined.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aggregate** list / elements=dictionary | | The set of username objects to be configured on the remote VyOS device. The list entries can either be the username or a hash of username and properties. This argument is mutually exclusive with the `name` argument.
aliases: users, collection |
| | **configured\_password** string | | The password to be configured on the VyOS device. The password needs to be provided in clear and it will be encrypted on the device. Please note that this option is not same as `provider password`. |
| | **full\_name** string | | The `full_name` argument provides the full name of the user account to be created on the remote device. This argument accepts any text string value. |
| | **level** string | | The `level` argument configures the level of the user when logged into the system. This argument accepts string values admin or operator.
aliases: role |
| | **name** string / required | | The username to be configured on the VyOS device. This argument accepts a string value and is mutually exclusive with the `aggregate` argument. Please note that this option is not same as `provider username`. |
| | **state** string | **Choices:*** present
* absent
| Configures the state of the username definition as it relates to the device operational configuration. When set to *present*, the username(s) should be configured in the device active configuration and when set to *absent* the username(s) should not be in the device active configuration |
| | **update\_password** string | **Choices:*** on\_create
* always
| Since passwords are encrypted in the device running config, this argument will instruct the module when to change the password. When set to `always`, the password will always be updated in the device and when set to `on_create` the password will be updated only if the username is created. |
| **configured\_password** string | | The password to be configured on the VyOS device. The password needs to be provided in clear and it will be encrypted on the device. Please note that this option is not same as `provider password`. |
| **full\_name** string | | The `full_name` argument provides the full name of the user account to be created on the remote device. This argument accepts any text string value. |
| **level** string | | The `level` argument configures the level of the user when logged into the system. This argument accepts string values admin or operator.
aliases: role |
| **name** string | | The username to be configured on the VyOS device. This argument accepts a string value and is mutually exclusive with the `aggregate` argument. Please note that this option is not same as `provider username`. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **purge** boolean | **Choices:*** **no** ←
* yes
| Instructs the module to consider the resource definition absolute. It will remove any previously configured usernames on the device with the exception of the `admin` user (the current defined set of users). |
| **state** string | **Choices:*** **present** ←
* absent
| Configures the state of the username definition as it relates to the device operational configuration. When set to *present*, the username(s) should be configured in the device active configuration and when set to *absent* the username(s) should not be in the device active configuration |
| **update\_password** string | **Choices:*** on\_create
* **always** ←
| Since passwords are encrypted in the device running config, this argument will instruct the module when to change the password. When set to `always`, the password will always be updated in the device and when set to `on_create` the password will be updated only if the username is created. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: create a new user
vyos.vyos.vyos_user:
name: ansible
configured_password: password
state: present
- name: remove all users except admin
vyos.vyos.vyos_user:
purge: yes
- name: set multiple users to level operator
vyos.vyos.vyos_user:
aggregate:
- name: netop
- name: netend
level: operator
state: present
- name: Change Password for User netop
vyos.vyos.vyos_user:
name: netop
configured_password: '{{ new_password }}'
update_password: always
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always | The list of configuration mode commands to send to the device **Sample:** ['set system login user test level operator', 'set system login user authentication plaintext-password password'] |
### Authors
* Trishna Guha (@trishnaguha)
ansible vyos.vyos.vyos_logging_global – Logging resource module vyos.vyos.vyos\_logging\_global – Logging resource module
=========================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_logging_global`.
New in version 2.4.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages the logging attributes of Vyos network devices
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | A list containing dictionary of logging options |
| | **console** dictionary | | logging to serial console |
| | | **facilities** list / elements=dictionary | | facility configurations for console |
| | | | **facility** string | **Choices:*** all
* auth
* authpriv
* cron
* daemon
* kern
* lpr
* mail
* mark
* news
* protocols
* security
* syslog
* user
* uucp
* local0
* local1
* local2
* local3
* local4
* local5
* local6
* local7
| Facility for logging |
| | | | **severity** string | **Choices:*** emerg
* alert
* crit
* err
* warning
* notice
* info
* debug
* all
| logging level |
| | | **state** string | **Choices:*** enabled
* disabled
| enable or disable the command |
| | **files** list / elements=dictionary | | logging to file |
| | | **archive** dictionary | | Log file size and rotation characteristics |
| | | | **file\_num** integer | | Number of saved files (default is 5) |
| | | | **size** integer | | Size of log files (in kilobytes, default is 256) |
| | | | **state** string | **Choices:*** enabled
* disabled
| enable or disable the command |
| | | **facilities** list / elements=dictionary | | facility configurations |
| | | | **facility** string | **Choices:*** all
* auth
* authpriv
* cron
* daemon
* kern
* lpr
* mail
* mark
* news
* protocols
* security
* syslog
* user
* uucp
* local0
* local1
* local2
* local3
* local4
* local5
* local6
* local7
| Facility for logging |
| | | | **severity** string | **Choices:*** emerg
* alert
* crit
* err
* warning
* notice
* info
* debug
* all
| logging level |
| | | **path** string | | file name or path |
| | **global\_params** dictionary | | logging to serial console |
| | | **archive** dictionary | | Log file size and rotation characteristics |
| | | | **file\_num** integer | | Number of saved files (default is 5) |
| | | | **size** integer | | Size of log files (in kilobytes, default is 256) |
| | | | **state** string | **Choices:*** enabled
* disabled
| enable or disable the command |
| | | **facilities** list / elements=dictionary | | facility configurations |
| | | | **facility** string | **Choices:*** all
* auth
* authpriv
* cron
* daemon
* kern
* lpr
* mail
* mark
* news
* protocols
* security
* syslog
* user
* uucp
* local0
* local1
* local2
* local3
* local4
* local5
* local6
* local7
| Facility for logging |
| | | | **severity** string | **Choices:*** emerg
* alert
* crit
* err
* warning
* notice
* info
* debug
* all
| logging level |
| | | **marker\_interval** integer | | time interval how often a mark message is being sent in seconds (default is 1200) |
| | | **preserve\_fqdn** boolean | **Choices:*** no
* yes
| uses FQDN for logging |
| | | **state** string | **Choices:*** enabled
* disabled
| enable or disable the command |
| | **hosts** list / elements=dictionary | | logging to serial console |
| | | **facilities** list / elements=dictionary | | facility configurations for host |
| | | | **facility** string | **Choices:*** all
* auth
* authpriv
* cron
* daemon
* kern
* lpr
* mail
* mark
* news
* protocols
* security
* syslog
* user
* uucp
* local0
* local1
* local2
* local3
* local4
* local5
* local6
* local7
| Facility for logging |
| | | | **protocol** string | **Choices:*** udp
* tcp
| syslog communication protocol |
| | | | **severity** string | **Choices:*** emerg
* alert
* crit
* err
* warning
* notice
* info
* debug
* all
| logging level |
| | | **hostname** string | | Remote host name or IP address |
| | | **port** integer | | Destination port (1-65535) |
| | **syslog** dictionary | | logging syslog |
| | | **state** string | **Choices:*** enabled
* disabled
| enable or disable the command |
| | **users** list / elements=dictionary | | logging to file |
| | | **facilities** list / elements=dictionary | | facility configurations |
| | | | **facility** string | **Choices:*** all
* auth
* authpriv
* cron
* daemon
* kern
* lpr
* mail
* mark
* news
* protocols
* security
* syslog
* user
* uucp
* local0
* local1
* local2
* local3
* local4
* local5
* local6
* local7
| Facility for logging |
| | | | **severity** string | **Choices:*** emerg
* alert
* crit
* err
* warning
* notice
* info
* debug
* all
| logging level |
| | | **username** string | | user login name |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VYOS device by executing the command **show configuration commands | grep syslog**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* gathered
* parsed
* rendered
| The state the configuration should be left in The states *replaced* and *overridden* have identical behaviour for this module. Refer to examples for more details. |
Notes
-----
Note
* Tested against vyos 1.2
* This module works with connection `network_cli`.
* The Configuration defaults of the Vyos network devices are supposed to hinder idempotent behavior of plays
Examples
--------
```
# Using state: merged
# Before state:
# -------------
# vyos:~$show configuration commands | grep syslog
- name: Apply the provided configuration
vyos.vyos.vyos_logging_global:
config:
console:
facilities:
- facility: local7
severity: err
files:
- path: logFile
archive:
file_num: 2
facilities:
- facility: local6
severity: emerg
hosts:
- hostname: 172.16.0.1
facilities:
- facility: local7
severity: all
- facility: all
protocol: udp
port: 223
users:
- username: vyos
facilities:
- facility: local7
severity: debug
global_params:
archive:
file_num: 2
size: 111
facilities:
- facility: cron
severity: debug
marker_interval: 111
preserve_fqdn: true
state: merged
# Commands Fired:
# ---------------
# "commands": [
# "set system syslog console facility local7 level err",
# "set system syslog file logFile archive file 2",
# "set system syslog host 172.16.0.1 facility local7 level all",
# "set system syslog file logFile facility local6 level emerg",
# "set system syslog host 172.16.0.1 facility all protocol udp",
# "set system syslog user vyos facility local7 level debug",
# "set system syslog host 172.16.0.1 port 223",
# "set system syslog global facility cron level debug",
# "set system syslog global archive file 2",
# "set system syslog global archive size 111",
# "set system syslog global marker interval 111",
# "set system syslog global preserve-fqdn"
# ],
# After state:
# ------------
# vyos:~$ show configuration commands | grep syslog
# set system syslog console facility local7 level 'err'
# set system syslog file logFile archive file '2'
# set system syslog file logFile facility local6 level 'emerg'
# set system syslog global archive file '2'
# set system syslog global archive size '111'
# set system syslog global facility cron level 'debug'
# set system syslog global marker interval '111'
# set system syslog global preserve-fqdn
# set system syslog host 172.16.0.1 facility all protocol 'udp'
# set system syslog host 172.16.0.1 facility local7 level 'all'
# set system syslog host 172.16.0.1 port '223'
# set system syslog user vyos facility local7 level 'debug'
# Using state: deleted
# Before state:
# -------------
# vyos:~$show configuration commands | grep syslog
# set system syslog console facility local7 level 'err'
# set system syslog file logFile archive file '2'
# set system syslog file logFile facility local6 level 'emerg'
# set system syslog global archive file '2'
# set system syslog global archive size '111'
# set system syslog global facility cron level 'debug'
# set system syslog global marker interval '111'
# set system syslog global preserve-fqdn
# set system syslog host 172.16.0.1 facility all protocol 'udp'
# set system syslog host 172.16.0.1 facility local7 level 'all'
# set system syslog host 172.16.0.1 port '223'
# set system syslog user vyos facility local7 level 'debug'
- name: delete the existing configuration
vyos.vyos.vyos_logging_global:
state: deleted
# Commands Fired:
# ---------------
# "commands": [
# "delete system syslog"
# ],
# After state:
# ------------
# vyos:~$show configuration commands | grep syslog
# Using state: overridden
# Before state:
# -------------
# vyos:~$show configuration commands | grep syslog
# set system syslog console facility local7 level 'err'
# set system syslog file logFile archive file '2'
# set system syslog file logFile facility local6 level 'emerg'
# set system syslog global archive file '2'
# set system syslog global archive size '111'
# set system syslog global facility cron level 'debug'
# set system syslog global marker interval '111'
# set system syslog global preserve-fqdn
# set system syslog host 172.16.0.1 facility all protocol 'udp'
# set system syslog host 172.16.0.1 facility local7 level 'all'
# set system syslog host 172.16.0.1 port '223'
# set system syslog user vyos facility local7 level 'debug'
- name: Override the current configuration
vyos.vyos.vyos_logging_global:
config:
console:
facilities:
- facility: all
- facility: local7
severity: err
- facility: news
severity: debug
files:
- path: logFileNew
hosts:
- hostname: 172.16.0.2
facilities:
- facility: local5
severity: all
global_params:
archive:
file_num: 10
state: overridden
# Commands Fired:
# ---------------
# "commands": [
# "delete system syslog file logFile",
# "delete system syslog global facility cron",
# "delete system syslog host 172.16.0.1",
# "delete system syslog user vyos",
# "set system syslog console facility all",
# "set system syslog console facility news level debug",
# "set system syslog file logFileNew",
# "set system syslog host 172.16.0.2 facility local5 level all",
# "set system syslog global archive file 10",
# "delete system syslog global archive size 111",
# "delete system syslog global marker",
# "delete system syslog global preserve-fqdn"
# ],
# After state:
# ------------
# vyos:~$show configuration commands | grep syslog
# set system syslog console facility all
# set system syslog console facility local7 level 'err'
# set system syslog console facility news level 'debug'
# set system syslog file logFileNew
# set system syslog global archive file '10'
# set system syslog host 172.16.0.2 facility local5 level 'all'
# Using state: replaced
# Before state:
# -------------
# vyos:~$show configuration commands | grep syslog
# set system syslog console facility all
# set system syslog console facility local7 level 'err'
# set system syslog console facility news level 'debug'
# set system syslog file logFileNew
# set system syslog global archive file '10'
# set system syslog host 172.16.0.2 facility local5 level 'all'
- name: Replace with the provided configuration
register: result
vyos.vyos.vyos_logging_global:
config:
console:
facilities:
- facility: local6
users:
- username: paul
facilities:
- facility: local7
severity: err
state: replaced
# Commands Fired:
# ---------------
# "commands": [
# "delete system syslog console facility all",
# "delete system syslog console facility local7",
# "delete system syslog console facility news",
# "delete system syslog file logFileNew",
# "delete system syslog global archive file 10",
# "delete system syslog host 172.16.0.2",
# "set system syslog console facility local6",
# "set system syslog user paul facility local7 level err"
# ],
# After state:
# ------------
# vyos:~$show configuration commands | grep syslog
# set system syslog console facility local6
# set system syslog user paul facility local7 level 'err'
# Using state: gathered
- name: Gather logging config
vyos.vyos.vyos_logging_global:
state: gathered
# Module Execution Result:
# ------------------------
# "gathered": {
# "console": {
# "facilities": [
# {
# "facility": "local6"
# },
# {
# "facility": "local7",
# "severity": "err"
# }
# ]
# },
# "files": [
# {
# "archive": {
# "file_num": 2
# },
# "facilities": [
# {
# "facility": "local6",
# "severity": "emerg"
# }
# ],
# "path": "logFile"
# }
# ],
# "global_params": {
# "archive": {
# "file_num": 2,
# "size": 111
# },
# "facilities": [
# {
# "facility": "cron",
# "severity": "debug"
# }
# ],
# "marker_interval": 111,
# "preserve_fqdn": true
# },
# "hosts": [
# {
# "facilities": [
# {
# "facility": "all",
# "protocol": "udp"
# },
# {
# "facility": "local7",
# "severity": "all"
# }
# ],
# "hostname": "172.16.0.1",
# "port": 223
# }
# ],
# "users": [
# {
# "facilities": [
# {
# "facility": "local7",
# "severity": "err"
# }
# ],
# "username": "paul"
# },
# {
# "facilities": [
# {
# "facility": "local7",
# "severity": "debug"
# }
# ],
# "username": "vyos"
# }
# ]
# },
# After state:
# ------------
# vyos:~$show configuration commands | grep syslog
# set system syslog console facility local6
# set system syslog console facility local7 level 'err'
# set system syslog file logFile archive file '2'
# set system syslog file logFile facility local6 level 'emerg'
# set system syslog global archive file '2'
# set system syslog global archive size '111'
# set system syslog global facility cron level 'debug'
# set system syslog global marker interval '111'
# set system syslog global preserve-fqdn
# set system syslog host 172.16.0.1 facility all protocol 'udp'
# set system syslog host 172.16.0.1 facility local7 level 'all'
# set system syslog host 172.16.0.1 port '223'
# set system syslog user paul facility local7 level 'err'
# set system syslog user vyos facility local7 level 'debug'
# Using state: rendered
- name: Render the provided configuration
vyos.vyos.vyos_logging_global:
config:
console:
facilities:
- facility: local7
severity: err
files:
- path: logFile
archive:
file_num: 2
facilities:
- facility: local6
severity: emerg
hosts:
- hostname: 172.16.0.1
facilities:
- facility: local7
severity: all
- facility: all
protocol: udp
port: 223
users:
- username: vyos
facilities:
- facility: local7
severity: debug
global_params:
archive:
file_num: 2
size: 111
facilities:
- facility: cron
severity: debug
marker_interval: 111
preserve_fqdn: true
state: rendered
# Module Execution Result:
# ------------------------
# "rendered": [
# "set system syslog console facility local7 level err",
# "set system syslog file logFile facility local6 level emerg",
# "set system syslog file logFile archive file 2",
# "set system syslog host 172.16.0.1 facility local7 level all",
# "set system syslog host 172.16.0.1 facility all protocol udp",
# "set system syslog host 172.16.0.1 port 223",
# "set system syslog user vyos facility local7 level debug",
# "set system syslog global facility cron level debug",
# "set system syslog global archive file 2",
# "set system syslog global archive size 111",
# "set system syslog global marker interval 111",
# "set system syslog global preserve-fqdn"
# ]
# Using state: parsed
# File: parsed.cfg
# ----------------
# set system syslog console facility local6
# set system syslog console facility local7 level 'err'
# set system syslog file logFile archive file '2'
# set system syslog file logFile facility local6 level 'emerg'
# set system syslog global archive file '2'
# set system syslog global archive size '111'
# set system syslog global facility cron level 'debug'
# set system syslog global marker interval '111'
# set system syslog global preserve-fqdn
# set system syslog host 172.16.0.1 facility all protocol 'udp'
# set system syslog host 172.16.0.1 facility local7 level 'all'
# set system syslog host 172.16.0.1 port '223'
# set system syslog user paul facility local7 level 'err'
# set system syslog user vyos facility local7 level 'debug'
- name: Parse the provided configuration
vyos.vyos.vyos_logging_global:
running_config: "{{ lookup('file', 'parsed_vyos.cfg') }}"
state: parsed
# Module Execution Result:
# ------------------------
# "parsed": {
# "console": {
# "facilities": [
# {
# "facility": "local6"
# },
# {
# "facility": "local7",
# "severity": "err"
# }
# ]
# },
# "files": [
# {
# "archive": {
# "file_num": 2
# },
# "facilities": [
# {
# "facility": "local6",
# "severity": "emerg"
# }
# ],
# "path": "logFile"
# }
# ],
# "global_params": {
# "archive": {
# "file_num": 2,
# "size": 111
# },
# "facilities": [
# {
# "facility": "cron",
# "severity": "debug"
# }
# ],
# "marker_interval": 111,
# "preserve_fqdn": true
# },
# "hosts": [
# {
# "facilities": [
# {
# "facility": "all",
# "protocol": "udp"
# },
# {
# "facility": "local7",
# "severity": "all"
# }
# ],
# "hostname": "172.16.0.1",
# "port": 223
# }
# ],
# "users": [
# {
# "facilities": [
# {
# "facility": "local7",
# "severity": "err"
# }
# ],
# "username": "paul"
# },
# {
# "facilities": [
# {
# "facility": "local7",
# "severity": "debug"
# }
# ],
# "username": "vyos"
# }
# ]
# }
# }
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** dictionary | when changed | The resulting configuration after module execution. **Sample:** This output will always be in the same format as the module argspec. |
| **before** dictionary | when state is *merged*, *replaced*, *overridden*, *deleted* or *purged* | The configuration prior to the module execution. **Sample:** This output will always be in the same format as the module argspec. |
| **commands** list / elements=string | when state is *merged*, *replaced*, *overridden*, *deleted* or *purged* | The set of commands pushed to the remote device. **Sample:** ['set system syslog console facility local7 level err', 'set system syslog host 172.16.0.1 port 223', 'set system syslog global archive size 111'] |
| **gathered** list / elements=string | when state is *gathered* | Facts about the network resource gathered from the remote device as structured data. **Sample:** This output will always be in the same format as the module argspec. |
| **parsed** list / elements=string | when state is *parsed* | The device native config provided in *running\_config* option parsed into structured data as per module argspec. **Sample:** This output will always be in the same format as the module argspec. |
| **rendered** list / elements=string | when state is *rendered* | The provided configuration in the task rendered in device-native format (offline). **Sample:** ['set system syslog host 172.16.0.1 port 223', 'set system syslog user vyos facility local7 level debug', 'set system syslog global facility cron level debug'] |
### Authors
* Sagar Paul (@KB-perByte)
| programming_docs |
ansible vyos.vyos.vyos_lldp – (deprecated, removed after 2022-06-01) Manage LLDP configuration on VyOS network devices vyos.vyos.vyos\_lldp – (deprecated, removed after 2022-06-01) Manage LLDP configuration on VyOS network devices
===============================================================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_lldp`.
New in version 1.0.0: of vyos.vyos
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Updated modules released with more functionality.
Alternative
vyos\_lldp\_global
Synopsis
--------
* This module provides declarative management of LLDP service on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **interfaces** list / elements=string | | Name of the interfaces. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
* enabled
* disabled
| State of the link aggregation group. |
Notes
-----
Note
* Tested against VYOS 1.1.7
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: Enable LLDP service
vyos.vyos.vyos_lldp:
state: present
- name: Disable LLDP service
vyos.vyos.vyos_lldp:
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always, except for the platforms that use Netconf transport to manage the device. | The list of configuration mode commands to send to the device **Sample:** ['set service lldp'] |
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Ricardo Carrillo Cruz (@rcarrillocruz)
ansible vyos.vyos.vyos_l3_interfaces – L3 interfaces resource module vyos.vyos.vyos\_l3\_interfaces – L3 interfaces resource module
==============================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_l3_interfaces`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages the L3 interface attributes on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | The provided L3 interfaces configuration. |
| | **ipv4** list / elements=dictionary | | List of IPv4 addresses of the interface. |
| | | **address** string | | IPv4 address of the interface. |
| | **ipv6** list / elements=dictionary | | List of IPv6 addresses of the interface. |
| | | **address** string | | IPv6 address of the interface. |
| | **name** string / required | | Full name of the interface, e.g. eth0, eth1. |
| | **vifs** list / elements=dictionary | | Virtual sub-interfaces L3 configurations. |
| | | **ipv4** list / elements=dictionary | | List of IPv4 addresses of the virtual interface. |
| | | | **address** string | | IPv4 address of the virtual interface. |
| | | **ipv6** list / elements=dictionary | | List of IPv6 addresses of the virtual interface. |
| | | | **address** string | | IPv6 address of the virtual interface. |
| | | **vlan\_id** integer | | Identifier for the virtual sub-interface. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep -e eth[2,3]**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* parsed
* gathered
* rendered
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos:~$ show configuration commands | grep -e eth[2,3]
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 vif 101
# set interfaces ethernet eth3 vif 102
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_l3_interfaces:
config:
- name: eth2
ipv4:
- address: 192.0.2.10/28
- address: 198.51.100.40/27
ipv6:
- address: 2001:db8:100::2/32
- address: 2001:db8:400::10/32
- name: eth3
ipv4:
- address: 203.0.113.65/26
vifs:
- vlan_id: 101
ipv4:
- address: 192.0.2.71/28
- address: 198.51.100.131/25
- vlan_id: 102
ipv6:
- address: 2001:db8:1000::5/38
- address: 2001:db8:1400::3/38
state: merged
# After state:
# -------------
#
# vyos:~$ show configuration commands | grep -e eth[2,3]
# set interfaces ethernet eth2 address '192.0.2.10/28'
# set interfaces ethernet eth2 address '198.51.100.40/27'
# set interfaces ethernet eth2 address '2001:db8:100::2/32'
# set interfaces ethernet eth2 address '2001:db8:400::10/32'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth3 address '203.0.113.65/26'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 vif 101 address '192.0.2.71/28'
# set interfaces ethernet eth3 vif 101 address '198.51.100.131/25'
# set interfaces ethernet eth3 vif 102 address '2001:db8:1000::5/38'
# set interfaces ethernet eth3 vif 102 address '2001:db8:1400::3/38'
# set interfaces ethernet eth3 vif 102 address '2001:db8:4000::2/34'
# Using replaced
#
# Before state:
# -------------
#
# vyos:~$ show configuration commands | grep eth
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:EA:0F:B9'
# set interfaces ethernet eth1 address '192.0.2.14/24'
# set interfaces ethernet eth2 address '192.0.2.10/24'
# set interfaces ethernet eth2 address '192.0.2.11/24'
# set interfaces ethernet eth2 address '2001:db8::10/32'
# set interfaces ethernet eth2 address '2001:db8::11/32'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth3 address '198.51.100.10/24'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 vif 101 address '198.51.100.130/25'
# set interfaces ethernet eth3 vif 101 address '198.51.100.131/25'
# set interfaces ethernet eth3 vif 102 address '2001:db8:4000::3/34'
# set interfaces ethernet eth3 vif 102 address '2001:db8:4000::2/34'
#
- name: Replace device configurations of listed interfaces with provided configurations
vyos.vyos.vyos_l3_interfaces:
config:
- name: eth2
ipv4:
- address: 192.0.2.10/24
- name: eth3
ipv6:
- address: 2001:db8::11/32
state: replaced
# After state:
# -------------
#
# vyos:~$ show configuration commands | grep eth
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:EA:0F:B9'
# set interfaces ethernet eth1 address '192.0.2.14/24'
# set interfaces ethernet eth2 address '192.0.2.10/24'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 address '2001:db8::11/32'
# set interfaces ethernet eth3 vif 101
# set interfaces ethernet eth3 vif 102
# Using overridden
#
# Before state
# --------------
#
# vyos@vyos-appliance:~$ show configuration commands | grep eth
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:EA:0F:B9'
# set interfaces ethernet eth1 address '192.0.2.14/24'
# set interfaces ethernet eth2 address '192.0.2.10/24'
# set interfaces ethernet eth2 address '192.0.2.11/24'
# set interfaces ethernet eth2 address '2001:db8::10/32'
# set interfaces ethernet eth2 address '2001:db8::11/32'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth3 address '198.51.100.10/24'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 vif 101 address '198.51.100.130/25'
# set interfaces ethernet eth3 vif 101 address '198.51.100.131/25'
# set interfaces ethernet eth3 vif 102 address '2001:db8:4000::3/34'
# set interfaces ethernet eth3 vif 102 address '2001:db8:4000::2/34'
- name: Overrides all device configuration with provided configuration
vyos.vyos.vyos_l3_interfaces:
config:
- name: eth0
ipv4:
- address: dhcp
ipv6:
- address: dhcpv6
state: overridden
# After state
# ------------
#
# vyos@vyos-appliance:~$ show configuration commands | grep eth
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 address 'dhcpv6'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:EA:0F:B9'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 vif 101
# set interfaces ethernet eth3 vif 102
# Using deleted
#
# Before state
# -------------
# vyos@vyos-appliance:~$ show configuration commands | grep eth
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:EA:0F:B9'
# set interfaces ethernet eth1 address '192.0.2.14/24'
# set interfaces ethernet eth2 address '192.0.2.10/24'
# set interfaces ethernet eth2 address '192.0.2.11/24'
# set interfaces ethernet eth2 address '2001:db8::10/32'
# set interfaces ethernet eth2 address '2001:db8::11/32'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth3 address '198.51.100.10/24'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 vif 101 address '198.51.100.130/25'
# set interfaces ethernet eth3 vif 101 address '198.51.100.131/25'
# set interfaces ethernet eth3 vif 102 address '2001:db8:4000::3/34'
# set interfaces ethernet eth3 vif 102 address '2001:db8:4000::2/34'
- name: Delete L3 attributes of given interfaces (Note - This won't delete the interface
itself)
vyos.vyos.vyos_l3_interfaces:
config:
- name: eth1
- name: eth2
- name: eth3
state: deleted
# After state
# ------------
# vyos@vyos-appliance:~$ show configuration commands | grep eth
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:f3:6c:b5'
# set interfaces ethernet eth0 smp_affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:ad:ef:65'
# set interfaces ethernet eth1 smp_affinity 'auto'
# set interfaces ethernet eth2 hw-id '08:00:27:ab:4e:79'
# set interfaces ethernet eth2 smp_affinity 'auto'
# set interfaces ethernet eth3 hw-id '08:00:27:17:3c:85'
# set interfaces ethernet eth3 smp_affinity 'auto'
# Using gathered
#
# Before state:
# -------------
#
# vyos:~$ show configuration commands | grep -e eth[2,3,0]
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:50:5e:19'
# set interfaces ethernet eth0 smp_affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 address '192.0.2.14/24'
# set interfaces ethernet eth2 address '192.0.2.11/24'
# set interfaces ethernet eth2 address '192.0.2.10/24'
# set interfaces ethernet eth2 address '2001:db8::10/32'
# set interfaces ethernet eth2 address '2001:db8::12/32'
#
- name: Gather listed l3 interfaces with provided configurations
vyos.vyos.vyos_l3_interfaces:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "ipv4": [
# {
# "address": "192.0.2.11/24"
# },
# {
# "address": "192.0.2.10/24"
# }
# ],
# "ipv6": [
# {
# "address": "2001:db8::10/32"
# },
# {
# "address": "2001:db8::12/32"
# }
# ],
# "name": "eth2"
# },
# {
# "ipv4": [
# {
# "address": "192.0.2.14/24"
# }
# ],
# "name": "eth1"
# },
# {
# "ipv4": [
# {
# "address": "dhcp"
# }
# ],
# "name": "eth0"
# }
# ]
#
#
# After state:
# -------------
#
# vyos:~$ show configuration commands | grep -e eth[2,3]
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:50:5e:19'
# set interfaces ethernet eth0 smp_affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 address '192.0.2.14/24'
# set interfaces ethernet eth2 address '192.0.2.11/24'
# set interfaces ethernet eth2 address '192.0.2.10/24'
# set interfaces ethernet eth2 address '2001:db8::10/32'
# set interfaces ethernet eth2 address '2001:db8::12/32'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_l3_interfaces:
config:
- name: eth1
ipv4:
- address: 192.0.2.14/24
- name: eth2
ipv4:
- address: 192.0.2.10/24
- address: 192.0.2.11/24
ipv6:
- address: 2001:db8::10/32
- address: 2001:db8::12/32
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set interfaces ethernet eth1 address '192.0.2.14/24'",
# "set interfaces ethernet eth2 address '192.0.2.11/24'",
# "set interfaces ethernet eth2 address '192.0.2.10/24'",
# "set interfaces ethernet eth2 address '2001:db8::10/32'",
# "set interfaces ethernet eth2 address '2001:db8::12/32'"
# ]
# Using parsed
#
#
- name: parse the provided running configuration
vyos.vyos.vyos_l3_interfaces:
running_config:
"set interfaces ethernet eth0 address 'dhcp'
set interfaces ethernet eth1 address '192.0.2.14/24'
set interfaces ethernet eth2 address '192.0.2.10/24'
set interfaces ethernet eth2 address '192.0.2.11/24'
set interfaces ethernet eth2 address '2001:db8::10/32'
set interfaces ethernet eth2 address '2001:db8::12/32'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "ipv4": [
# {
# "address": "192.0.2.10/24"
# },
# {
# "address": "192.0.2.11/24"
# }
# ],
# "ipv6": [
# {
# "address": "2001:db8::10/32"
# },
# {
# "address": "2001:db8::12/32"
# }
# ],
# "name": "eth2"
# },
# {
# "ipv4": [
# {
# "address": "192.0.2.14/24"
# }
# ],
# "name": "eth1"
# },
# {
# "ipv4": [
# {
# "address": "dhcp"
# }
# ],
# "name": "eth0"
# }
# ]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['set interfaces ethernet eth1 192.0.2.14/2', 'set interfaces ethernet eth3 vif 101 address 198.51.100.130/25'] |
### Authors
* Nilashish Chakraborty (@NilashishC)
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_firewall_rules – FIREWALL rules resource module vyos.vyos.vyos\_firewall\_rules – FIREWALL rules resource module
================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_firewall_rules`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages firewall rule-set attributes on VyOS devices
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A dictionary of Firewall rule-set options. |
| | **afi** string / required | **Choices:*** ipv4
* ipv6
| Specifies the type of rule-set. |
| | **rule\_sets** list / elements=dictionary | | The Firewall rule-set list. |
| | | **default\_action** string | **Choices:*** drop
* reject
* accept
| Default action for rule-set. drop (Drop if no prior rules are hit (default)) reject (Drop and notify source if no prior rules are hit) accept (Accept if no prior rules are hit) |
| | | **description** string | | Rule set description. |
| | | **enable\_default\_log** boolean | **Choices:*** no
* yes
| Option to log packets hitting default-action. |
| | | **name** string | | Firewall rule set name. |
| | | **rules** list / elements=dictionary | | A dictionary that specifies the rule-set configurations. |
| | | | **action** string | **Choices:*** drop
* reject
* accept
* inspect
| Specifying the action. |
| | | | **description** string | | Description of this rule. |
| | | | **destination** dictionary | | Specifying the destination parameters. |
| | | | | **address** string | | Destination ip address subnet or range. IPv4/6 address, subnet or range to match. Match everything except the specified address, subnet or range. Destination ip address subnet or range. |
| | | | | **group** dictionary | | Destination group. |
| | | | | | **address\_group** string | | Group of addresses. |
| | | | | | **network\_group** string | | Group of networks. |
| | | | | | **port\_group** string | | Group of ports. |
| | | | | **port** string | | Multiple destination ports can be specified as a comma-separated list. The whole list can also be "negated" using '!'. For example:'!22,telnet,http,123,1001-1005'. |
| | | | **disabled** boolean | **Choices:*** no
* yes
| Option to disable firewall rule. |
| | | | **fragment** string | **Choices:*** match-frag
* match-non-frag
| IP fragment match. |
| | | | **icmp** dictionary | | ICMP type and code information. |
| | | | | **code** integer | | ICMP code. |
| | | | | **type** integer | | ICMP type. |
| | | | | **type\_name** string | **Choices:*** any
* echo-reply
* destination-unreachable
* network-unreachable
* host-unreachable
* protocol-unreachable
* port-unreachable
* fragmentation-needed
* source-route-failed
* network-unknown
* host-unknown
* network-prohibited
* host-prohibited
* TOS-network-unreachable
* TOS-host-unreachable
* communication-prohibited
* host-precedence-violation
* precedence-cutoff
* source-quench
* redirect
* network-redirect
* host-redirect
* TOS-network-redirect
* TOS-host-redirect
* echo-request
* router-advertisement
* router-solicitation
* time-exceeded
* ttl-zero-during-transit
* ttl-zero-during-reassembly
* parameter-problem
* ip-header-bad
* required-option-missing
* timestamp-request
* timestamp-reply
* address-mask-request
* address-mask-reply
* ping
* pong
* ttl-exceeded
| ICMP type-name. |
| | | | **ipsec** string | **Choices:*** match-ipsec
* match-none
| Inbound ip sec packets. |
| | | | **limit** dictionary | | Rate limit using a token bucket filter. |
| | | | | **burst** integer | | Maximum number of packets to allow in excess of rate. |
| | | | | **rate** dictionary | | format for rate (integer/time unit). any one of second, minute, hour or day may be used to specify time unit. eg. 1/second implies rule to be matched at an average of once per second. |
| | | | | | **number** integer | | This is the integer value. |
| | | | | | **unit** string | | This is the time unit. |
| | | | **number** integer / required | | Rule number. |
| | | | **p2p** list / elements=dictionary | | P2P application packets. |
| | | | | **application** string | **Choices:*** all
* applejuice
* bittorrent
* directconnect
* edonkey
* gnutella
* kazaa
| Name of the application. |
| | | | **protocol** string | | Protocol to match (protocol name in /etc/protocols or protocol number or all). <text> IP protocol name from /etc/protocols (e.g. "tcp" or "udp"). <0-255> IP protocol number. tcp\_udp Both TCP and UDP. all All IP protocols. (!)All IP protocols except for the specified name or number. |
| | | | **recent** dictionary | | Parameters for matching recently seen sources. |
| | | | | **count** integer | | Source addresses seen more than N times. |
| | | | | **time** integer | | Source addresses seen in the last N seconds. |
| | | | **source** dictionary | | Source parameters. |
| | | | | **address** string | | Source ip address subnet or range. IPv4/6 address, subnet or range to match. Match everything except the specified address, subnet or range. Source ip address subnet or range. |
| | | | | **group** dictionary | | Source group. |
| | | | | | **address\_group** string | | Group of addresses. |
| | | | | | **network\_group** string | | Group of networks. |
| | | | | | **port\_group** string | | Group of ports. |
| | | | | **mac\_address** string | | <MAC address> MAC address to match. <!MAC address> Match everything except the specified MAC address. |
| | | | | **port** string | | Multiple source ports can be specified as a comma-separated list. The whole list can also be "negated" using '!'. For example:'!22,telnet,http,123,1001-1005'. |
| | | | **state** dictionary | | Session state. |
| | | | | **established** boolean | **Choices:*** no
* yes
| Established state. |
| | | | | **invalid** boolean | **Choices:*** no
* yes
| Invalid state. |
| | | | | **new** boolean | **Choices:*** no
* yes
| New state. |
| | | | | **related** boolean | **Choices:*** no
* yes
| Related state. |
| | | | **tcp** dictionary | | TCP flags to match. |
| | | | | **flags** string | | TCP flags to be matched. |
| | | | **time** dictionary | | Time to match rule. |
| | | | | **monthdays** string | | Monthdays to match rule on. |
| | | | | **startdate** string | | Date to start matching rule. |
| | | | | **starttime** string | | Time of day to start matching rule. |
| | | | | **stopdate** string | | Date to stop matching rule. |
| | | | | **stoptime** string | | Time of day to stop matching rule. |
| | | | | **utc** boolean | **Choices:*** no
* yes
| Interpret times for startdate, stopdate, starttime and stoptime to be UTC. |
| | | | | **weekdays** string | | Weekdays to match rule on. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep firewall**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* gathered
* rendered
* parsed
| The state the configuration should be left in |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using deleted to delete firewall rules based on rule-set name
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall name Downlink default-action 'accept'
# set firewall name Downlink description 'IPv4 INBOUND rule set'
# set firewall name Downlink rule 501 action 'accept'
# set firewall name Downlink rule 501 description 'Rule 501 is configured by Ansible'
# set firewall name Downlink rule 501 ipsec 'match-ipsec'
# set firewall name Downlink rule 502 action 'reject'
# set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'
# set firewall name Downlink rule 502 ipsec 'match-ipsec'
#
- name: Delete attributes of given firewall rules.
vyos.vyos.vyos_firewall_rules:
config:
- afi: ipv4
rule_sets:
- name: Downlink
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "Downlink",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 501 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 501
# },
# {
# "action": "reject",
# "description": "Rule 502 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 502
# }
# ]
# }
# ]
# }
# ]
# "commands": [
# "delete firewall name Downlink"
# ]
#
# "after": []
# After state
# ------------
# vyos@vyos# run show configuration commands | grep firewall
# set firewall group address-group 'inbound'
# Using deleted to delete firewall rules based on afi
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name UPLINK default-action 'accept'
# set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
# set firewall ipv6-name UPLINK rule 1 action 'accept'
# set firewall ipv6-name UPLINK rule 1
# set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec'
# set firewall ipv6-name UPLINK rule 2 action 'accept'
# set firewall ipv6-name UPLINK rule 2
# set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec'
# set firewall group address-group 'inbound'
# set firewall name Downlink default-action 'accept'
# set firewall name Downlink description 'IPv4 INBOUND rule set'
# set firewall name Downlink rule 501 action 'accept'
# set firewall name Downlink rule 501 description 'Rule 501 is configured by Ansible'
# set firewall name Downlink rule 501 ipsec 'match-ipsec'
# set firewall name Downlink rule 502 action 'reject'
# set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'
# set firewall name Downlink rule 502 ipsec 'match-ipsec'
#
- name: Delete attributes of given firewall rules.
vyos.vyos.vyos_firewall_rules:
config:
- afi: ipv4
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "afi": "ipv6",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "This is ipv6 specific rule-set",
# "name": "UPLINK",
# "rules": [
# {
# "action": "accept",
# "description": "Fwipv6-Rule 1 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 1
# },
# {
# "action": "accept",
# "description": "Fwipv6-Rule 2 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 2
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "Downlink",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 501 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 501
# },
# {
# "action": "reject",
# "description": "Rule 502 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 502
# }
# ]
# }
# ]
# }
# ]
# "commands": [
# "delete firewall name"
# ]
#
# "after": []
# After state
# ------------
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name UPLINK default-action 'accept'
# set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
# set firewall ipv6-name UPLINK rule 1 action 'accept'
# set firewall ipv6-name UPLINK rule 1
# set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec'
# set firewall ipv6-name UPLINK rule 2 action 'accept'
# set firewall ipv6-name UPLINK rule 2
# set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec'
# Using deleted to delete all the the firewall rules when provided config is empty
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall name Downlink default-action 'accept'
# set firewall name Downlink description 'IPv4 INBOUND rule set'
# set firewall name Downlink rule 501 action 'accept'
# set firewall name Downlink rule 501 description 'Rule 501 is configured by Ansible'
# set firewall name Downlink rule 501 ipsec 'match-ipsec'
# set firewall name Downlink rule 502 action 'reject'
# set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'
# set firewall name Downlink rule 502 ipsec 'match-ipsec'
#
- name: Delete attributes of given firewall rules.
vyos.vyos.vyos_firewall_rules:
config:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "Downlink",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 501 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 501
# },
# {
# "action": "reject",
# "description": "Rule 502 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 502
# }
# ]
# }
# ]
# }
# ]
# "commands": [
# "delete firewall name"
# ]
#
# "after": []
# After state
# ------------
# vyos@vyos# run show configuration commands | grep firewall
# set firewall group address-group 'inbound'
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep firewall
# set firewall group address-group 'inbound'
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_firewall_rules:
config:
- afi: ipv6
rule_sets:
- name: UPLINK
description: This is ipv6 specific rule-set
default_action: accept
rules:
- number: 1
action: accept
description: Fwipv6-Rule 1 is configured by Ansible
ipsec: match-ipsec
- number: 2
action: accept
description: Fwipv6-Rule 2 is configured by Ansible
ipsec: match-ipsec
- afi: ipv4
rule_sets:
- name: INBOUND
description: IPv4 INBOUND rule set
default_action: accept
rules:
- number: 101
action: accept
description: Rule 101 is configured by Ansible
ipsec: match-ipsec
- number: 102
action: reject
description: Rule 102 is configured by Ansible
ipsec: match-ipsec
- number: 103
action: accept
description: Rule 103 is configured by Ansible
destination:
group:
address_group: inbound
source:
address: 192.0.2.0
state:
established: true
new: false
invalid: false
related: true
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": []
#
# "commands": [
# "set firewall ipv6-name UPLINK default-action 'accept'",
# "set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'",
# "set firewall ipv6-name UPLINK rule 1 action 'accept'",
# "set firewall ipv6-name UPLINK rule 1",
# "set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible'",
# "set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec'",
# "set firewall ipv6-name UPLINK rule 2 action 'accept'",
# "set firewall ipv6-name UPLINK rule 2",
# "set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible'",
# "set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec'",
# "set firewall name INBOUND default-action 'accept'",
# "set firewall name INBOUND description 'IPv4 INBOUND rule set'",
# "set firewall name INBOUND rule 101 action 'accept'",
# "set firewall name INBOUND rule 101",
# "set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'",
# "set firewall name INBOUND rule 101 ipsec 'match-ipsec'",
# "set firewall name INBOUND rule 102 action 'reject'",
# "set firewall name INBOUND rule 102",
# "set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible'",
# "set firewall name INBOUND rule 102 ipsec 'match-ipsec'",
# "set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible'",
# "set firewall name INBOUND rule 103 destination group address-group inbound",
# "set firewall name INBOUND rule 103",
# "set firewall name INBOUND rule 103 source address 192.0.2.0",
# "set firewall name INBOUND rule 103 state established enable",
# "set firewall name INBOUND rule 103 state related enable",
# "set firewall name INBOUND rule 103 state invalid disable",
# "set firewall name INBOUND rule 103 state new disable",
# "set firewall name INBOUND rule 103 action 'accept'"
# ]
#
# "after": [
# {
# "afi": "ipv6",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "This is ipv6 specific rule-set",
# "name": "UPLINK",
# "rules": [
# {
# "action": "accept",
# "description": "Fwipv6-Rule 1 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 1
# },
# {
# "action": "accept",
# "description": "Fwipv6-Rule 2 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 2
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "INBOUND",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 101 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 101
# },
# {
# "action": "reject",
# "description": "Rule 102 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 102
# },
# {
# "action": "accept",
# "description": "Rule 103 is configured by Ansible",
# "destination": {
# "group": {
# "address_group": "inbound"
# }
# },
# "number": 103,
# "source": {
# "address": "192.0.2.0"
# },
# "state": {
# "established": true,
# "invalid": false,
# "new": false,
# "related": true
# }
# }
# ]
# }
# ]
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall ipv6-name UPLINK default-action 'accept'
# set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
# set firewall ipv6-name UPLINK rule 1 action 'accept'
# set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec'
# set firewall ipv6-name UPLINK rule 2 action 'accept'
# set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec'
# set firewall name INBOUND default-action 'accept'
# set firewall name INBOUND description 'IPv4 INBOUND rule set'
# set firewall name INBOUND rule 101 action 'accept'
# set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'
# set firewall name INBOUND rule 101 ipsec 'match-ipsec'
# set firewall name INBOUND rule 102 action 'reject'
# set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible'
# set firewall name INBOUND rule 102 ipsec 'match-ipsec'
# set firewall name INBOUND rule 103 action 'accept'
# set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible'
# set firewall name INBOUND rule 103 destination group address-group 'inbound'
# set firewall name INBOUND rule 103 source address '192.0.2.0'
# set firewall name INBOUND rule 103 state established 'enable'
# set firewall name INBOUND rule 103 state invalid 'disable'
# set firewall name INBOUND rule 103 state new 'disable'
# set firewall name INBOUND rule 103 state related 'enable'
# Using replaced
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall ipv6-name UPLINK default-action 'accept'
# set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
# set firewall ipv6-name UPLINK rule 1 action 'accept'
# set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec'
# set firewall ipv6-name UPLINK rule 2 action 'accept'
# set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec'
# set firewall name INBOUND default-action 'accept'
# set firewall name INBOUND description 'IPv4 INBOUND rule set'
# set firewall name INBOUND rule 101 action 'accept'
# set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'
# set firewall name INBOUND rule 101 ipsec 'match-ipsec'
# set firewall name INBOUND rule 102 action 'reject'
# set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible'
# set firewall name INBOUND rule 102 ipsec 'match-ipsec'
# set firewall name INBOUND rule 103 action 'accept'
# set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible'
# set firewall name INBOUND rule 103 destination group address-group 'inbound'
# set firewall name INBOUND rule 103 source address '192.0.2.0'
# set firewall name INBOUND rule 103 state established 'enable'
# set firewall name INBOUND rule 103 state invalid 'disable'
# set firewall name INBOUND rule 103 state new 'disable'
# set firewall name INBOUND rule 103 state related 'enable'
#
- name: Replace device configurations of listed firewall rules with provided configurations
vyos.vyos.vyos_firewall_rules:
config:
- afi: ipv6
rule_sets:
- name: UPLINK
description: This is ipv6 specific rule-set
default_action: accept
- afi: ipv4
rule_sets:
- name: INBOUND
description: IPv4 INBOUND rule set
default_action: accept
rules:
- number: 101
action: accept
description: Rule 101 is configured by Ansible
ipsec: match-ipsec
- number: 104
action: reject
description: Rule 104 is configured by Ansible
ipsec: match-none
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "afi": "ipv6",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "This is ipv6 specific rule-set",
# "name": "UPLINK",
# "rules": [
# {
# "action": "accept",
# "description": "Fwipv6-Rule 1 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 1
# },
# {
# "action": "accept",
# "description": "Fwipv6-Rule 2 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 2
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "INBOUND",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 101 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 101
# },
# {
# "action": "reject",
# "description": "Rule 102 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 102
# },
# {
# "action": "accept",
# "description": "Rule 103 is configured by Ansible",
# "destination": {
# "group": {
# "address_group": "inbound"
# }
# },
# "number": 103,
# "source": {
# "address": "192.0.2.0"
# },
# "state": {
# "established": true,
# "invalid": false,
# "new": false,
# "related": true
# }
# }
# ]
# }
# ]
# }
# ]
#
# "commands": [
# "delete firewall ipv6-name UPLINK rule 1",
# "delete firewall ipv6-name UPLINK rule 2",
# "delete firewall name INBOUND rule 102",
# "delete firewall name INBOUND rule 103",
# "set firewall name INBOUND rule 104 action 'reject'",
# "set firewall name INBOUND rule 104 description 'Rule 104 is configured by Ansible'",
# "set firewall name INBOUND rule 104",
# "set firewall name INBOUND rule 104 ipsec 'match-none'"
# ]
#
# "after": [
# {
# "afi": "ipv6",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "This is ipv6 specific rule-set",
# "name": "UPLINK"
# }
# ]
# },
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "INBOUND",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 101 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 101
# },
# {
# "action": "reject",
# "description": "Rule 104 is configured by Ansible",
# "ipsec": "match-none",
# "number": 104
# }
# ]
# }
# ]
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall ipv6-name UPLINK default-action 'accept'
# set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
# set firewall name INBOUND default-action 'accept'
# set firewall name INBOUND description 'IPv4 INBOUND rule set'
# set firewall name INBOUND rule 101 action 'accept'
# set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'
# set firewall name INBOUND rule 101 ipsec 'match-ipsec'
# set firewall name INBOUND rule 104 action 'reject'
# set firewall name INBOUND rule 104 description 'Rule 104 is configured by Ansible'
# set firewall name INBOUND rule 104 ipsec 'match-none'
# Using overridden
#
# Before state
# --------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall ipv6-name UPLINK default-action 'accept'
# set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
# set firewall name INBOUND default-action 'accept'
# set firewall name INBOUND description 'IPv4 INBOUND rule set'
# set firewall name INBOUND rule 101 action 'accept'
# set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'
# set firewall name INBOUND rule 101 ipsec 'match-ipsec'
# set firewall name INBOUND rule 104 action 'reject'
# set firewall name INBOUND rule 104 description 'Rule 104 is configured by Ansible'
# set firewall name INBOUND rule 104 ipsec 'match-none'
#
- name: Overrides all device configuration with provided configuration
vyos.vyos.vyos_firewall_rules:
config:
- afi: ipv4
rule_sets:
- name: Downlink
description: IPv4 INBOUND rule set
default_action: accept
rules:
- number: 501
action: accept
description: Rule 501 is configured by Ansible
ipsec: match-ipsec
- number: 502
action: reject
description: Rule 502 is configured by Ansible
ipsec: match-ipsec
state: overridden
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "afi": "ipv6",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "This is ipv6 specific rule-set",
# "name": "UPLINK"
# }
# ]
# },
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "INBOUND",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 101 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 101
# },
# {
# "action": "reject",
# "description": "Rule 104 is configured by Ansible",
# "ipsec": "match-none",
# "number": 104
# }
# ]
# }
# ]
# }
# ]
#
# "commands": [
# "delete firewall ipv6-name UPLINK",
# "delete firewall name INBOUND",
# "set firewall name Downlink default-action 'accept'",
# "set firewall name Downlink description 'IPv4 INBOUND rule set'",
# "set firewall name Downlink rule 501 action 'accept'",
# "set firewall name Downlink rule 501",
# "set firewall name Downlink rule 501 description 'Rule 501 is configured by Ansible'",
# "set firewall name Downlink rule 501 ipsec 'match-ipsec'",
# "set firewall name Downlink rule 502 action 'reject'",
# "set firewall name Downlink rule 502",
# "set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'",
# "set firewall name Downlink rule 502 ipsec 'match-ipsec'"
#
#
# "after": [
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "Downlink",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 501 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 501
# },
# {
# "action": "reject",
# "description": "Rule 502 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 502
# }
# ]
# }
# ]
# }
# ]
#
#
# After state
# ------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall name Downlink default-action 'accept'
# set firewall name Downlink description 'IPv4 INBOUND rule set'
# set firewall name Downlink rule 501 action 'accept'
# set firewall name Downlink rule 501 description 'Rule 501 is configured by Ansible'
# set firewall name Downlink rule 501 ipsec 'match-ipsec'
# set firewall name Downlink rule 502 action 'reject'
# set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'
# set firewall name Downlink rule 502 ipsec 'match-ipsec'
# Using gathered
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall ipv6-name UPLINK default-action 'accept'
# set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
# set firewall ipv6-name UPLINK rule 1 action 'accept'
# set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec'
# set firewall ipv6-name UPLINK rule 2 action 'accept'
# set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec'
# set firewall name INBOUND default-action 'accept'
# set firewall name INBOUND description 'IPv4 INBOUND rule set'
# set firewall name INBOUND rule 101 action 'accept'
# set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'
# set firewall name INBOUND rule 101 ipsec 'match-ipsec'
# set firewall name INBOUND rule 102 action 'reject'
# set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible'
# set firewall name INBOUND rule 102 ipsec 'match-ipsec'
# set firewall name INBOUND rule 103 action 'accept'
# set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible'
# set firewall name INBOUND rule 103 destination group address-group 'inbound'
# set firewall name INBOUND rule 103 source address '192.0.2.0'
# set firewall name INBOUND rule 103 state established 'enable'
# set firewall name INBOUND rule 103 state invalid 'disable'
# set firewall name INBOUND rule 103 state new 'disable'
# set firewall name INBOUND rule 103 state related 'enable'
#
- name: Gather listed firewall rules with provided configurations
vyos.vyos.vyos_firewall_rules:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "afi": "ipv6",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "This is ipv6 specific rule-set",
# "name": "UPLINK",
# "rules": [
# {
# "action": "accept",
# "description": "Fwipv6-Rule 1 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 1
# },
# {
# "action": "accept",
# "description": "Fwipv6-Rule 2 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 2
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "INBOUND",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 101 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 101
# },
# {
# "action": "reject",
# "description": "Rule 102 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 102
# },
# {
# "action": "accept",
# "description": "Rule 103 is configured by Ansible",
# "destination": {
# "group": {
# "address_group": "inbound"
# }
# },
# "number": 103,
# "source": {
# "address": "192.0.2.0"
# },
# "state": {
# "established": true,
# "invalid": false,
# "new": false,
# "related": true
# }
# }
# ]
# }
# ]
# }
# ]
#
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall group address-group 'inbound'
# set firewall ipv6-name UPLINK default-action 'accept'
# set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
# set firewall ipv6-name UPLINK rule 1 action 'accept'
# set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec'
# set firewall ipv6-name UPLINK rule 2 action 'accept'
# set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible'
# set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec'
# set firewall name INBOUND default-action 'accept'
# set firewall name INBOUND description 'IPv4 INBOUND rule set'
# set firewall name INBOUND rule 101 action 'accept'
# set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'
# set firewall name INBOUND rule 101 ipsec 'match-ipsec'
# set firewall name INBOUND rule 102 action 'reject'
# set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible'
# set firewall name INBOUND rule 102 ipsec 'match-ipsec'
# set firewall name INBOUND rule 103 action 'accept'
# set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible'
# set firewall name INBOUND rule 103 destination group address-group 'inbound'
# set firewall name INBOUND rule 103 source address '192.0.2.0'
# set firewall name INBOUND rule 103 state established 'enable'
# set firewall name INBOUND rule 103 state invalid 'disable'
# set firewall name INBOUND rule 103 state new 'disable'
# set firewall name INBOUND rule 103 state related 'enable'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_firewall_rules:
config:
- afi: ipv6
rule_sets:
- name: UPLINK
description: This is ipv6 specific rule-set
default_action: accept
- afi: ipv4
rule_sets:
- name: INBOUND
description: IPv4 INBOUND rule set
default_action: accept
rules:
- number: 101
action: accept
description: Rule 101 is configured by Ansible
ipsec: match-ipsec
- number: 102
action: reject
description: Rule 102 is configured by Ansible
ipsec: match-ipsec
- number: 103
action: accept
description: Rule 103 is configured by Ansible
destination:
group:
address_group: inbound
source:
address: 192.0.2.0
state:
established: true
new: false
invalid: false
related: true
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set firewall ipv6-name UPLINK default-action 'accept'",
# "set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'",
# "set firewall name INBOUND default-action 'accept'",
# "set firewall name INBOUND description 'IPv4 INBOUND rule set'",
# "set firewall name INBOUND rule 101 action 'accept'",
# "set firewall name INBOUND rule 101",
# "set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'",
# "set firewall name INBOUND rule 101 ipsec 'match-ipsec'",
# "set firewall name INBOUND rule 102 action 'reject'",
# "set firewall name INBOUND rule 102",
# "set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible'",
# "set firewall name INBOUND rule 102 ipsec 'match-ipsec'",
# "set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible'",
# "set firewall name INBOUND rule 103 destination group address-group inbound",
# "set firewall name INBOUND rule 103",
# "set firewall name INBOUND rule 103 source address 192.0.2.0",
# "set firewall name INBOUND rule 103 state established enable",
# "set firewall name INBOUND rule 103 state related enable",
# "set firewall name INBOUND rule 103 state invalid disable",
# "set firewall name INBOUND rule 103 state new disable",
# "set firewall name INBOUND rule 103 action 'accept'"
# ]
# Using parsed
#
#
- name: Parsed the provided input commands.
vyos.vyos.vyos_firewall_rules:
running_config:
"set firewall group address-group 'inbound'
set firewall name Downlink default-action 'accept'
set firewall name Downlink description 'IPv4 INBOUND rule set'
set firewall name Downlink rule 501 action 'accept'
set firewall name Downlink rule 501 description 'Rule 501 is configured by Ansible'
set firewall name Downlink rule 501 ipsec 'match-ipsec'
set firewall name Downlink rule 502 action 'reject'
set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'
set firewall name Downlink rule 502 ipsec 'match-ipsec'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "Downlink",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 501 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 501
# },
# {
# "action": "reject",
# "description": "Rule 502 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 502
# }
# ]
# }
# ]
# }
# ]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ["set firewall name Downlink default-action 'accept'", "set firewall name Downlink description 'IPv4 INBOUND rule set'", "set firewall name Downlink rule 501 action 'accept'", "set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'", "set firewall name Downlink rule 502 ipsec 'match-ipsec'"] |
### Authors
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_command – Run one or more commands on VyOS devices vyos.vyos.vyos\_command – Run one or more commands on VyOS devices
==================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_command`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The command module allows running one or more commands on remote devices running VyOS. This module can also be introspected to validate key parameters before returning successfully. If the conditional statements are not met in the wait period, the task fails.
* Certain `show` commands in VyOS produce many lines of output and use a custom pager that can cause this module to hang. If the value of the environment variable `ANSIBLE_VYOS_TERMINAL_LENGTH` is not set, the default number of 10000 is used.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **commands** list / elements=raw / required | | The ordered set of commands to execute on the remote device running VyOS. The output from the command execution is returned to the playbook. If the *wait\_for* argument is provided, the module is not returned until the condition is satisfied or the number of retries has been exceeded. If a command sent to the device requires answering a prompt, it is possible to pass a dict containing command, answer and prompt. Common answers are 'y' or "\r" (carriage return, must be double quotes). Refer below examples. |
| **interval** integer | **Default:**1 | Configures the interval in seconds to wait between *retries* of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again. |
| **match** string | **Choices:*** any
* **all** ←
| The *match* argument is used in conjunction with the *wait\_for* argument to specify the match policy. Valid values are `all` or `any`. If the value is set to `all` then all conditionals in the wait\_for must be satisfied. If the value is set to `any` then only one of the values must be satisfied. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **retries** integer | **Default:**10 | Specifies the number of retries a command should be tried before it is considered failed. The command is run on the target device every retry and evaluated against the *wait\_for* conditionals. |
| **wait\_for** list / elements=string | | Specifies what to evaluate from the output of the command and what conditionals to apply. This argument will cause the task to wait for a particular conditional to be true before moving forward. If the conditional is not true by the configured *retries*, the task fails. See examples.
aliases: waitfor |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* Running `show system boot-messages all` will cause the module to hang since VyOS is using a custom pager setting to display the output of that command.
* If a command sent to the device requires answering a prompt, it is possible to pass a dict containing *command*, *answer* and *prompt*. See examples.
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: show configuration on ethernet devices eth0 and eth1
vyos.vyos.vyos_command:
commands:
- show interfaces ethernet {{ item }}
with_items:
- eth0
- eth1
- name: run multiple commands and check if version output contains specific version
string
vyos.vyos.vyos_command:
commands:
- show version
- show hardware cpu
wait_for:
- result[0] contains 'VyOS 1.1.7'
- name: run command that requires answering a prompt
vyos.vyos.vyos_command:
commands:
- command: rollback 1
prompt: Proceed with reboot? [confirm][y]
answer: y
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **failed\_conditions** list / elements=string | failed | The list of conditionals that have failed **Sample:** ['...', '...'] |
| **stdout** list / elements=string | always apart from low level errors (such as action plugin) | The set of responses from the commands **Sample:** ['...', '...'] |
| **stdout\_lines** list / elements=string | always | The value of stdout split into a list **Sample:** [['...', '...'], ['...'], ['...']] |
| **warnings** list / elements=string | always | The list of warnings (if any) generated by module based on arguments **Sample:** ['...', '...'] |
### Authors
* Nathaniel Case (@Qalthos)
ansible vyos.vyos.vyos_banner – Manage multiline banners on VyOS devices vyos.vyos.vyos\_banner – Manage multiline banners on VyOS devices
=================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_banner`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This will configure both pre-login and post-login banners on remote devices running VyOS. It allows playbooks to add or remote banner text from the active running configuration.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **banner** string / required | **Choices:*** pre-login
* post-login
| Specifies which banner that should be configured on the remote device. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| Specifies whether or not the configuration is present in the current devices active running configuration. |
| **text** string | | The banner text that should be present in the remote device running configuration. This argument accepts a multiline string, with no empty lines. Requires *state=present*. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: configure the pre-login banner
vyos.vyos.vyos_banner:
banner: pre-login
text: |
this is my pre-login banner
that contains a multiline
string
state: present
- name: remove the post-login banner
vyos.vyos.vyos_banner:
banner: post-login
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always | The list of configuration mode commands to send to the device **Sample:** ['banner pre-login', 'this is my pre-login banner', 'that contains a multiline', 'string'] |
### Authors
* Trishna Guha (@trishnaguha)
ansible Vyos.Vyos Vyos.Vyos
=========
Collection version 2.6.0
Plugin Index
------------
These are the plugins in the vyos.vyos collection
### Cliconf Plugins
* [vyos](vyos_cliconf#ansible-collections-vyos-vyos-vyos-cliconf) – Use vyos cliconf to run command on VyOS platform
### Modules
* [vyos\_banner](vyos_banner_module#ansible-collections-vyos-vyos-vyos-banner-module) – Manage multiline banners on VyOS devices
* [vyos\_bgp\_address\_family](vyos_bgp_address_family_module#ansible-collections-vyos-vyos-vyos-bgp-address-family-module) – BGP Address Family Resource Module.
* [vyos\_bgp\_global](vyos_bgp_global_module#ansible-collections-vyos-vyos-vyos-bgp-global-module) – BGP Global Resource Module.
* [vyos\_command](vyos_command_module#ansible-collections-vyos-vyos-vyos-command-module) – Run one or more commands on VyOS devices
* [vyos\_config](vyos_config_module#ansible-collections-vyos-vyos-vyos-config-module) – Manage VyOS configuration on remote device
* [vyos\_facts](vyos_facts_module#ansible-collections-vyos-vyos-vyos-facts-module) – Get facts about vyos devices.
* [vyos\_firewall\_global](vyos_firewall_global_module#ansible-collections-vyos-vyos-vyos-firewall-global-module) – FIREWALL global resource module
* [vyos\_firewall\_interfaces](vyos_firewall_interfaces_module#ansible-collections-vyos-vyos-vyos-firewall-interfaces-module) – FIREWALL interfaces resource module
* [vyos\_firewall\_rules](vyos_firewall_rules_module#ansible-collections-vyos-vyos-vyos-firewall-rules-module) – FIREWALL rules resource module
* [vyos\_interface](vyos_interface_module#ansible-collections-vyos-vyos-vyos-interface-module) – (deprecated, removed after 2022-06-01) Manage Interface on VyOS network devices
* [vyos\_interfaces](vyos_interfaces_module#ansible-collections-vyos-vyos-vyos-interfaces-module) – Interfaces resource module
* [vyos\_l3\_interface](vyos_l3_interface_module#ansible-collections-vyos-vyos-vyos-l3-interface-module) – (deprecated, removed after 2022-06-01) Manage L3 interfaces on VyOS network devices
* [vyos\_l3\_interfaces](vyos_l3_interfaces_module#ansible-collections-vyos-vyos-vyos-l3-interfaces-module) – L3 interfaces resource module
* [vyos\_lag\_interfaces](vyos_lag_interfaces_module#ansible-collections-vyos-vyos-vyos-lag-interfaces-module) – LAG interfaces resource module
* [vyos\_linkagg](vyos_linkagg_module#ansible-collections-vyos-vyos-vyos-linkagg-module) – (deprecated, removed after 2022-06-01) Manage link aggregation groups on VyOS network devices
* [vyos\_lldp](vyos_lldp_module#ansible-collections-vyos-vyos-vyos-lldp-module) – (deprecated, removed after 2022-06-01) Manage LLDP configuration on VyOS network devices
* [vyos\_lldp\_global](vyos_lldp_global_module#ansible-collections-vyos-vyos-vyos-lldp-global-module) – LLDP global resource module
* [vyos\_lldp\_interface](vyos_lldp_interface_module#ansible-collections-vyos-vyos-vyos-lldp-interface-module) – (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on VyOS network devices
* [vyos\_lldp\_interfaces](vyos_lldp_interfaces_module#ansible-collections-vyos-vyos-vyos-lldp-interfaces-module) – LLDP interfaces resource module
* [vyos\_logging](vyos_logging_module#ansible-collections-vyos-vyos-vyos-logging-module) – Manage logging on network devices
* [vyos\_logging\_global](vyos_logging_global_module#ansible-collections-vyos-vyos-vyos-logging-global-module) – Logging resource module
* [vyos\_ntp\_global](vyos_ntp_global_module#ansible-collections-vyos-vyos-vyos-ntp-global-module) – Manages ntp modules of Vyos network devices
* [vyos\_ospf\_interfaces](vyos_ospf_interfaces_module#ansible-collections-vyos-vyos-vyos-ospf-interfaces-module) – OSPF Interfaces Resource Module.
* [vyos\_ospfv2](vyos_ospfv2_module#ansible-collections-vyos-vyos-vyos-ospfv2-module) – OSPFv2 resource module
* [vyos\_ospfv3](vyos_ospfv3_module#ansible-collections-vyos-vyos-vyos-ospfv3-module) – OSPFV3 resource module
* [vyos\_ping](vyos_ping_module#ansible-collections-vyos-vyos-vyos-ping-module) – Tests reachability using ping from VyOS network devices
* [vyos\_prefix\_lists](vyos_prefix_lists_module#ansible-collections-vyos-vyos-vyos-prefix-lists-module) – Prefix-Lists resource module for VyOS
* [vyos\_route\_maps](vyos_route_maps_module#ansible-collections-vyos-vyos-vyos-route-maps-module) – Route Map Resource Module.
* [vyos\_static\_route](vyos_static_route_module#ansible-collections-vyos-vyos-vyos-static-route-module) – (deprecated, removed after 2022-06-01) Manage static IP routes on Vyatta VyOS network devices
* [vyos\_static\_routes](vyos_static_routes_module#ansible-collections-vyos-vyos-vyos-static-routes-module) – Static routes resource module
* [vyos\_system](vyos_system_module#ansible-collections-vyos-vyos-vyos-system-module) – Run `set system` commands on VyOS devices
* [vyos\_user](vyos_user_module#ansible-collections-vyos-vyos-vyos-user-module) – Manage the collection of local users on VyOS device
* [vyos\_vlan](vyos_vlan_module#ansible-collections-vyos-vyos-vyos-vlan-module) – Manage VLANs on VyOS network devices
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible vyos.vyos.vyos_route_maps – Route Map Resource Module. vyos.vyos.vyos\_route\_maps – Route Map Resource Module.
========================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_route_maps`.
New in version 2.3.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module manages route map configurations on devices running VYOS.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of route-map configuration. |
| | **entries** list / elements=dictionary | | Route Map rules.
aliases: rules |
| | | **action** string | **Choices:*** deny
* permit
| Action for matching routes |
| | | **call** string | | Route map name |
| | | **continue\_sequence** integer | | Continue on a different entry within the route-map. |
| | | **description** string | | Description for the rule. |
| | | **match** dictionary | | Route parameters to match. |
| | | | **as\_path** string | | Set as-path. |
| | | | **community** dictionary | | BGP community attribute. |
| | | | | **community\_list** string | | BGP community-list to match |
| | | | | **exact\_match** boolean | **Choices:*** no
* yes
| BGP community-list to match |
| | | | **extcommunity** string | | Extended community name. |
| | | | **interface** string | | First hop interface of a route to match. |
| | | | **ip** dictionary | | IP prefix parameters to match. |
| | | | | **address** dictionary | | IP address of route to match. |
| | | | | | **list\_type** string | **Choices:*** access-list
* prefix-list
| type of list |
| | | | | | **value** string | | value of access-list and prefix list |
| | | | | **next\_hop** dictionary | | next hop prefix list. |
| | | | | | **list\_type** string | **Choices:*** access-list
* prefix-list
| type of list |
| | | | | | **value** string | | value of access-list and prefix list |
| | | | | **route\_source** dictionary | | IP route-source to match |
| | | | | | **list\_type** string | **Choices:*** access-list
* prefix-list
| type of list |
| | | | | | **value** string | | value of access-list and prefix list |
| | | | **ipv6** dictionary | | IPv6 prefix parameters to match. |
| | | | | **address** dictionary | | IPv6 address of route to match. |
| | | | | | **list\_type** string | **Choices:*** access-list
* prefix-list
| type of list |
| | | | | | **value** string | | value of access-list and prefix list |
| | | | | **next\_hop** string | | next-hop ipv6 address IPv6 <h:h:h:h:h:h:h:h>. |
| | | | **large\_community\_large\_community\_list** string | | BGP large-community-list to match. |
| | | | **metric** integer | | Route metric <1-65535>. |
| | | | **origin** string | **Choices:*** ebgp
* ibgp
* incomplete
| bgp origin. |
| | | | **peer** string | | Peer IP address <x.x.x.x>. |
| | | | **rpki** string | **Choices:*** notfound
* invalid
* valid
| RPKI validation value. |
| | | **on\_match** dictionary | | Exit policy on matches. |
| | | | **goto** integer | | Rule number to goto on match <1-65535>. |
| | | | **next** boolean | **Choices:*** no
* yes
| Next sequence number to goto on match. |
| | | **sequence** integer | | Route map rule number <1-65535>. |
| | | **set** dictionary | | Route parameters. |
| | | | **aggregator** dictionary | | Border Gateway Protocol (BGP) aggregator attribute. |
| | | | | **as** string | | AS number of an aggregation. |
| | | | | **ip** string | | IP address. |
| | | | **as\_path\_exclude** string | | BGP AS path exclude string ex "456 64500 45001" |
| | | | **as\_path\_prepend** string | | Prepend string for a Border Gateway Protocol (BGP) AS-path attribute. |
| | | | **atomic\_aggregate** boolean | **Choices:*** no
* yes
| Border Gateway Protocol (BGP) atomic aggregate attribute. |
| | | | **bgp\_extcommunity\_rt** string | | ExtCommunity in format AS:value |
| | | | **comm\_list** dictionary | | Border Gateway Protocol (BGP) communities matching a community-list. |
| | | | | **comm\_list** string | | BGP communities with a community-list. |
| | | | | **delete** boolean | **Choices:*** no
* yes
| Delete BGP communities matching the community-list. |
| | | | **community** dictionary | | Border Gateway Protocol (BGP) community attribute. |
| | | | | **value** string | | Community in 4 octet AS:value format or it can be from local-AS, no-advertise,no-expert,internet,additive,none. |
| | | | **extcommunity\_rt** string | | Set route target value.ASN:nn\_or\_IP\_address:nn VPN extended community. |
| | | | **extcommunity\_soo** string | | Set Site of Origin value. ASN:nn\_or\_IP\_address:nn VPN extended community |
| | | | **ip\_next\_hop** string | | IP address. |
| | | | **ipv6\_next\_hop** dictionary | | Nexthop IPv6 address. |
| | | | | **ip\_type** string | **Choices:*** global
* local
| Global or Local |
| | | | | **value** string | | ipv6 address |
| | | | **large\_community** string | | Set BGP large community value. |
| | | | **local\_preference** string | | Border Gateway Protocol (BGP) local preference attribute.Example <0-4294967295>. |
| | | | **metric** string | | Destination routing protocol metric. Example <0-4294967295>. |
| | | | **metric\_type** string | **Choices:*** type-1
* type-2
| Open Shortest Path First (OSPF) external metric-type. |
| | | | **origin** string | **Choices:*** egp
* igp
* incomplete
| Set bgp origin. |
| | | | **originator\_id** string | | Border Gateway Protocol (BGP) originator ID attribute. Originator IP address. |
| | | | **src** string | | Source address for route. Example <x.x.x.x> IP address. |
| | | | **tag** string | | Tag value for routing protocol. Example <1-65535> |
| | | | **weight** string | | Border Gateway Protocol (BGP) weight attribute. Example <0-4294967295> |
| | **route\_map** string | | Route map name. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VYOS device by executing the command **show configuration commands | grep route-map**. The state *parsed* reads the configuration from `show configuration commands | grep route-map` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** deleted
* **merged** ←
* overridden
* replaced
* gathered
* rendered
* parsed
| The state the configuration should be left in. |
Notes
-----
Note
* Tested against vyos 1.2.
* This module works with connection `network_cli`.
Examples
--------
```
# Using merged
# Before state
# vyos@vyos:~$ show configuration commands | match "set policy route-map"
# vyos@vyos:~$
- name: Merge the provided configuration with the existing running configuration
register: result
vyos.vyos.vyos_route_maps: &id001
config:
- route_map: test1
entries:
- sequence: 1
description: "test"
action: permit
continue: 2
on_match:
next: True
- route_map: test3
entries:
- sequence: 1
action: permit
match:
rpki: invalid
metric: 1
peer: 192.0.2.32
set:
local_preference: 4
metric: 5
metric_type: "type-1"
origin: egp
originator_id: 192.0.2.34
tag: 5
weight: 4
state: merged
# After State
# vyos@vyos:~$ show configuration commands | match "set policy route-maps"
# set policy route-map test1 rule 1 description test
# set policy route-map test1 rule 1 action permit
# set policy route-map test1 rule 1 continue 2
# set policy route-map test1 rule 1 on-match next
# set policy route-map test3 rule 1 action permit
# set policy route-map test3 rule 1 set local-preference 4
# set policy route-map test3 rule 1 set metric 5
# set policy route-map test3 rule 1 set metric-type type-1
# set policy route-map test3 rule 1 set origin egp
# set policy route-map test3 rule 1 set originator-id 192.0.2.34
# set policy route-map test3 rule 1 set tag 5
# set policy route-map test3 rule 1 set weight 4
# set policy route-map test3 rule 1 match metric 1
# set policy route-map test3 rule 1 match peer 192.0.2.32
# set policy route-map test3 rule 1 match rpki invalid
# "after": [
# {
# "entries": [
# {
# "action": "permit",
# "continue_sequence": 2,
# "description": "test",
# "on_match": {
# "next": true
# },
# "sequence": 1
# }
# ],
# "route_map": "test1"
# },
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "metric": 1,
# "peer": "192.0.2.32",
# "rpki": "invalid"
# },
# "sequence": 1,
# "set": {
# "local_preference": "4",
# "metric": "5",
# "metric_type": "type-1",
# "origin": "egp",
# "originator_id": "192.0.2.34",
# "tag": "5",
# "weight": "4"
# }
# }
# ],
# "route_map": "test3"
# }
# ],
# "before": [],
# "changed": true,
# "commands": [
# "set policy route-map test1 rule 1 description test",
# "set policy route-map test1 rule 1 action permit",
# "set policy route-map test1 rule 1 continue 2",
# "set policy route-map test1 rule 1 on-match next",
# "set policy route-map test3 rule 1 action permit",
# "set policy route-map test3 rule 1 set local-preference 4",
# "set policy route-map test3 rule 1 set metric 5",
# "set policy route-map test3 rule 1 set metric-type type-1",
# "set policy route-map test3 rule 1 set origin egp",
# "set policy route-map test3 rule 1 set originator-id 192.0.2.34",
# "set policy route-map test3 rule 1 set tag 5",
# "set policy route-map test3 rule 1 set weight 4",
# "set policy route-map test3 rule 1 match metric 1",
# "set policy route-map test3 rule 1 match peer 192.0.2.32",
# "set policy route-map test3 rule 1 match rpki invalid"
# ],
# Using replaced:
# --------------
# Before state:
# vyos@vyos:~$ show configuration commands | match "set route-map policy"
# set policy route-map test2 rule 1 action 'permit'
# set policy route-map test2 rule 1 description 'test'
# set policy route-map test2 rule 1 on-match next
# set policy route-map test2 rule 2 action 'permit'
# set policy route-map test2 rule 2 on-match goto '4'
# set policy route-map test3 rule 1 action 'permit'
# set policy route-map test3 rule 1 match metric '1'
# set policy route-map test3 rule 1 match peer '192.0.2.32'
# set policy route-map test3 rule 1 match rpki 'invalid'
# set policy route-map test3 rule 1 set community 'internet'
# set policy route-map test3 rule 1 set ip-next-hop '192.0.2.33'
# set policy route-map test3 rule 1 set local-preference '4'
# set policy route-map test3 rule 1 set metric '5'
# set policy route-map test3 rule 1 set metric-type 'type-1'
# set policy route-map test3 rule 1 set origin 'egp'
# set policy route-map test3 rule 1 set originator-id '192.0.2.34'
# set policy route-map test3 rule 1 set tag '5'
# set policy route-map test3 rule 1 set weight '4'
#
# - name: Replace the provided configuration with the existing running configuration
# register: result
# vyos.vyos.vyos_route_maps: &id001
# config:
# - route_map: test3
# entries:
# - sequence: 1
# action: permit
# match:
# rpki: invalid
# metric: 3
# peer: 192.0.2.35
# set:
# local_preference: 6
# metric: 4
# metric_type: "type-1"
# origin: egp
# originator_id: 192.0.2.34
# tag: 4
# weight: 4
# state: replaced
# After state:
# vyos@vyos:~$ show configuration commands | match "set policy route-map"
# set policy route-map test3 rule 1 set local-preference 6
# set policy route-map test3 rule 1 set metric 4
# set policy route-map test3 rule 1 set tag 4
# set policy route-map test3 rule 1 match metric 3
# set policy route-map test3 rule 1 match peer 192.0.2.35
# vyos@vyos:~$
#
#
# Module Execution:
#
# "after": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "test",
# "on_match": {
# "next": true
# },
# "sequence": 1
# },
# {
# "action": "permit",
# "on_match": {
# "goto": 4
# },
# "sequence": 2
# }
# ],
# "route_map": "test2"
# },
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "metric": 3,
# "peer": "192.0.2.35",
# "rpki": "invalid"
# },
# "sequence": 1,
# "set": {
# "local_preference": "6",
# "metric": "4",
# "metric_type": "type-1",
# "origin": "egp",
# "originator_id": "192.0.2.34",
# "tag": "4",
# "weight": "4"
# }
# }
# ],
# "route_map": "test3"
# }
# ],
# "before": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "test",
# "on_match": {
# "next": true
# },
# "sequence": 1
# },
# {
# "action": "permit",
# "on_match": {
# "goto": 4
# },
# "sequence": 2
# }
# ],
# "route_map": "test2"
# },
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "metric": 1,
# "peer": "192.0.2.32",
# "rpki": "invalid"
# },
# "sequence": 1,
# "set": {
# "community": {
# "value": "internet"
# },
# "ip_next_hop": "192.0.2.33",
# "local_preference": "4",
# "metric": "5",
# "metric_type": "type-1",
# "origin": "egp",
# "originator_id": "192.0.2.34",
# "tag": "5",
# "weight": "4"
# }
# }
# ],
# "route_map": "test3"
# }
# ],
# "changed": true,
# "commands": [
# "delete policy route-map test3 rule 1 set ip-next-hop 192.0.2.33",
# "set policy route-map test3 rule 1 set local-preference 6",
# "set policy route-map test3 rule 1 set metric 4",
# "set policy route-map test3 rule 1 set tag 4",
# "delete policy route-map test3 rule 1 set community internet",
# "set policy route-map test3 rule 1 match metric 3",
# "set policy route-map test3 rule 1 match peer 192.0.2.35"
# ],
#
# Using deleted:
# -------------
# Before state:
# vyos@vyos:~$ show configuration commands | match "set policy route-map"
# set policy route-map test3 rule 1 set local-preference 6
# set policy route-map test3 rule 1 set metric 4
# set policy route-map test3 rule 1 set tag 4
# set policy route-map test3 rule 1 match metric 3
# set policy route-map test3 rule 1 match peer 192.0.2.35
# vyos@vyos:~$
#
# - name: Delete the provided configuration
# register: result
# vyos.vyos.vyos_route_maps:
# config:
# state: deleted
# After state:
# vyos@vyos:~$ show configuration commands | match "set policy route-map"
# vyos@vyos:~$
#
#
# Module Execution:
#
# "after": [],
# "before": [
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "metric": 3,
# "peer": "192.0.2.35",
# },
# "sequence": 1,
# "set": {
# "local_preference": "6",
# "metric": "4",
# "tag": "4",
# }
# }
# ],
# "route_map": "test3"
# }
# ],
# "changed": true,
# "commands": [
# "delete policy route-map test3"
# ],
#
# using gathered:
# --------------
#
# Before state:
# vyos@vyos:~$ show configuration commands | match "set policy route-maps"
# set policy route-map test1 rule 1 description test
# set policy route-map test1 rule 1 action permit
# set policy route-map test1 rule 1 continue 2
# set policy route-map test1 rule 1 on-match next
# set policy route-map test3 rule 1 action permit
# set policy route-map test3 rule 1 set local-preference 4
# set policy route-map test3 rule 1 set metric 5
# set policy route-map test3 rule 1 set metric-type type-1
# set policy route-map test3 rule 1 set origin egp
# set policy route-map test3 rule 1 set originator-id 192.0.2.34
# set policy route-map test3 rule 1 set tag 5
# set policy route-map test3 rule 1 set weight 4
# set policy route-map test3 rule 1 match metric 1
# set policy route-map test3 rule 1 match peer 192.0.2.32
# set policy route-map test3 rule 1 match rpki invalid
#
# - name: gather configs
# vyos.vyos.vyos_route_maps:
# state: gathered
# "gathered": [
# {
# "entries": [
# {
# "action": "permit",
# "continue_sequence": 2,
# "description": "test",
# "on_match": {
# "next": true
# },
# "sequence": 1
# }
# ],
# "route_map": "test1"
# },
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "metric": 1,
# "peer": "192.0.2.32",
# "rpki": "invalid"
# },
# "sequence": 1,
# "set": {
# "local_preference": "4",
# "metric": "5",
# "metric_type": "type-1",
# "origin": "egp",
# "originator_id": "192.0.2.34",
# "tag": "5",
# "weight": "4"
# }
# }
# ],
# "route_map": "test3"
# }
# ]
# Using parsed:
# ------------
# parsed.cfg
# set policy route-map test1 rule 1 description test
# set policy route-map test1 rule 1 action permit
# set policy route-map test1 rule 1 continue 2
# set policy route-map test1 rule 1 on-match next
# set policy route-map test3 rule 1 action permit
# set policy route-map test3 rule 1 set local-preference 4
# set policy route-map test3 rule 1 set metric 5
# set policy route-map test3 rule 1 set metric-type type-1
# set policy route-map test3 rule 1 set origin egp
# set policy route-map test3 rule 1 set originator-id 192.0.2.34
# set policy route-map test3 rule 1 set tag 5
# set policy route-map test3 rule 1 set weight 4
# set policy route-map test3 rule 1 match metric 1
# set policy route-map test3 rule 1 match peer 192.0.2.32
# set policy route-map test3 rule 1 match rpki invalid
#
# - name: parse configs
# vyos.vyos.vyos_route_maps:
# running_config: "{{ lookup('file', './parsed.cfg') }}"
# state: parsed
# tags:
# - parsed
#
# Module execution:
# "parsed": [
# {
# "entries": [
# {
# "action": "permit",
# "continue_sequence": 2,
# "description": "test",
# "on_match": {
# "next": true
# },
# "sequence": 1
# }
# ],
# "route_map": "test1"
# },
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "metric": 1,
# "peer": "192.0.2.32",
# "rpki": "invalid"
# },
# "sequence": 1,
# "set": {
# "local_preference": "4",
# "metric": "5",
# "metric_type": "type-1",
# "origin": "egp",
# "originator_id": "192.0.2.34",
# "tag": "5",
# "weight": "4"
# }
# }
# ],
# "route_map": "test3"
# }
# ]
#
#
# Using rendered:
# --------------
# - name: Structure provided configuration into device specific commands
# register: result
# vyos.vyos.vyos_route_maps: &id001
# config:
# - route_map: test1
# entries:
# - sequence: 1
# description: "test"
# action: permit
# continue_sequence: 2
# on_match:
# next: True
# - route_map: test3
# entries:
# - sequence: 1
# action: permit
# match:
# rpki: invalid
# metric: 1
# peer: 192.0.2.32
# set:
# local_preference: 4
# metric: 5
# metric_type: "type-1"
# origin: egp
# originator_id: 192.0.2.34
# tag: 5
# weight: 4
# state: rendered
# Module Execution:
# "rendered": [
# "set policy route-map test1 rule 1 description test",
# "set policy route-map test1 rule 1 action permit",
# "set policy route-map test1 rule 1 continue 2",
# "set policy route-map test1 rule 1 on-match next",
# "set policy route-map test3 rule 1 action permit",
# "set policy route-map test3 rule 1 set local-preference 4",
# "set policy route-map test3 rule 1 set metric 5",
# "set policy route-map test3 rule 1 set metric-type type-1",
# "set policy route-map test3 rule 1 set origin egp",
# "set policy route-map test3 rule 1 set originator-id 192.0.2.34",
# "set policy route-map test3 rule 1 set tag 5",
# "set policy route-map test3 rule 1 set weight 4",
# "set policy route-map test3 rule 1 match metric 1",
# "set policy route-map test3 rule 1 match peer 192.0.2.32",
# "set policy route-map test3 rule 1 match rpki invalid"
# ]
#
#
# Using overridden:
# --------------
# Before state:
# vyos@vyos:~$ show configuration commands | match "set policy route-map"
# set policy route-map test2 rule 1 action 'permit'
# set policy route-map test2 rule 1 description 'test'
# set policy route-map test2 rule 1 on-match next
# set policy route-map test2 rule 2 action 'permit'
# set policy route-map test2 rule 2 on-match goto '4'
# set policy route-map test3 rule 1 action 'permit'
# set policy route-map test3 rule 1 match metric '1'
# set policy route-map test3 rule 1 match peer '192.0.2.32'
# set policy route-map test3 rule 1 match rpki 'invalid'
# set policy route-map test3 rule 1 set community 'internet'
# set policy route-map test3 rule 1 set ip-next-hop '192.0.2.33'
# set policy route-map test3 rule 1 set local-preference '4'
# set policy route-map test3 rule 1 set metric '5'
# set policy route-map test3 rule 1 set metric-type 'type-1'
# set policy route-map test3 rule 1 set origin 'egp'
# set policy route-map test3 rule 1 set originator-id '192.0.2.34'
# set policy route-map test3 rule 1 set tag '5'
# set policy route-map test3 rule 1 set weight '4'
#
# - name: Override the existing configuration with the provided running configuration
# register: result
# vyos.vyos.vyos_route_maps: &id001
# config:
# - route_map: test3
# entries:
# - sequence: 1
# action: permit
# match:
# rpki: invalid
# metric: 3
# peer: 192.0.2.35
# set:
# local_preference: 6
# metric: 4
# metric_type: "type-1"
# origin: egp
# originator_id: 192.0.2.34
# tag: 4
# weight: 4
# state: overridden
# After state:
# vyos@vyos:~$ show configuration commands | match "set policy route-map"
# set policy route-map test3 rule 1 set metric-type 'type-1'
# set policy route-map test3 rule 1 set origin 'egp'
# set policy route-map test3 rule 1 set originator-id '192.0.2.34'
# set policy route-map test3 rule 1 set weight '4'
# set policy route-map test3 rule 1 set local-preference 6
# set policy route-map test3 rule 1 set metric 4
# set policy route-map test3 rule 1 set tag 4
# set policy route-map test3 rule 1 match metric 3
# set policy route-map test3 rule 1 match peer 192.0.2.35
# set policy route-map test3 rule 1 match rpki 'invalid'
# Module Execution:
# "after": [
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "metric": 3,
# "peer": "192.0.2.35",
# "rpki": "invalid"
# },
# "sequence": 1,
# "set": {
# "local_preference": "6",
# "metric": "4",
# "metric_type": "type-1",
# "origin": "egp",
# "originator_id": "192.0.2.34",
# "tag": "4",
# "weight": "4"
# }
# }
# ],
# "route_map": "test3"
# }
# ],
# "before": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "test",
# "on_match": {
# "next": true
# },
# "sequence": 1
# },
# {
# "action": "permit",
# "on_match": {
# "goto": 4
# },
# "sequence": 2
# }
# ],
# "route_map": "test2"
# },
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "metric": 1,
# "peer": "192.0.2.32",
# "rpki": "invalid"
# },
# "sequence": 1,
# "set": {
# "community": {
# "value": "internet"
# },
# "ip_next_hop": "192.0.2.33",
# "local_preference": "4",
# "metric": "5",
# "metric_type": "type-1",
# "origin": "egp",
# "originator_id": "192.0.2.34",
# "tag": "5",
# "weight": "4"
# }
# }
# ],
# "route_map": "test3"
# }
# ],
# "changed": true,
# "commands": [
# "delete policy route-map test2",
# "delete policy route-map test3 rule 1 set ip-next-hop 192.0.2.33",
# "set policy route-map test3 rule 1 set local-preference 6",
# "set policy route-map test3 rule 1 set metric 4",
# "set policy route-map test3 rule 1 set tag 4",
# "delete policy route-map test3 rule 1 set community internet",
# "set policy route-map test3 rule 1 match metric 3",
# "set policy route-map test3 rule 1 match peer 192.0.2.35"
# ],
#
```
### Authors
* Ashwini Mhatre (@amhatre)
| programming_docs |
ansible vyos.vyos.vyos_ospfv2 – OSPFv2 resource module vyos.vyos.vyos\_ospfv2 – OSPFv2 resource module
===============================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_ospfv2`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This resource module configures and manages attributes of OSPFv2 routes on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | A provided OSPFv2 route configuration. |
| | **areas** list / elements=dictionary | | OSPFv2 area. |
| | | **area\_id** string | | OSPFv2 area identity. |
| | | **area\_type** dictionary | | Area type. |
| | | | **normal** boolean | **Choices:*** no
* yes
| Normal OSPFv2 area. |
| | | | **nssa** dictionary | | NSSA OSPFv2 area. |
| | | | | **default\_cost** integer | | Summary-default cost of NSSA area. |
| | | | | **no\_summary** boolean | **Choices:*** no
* yes
| Do not inject inter-area routes into stub. |
| | | | | **set** boolean | **Choices:*** no
* yes
| Enabling NSSA. |
| | | | | **translate** string | **Choices:*** always
* candidate
* never
| NSSA-ABR. |
| | | | **stub** dictionary | | Stub OSPFv2 area. |
| | | | | **default\_cost** integer | | Summary-default cost of stub area. |
| | | | | **no\_summary** boolean | **Choices:*** no
* yes
| Do not inject inter-area routes into stub. |
| | | | | **set** boolean | **Choices:*** no
* yes
| Enabling stub. |
| | | **authentication** string | **Choices:*** plaintext-password
* md5
| OSPFv2 area authentication type. |
| | | **network** list / elements=dictionary | | OSPFv2 network. |
| | | | **address** string / required | | OSPFv2 IPv4 network address. |
| | | **range** list / elements=dictionary | | Summarize routes matching prefix (border routers only). |
| | | | **address** string | | border router IPv4 address. |
| | | | **cost** integer | | Metric for this range. |
| | | | **not\_advertise** boolean | **Choices:*** no
* yes
| Don't advertise this range. |
| | | | **substitute** string | | Announce area range (IPv4 address) as another prefix. |
| | | **shortcut** string | **Choices:*** default
* disable
* enable
| Area's shortcut mode. |
| | | **virtual\_link** list / elements=dictionary | | Virtual link address. |
| | | | **address** string | | virtual link address. |
| | | | **authentication** dictionary | | OSPFv2 area authentication type. |
| | | | | **md5** list / elements=dictionary | | MD5 key id based authentication. |
| | | | | | **key\_id** integer | | MD5 key id. |
| | | | | | **md5\_key** string | | MD5 key. |
| | | | | **plaintext\_password** string | | Plain text password. |
| | | | **dead\_interval** integer | | Interval after which a neighbor is declared dead. |
| | | | **hello\_interval** integer | | Interval between hello packets. |
| | | | **retransmit\_interval** integer | | Interval between retransmitting lost link state advertisements. |
| | | | **transmit\_delay** integer | | Link state transmit delay. |
| | **auto\_cost** dictionary | | Calculate OSPFv2 interface cost according to bandwidth. |
| | | **reference\_bandwidth** integer | | Reference bandwidth cost in Mbits/sec. |
| | **default\_information** dictionary | | Control distribution of default information. |
| | | **originate** dictionary | | Distribute a default route. |
| | | | **always** boolean | **Choices:*** no
* yes
| Always advertise default route. |
| | | | **metric** integer | | OSPFv2 default metric. |
| | | | **metric\_type** integer | | OSPFv2 Metric types for default routes. |
| | | | **route\_map** string | | Route map references. |
| | **default\_metric** integer | | Metric of redistributed routes |
| | **distance** dictionary | | Administrative distance. |
| | | **global** integer | | Global OSPFv2 administrative distance. |
| | | **ospf** dictionary | | OSPFv2 administrative distance. |
| | | | **external** integer | | Distance for external routes. |
| | | | **inter\_area** integer | | Distance for inter-area routes. |
| | | | **intra\_area** integer | | Distance for intra-area routes. |
| | **log\_adjacency\_changes** string | **Choices:*** detail
| Log changes in adjacency state. |
| | **max\_metric** dictionary | | OSPFv2 maximum/infinite-distance metric. |
| | | **router\_lsa** dictionary | | Advertise own Router-LSA with infinite distance (stub router). |
| | | | **administrative** boolean | **Choices:*** no
* yes
| Administratively apply, for an indefinite period. |
| | | | **on\_shutdown** integer | | Time to advertise self as stub-router. |
| | | | **on\_startup** integer | | Time to advertise self as stub-router |
| | **mpls\_te** dictionary | | MultiProtocol Label Switching-Traffic Engineering (MPLS-TE) parameters. |
| | | **enabled** boolean | **Choices:*** no
* yes
| Enable MPLS-TE functionality. |
| | | **router\_address** string | | Stable IP address of the advertising router. |
| | **neighbor** list / elements=dictionary | | Neighbor IP address. |
| | | **neighbor\_id** string | | Identity (number/IP address) of neighbor. |
| | | **poll\_interval** integer | | Seconds between dead neighbor polling interval. |
| | | **priority** integer | | Neighbor priority. |
| | **parameters** dictionary | | OSPFv2 specific parameters. |
| | | **abr\_type** string | **Choices:*** cisco
* ibm
* shortcut
* standard
| OSPFv2 ABR Type. |
| | | **opaque\_lsa** boolean | **Choices:*** no
* yes
| Enable the Opaque-LSA capability (rfc2370). |
| | | **rfc1583\_compatibility** boolean | **Choices:*** no
* yes
| Enable rfc1583 criteria for handling AS external routes. |
| | | **router\_id** string | | Override the default router identifier. |
| | **passive\_interface** list / elements=string | | Suppress routing updates on an interface. |
| | **passive\_interface\_exclude** list / elements=string | | Interface to exclude when using passive-interface default. |
| | **redistribute** list / elements=dictionary | | Redistribute information from another routing protocol. |
| | | **metric** integer | | Metric for redistribution routes. |
| | | **metric\_type** integer | | OSPFv2 Metric types. |
| | | **route\_map** string | | Route map references. |
| | | **route\_type** string | **Choices:*** bgp
* connected
* kernel
* rip
* static
| Route type to redistribute. |
| | **route\_map** list / elements=string | | Filter routes installed in local route map. |
| | **timers** dictionary | | Adjust routing timers. |
| | | **refresh** dictionary | | Adjust refresh parameters. |
| | | | **timers** integer | | refresh timer. |
| | | **throttle** dictionary | | Throttling adaptive timers. |
| | | | **spf** dictionary | | OSPFv2 SPF timers. |
| | | | | **delay** integer | | Delay (msec) from first change received till SPF calculation. |
| | | | | **initial\_holdtime** integer | | Initial hold time(msec) between consecutive SPF calculations. |
| | | | | **max\_holdtime** integer | | maximum hold time (sec). |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep ospf**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* deleted
* parsed
* gathered
* rendered
| The state the configuration should be left in. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep ospf
#
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.11.11
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
- eth2
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: true
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
range:
- address: 192.0.3.0/24
cost: 10
- address: 192.0.4.0/24
cost: 12
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": {}
#
# "commands": [
# "set protocols ospf mpls-te enable",
# "set protocols ospf mpls-te router-address '192.0.11.11'",
# "set protocols ospf redistribute bgp",
# "set protocols ospf redistribute bgp metric-type 2",
# "set protocols ospf redistribute bgp metric 10",
# "set protocols ospf default-information originate metric-type 2",
# "set protocols ospf default-information originate always",
# "set protocols ospf default-information originate metric 10",
# "set protocols ospf default-information originate route-map ingress",
# "set protocols ospf auto-cost reference-bandwidth '2'",
# "set protocols ospf parameters router-id '192.0.1.1'",
# "set protocols ospf parameters opaque-lsa",
# "set protocols ospf parameters abr-type 'cisco'",
# "set protocols ospf parameters rfc1583-compatibility",
# "set protocols ospf passive-interface eth1",
# "set protocols ospf passive-interface eth2",
# "set protocols ospf max-metric router-lsa on-shutdown 10",
# "set protocols ospf max-metric router-lsa administrative",
# "set protocols ospf max-metric router-lsa on-startup 10",
# "set protocols ospf log-adjacency-changes 'detail'",
# "set protocols ospf neighbor 192.0.11.12 priority 2",
# "set protocols ospf neighbor 192.0.11.12 poll-interval 10",
# "set protocols ospf neighbor 192.0.11.12",
# "set protocols ospf area '2'",
# "set protocols ospf area 2 authentication plaintext-password",
# "set protocols ospf area 2 shortcut enable",
# "set protocols ospf area 2 area-type normal",
# "set protocols ospf area '3'",
# "set protocols ospf area 3 area-type nssa",
# "set protocols ospf area 4 range 192.0.3.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.3.0/24",
# "set protocols ospf area 4 range 192.0.4.0/24 cost 12",
# "set protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf area 4 area-type stub default-cost 20",
# "set protocols ospf area '4'",
# "set protocols ospf area 4 network 192.0.2.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep ospf
#
#
- name: Merge the provided configuration to update existing running configuration
vyos.vyos.vyos_ospfv2:
config:
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: false
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
- address: 192.0.22.0/24
- address: 192.0.32.0/24
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# "commands": [
# "delete protocols ospf area 4 area-type stub",
# "set protocols ospf area 4 network 192.0.22.0/24"
# "set protocols ospf area 4 network 192.0.32.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# },
# {
# "address": "192.0.22.0/24"
# },
# {
# "address": "192.0.32.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 network '192.0.22.0/24'
# set protocols ospf area 4 network '192.0.32.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using replaced
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Replace ospfv2 routes attributes configuration.
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.22.22
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
- address: 192.0.12.0/24
- address: 192.0.22.0/24
- address: 192.0.32.0/24
range:
- address: 192.0.42.0/24
cost: 10
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# "commands": [
# "delete protocols ospf passive-interface eth2",
# "delete protocols ospf area 3",
# "delete protocols ospf area 4 range 192.0.3.0/24 cost",
# "delete protocols ospf area 4 range 192.0.3.0/24",
# "delete protocols ospf area 4 range 192.0.4.0/24 cost",
# "delete protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf mpls-te router-address '192.0.22.22'",
# "set protocols ospf area 4 range 192.0.42.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.42.0/24",
# "set protocols ospf area 4 network 192.0.12.0/24",
# "set protocols ospf area 4 network 192.0.22.0/24",
# "set protocols ospf area 4 network 192.0.32.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.12.0/24"
# },
# {
# "address": "192.0.2.0/24"
# },
# {
# "address": "192.0.22.0/24"
# },
# {
# "address": "192.0.32.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.42.0/24",
# "cost": 10
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.22.22"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 network '192.0.12.0/24'
# set protocols ospf area 4 network '192.0.22.0/24'
# set protocols ospf area 4 network '192.0.32.0/24'
# set protocols ospf area 4 range 192.0.42.0/24 cost '10'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.22.22'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.11.11
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
- eth2
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: true
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
range:
- address: 192.0.3.0/24
cost: 10
- address: 192.0.4.0/24
cost: 12
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# [
# "set protocols ospf mpls-te enable",
# "set protocols ospf mpls-te router-address '192.0.11.11'",
# "set protocols ospf redistribute bgp",
# "set protocols ospf redistribute bgp metric-type 2",
# "set protocols ospf redistribute bgp metric 10",
# "set protocols ospf default-information originate metric-type 2",
# "set protocols ospf default-information originate always",
# "set protocols ospf default-information originate metric 10",
# "set protocols ospf default-information originate route-map ingress",
# "set protocols ospf auto-cost reference-bandwidth '2'",
# "set protocols ospf parameters router-id '192.0.1.1'",
# "set protocols ospf parameters opaque-lsa",
# "set protocols ospf parameters abr-type 'cisco'",
# "set protocols ospf parameters rfc1583-compatibility",
# "set protocols ospf passive-interface eth1",
# "set protocols ospf passive-interface eth2",
# "set protocols ospf max-metric router-lsa on-shutdown 10",
# "set protocols ospf max-metric router-lsa administrative",
# "set protocols ospf max-metric router-lsa on-startup 10",
# "set protocols ospf log-adjacency-changes 'detail'",
# "set protocols ospf neighbor 192.0.11.12 priority 2",
# "set protocols ospf neighbor 192.0.11.12 poll-interval 10",
# "set protocols ospf neighbor 192.0.11.12",
# "set protocols ospf area '2'",
# "set protocols ospf area 2 authentication plaintext-password",
# "set protocols ospf area 2 shortcut enable",
# "set protocols ospf area 2 area-type normal",
# "set protocols ospf area '3'",
# "set protocols ospf area 3 area-type nssa",
# "set protocols ospf area 4 range 192.0.3.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.3.0/24",
# "set protocols ospf area 4 range 192.0.4.0/24 cost 12",
# "set protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf area 4 area-type stub default-cost 20",
# "set protocols ospf area '4'",
# "set protocols ospf area 4 network 192.0.2.0/24"
# ]
# Using parsed
#
#
- name: Parse the commands for provided structured configuration
vyos.vyos.vyos_ospfv2:
running_config:
"set protocols ospf area 2 area-type 'normal'
set protocols ospf area 2 authentication 'plaintext-password'
set protocols ospf area 2 shortcut 'enable'
set protocols ospf area 3 area-type 'nssa'
set protocols ospf area 4 area-type stub default-cost '20'
set protocols ospf area 4 network '192.0.2.0/24'
set protocols ospf area 4 range 192.0.3.0/24 cost '10'
set protocols ospf area 4 range 192.0.4.0/24 cost '12'
set protocols ospf auto-cost reference-bandwidth '2'
set protocols ospf default-information originate 'always'
set protocols ospf default-information originate metric '10'
set protocols ospf default-information originate metric-type '2'
set protocols ospf default-information originate route-map 'ingress'
set protocols ospf log-adjacency-changes 'detail'
set protocols ospf max-metric router-lsa 'administrative'
set protocols ospf max-metric router-lsa on-shutdown '10'
set protocols ospf max-metric router-lsa on-startup '10'
set protocols ospf mpls-te 'enable'
set protocols ospf mpls-te router-address '192.0.11.11'
set protocols ospf neighbor 192.0.11.12 poll-interval '10'
set protocols ospf neighbor 192.0.11.12 priority '2'
set protocols ospf parameters abr-type 'cisco'
set protocols ospf parameters 'opaque-lsa'
set protocols ospf parameters 'rfc1583-compatibility'
set protocols ospf parameters router-id '192.0.1.1'
set protocols ospf passive-interface 'eth1'
set protocols ospf passive-interface 'eth2'
set protocols ospf redistribute bgp metric '10'
set protocols ospf redistribute bgp metric-type '2'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
# }
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Gather ospfv2 routes config with provided configurations
vyos.vyos.vyos_ospfv2:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using deleted
#
# Before state
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Delete attributes of ospfv2 routes.
vyos.vyos.vyos_ospfv2:
config:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
# "commands": [
# "delete protocols ospf"
# ]
#
# "after": {}
# After state
# ------------
# vyos@192# run show configuration commands | grep ospf
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['set protocols ospf parameters router-id 192.0.1.1', "set protocols ospf passive-interface 'eth1'"] |
### Authors
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_bgp_global – BGP Global Resource Module. vyos.vyos.vyos\_bgp\_global – BGP Global Resource Module.
=========================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_bgp_global`.
New in version 2.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module manages BGP global configuration of interfaces on devices running VYOS.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | A dict of BGP global configuration for interfaces. |
| | **aggregate\_address** list / elements=dictionary | | BGP aggregate network. |
| | | **as\_set** boolean | **Choices:*** no
* yes
| Generate AS-set path information for this aggregate address. |
| | | **prefix** string | | BGP aggregate network. |
| | | **summary\_only** boolean | **Choices:*** no
* yes
| Announce the aggregate summary network only. |
| | **as\_number** integer | | AS number. |
| | **bgp\_params** dictionary | | BGP parameters |
| | | **always\_compare\_med** boolean | **Choices:*** no
* yes
| Always compare MEDs from different neighbors |
| | | **bestpath** dictionary | | Default bestpath selection mechanism |
| | | | **as\_path** string | **Choices:*** confed
* ignore
| AS-path attribute comparison parameters |
| | | | **compare\_routerid** boolean | **Choices:*** no
* yes
| Compare the router-id for identical EBGP paths |
| | | | **med** string | **Choices:*** confed
* missing-as-worst
| MED attribute comparison parameters |
| | | **cluster\_id** string | | Route-reflector cluster-id |
| | | **confederation** list / elements=dictionary | | AS confederation parameters |
| | | | **identifier** integer | | Confederation AS identifier |
| | | | **peers** integer | | Peer ASs in the BGP confederation |
| | | **dampening** dictionary | | Enable route-flap dampening |
| | | | **half\_life** integer | | Half-life penalty in seconds |
| | | | **max\_suppress\_time** integer | | Maximum duration to suppress a stable route |
| | | | **re\_use** integer | | Time to start reusing a route |
| | | | **start\_suppress\_time** integer | | When to start suppressing a route |
| | | **default** dictionary | | BGP defaults |
| | | | **local\_pref** integer | | Default local preference |
| | | | **no\_ipv4\_unicast** boolean | **Choices:*** no
* yes
| Deactivate IPv4 unicast for a peer by default |
| | | **deterministic\_med** boolean | **Choices:*** no
* yes
| Compare MEDs between different peers in the same AS |
| | | **disable\_network\_import\_check** boolean | **Choices:*** no
* yes
| Disable IGP route check for network statements |
| | | **distance** list / elements=dictionary | | Administrative distances for BGP routes |
| | | | **prefix** integer | | Administrative distance for a specific BGP prefix |
| | | | **type** string | **Choices:*** external
* internal
* local
| Type of route |
| | | | **value** integer | | distance |
| | | **enforce\_first\_as** boolean | **Choices:*** no
* yes
| Require first AS in the path to match peer's AS |
| | | **graceful\_restart** integer | | Maximum time to hold onto restarting peer's stale paths |
| | | **log\_neighbor\_changes** boolean | **Choices:*** no
* yes
| Log neighbor up/down changes and reset reason |
| | | **no\_client\_to\_client\_reflection** boolean | **Choices:*** no
* yes
| Disable client to client route reflection |
| | | **no\_fast\_external\_failover** boolean | **Choices:*** no
* yes
| Disable immediate session reset if peer's connected link goes down |
| | | **router\_id** string | | BGP router-id |
| | | **scan\_time** integer | | BGP route scanner interval |
| | **maximum\_paths** list / elements=dictionary | | BGP multipaths |
| | | **count** integer | | No. of paths. |
| | | **path** string | | BGP multipaths |
| | **neighbor** list / elements=dictionary | | BGP neighbor |
| | | **address** string | | BGP neighbor address (v4/v6). |
| | | **advertisement\_interval** integer | | Minimum interval for sending routing updates. |
| | | **allowas\_in** integer | | Number of occurrences of AS number. |
| | | **as\_override** boolean | **Choices:*** no
* yes
| AS for routes sent to this neighbor to be the local AS. |
| | | **attribute\_unchanged** dictionary | | BGP attributes are sent unchanged. |
| | | | **as\_path** boolean | **Choices:*** no
* yes
| as\_path |
| | | | **med** boolean | **Choices:*** no
* yes
| med |
| | | | **next\_hop** boolean | **Choices:*** no
* yes
| next\_hop |
| | | **capability** dictionary | | Advertise capabilities to this neighbor. |
| | | | **dynamic** boolean | **Choices:*** no
* yes
| Advertise dynamic capability to this neighbor. |
| | | | **orf** string | **Choices:*** send
* receive
| Advertise ORF capability to this neighbor. |
| | | **default\_originate** string | | Send default route to this neighbor |
| | | **description** string | | description text |
| | | **disable\_capability\_negotiation** boolean | **Choices:*** no
* yes
| Disbale capability negotiation with the neighbor |
| | | **disable\_connected\_check** boolean | **Choices:*** no
* yes
| Disable check to see if EBGP peer's address is a connected route. |
| | | **disable\_send\_community** string | **Choices:*** extended
* standard
| Disable sending community attributes to this neighbor. |
| | | **distribute\_list** list / elements=dictionary | | Access-list to filter route updates to/from this neighbor. |
| | | | **acl** integer | | Access-list number. |
| | | | **action** string | **Choices:*** export
* import
| Access-list to filter outgoing/incoming route updates to this neighbor |
| | | **ebgp\_multihop** integer | | Allow this EBGP neighbor to not be on a directly connected network. Specify the number hops. |
| | | **filter\_list** list / elements=dictionary | | As-path-list to filter route updates to/from this neighbor. |
| | | | **action** string | **Choices:*** export
* import
| filter outgoing/incoming route updates |
| | | | **path\_list** string | | As-path-list to filter |
| | | **local\_as** integer | | local as number not to be prepended to updates from EBGP peers |
| | | **maximum\_prefix** integer | | Maximum number of prefixes to accept from this neighbor nexthop-self Nexthop for routes sent to this neighbor to be the local router. |
| | | **nexthop\_self** boolean | **Choices:*** no
* yes
| Nexthop for routes sent to this neighbor to be the local router. |
| | | **override\_capability** boolean | **Choices:*** no
* yes
| Ignore capability negotiation with specified neighbor. |
| | | **passive** boolean | **Choices:*** no
* yes
| Do not initiate a session with this neighbor |
| | | **password** string | | BGP MD5 password |
| | | **peer\_group** boolean | **Choices:*** no
* yes
| True if all the configs under this neighbor key is for peer group template. |
| | | **peer\_group\_name** string | | IPv4 peer group for this peer |
| | | **port** integer | | Neighbor's BGP port |
| | | **prefix\_list** list / elements=dictionary | | Prefix-list to filter route updates to/from this neighbor. |
| | | | **action** string | **Choices:*** export
* import
| filter outgoing/incoming route updates |
| | | | **prefix\_list** string | | Prefix-list to filter |
| | | **remote\_as** integer | | Neighbor BGP AS number |
| | | **remove\_private\_as** boolean | **Choices:*** no
* yes
| Remove private AS numbers from AS path in outbound route updates |
| | | **route\_map** list / elements=dictionary | | Route-map to filter route updates to/from this neighbor. |
| | | | **action** string | **Choices:*** export
* import
| filter outgoing/incoming route updates |
| | | | **route\_map** string | | route-map to filter |
| | | **route\_reflector\_client** boolean | **Choices:*** no
* yes
| Neighbor as a route reflector client |
| | | **route\_server\_client** boolean | **Choices:*** no
* yes
| Neighbor is route server client |
| | | **shutdown** boolean | **Choices:*** no
* yes
| Administratively shut down neighbor |
| | | **soft\_reconfiguration** boolean | **Choices:*** no
* yes
| Soft reconfiguration for neighbor |
| | | **strict\_capability\_match** boolean | **Choices:*** no
* yes
| Enable strict capability negotiation |
| | | **timers** dictionary | | Neighbor timers |
| | | | **connect** integer | | BGP connect timer for this neighbor. |
| | | | **holdtime** integer | | BGP hold timer for this neighbor |
| | | | **keepalive** integer | | BGP keepalive interval for this neighbor |
| | | **ttl\_security** integer | | Ttl security mechanism for this BGP peer |
| | | **unsuppress\_map** string | | Route-map to selectively unsuppress suppressed routes |
| | | **update\_source** string | | Source IP of routing updates |
| | | **weight** integer | | Default weight for routes from this neighbor |
| | **network** list / elements=dictionary | | BGP network |
| | | **address** string | | BGP network address |
| | | **backdoor** boolean | **Choices:*** no
* yes
| Network as a backdoor route |
| | | **route\_map** string | | Route-map to modify route attributes |
| | **redistribute** list / elements=dictionary | | Redistribute routes from other protocols into BGP |
| | | **metric** integer | | Metric for redistributed routes. |
| | | **protocol** string | **Choices:*** connected
* kernel
* ospf
* rip
* static
| types of routes to be redistributed. |
| | | **route\_map** string | | Route map to filter redistributed routes |
| | **timers** dictionary | | BGP protocol timers |
| | | **holdtime** integer | | Hold time interval |
| | | **keepalive** integer | | Keepalive interval |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the EOS device by executing the command **show running-config | section bgp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** deleted
* **merged** ←
* purged
* replaced
* gathered
* rendered
* parsed
| The state the configuration should be left in. State *purged* removes all the BGP configurations from the target device. Use caution with this state.('delete protocols bgp <x>') State *deleted* only removes BGP attributes that this modules manages and does not negate the BGP process completely. Thereby, preserving address-family related configurations under BGP context. Running states *deleted* and *replaced* will result in an error if there are address-family configuration lines present under neighbor context that is is to be removed. Please use the [vyos.vyos.vyos\_bgp\_address\_family](vyos_bgp_address_family_module) module for prior cleanup. Refer to examples for more details. |
Examples
--------
```
# Using merged
# Before state
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# vyos@vyos:~$
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_bgp_global:
config:
as_number: "65536"
aggregate_address:
- prefix: "203.0.113.0/24"
as_set: true
- prefix: "192.0.2.0/24"
summary_only: true
network:
- address: "192.1.13.0/24"
backdoor: true
redistribute:
- protocol: "kernel"
metric: 45
- protocol: "connected"
route_map: "map01"
maximum_paths:
- path: "ebgp"
count: 20
- path: "ibgp"
count: 55
timers:
keepalive: 35
bgp_params:
bestpath:
as_path: "confed"
compare_routerid: true
default:
no_ipv4_unicast: true
router_id: "192.1.2.9"
confederation:
- peers: 20
- peers: 55
- identifier: 66
neighbor:
- address: "192.0.2.25"
disable_connected_check: true
timers:
holdtime: 30
keepalive: 10
- address: "203.0.113.5"
attribute_unchanged:
as_path: true
med: true
ebgp_multihop: 2
remote_as: 101
update_source: "192.0.2.25"
- address: "5001::64"
maximum_prefix: 34
distribute_list:
- acl: 20
action: "export"
- acl: 40
action: "import"
state: merged
# After State
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 65536 aggregate-address 192.0.2.0/24 'summary-only'
# set protocols bgp 65536 aggregate-address 203.0.113.0/24 'as-set'
# set protocols bgp 65536 maximum-paths ebgp '20'
# set protocols bgp 65536 maximum-paths ibgp '55'
# set protocols bgp 65536 neighbor 192.0.2.25 'disable-connected-check'
# set protocols bgp 65536 neighbor 192.0.2.25 timers holdtime '30'
# set protocols bgp 65536 neighbor 192.0.2.25 timers keepalive '10'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'as-path'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'med'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'next-hop'
# set protocols bgp 65536 neighbor 203.0.113.5 ebgp-multihop '2'
# set protocols bgp 65536 neighbor 203.0.113.5 remote-as '101'
# set protocols bgp 65536 neighbor 203.0.113.5 update-source '192.0.2.25'
# set protocols bgp 65536 neighbor 5001::64 distribute-list export '20'
# set protocols bgp 65536 neighbor 5001::64 distribute-list import '40'
# set protocols bgp 65536 neighbor 5001::64 maximum-prefix '34'
# set protocols bgp 65536 network 192.1.13.0/24 'backdoor'
# set protocols bgp 65536 parameters bestpath as-path 'confed'
# set protocols bgp 65536 parameters bestpath 'compare-routerid'
# set protocols bgp 65536 parameters confederation identifier '66'
# set protocols bgp 65536 parameters confederation peers '20'
# set protocols bgp 65536 parameters confederation peers '55'
# set protocols bgp 65536 parameters default 'no-ipv4-unicast'
# set protocols bgp 65536 parameters router-id '192.1.2.9'
# set protocols bgp 65536 redistribute connected route-map 'map01'
# set protocols bgp 65536 redistribute kernel metric '45'
# set protocols bgp 65536 timers keepalive '35'
# vyos@vyos:~$
#
# # Module Execution:
#
# "after": {
# "aggregate_address": [
# {
# "prefix": "192.0.2.0/24",
# "summary_only": true
# },
# {
# "prefix": "203.0.113.0/24",
# "as_set": true
# }
# ],
# "as_number": 65536,
# "bgp_params": {
# "bestpath": {
# "as_path": "confed",
# "compare_routerid": true
# },
# "confederation": [
# {
# "identifier": 66
# },
# {
# "peers": 20
# },
# {
# "peers": 55
# }
# ],
# "default": {
# "no_ipv4_unicast": true
# },
# "router_id": "192.1.2.9"
# },
# "maximum_paths": [
# {
# "count": 20,
# "path": "ebgp"
# },
# {
# "count": 55,
# "path": "ibgp"
# }
# ],
# "neighbor": [
# {
# "address": "192.0.2.25",
# "disable_connected_check": true,
# "timers": {
# "holdtime": 30,
# "keepalive": 10
# }
# },
# {
# "address": "203.0.113.5",
# "attribute_unchanged": {
# "as_path": true,
# "med": true,
# "next_hop": true
# },
# "ebgp_multihop": 2,
# "remote_as": 101,
# "update_source": "192.0.2.25"
# },
# {
# "address": "5001::64",
# "distribute_list": [
# {
# "acl": 20,
# "action": "export"
# },
# {
# "acl": 40,
# "action": "import"
# }
# ],
# "maximum_prefix": 34
# }
# ],
# "network": [
# {
# "address": "192.1.13.0/24",
# "backdoor": true
# }
# ],
# "redistribute": [
# {
# "protocol": "connected",
# "route_map": "map01"
# },
# {
# "metric": 45,
# "protocol": "kernel"
# }
# ],
# "timers": {
# "keepalive": 35
# }
# },
# "before": {},
# "changed": true,
# "commands": [
# "set protocols bgp 65536 neighbor 192.0.2.25 disable-connected-check",
# "set protocols bgp 65536 neighbor 192.0.2.25 timers holdtime 30",
# "set protocols bgp 65536 neighbor 192.0.2.25 timers keepalive 10",
# "set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged as-path",
# "set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged med",
# "set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged next-hop",
# "set protocols bgp 65536 neighbor 203.0.113.5 ebgp-multihop 2",
# "set protocols bgp 65536 neighbor 203.0.113.5 remote-as 101",
# "set protocols bgp 65536 neighbor 203.0.113.5 update-source 192.0.2.25",
# "set protocols bgp 65536 neighbor 5001::64 maximum-prefix 34",
# "set protocols bgp 65536 neighbor 5001::64 distribute-list export 20",
# "set protocols bgp 65536 neighbor 5001::64 distribute-list import 40",
# "set protocols bgp 65536 redistribute kernel metric 45",
# "set protocols bgp 65536 redistribute connected route-map map01",
# "set protocols bgp 65536 network 192.1.13.0/24 backdoor",
# "set protocols bgp 65536 aggregate-address 203.0.113.0/24 as-set",
# "set protocols bgp 65536 aggregate-address 192.0.2.0/24 summary-only",
# "set protocols bgp 65536 parameters bestpath as-path confed",
# "set protocols bgp 65536 parameters bestpath compare-routerid",
# "set protocols bgp 65536 parameters default no-ipv4-unicast",
# "set protocols bgp 65536 parameters router-id 192.1.2.9",
# "set protocols bgp 65536 parameters confederation peers 20",
# "set protocols bgp 65536 parameters confederation peers 55",
# "set protocols bgp 65536 parameters confederation identifier 66",
# "set protocols bgp 65536 maximum-paths ebgp 20",
# "set protocols bgp 65536 maximum-paths ibgp 55",
# "set protocols bgp 65536 timers keepalive 35"
# ],
# Using replaced:
# --------------
# Before state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 65536 aggregate-address 192.0.2.0/24 'summary-only'
# set protocols bgp 65536 aggregate-address 203.0.113.0/24 'as-set'
# set protocols bgp 65536 maximum-paths ebgp '20'
# set protocols bgp 65536 maximum-paths ibgp '55'
# set protocols bgp 65536 neighbor 192.0.2.25 'disable-connected-check'
# set protocols bgp 65536 neighbor 192.0.2.25 timers holdtime '30'
# set protocols bgp 65536 neighbor 192.0.2.25 timers keepalive '10'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'as-path'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'med'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'next-hop'
# set protocols bgp 65536 neighbor 203.0.113.5 ebgp-multihop '2'
# set protocols bgp 65536 neighbor 203.0.113.5 remote-as '101'
# set protocols bgp 65536 neighbor 203.0.113.5 update-source '192.0.2.25'
# set protocols bgp 65536 neighbor 5001::64 distribute-list export '20'
# set protocols bgp 65536 neighbor 5001::64 distribute-list import '40'
# set protocols bgp 65536 neighbor 5001::64 maximum-prefix '34'
# set protocols bgp 65536 network 192.1.13.0/24 'backdoor'
# set protocols bgp 65536 parameters bestpath as-path 'confed'
# set protocols bgp 65536 parameters bestpath 'compare-routerid'
# set protocols bgp 65536 parameters confederation identifier '66'
# set protocols bgp 65536 parameters confederation peers '20'
# set protocols bgp 65536 parameters confederation peers '55'
# set protocols bgp 65536 parameters default 'no-ipv4-unicast'
# set protocols bgp 65536 parameters router-id '192.1.2.9'
# set protocols bgp 65536 redistribute connected route-map 'map01'
# set protocols bgp 65536 redistribute kernel metric '45'
# set protocols bgp 65536 timers keepalive '35'
# vyos@vyos:~$
- name: Replace
vyos.vyos.vyos_bgp_global:
config:
as_number: "65536"
network:
- address: "203.0.113.0/24"
route_map: map01
redistribute:
- protocol: "static"
route_map: "map01"
neighbor:
- address: "192.0.2.40"
advertisement_interval: 72
capability:
orf: "receive"
bgp_params:
bestpath:
as_path: "confed"
state: replaced
# After state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 65536 neighbor 192.0.2.40 advertisement-interval '72'
# set protocols bgp 65536 neighbor 192.0.2.40 capability orf prefix-list 'receive'
# set protocols bgp 65536 network 203.0.113.0/24 route-map 'map01'
# set protocols bgp 65536 parameters bestpath as-path 'confed'
# set protocols bgp 65536 redistribute static route-map 'map01'
# vyos@vyos:~$
#
#
# Module Execution:
#
# "after": {
# "as_number": 65536,
# "bgp_params": {
# "bestpath": {
# "as_path": "confed"
# }
# },
# "neighbor": [
# {
# "address": "192.0.2.40",
# "advertisement_interval": 72,
# "capability": {
# "orf": "receive"
# }
# }
# ],
# "network": [
# {
# "address": "203.0.113.0/24",
# "route_map": "map01"
# }
# ],
# "redistribute": [
# {
# "protocol": "static",
# "route_map": "map01"
# }
# ]
# },
# "before": {
# "aggregate_address": [
# {
# "prefix": "192.0.2.0/24",
# "summary_only": true
# },
# {
# "prefix": "203.0.113.0/24",
# "as_set": true
# }
# ],
# "as_number": 65536,
# "bgp_params": {
# "bestpath": {
# "as_path": "confed",
# "compare_routerid": true
# },
# "confederation": [
# {
# "identifier": 66
# },
# {
# "peers": 20
# },
# {
# "peers": 55
# }
# ],
# "default": {
# "no_ipv4_unicast": true
# },
# "router_id": "192.1.2.9"
# },
# "maximum_paths": [
# {
# "count": 20,
# "path": "ebgp"
# },
# {
# "count": 55,
# "path": "ibgp"
# }
# ],
# "neighbor": [
# {
# "address": "192.0.2.25",
# "disable_connected_check": true,
# "timers": {
# "holdtime": 30,
# "keepalive": 10
# }
# },
# {
# "address": "203.0.113.5",
# "attribute_unchanged": {
# "as_path": true,
# "med": true,
# "next_hop": true
# },
# "ebgp_multihop": 2,
# "remote_as": 101,
# "update_source": "192.0.2.25"
# },
# {
# "address": "5001::64",
# "distribute_list": [
# {
# "acl": 20,
# "action": "export"
# },
# {
# "acl": 40,
# "action": "import"
# }
# ],
# "maximum_prefix": 34
# }
# ],
# "network": [
# {
# "address": "192.1.13.0/24",
# "backdoor": true
# }
# ],
# "redistribute": [
# {
# "protocol": "connected",
# "route_map": "map01"
# },
# {
# "metric": 45,
# "protocol": "kernel"
# }
# ],
# "timers": {
# "keepalive": 35
# }
# },
# "changed": true,
# "commands": [
# "delete protocols bgp 65536 timers",
# "delete protocols bgp 65536 maximum-paths ",
# "delete protocols bgp 65536 maximum-paths ",
# "delete protocols bgp 65536 parameters router-id 192.1.2.9",
# "delete protocols bgp 65536 parameters default",
# "delete protocols bgp 65536 parameters confederation",
# "delete protocols bgp 65536 parameters bestpath compare-routerid",
# "delete protocols bgp 65536 aggregate-address",
# "delete protocols bgp 65536 network 192.1.13.0/24",
# "delete protocols bgp 65536 redistribute kernel",
# "delete protocols bgp 65536 redistribute kernel",
# "delete protocols bgp 65536 redistribute connected",
# "delete protocols bgp 65536 redistribute connected",
# "delete protocols bgp 65536 neighbor 5001::64",
# "delete protocols bgp 65536 neighbor 203.0.113.5",
# "delete protocols bgp 65536 neighbor 192.0.2.25",
# "set protocols bgp 65536 neighbor 192.0.2.40 advertisement-interval 72",
# "set protocols bgp 65536 neighbor 192.0.2.40 capability orf prefix-list receive",
# "set protocols bgp 65536 redistribute static route-map map01",
# "set protocols bgp 65536 network 203.0.113.0/24 route-map map01"
# ],
# Using deleted:
# -------------
# Before state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 65536 neighbor 192.0.2.40 advertisement-interval '72'
# set protocols bgp 65536 neighbor 192.0.2.40 capability orf prefix-list 'receive'
# set protocols bgp 65536 network 203.0.113.0/24 route-map 'map01'
# set protocols bgp 65536 parameters bestpath as-path 'confed'
# set protocols bgp 65536 redistribute static route-map 'map01'
# vyos@vyos:~$
- name: Delete configuration
vyos.vyos.vyos_bgp_global:
config:
as_number: "65536"
state: deleted
# After state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp '65536'
# vyos@vyos:~$
#
#
# Module Execution:
#
# "after": {
# "as_number": 65536
# },
# "before": {
# "as_number": 65536,
# "bgp_params": {
# "bestpath": {
# "as_path": "confed"
# }
# },
# "neighbor": [
# {
# "address": "192.0.2.40",
# "advertisement_interval": 72,
# "capability": {
# "orf": "receive"
# }
# }
# ],
# "network": [
# {
# "address": "203.0.113.0/24",
# "route_map": "map01"
# }
# ],
# "redistribute": [
# {
# "protocol": "static",
# "route_map": "map01"
# }
# ]
# },
# "changed": true,
# "commands": [
# "delete protocols bgp 65536 neighbor 192.0.2.40",
# "delete protocols bgp 65536 redistribute",
# "delete protocols bgp 65536 network",
# "delete protocols bgp 65536 parameters"
# ],
# Using purged:
# Before state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 65536 aggregate-address 192.0.2.0/24 'summary-only'
# set protocols bgp 65536 aggregate-address 203.0.113.0/24 'as-set'
# set protocols bgp 65536 maximum-paths ebgp '20'
# set protocols bgp 65536 maximum-paths ibgp '55'
# set protocols bgp 65536 neighbor 192.0.2.25 'disable-connected-check'
# set protocols bgp 65536 neighbor 192.0.2.25 timers holdtime '30'
# set protocols bgp 65536 neighbor 192.0.2.25 timers keepalive '10'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'as-path'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'med'
# set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'next-hop'
# set protocols bgp 65536 neighbor 203.0.113.5 ebgp-multihop '2'
# set protocols bgp 65536 neighbor 203.0.113.5 remote-as '101'
# set protocols bgp 65536 neighbor 203.0.113.5 update-source '192.0.2.25'
# set protocols bgp 65536 neighbor 5001::64 distribute-list export '20'
# set protocols bgp 65536 neighbor 5001::64 distribute-list import '40'
# set protocols bgp 65536 neighbor 5001::64 maximum-prefix '34'
# set protocols bgp 65536 network 192.1.13.0/24 'backdoor'
# set protocols bgp 65536 parameters bestpath as-path 'confed'
# set protocols bgp 65536 parameters bestpath 'compare-routerid'
# set protocols bgp 65536 parameters confederation identifier '66'
# set protocols bgp 65536 parameters confederation peers '20'
# set protocols bgp 65536 parameters confederation peers '55'
# set protocols bgp 65536 parameters default 'no-ipv4-unicast'
# set protocols bgp 65536 parameters router-id '192.1.2.9'
# set protocols bgp 65536 redistribute connected route-map 'map01'
# set protocols bgp 65536 redistribute kernel metric '45'
# set protocols bgp 65536 timers keepalive '35'
# vyos@vyos:~$
- name: Purge configuration
vyos.vyos.vyos_bgp_global:
config:
as_number: "65536"
state: purged
# After state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# vyos@vyos:~$
#
# Module Execution:
#
# "after": {},
# "before": {
# "aggregate_address": [
# {
# "prefix": "192.0.2.0/24",
# "summary_only": true
# },
# {
# "prefix": "203.0.113.0/24",
# "as_set": true
# }
# ],
# "as_number": 65536,
# "bgp_params": {
# "bestpath": {
# "as_path": "confed",
# "compare_routerid": true
# },
# "confederation": [
# {
# "identifier": 66
# },
# {
# "peers": 20
# },
# {
# "peers": 55
# }
# ],
# "default": {
# "no_ipv4_unicast": true
# },
# "router_id": "192.1.2.9"
# },
# "maximum_paths": [
# {
# "count": 20,
# "path": "ebgp"
# },
# {
# "count": 55,
# "path": "ibgp"
# }
# ],
# "neighbor": [
# {
# "address": "192.0.2.25",
# "disable_connected_check": true,
# "timers": {
# "holdtime": 30,
# "keepalive": 10
# }
# },
# {
# "address": "203.0.113.5",
# "attribute_unchanged": {
# "as_path": true,
# "med": true,
# "next_hop": true
# },
# "ebgp_multihop": 2,
# "remote_as": 101,
# "update_source": "192.0.2.25"
# },
# {
# "address": "5001::64",
# "distribute_list": [
# {
# "acl": 20,
# "action": "export"
# },
# {
# "acl": 40,
# "action": "import"
# }
# ],
# "maximum_prefix": 34
# }
# ],
# "network": [
# {
# "address": "192.1.13.0/24",
# "backdoor": true
# }
# ],
# "redistribute": [
# {
# "protocol": "connected",
# "route_map": "map01"
# },
# {
# "metric": 45,
# "protocol": "kernel"
# }
# ],
# "timers": {
# "keepalive": 35
# }
# },
# "changed": true,
# "commands": [
# "delete protocols bgp 65536"
# ],
# Deleted in presence of address family under neighbors:
# Before state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 65536 neighbor 192.0.2.43 advertisement-interval '72'
# set protocols bgp 65536 neighbor 192.0.2.43 capability 'dynamic'
# set protocols bgp 65536 neighbor 192.0.2.43 'disable-connected-check'
# set protocols bgp 65536 neighbor 192.0.2.43 timers holdtime '30'
# set protocols bgp 65536 neighbor 192.0.2.43 timers keepalive '10'
# set protocols bgp 65536 neighbor 203.0.113.0 address-family 'ipv6-unicast'
# set protocols bgp 65536 neighbor 203.0.113.0 capability orf prefix-list 'receive'
# set protocols bgp 65536 network 203.0.113.0/24 route-map 'map01'
# set protocols bgp 65536 parameters 'always-compare-med'
# set protocols bgp 65536 parameters bestpath as-path 'confed'
# set protocols bgp 65536 parameters bestpath 'compare-routerid'
# set protocols bgp 65536 parameters dampening half-life '33'
# set protocols bgp 65536 parameters dampening max-suppress-time '20'
# set protocols bgp 65536 parameters dampening re-use '60'
# set protocols bgp 65536 parameters dampening start-suppress-time '5'
# set protocols bgp 65536 parameters default 'no-ipv4-unicast'
# set protocols bgp 65536 parameters distance global external '66'
# set protocols bgp 65536 parameters distance global internal '20'
# set protocols bgp 65536 parameters distance global local '10'
# set protocols bgp 65536 redistribute static route-map 'map01'
# vyos@vyos:~$ ^C
# vyos@vyos:~$
- name: Delete configuration
vyos.vyos.vyos_bgp_global:
config:
as_number: "65536"
state: deleted
# Module Execution:
#
# "changed": false,
# "invocation": {
# "module_args": {
# "config": {
# "aggregate_address": null,
# "as_number": 65536,
# "bgp_params": null,
# "maximum_paths": null,
# "neighbor": null,
# "network": null,
# "redistribute": null,
# "timers": null
# },
# "running_config": null,
# "state": "deleted"
# }
# },
# "msg": "Use the _bgp_address_family module to delete the address_family under neighbor 203.0.113.0, before replacing/deleting the neighbor."
# }
# using gathered:
# --------------
# Before state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 65536 neighbor 192.0.2.43 advertisement-interval '72'
# set protocols bgp 65536 neighbor 192.0.2.43 capability 'dynamic'
# set protocols bgp 65536 neighbor 192.0.2.43 'disable-connected-check'
# set protocols bgp 65536 neighbor 192.0.2.43 timers holdtime '30'
# set protocols bgp 65536 neighbor 192.0.2.43 timers keepalive '10'
# set protocols bgp 65536 neighbor 203.0.113.0 address-family 'ipv6-unicast'
# set protocols bgp 65536 neighbor 203.0.113.0 capability orf prefix-list 'receive'
# set protocols bgp 65536 network 203.0.113.0/24 route-map 'map01'
# set protocols bgp 65536 parameters 'always-compare-med'
# set protocols bgp 65536 parameters bestpath as-path 'confed'
# set protocols bgp 65536 parameters bestpath 'compare-routerid'
# set protocols bgp 65536 parameters dampening half-life '33'
# set protocols bgp 65536 parameters dampening max-suppress-time '20'
# set protocols bgp 65536 parameters dampening re-use '60'
# set protocols bgp 65536 parameters dampening start-suppress-time '5'
# set protocols bgp 65536 parameters default 'no-ipv4-unicast'
# set protocols bgp 65536 parameters distance global external '66'
# set protocols bgp 65536 parameters distance global internal '20'
# set protocols bgp 65536 parameters distance global local '10'
# set protocols bgp 65536 redistribute static route-map 'map01'
# vyos@vyos:~$ ^C
- name: gather configs
vyos.vyos.vyos_bgp_global:
state: gathered
# Module Execution:
# "gathered": {
# "as_number": 65536,
# "bgp_params": {
# "always_compare_med": true,
# "bestpath": {
# "as_path": "confed",
# "compare_routerid": true
# },
# "default": {
# "no_ipv4_unicast": true
# },
# "distance": [
# {
# "type": "external",
# "value": 66
# },
# {
# "type": "internal",
# "value": 20
# },
# {
# "type": "local",
# "value": 10
# }
# ]
# },
# "neighbor": [
# {
# "address": "192.0.2.43",
# "advertisement_interval": 72,
# "capability": {
# "dynamic": true
# },
# "disable_connected_check": true,
# "timers": {
# "holdtime": 30,
# "keepalive": 10
# }
# },
# {
# "address": "203.0.113.0",
# "capability": {
# "orf": "receive"
# }
# }
# ],
# "network": [
# {
# "address": "203.0.113.0/24",
# "route_map": "map01"
# }
# ],
# "redistribute": [
# {
# "protocol": "static",
# "route_map": "map01"
# }
# ]
# },
#
# Using parsed:
# ------------
# parsed.cfg
# set protocols bgp 65536 neighbor 192.0.2.43 advertisement-interval '72'
# set protocols bgp 65536 neighbor 192.0.2.43 capability 'dynamic'
# set protocols bgp 65536 neighbor 192.0.2.43 'disable-connected-check'
# set protocols bgp 65536 neighbor 192.0.2.43 timers holdtime '30'
# set protocols bgp 65536 neighbor 192.0.2.43 timers keepalive '10'
# set protocols bgp 65536 neighbor 203.0.113.0 address-family 'ipv6-unicast'
# set protocols bgp 65536 neighbor 203.0.113.0 capability orf prefix-list 'receive'
# set protocols bgp 65536 network 203.0.113.0/24 route-map 'map01'
# set protocols bgp 65536 parameters 'always-compare-med'
# set protocols bgp 65536 parameters bestpath as-path 'confed'
# set protocols bgp 65536 parameters bestpath 'compare-routerid'
# set protocols bgp 65536 parameters dampening half-life '33'
# set protocols bgp 65536 parameters dampening max-suppress-time '20'
# set protocols bgp 65536 parameters dampening re-use '60'
# set protocols bgp 65536 parameters dampening start-suppress-time '5'
# set protocols bgp 65536 parameters default 'no-ipv4-unicast'
# set protocols bgp 65536 parameters distance global external '66'
# set protocols bgp 65536 parameters distance global internal '20'
# set protocols bgp 65536 parameters distance global local '10'
# set protocols bgp 65536 redistribute static route-map 'map01'
- name: parse configs
vyos.vyos.vyos_bgp_global:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
tags:
- parsed
# Module execution:
# "parsed": {
# "as_number": 65536,
# "bgp_params": {
# "always_compare_med": true,
# "bestpath": {
# "as_path": "confed",
# "compare_routerid": true
# },
# "default": {
# "no_ipv4_unicast": true
# },
# "distance": [
# {
# "type": "external",
# "value": 66
# },
# {
# "type": "internal",
# "value": 20
# },
# {
# "type": "local",
# "value": 10
# }
# ]
# },
# "neighbor": [
# {
# "address": "192.0.2.43",
# "advertisement_interval": 72,
# "capability": {
# "dynamic": true
# },
# "disable_connected_check": true,
# "timers": {
# "holdtime": 30,
# "keepalive": 10
# }
# },
# {
# "address": "203.0.113.0",
# "capability": {
# "orf": "receive"
# }
# }
# ],
# "network": [
# {
# "address": "203.0.113.0/24",
# "route_map": "map01"
# }
# ],
# "redistribute": [
# {
# "protocol": "static",
# "route_map": "map01"
# }
# ]
# }
#
# Using rendered:
# --------------
- name: Render
vyos.vyos.vyos_bgp_global:
config:
as_number: "65536"
network:
- address: "203.0.113.0/24"
route_map: map01
redistribute:
- protocol: "static"
route_map: "map01"
bgp_params:
always_compare_med: true
dampening:
start_suppress_time: 5
max_suppress_time: 20
half_life: 33
re_use: 60
distance:
- type: "internal"
value: 20
- type: "local"
value: 10
- type: "external"
value: 66
bestpath:
as_path: "confed"
compare_routerid: true
default:
no_ipv4_unicast: true
neighbor:
- address: "192.0.2.43"
disable_connected_check: true
advertisement_interval: 72
capability:
dynamic: true
timers:
holdtime: 30
keepalive: 10
- address: "203.0.113.0"
capability:
orf: "receive"
state: rendered
# Module Execution:
# "rendered": [
# "set protocols bgp 65536 neighbor 192.0.2.43 disable-connected-check",
# "set protocols bgp 65536 neighbor 192.0.2.43 advertisement-interval 72",
# "set protocols bgp 65536 neighbor 192.0.2.43 capability dynamic",
# "set protocols bgp 65536 neighbor 192.0.2.43 timers holdtime 30",
# "set protocols bgp 65536 neighbor 192.0.2.43 timers keepalive 10",
# "set protocols bgp 65536 neighbor 203.0.113.0 capability orf prefix-list receive",
# "set protocols bgp 65536 redistribute static route-map map01",
# "set protocols bgp 65536 network 203.0.113.0/24 route-map map01",
# "set protocols bgp 65536 parameters always-compare-med",
# "set protocols bgp 65536 parameters dampening half-life 33",
# "set protocols bgp 65536 parameters dampening max-suppress-time 20",
# "set protocols bgp 65536 parameters dampening re-use 60",
# "set protocols bgp 65536 parameters dampening start-suppress-time 5",
# "set protocols bgp 65536 parameters distance global internal 20",
# "set protocols bgp 65536 parameters distance global local 10",
# "set protocols bgp 65536 parameters distance global external 66",
# "set protocols bgp 65536 parameters bestpath as-path confed",
# "set protocols bgp 65536 parameters bestpath compare-routerid",
# "set protocols bgp 65536 parameters default no-ipv4-unicast"
# ]
```
### Authors
* Gomathi Selvi Srinivasan (@GomathiselviS)
| programming_docs |
ansible vyos.vyos.vyos_firewall_global – FIREWALL global resource module vyos.vyos.vyos\_firewall\_global – FIREWALL global resource module
==================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_firewall_global`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manage global policies or configurations for firewall on VyOS devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | A dictionary of Firewall global configuration options. |
| | **config\_trap** boolean | **Choices:*** no
* yes
| SNMP trap generation on firewall configuration changes. |
| | **group** dictionary | | Defines a group of objects for referencing in firewall rules. |
| | | **address\_group** list / elements=dictionary | | Defines a group of IP addresses for referencing in firewall rules. |
| | | | **afi** string | **Choices:*** **ipv4** ←
* ipv6
| Specifies IP address type |
| | | | **description** string | | Allows you to specify a brief description for the address group. |
| | | | **members** list / elements=dictionary | | Address-group members. IPv4 address to match. IPv4 range to match. |
| | | | | **address** string | | IP address. |
| | | | **name** string / required | | Name of the firewall address group. |
| | | **network\_group** list / elements=dictionary | | Defines a group of networks for referencing in firewall rules. |
| | | | **afi** string | **Choices:*** **ipv4** ←
* ipv6
| Specifies network address type |
| | | | **description** string | | Allows you to specify a brief description for the network group. |
| | | | **members** list / elements=dictionary | | Adds an IPv4 network to the specified network group. The format is ip-address/prefix. |
| | | | | **address** string | | IP address. |
| | | | **name** string / required | | Name of the firewall network group. |
| | | **port\_group** list / elements=dictionary | | Defines a group of ports for referencing in firewall rules. |
| | | | **description** string | | Allows you to specify a brief description for the port group. |
| | | | **members** list / elements=dictionary | | Port-group member. |
| | | | | **port** string | | Defines the number. |
| | | | **name** string / required | | Name of the firewall port group. |
| | **log\_martians** boolean | **Choices:*** no
* yes
| Specifies whether or not to record packets with invalid addresses in the log. (True) Logs packets with invalid addresses. (False) Does not log packets with invalid addresses. |
| | **ping** dictionary | | Policy for handling of all IPv4 ICMP echo requests. |
| | | **all** boolean | **Choices:*** no
* yes
| Enables or disables response to all IPv4 ICMP Echo Request (ping) messages. The system responds to IPv4 ICMP Echo Request messages. |
| | | **broadcast** boolean | **Choices:*** no
* yes
| Enables or disables response to broadcast IPv4 ICMP Echo Request and Timestamp Request messages. IPv4 ICMP Echo and Timestamp Request messages are not processed. |
| | **route\_redirects** list / elements=dictionary | | -A dictionary of Firewall icmp redirect and source route global configuration options. |
| | | **afi** string / required | **Choices:*** ipv4
* ipv6
| Specifies IP address type |
| | | **icmp\_redirects** dictionary | | Specifies whether to allow sending/receiving of IPv4/v6 ICMP redirect messages. |
| | | | **receive** boolean | **Choices:*** no
* yes
| Permits or denies receiving packets ICMP redirect messages. |
| | | | **send** boolean | **Choices:*** no
* yes
| Permits or denies transmitting packets ICMP redirect messages. |
| | | **ip\_src\_route** boolean | **Choices:*** no
* yes
| Specifies whether or not to process source route IP options. |
| | **state\_policy** list / elements=dictionary | | Specifies global firewall state-policy. |
| | | **action** string | **Choices:*** accept
* drop
* reject
| Action for packets part of an established connection. |
| | | **connection\_type** string | **Choices:*** established
* invalid
* related
| Specifies connection type. |
| | | **log** boolean | **Choices:*** no
* yes
| Enable logging of packets part of an established connection. |
| | **syn\_cookies** boolean | **Choices:*** no
* yes
| Specifies policy for using TCP SYN cookies with IPv4. (True) Enables TCP SYN cookies with IPv4. (False) Disables TCP SYN cookies with IPv4. |
| | **twa\_hazards\_protection** boolean | **Choices:*** no
* yes
| RFC1337 TCP TIME-WAIT assassination hazards protection. |
| | **validation** string | **Choices:*** strict
* loose
* disable
| Specifies a policy for source validation by reversed path, as defined in RFC 3704. (disable) No source validation is performed. (loose) Enable Loose Reverse Path Forwarding as defined in RFC3704. (strict) Enable Strict Reverse Path Forwarding as defined in RFC3704. |
| **running\_config** string | | The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The *running\_config* argument allows the implementer to pass in the configuration to use as the base config for comparison. This value of this option should be the output received from device by executing command `show configuration commands | grep 'firewall'`
|
| **state** string | **Choices:*** **merged** ←
* replaced
* deleted
* gathered
* rendered
* parsed
| The state the configuration should be left in. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep firewall
#
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_firewall_global:
config:
validation: strict
config_trap: true
log_martians: true
syn_cookies: true
twa_hazards_protection: true
ping:
all: true
broadcast: true
state_policy:
- connection_type: established
action: accept
log: true
- connection_type: invalid
action: reject
route_redirects:
- afi: ipv4
ip_src_route: true
icmp_redirects:
send: true
receive: false
group:
address_group:
- name: MGMT-HOSTS
description: This group has the Management hosts address list
members:
- address: 192.0.1.1
- address: 192.0.1.3
- address: 192.0.1.5
network_group:
- name: MGMT
description: This group has the Management network addresses
members:
- address: 192.0.1.0/24
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": []
#
# "commands": [
# "set firewall group address-group MGMT-HOSTS address 192.0.1.1",
# "set firewall group address-group MGMT-HOSTS address 192.0.1.3",
# "set firewall group address-group MGMT-HOSTS address 192.0.1.5",
# "set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list'",
# "set firewall group address-group MGMT-HOSTS",
# "set firewall group network-group MGMT network 192.0.1.0/24",
# "set firewall group network-group MGMT description 'This group has the Management network addresses'",
# "set firewall group network-group MGMT",
# "set firewall ip-src-route 'enable'",
# "set firewall receive-redirects 'disable'",
# "set firewall send-redirects 'enable'",
# "set firewall config-trap 'enable'",
# "set firewall state-policy established action 'accept'",
# "set firewall state-policy established log 'enable'",
# "set firewall state-policy invalid action 'reject'",
# "set firewall broadcast-ping 'enable'",
# "set firewall all-ping 'enable'",
# "set firewall log-martians 'enable'",
# "set firewall twa-hazards-protection 'enable'",
# "set firewall syn-cookies 'enable'",
# "set firewall source-validation 'strict'"
# ]
#
# "after": {
# "config_trap": true,
# "group": {
# "address_group": [
# {
# "description": "This group has the Management hosts address list",
# "members": [
# {
# "address": "192.0.1.1"
# },
# {
# "address": "192.0.1.3"
# },
# {
# "address": "192.0.1.5"
# }
# ],
# "name": "MGMT-HOSTS"
# }
# ],
# "network_group": [
# {
# "description": "This group has the Management network addresses",
# "members": [
# {
# "address": "192.0.1.0/24"
# }
# ],
# "name": "MGMT"
# }
# ]
# },
# "log_martians": true,
# "ping": {
# "all": true,
# "broadcast": true
# },
# "route_redirects": [
# {
# "afi": "ipv4",
# "icmp_redirects": {
# "receive": false,
# "send": true
# },
# "ip_src_route": true
# }
# ],
# "state_policy": [
# {
# "action": "accept",
# "connection_type": "established",
# "log": true
# },
# {
# "action": "reject",
# "connection_type": "invalid"
# }
# ],
# "syn_cookies": true,
# "twa_hazards_protection": true,
# "validation": "strict"
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep firewall
# set firewall all-ping 'enable'
# set firewall broadcast-ping 'enable'
# set firewall config-trap 'enable'
# set firewall group address-group MGMT-HOSTS address '192.0.1.1'
# set firewall group address-group MGMT-HOSTS address '192.0.1.3'
# set firewall group address-group MGMT-HOSTS address '192.0.1.5'
# set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list'
# set firewall group network-group MGMT description 'This group has the Management network addresses'
# set firewall group network-group MGMT network '192.0.1.0/24'
# set firewall ip-src-route 'enable'
# set firewall log-martians 'enable'
# set firewall receive-redirects 'disable'
# set firewall send-redirects 'enable'
# set firewall source-validation 'strict'
# set firewall state-policy established action 'accept'
# set firewall state-policy established log 'enable'
# set firewall state-policy invalid action 'reject'
# set firewall syn-cookies 'enable'
# set firewall twa-hazards-protection 'enable'
#
#
# Using parsed
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_firewall_global:
running_config:
"set firewall all-ping 'enable'
set firewall broadcast-ping 'enable'
set firewall config-trap 'enable'
set firewall group address-group ENG-HOSTS address '192.0.3.1'
set firewall group address-group ENG-HOSTS address '192.0.3.2'
set firewall group address-group ENG-HOSTS description 'Sales office hosts address list'
set firewall group address-group SALES-HOSTS address '192.0.2.1'
set firewall group address-group SALES-HOSTS address '192.0.2.2'
set firewall group address-group SALES-HOSTS address '192.0.2.3'
set firewall group address-group SALES-HOSTS description 'Sales office hosts address list'
set firewall group network-group MGMT description 'This group has the Management network addresses'
set firewall group network-group MGMT network '192.0.1.0/24'
set firewall ip-src-route 'enable'
set firewall log-martians 'enable'
set firewall receive-redirects 'disable'
set firewall send-redirects 'enable'
set firewall source-validation 'strict'
set firewall state-policy established action 'accept'
set firewall state-policy established log 'enable'
set firewall state-policy invalid action 'reject'
set firewall syn-cookies 'enable'
set firewall twa-hazards-protection 'enable'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": {
# "config_trap": true,
# "group": {
# "address_group": [
# {
# "description": "Sales office hosts address list",
# "members": [
# {
# "address": "192.0.3.1"
# },
# {
# "address": "192.0.3.2"
# }
# ],
# "name": "ENG-HOSTS"
# },
# {
# "description": "Sales office hosts address list",
# "members": [
# {
# "address": "192.0.2.1"
# },
# {
# "address": "192.0.2.2"
# },
# {
# "address": "192.0.2.3"
# }
# ],
# "name": "SALES-HOSTS"
# }
# ],
# "network_group": [
# {
# "description": "This group has the Management network addresses",
# "members": [
# {
# "address": "192.0.1.0/24"
# }
# ],
# "name": "MGMT"
# }
# ]
# },
# "log_martians": true,
# "ping": {
# "all": true,
# "broadcast": true
# },
# "route_redirects": [
# {
# "afi": "ipv4",
# "icmp_redirects": {
# "receive": false,
# "send": true
# },
# "ip_src_route": true
# }
# ],
# "state_policy": [
# {
# "action": "accept",
# "connection_type": "established",
# "log": true
# },
# {
# "action": "reject",
# "connection_type": "invalid"
# }
# ],
# "syn_cookies": true,
# "twa_hazards_protection": true,
# "validation": "strict"
# }
# }
#
#
# Using deleted
#
# Before state
# -------------
#
# vyos@192# run show configuration commands | grep firewall
# set firewall all-ping 'enable'
# set firewall broadcast-ping 'enable'
# set firewall config-trap 'enable'
# set firewall group address-group MGMT-HOSTS address '192.0.1.1'
# set firewall group address-group MGMT-HOSTS address '192.0.1.3'
# set firewall group address-group MGMT-HOSTS address '192.0.1.5'
# set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list'
# set firewall group network-group MGMT description 'This group has the Management network addresses'
# set firewall group network-group MGMT network '192.0.1.0/24'
# set firewall ip-src-route 'enable'
# set firewall log-martians 'enable'
# set firewall receive-redirects 'disable'
# set firewall send-redirects 'enable'
# set firewall source-validation 'strict'
# set firewall state-policy established action 'accept'
# set firewall state-policy established log 'enable'
# set firewall state-policy invalid action 'reject'
# set firewall syn-cookies 'enable'
# set firewall twa-hazards-protection 'enable'
- name: Delete attributes of firewall.
vyos.vyos.vyos_firewall_global:
config:
state_policy:
config_trap:
log_martians:
syn_cookies:
twa_hazards_protection:
route_redirects:
ping:
group:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": {
# "config_trap": true,
# "group": {
# "address_group": [
# {
# "description": "This group has the Management hosts address list",
# "members": [
# {
# "address": "192.0.1.1"
# },
# {
# "address": "192.0.1.3"
# },
# {
# "address": "192.0.1.5"
# }
# ],
# "name": "MGMT-HOSTS"
# }
# ],
# "network_group": [
# {
# "description": "This group has the Management network addresses",
# "members": [
# {
# "address": "192.0.1.0/24"
# }
# ],
# "name": "MGMT"
# }
# ]
# },
# "log_martians": true,
# "ping": {
# "all": true,
# "broadcast": true
# },
# "route_redirects": [
# {
# "afi": "ipv4",
# "icmp_redirects": {
# "receive": false,
# "send": true
# },
# "ip_src_route": true
# }
# ],
# "state_policy": [
# {
# "action": "accept",
# "connection_type": "established",
# "log": true
# },
# {
# "action": "reject",
# "connection_type": "invalid"
# }
# ],
# "syn_cookies": true,
# "twa_hazards_protection": true,
# "validation": "strict"
# }
# "commands": [
# "delete firewall source-validation",
# "delete firewall group",
# "delete firewall log-martians",
# "delete firewall ip-src-route",
# "delete firewall receive-redirects",
# "delete firewall send-redirects",
# "delete firewall config-trap",
# "delete firewall state-policy",
# "delete firewall syn-cookies",
# "delete firewall broadcast-ping",
# "delete firewall all-ping",
# "delete firewall twa-hazards-protection"
# ]
#
# "after": []
# After state
# ------------
# vyos@192# run show configuration commands | grep firewall
# set 'firewall'
#
#
# Using replaced
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall all-ping 'enable'
# set firewall broadcast-ping 'enable'
# set firewall config-trap 'enable'
# set firewall group address-group MGMT-HOSTS address '192.0.1.1'
# set firewall group address-group MGMT-HOSTS address '192.0.1.3'
# set firewall group address-group MGMT-HOSTS address '192.0.1.5'
# set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list'
# set firewall group network-group MGMT description 'This group has the Management network addresses'
# set firewall group network-group MGMT network '192.0.1.0/24'
# set firewall ip-src-route 'enable'
# set firewall log-martians 'enable'
# set firewall receive-redirects 'disable'
# set firewall send-redirects 'enable'
# set firewall source-validation 'strict'
# set firewall state-policy established action 'accept'
# set firewall state-policy established log 'enable'
# set firewall state-policy invalid action 'reject'
# set firewall syn-cookies 'enable'
# set firewall twa-hazards-protection 'enable'
#
- name: Replace firewall global attributes configuration.
vyos.vyos.vyos_firewall_global:
config:
validation: strict
config_trap: true
log_martians: true
syn_cookies: true
twa_hazards_protection: true
ping:
all: true
broadcast: true
state_policy:
- connection_type: established
action: accept
log: true
- connection_type: invalid
action: reject
route_redirects:
- afi: ipv4
ip_src_route: true
icmp_redirects:
send: true
receive: false
group:
address_group:
- name: SALES-HOSTS
description: Sales office hosts address list
members:
- address: 192.0.2.1
- address: 192.0.2.2
- address: 192.0.2.3
- name: ENG-HOSTS
description: Sales office hosts address list
members:
- address: 192.0.3.1
- address: 192.0.3.2
network_group:
- name: MGMT
description: This group has the Management network addresses
members:
- address: 192.0.1.0/24
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": {
# "config_trap": true,
# "group": {
# "address_group": [
# {
# "description": "This group has the Management hosts address list",
# "members": [
# {
# "address": "192.0.1.1"
# },
# {
# "address": "192.0.1.3"
# },
# {
# "address": "192.0.1.5"
# }
# ],
# "name": "MGMT-HOSTS"
# }
# ],
# "network_group": [
# {
# "description": "This group has the Management network addresses",
# "members": [
# {
# "address": "192.0.1.0/24"
# }
# ],
# "name": "MGMT"
# }
# ]
# },
# "log_martians": true,
# "ping": {
# "all": true,
# "broadcast": true
# },
# "route_redirects": [
# {
# "afi": "ipv4",
# "icmp_redirects": {
# "receive": false,
# "send": true
# },
# "ip_src_route": true
# }
# ],
# "state_policy": [
# {
# "action": "accept",
# "connection_type": "established",
# "log": true
# },
# {
# "action": "reject",
# "connection_type": "invalid"
# }
# ],
# "syn_cookies": true,
# "twa_hazards_protection": true,
# "validation": "strict"
# }
#
# "commands": [
# "delete firewall group address-group MGMT-HOSTS",
# "set firewall group address-group SALES-HOSTS address 192.0.2.1",
# "set firewall group address-group SALES-HOSTS address 192.0.2.2",
# "set firewall group address-group SALES-HOSTS address 192.0.2.3",
# "set firewall group address-group SALES-HOSTS description 'Sales office hosts address list'",
# "set firewall group address-group SALES-HOSTS",
# "set firewall group address-group ENG-HOSTS address 192.0.3.1",
# "set firewall group address-group ENG-HOSTS address 192.0.3.2",
# "set firewall group address-group ENG-HOSTS description 'Sales office hosts address list'",
# "set firewall group address-group ENG-HOSTS"
# ]
#
# "after": {
# "config_trap": true,
# "group": {
# "address_group": [
# {
# "description": "Sales office hosts address list",
# "members": [
# {
# "address": "192.0.3.1"
# },
# {
# "address": "192.0.3.2"
# }
# ],
# "name": "ENG-HOSTS"
# },
# {
# "description": "Sales office hosts address list",
# "members": [
# {
# "address": "192.0.2.1"
# },
# {
# "address": "192.0.2.2"
# },
# {
# "address": "192.0.2.3"
# }
# ],
# "name": "SALES-HOSTS"
# }
# ],
# "network_group": [
# {
# "description": "This group has the Management network addresses",
# "members": [
# {
# "address": "192.0.1.0/24"
# }
# ],
# "name": "MGMT"
# }
# ]
# },
# "log_martians": true,
# "ping": {
# "all": true,
# "broadcast": true
# },
# "route_redirects": [
# {
# "afi": "ipv4",
# "icmp_redirects": {
# "receive": false,
# "send": true
# },
# "ip_src_route": true
# }
# ],
# "state_policy": [
# {
# "action": "accept",
# "connection_type": "established",
# "log": true
# },
# {
# "action": "reject",
# "connection_type": "invalid"
# }
# ],
# "syn_cookies": true,
# "twa_hazards_protection": true,
# "validation": "strict"
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep firewall
# set firewall all-ping 'enable'
# set firewall broadcast-ping 'enable'
# set firewall config-trap 'enable'
# set firewall group address-group ENG-HOSTS address '192.0.3.1'
# set firewall group address-group ENG-HOSTS address '192.0.3.2'
# set firewall group address-group ENG-HOSTS description 'Sales office hosts address list'
# set firewall group address-group SALES-HOSTS address '192.0.2.1'
# set firewall group address-group SALES-HOSTS address '192.0.2.2'
# set firewall group address-group SALES-HOSTS address '192.0.2.3'
# set firewall group address-group SALES-HOSTS description 'Sales office hosts address list'
# set firewall group network-group MGMT description 'This group has the Management network addresses'
# set firewall group network-group MGMT network '192.0.1.0/24'
# set firewall ip-src-route 'enable'
# set firewall log-martians 'enable'
# set firewall receive-redirects 'disable'
# set firewall send-redirects 'enable'
# set firewall source-validation 'strict'
# set firewall state-policy established action 'accept'
# set firewall state-policy established log 'enable'
# set firewall state-policy invalid action 'reject'
# set firewall syn-cookies 'enable'
# set firewall twa-hazards-protection 'enable'
#
#
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep firewall
# set firewall all-ping 'enable'
# set firewall broadcast-ping 'enable'
# set firewall config-trap 'enable'
# set firewall group address-group ENG-HOSTS address '192.0.3.1'
# set firewall group address-group ENG-HOSTS address '192.0.3.2'
# set firewall group address-group ENG-HOSTS description 'Sales office hosts address list'
# set firewall group address-group SALES-HOSTS address '192.0.2.1'
# set firewall group address-group SALES-HOSTS address '192.0.2.2'
# set firewall group address-group SALES-HOSTS address '192.0.2.3'
# set firewall group address-group SALES-HOSTS description 'Sales office hosts address list'
# set firewall group network-group MGMT description 'This group has the Management network addresses'
# set firewall group network-group MGMT network '192.0.1.0/24'
# set firewall ip-src-route 'enable'
# set firewall log-martians 'enable'
# set firewall receive-redirects 'disable'
# set firewall send-redirects 'enable'
# set firewall source-validation 'strict'
# set firewall state-policy established action 'accept'
# set firewall state-policy established log 'enable'
# set firewall state-policy invalid action 'reject'
# set firewall syn-cookies 'enable'
# set firewall twa-hazards-protection 'enable'
#
- name: Gather firewall global config with provided configurations
vyos.vyos.vyos_firewall_global:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "config_trap": true,
# "group": {
# "address_group": [
# {
# "description": "Sales office hosts address list",
# "members": [
# {
# "address": "192.0.3.1"
# },
# {
# "address": "192.0.3.2"
# }
# ],
# "name": "ENG-HOSTS"
# },
# {
# "description": "Sales office hosts address list",
# "members": [
# {
# "address": "192.0.2.1"
# },
# {
# "address": "192.0.2.2"
# },
# {
# "address": "192.0.2.3"
# }
# ],
# "name": "SALES-HOSTS"
# }
# ],
# "network_group": [
# {
# "description": "This group has the Management network addresses",
# "members": [
# {
# "address": "192.0.1.0/24"
# }
# ],
# "name": "MGMT"
# }
# ]
# },
# "log_martians": true,
# "ping": {
# "all": true,
# "broadcast": true
# },
# "route_redirects": [
# {
# "afi": "ipv4",
# "icmp_redirects": {
# "receive": false,
# "send": true
# },
# "ip_src_route": true
# }
# ],
# "state_policy": [
# {
# "action": "accept",
# "connection_type": "established",
# "log": true
# },
# {
# "action": "reject",
# "connection_type": "invalid"
# }
# ],
# "syn_cookies": true,
# "twa_hazards_protection": true,
# "validation": "strict"
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep firewall
# set firewall all-ping 'enable'
# set firewall broadcast-ping 'enable'
# set firewall config-trap 'enable'
# set firewall group address-group ENG-HOSTS address '192.0.3.1'
# set firewall group address-group ENG-HOSTS address '192.0.3.2'
# set firewall group address-group ENG-HOSTS description 'Sales office hosts address list'
# set firewall group address-group SALES-HOSTS address '192.0.2.1'
# set firewall group address-group SALES-HOSTS address '192.0.2.2'
# set firewall group address-group SALES-HOSTS address '192.0.2.3'
# set firewall group address-group SALES-HOSTS description 'Sales office hosts address list'
# set firewall group network-group MGMT description 'This group has the Management network addresses'
# set firewall group network-group MGMT network '192.0.1.0/24'
# set firewall ip-src-route 'enable'
# set firewall log-martians 'enable'
# set firewall receive-redirects 'disable'
# set firewall send-redirects 'enable'
# set firewall source-validation 'strict'
# set firewall state-policy established action 'accept'
# set firewall state-policy established log 'enable'
# set firewall state-policy invalid action 'reject'
# set firewall syn-cookies 'enable'
# set firewall twa-hazards-protection 'enable'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_firewall_global:
config:
validation: strict
config_trap: true
log_martians: true
syn_cookies: true
twa_hazards_protection: true
ping:
all: true
broadcast: true
state_policy:
- connection_type: established
action: accept
log: true
- connection_type: invalid
action: reject
route_redirects:
- afi: ipv4
ip_src_route: true
icmp_redirects:
send: true
receive: false
group:
address_group:
- name: SALES-HOSTS
description: Sales office hosts address list
members:
- address: 192.0.2.1
- address: 192.0.2.2
- address: 192.0.2.3
- name: ENG-HOSTS
description: Sales office hosts address list
members:
- address: 192.0.3.1
- address: 192.0.3.2
network_group:
- name: MGMT
description: This group has the Management network addresses
members:
- address: 192.0.1.0/24
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set firewall group address-group SALES-HOSTS address 192.0.2.1",
# "set firewall group address-group SALES-HOSTS address 192.0.2.2",
# "set firewall group address-group SALES-HOSTS address 192.0.2.3",
# "set firewall group address-group SALES-HOSTS description 'Sales office hosts address list'",
# "set firewall group address-group SALES-HOSTS",
# "set firewall group address-group ENG-HOSTS address 192.0.3.1",
# "set firewall group address-group ENG-HOSTS address 192.0.3.2",
# "set firewall group address-group ENG-HOSTS description 'Sales office hosts address list'",
# "set firewall group address-group ENG-HOSTS",
# "set firewall group network-group MGMT network 192.0.1.0/24",
# "set firewall group network-group MGMT description 'This group has the Management network addresses'",
# "set firewall group network-group MGMT",
# "set firewall ip-src-route 'enable'",
# "set firewall receive-redirects 'disable'",
# "set firewall send-redirects 'enable'",
# "set firewall config-trap 'enable'",
# "set firewall state-policy established action 'accept'",
# "set firewall state-policy established log 'enable'",
# "set firewall state-policy invalid action 'reject'",
# "set firewall broadcast-ping 'enable'",
# "set firewall all-ping 'enable'",
# "set firewall log-martians 'enable'",
# "set firewall twa-hazards-protection 'enable'",
# "set firewall syn-cookies 'enable'",
# "set firewall source-validation 'strict'"
# ]
#
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['set firewall group address-group ENG-HOSTS', 'set firewall group address-group ENG-HOSTS address 192.0.3.1'] |
### Authors
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_bgp_address_family – BGP Address Family Resource Module. vyos.vyos.vyos\_bgp\_address\_family – BGP Address Family Resource Module.
==========================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_bgp_address_family`.
New in version 2.1.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module manages BGP address family configuration of interfaces on devices running VYOS.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | A dict of BGP global configuration for interfaces. |
| | **address\_family** list / elements=dictionary | | BGP address-family parameters. |
| | | **afi** string | **Choices:*** ipv4
* ipv6
| BGP address family settings. |
| | | **aggregate\_address** list / elements=dictionary | | BGP aggregate network. |
| | | | **as\_set** boolean | **Choices:*** no
* yes
| Generate AS-set path information for this aggregate address. |
| | | | **prefix** string | | BGP aggregate network. |
| | | | **summary\_only** boolean | **Choices:*** no
* yes
| Announce the aggregate summary network only. |
| | | **networks** list / elements=dictionary | | BGP network |
| | | | **backdoor** boolean | **Choices:*** no
* yes
| Network as a backdoor route. |
| | | | **path\_limit** integer | | AS path hop count limit |
| | | | **prefix** string | | BGP network address |
| | | | **route\_map** string | | Route-map to modify route attributes |
| | | **redistribute** list / elements=dictionary | | Redistribute routes from other protocols into BGP |
| | | | **metric** integer | | Metric for redistributed routes. |
| | | | **protocol** string | **Choices:*** connected
* kernel
* ospf
* ospfv3
* rip
* ripng
* static
| types of routes to be redistributed. |
| | | | **route\_map** string | | Route map to filter redistributed routes |
| | | | **table** string | | Redistribute non-main Kernel Routing Table. |
| | **as\_number** integer | | AS number. |
| | **neighbors** list / elements=dictionary | | BGP neighbor |
| | | **address\_family** list / elements=dictionary | | address family. |
| | | | **afi** string | **Choices:*** ipv4
* ipv6
| BGP neighbor parameters. |
| | | | **allowas\_in** integer | | Number of occurrences of AS number. |
| | | | **as\_override** boolean | **Choices:*** no
* yes
| AS for routes sent to this neighbor to be the local AS. |
| | | | **attribute\_unchanged** dictionary | | BGP attributes are sent unchanged. |
| | | | | **as\_path** boolean | **Choices:*** no
* yes
| as\_path attribute |
| | | | | **med** boolean | **Choices:*** no
* yes
| med attribute |
| | | | | **next\_hop** boolean | **Choices:*** no
* yes
| next\_hop attribute |
| | | | **capability** dictionary | | Advertise capabilities to this neighbor. |
| | | | | **dynamic** boolean | **Choices:*** no
* yes
| Advertise dynamic capability to this neighbor. |
| | | | | **orf** string | **Choices:*** send
* receive
| Advertise ORF capability to this neighbor. |
| | | | **default\_originate** string | | Send default route to this neighbor |
| | | | **distribute\_list** list / elements=dictionary | | Access-list to filter route updates to/from this neighbor. |
| | | | | **acl** integer | | Access-list number. |
| | | | | **action** string | **Choices:*** export
* import
| Access-list to filter outgoing/incoming route updates to this neighbor |
| | | | **filter\_list** list / elements=dictionary | | As-path-list to filter route updates to/from this neighbor. |
| | | | | **action** string | **Choices:*** export
* import
| filter outgoing/incoming route updates |
| | | | | **path\_list** string | | As-path-list to filter |
| | | | **maximum\_prefix** integer | | Maximum number of prefixes to accept from this neighbor nexthop-self Nexthop for routes sent to this neighbor to be the local router. |
| | | | **nexthop\_local** boolean | **Choices:*** no
* yes
| Nexthop attributes. |
| | | | **nexthop\_self** boolean | **Choices:*** no
* yes
| Nexthop for routes sent to this neighbor to be the local router. |
| | | | **peer\_group** string | | IPv4 peer group for this peer |
| | | | **prefix\_list** list / elements=dictionary | | Prefix-list to filter route updates to/from this neighbor. |
| | | | | **action** string | **Choices:*** export
* import
| filter outgoing/incoming route updates |
| | | | | **prefix\_list** string | | Prefix-list to filter |
| | | | **remove\_private\_as** boolean | **Choices:*** no
* yes
| Remove private AS numbers from AS path in outbound route updates |
| | | | **route\_map** list / elements=dictionary | | Route-map to filter route updates to/from this neighbor. |
| | | | | **action** string | **Choices:*** export
* import
| filter outgoing/incoming route updates |
| | | | | **route\_map** string | | route-map to filter |
| | | | **route\_reflector\_client** boolean | **Choices:*** no
* yes
| Neighbor as a route reflector client |
| | | | **route\_server\_client** boolean | **Choices:*** no
* yes
| Neighbor is route server client |
| | | | **soft\_reconfiguration** boolean | **Choices:*** no
* yes
| Soft reconfiguration for neighbor |
| | | | **unsupress\_map** string | | Route-map to selectively unsuppress suppressed routes |
| | | | **weight** integer | | Default weight for routes from this neighbor |
| | | **neighbor\_address** string | | BGP neighbor address (v4/v6). |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VYOS device by executing the command **show configuration command | match bgp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* deleted
* gathered
* parsed
* rendered
* purged
* overridden
| The state the configuration should be left in. |
Examples
--------
```
# Using merged
# Before state
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# vyos@vyos:~$
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_bgp_address_family:
config:
as_number: "100"
address_family:
- afi: "ipv4"
redistribute:
- protocol: "static"
metric: 50
neighbors:
- neighbor_address: "20.33.1.1/24"
address_family:
- afi: "ipv4"
allowas_in: 4
as_override: True
attribute_unchanged:
med: True
- afi: "ipv6"
default_originate: "map01"
distribute_list:
- action: "export"
acl: 10
- neighbor_address: "100.11.34.12"
address_family:
- afi: "ipv4"
maximum_prefix: 45
nexthop_self: True
route_map:
- action: "export"
route_map: "map01"
- action: "import"
route_map: "map01"
weight: 50
# After State:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast redistribute static metric '50'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast allowas-in number '4'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast as-override
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged med
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast default-originate route-map 'map01'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast distribute-list export '10'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast maximum-prefix '45'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast nexthop-self
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map export 'map01'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map import 'map01'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast weight '50'
# vyos@vyos:~$
#
# Module Execution:
#
# "after": {
# "address_family": [
# {
# "afi": "ipv4",
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# }
# ],
# "as_number": 100,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "maximum_prefix": 45,
# "nexthop_self": true,
# "route_map": [
# {
# "action": "export",
# "route_map": "map01"
# },
# {
# "action": "import",
# "route_map": "map01"
# }
# ],
# "weight": 50
# }
# ],
# "neighbor_address": "100.11.34.12"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "allowas_in": 4,
# "as_override": true,
# "attribute_unchanged": {
# "med": true
# }
# },
# {
# "afi": "ipv6",
# "default_originate": "map01",
# "distribute_list": [
# {
# "acl": 10,
# "action": "export"
# }
# ]
# }
# ],
# "neighbor_address": "20.33.1.1/24"
# }
# ]
# },
# "before": {},
# "changed": true,
# "commands": [
# "set protocols bgp 100 address-family ipv4-unicast redistribute static metric 50",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast allowas-in number 4",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast as-override",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged med",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast default-originate route-map map01",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast distribute-list export 10",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast maximum-prefix 45",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast nexthop-self",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map export map01",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map import map01",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast weight 50"
# ],
#
# Using replaced:
# Before state:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast redistribute static metric '50'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast allowas-in number '4'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast as-override
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged med
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast default-originate route-map 'map01'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast distribute-list export '10'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast maximum-prefix '45'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast nexthop-self
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map export 'map01'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map import 'map01'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast weight '50'
# vyos@vyos:~$
- name: Replace provided configuration with device configuration
vyos.vyos.vyos_bgp_address_family:
config:
as_number: "100"
neighbors:
- neighbor_address: "100.11.34.12"
address_family:
- afi: "ipv4"
allowas_in: 4
as_override: True
attribute_unchanged:
med: True
- afi: "ipv6"
default_originate: "map01"
distribute_list:
- action: "export"
acl: 10
- neighbor_address: "20.33.1.1/24"
address_family:
- afi: "ipv6"
maximum_prefix: 45
nexthop_self: True
state: replaced
# After State:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast redistribute static metric '50'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast maximum-prefix '45'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast nexthop-self
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast allowas-in number '4'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast as-override
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast attribute-unchanged med
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast default-originate route-map 'map01'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast distribute-list export '10'
# vyos@vyos:~$
#
#
# # Module Execution:
# "after": {
# "address_family": [
# {
# "afi": "ipv4",
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# }
# ],
# "as_number": 100,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "allowas_in": 4,
# "as_override": true,
# "attribute_unchanged": {
# "med": true
# }
# },
# {
# "afi": "ipv6",
# "default_originate": "map01",
# "distribute_list": [
# {
# "acl": 10,
# "action": "export"
# }
# ]
# }
# ],
# "neighbor_address": "100.11.34.12"
# },
# {
# "address_family": [
# {
# "afi": "ipv4"
# },
# {
# "afi": "ipv6",
# "maximum_prefix": 45,
# "nexthop_self": true
# }
# ],
# "neighbor_address": "20.33.1.1/24"
# }
# ]
# },
# "before": {
# "address_family": [
# {
# "afi": "ipv4",
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# }
# ],
# "as_number": 100,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "maximum_prefix": 45,
# "nexthop_self": true,
# "route_map": [
# {
# "action": "export",
# "route_map": "map01"
# },
# {
# "action": "import",
# "route_map": "map01"
# }
# ],
# "weight": 50
# }
# ],
# "neighbor_address": "100.11.34.12"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "allowas_in": 4,
# "as_override": true,
# "attribute_unchanged": {
# "med": true
# }
# },
# {
# "afi": "ipv6",
# "default_originate": "map01",
# "distribute_list": [
# {
# "acl": 10,
# "action": "export"
# }
# ]
# }
# ],
# "neighbor_address": "20.33.1.1/24"
# }
# ]
# },
# "changed": true,
# "commands": [
# "delete protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast distribute-list",
# "delete protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast default-originate",
# "delete protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged",
# "delete protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast as-override",
# "delete protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast allowas-in",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast weight",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast nexthop-self",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast maximum-prefix",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast allowas-in number 4",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast as-override",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast attribute-unchanged med",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast default-originate route-map map01",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast distribute-list export 10",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast maximum-prefix 45",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast nexthop-self"
# ],
# Using overridden
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast network 35.1.1.0/24 backdoor
# set protocols bgp 100 address-family ipv4-unicast redistribute static metric '50'
# set protocols bgp 100 address-family ipv6-unicast aggregate-address 6601:1:1:1::/64 summary-only
# set protocols bgp 100 address-family ipv6-unicast network 5001:1:1:1::/64 route-map 'map01'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast maximum-prefix '45'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast nexthop-self
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast allowas-in number '4'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast as-override
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast attribute-unchanged med
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast default-originate route-map 'map01'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast distribute-list export '10'
# vyos@vyos:~$
- name: Override
vyos.vyos.vyos_bgp_address_family:
config:
as_number: "100"
neighbors:
- neighbor_address: "100.11.34.12"
address_family:
- afi: "ipv6"
maximum_prefix: 45
nexthop_self: True
route_map:
- action: "import"
route_map: "map01"
address_family:
- afi: "ipv4"
aggregate_address:
- prefix: "60.9.2.0/24"
summary_only: True
- afi: "ipv6"
redistribute:
- protocol: "static"
metric: 50
state: overridden
# Aft=validate-moduleser State
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast aggregate-address 60.9.2.0/24 summary-only
# set protocols bgp 100 address-family ipv6-unicast redistribute static metric '50'
# set protocols bgp 100 neighbor 20.33.1.1/24
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast maximum-prefix '45'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast nexthop-self
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast route-map import 'map01'
# vyos@vyos:~$
# Module Execution:
# "after": {
# "address_family": [
# {
# "afi": "ipv4",
# "aggregate_address": [
# {
# "prefix": "60.9.2.0/24",
# "summary_only": true
# }
# ]
# },
# {
# "afi": "ipv6",
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# }
# ],
# "as_number": 100,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4"
# },
# {
# "afi": "ipv6",
# "maximum_prefix": 45,
# "nexthop_self": true,
# "route_map": [
# {
# "action": "import",
# "route_map": "map01"
# }
# ]
# }
# ],
# "neighbor_address": "100.11.34.12"
# }
# ]
# },
# "before": {
# "address_family": [
# {
# "afi": "ipv4",
# "networks": [
# {
# "backdoor": true,
# "prefix": "35.1.1.0/24"
# }
# ],
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# },
# {
# "afi": "ipv6",
# "aggregate_address": [
# {
# "prefix": "6601:1:1:1::/64",
# "summary_only": true
# }
# ],
# "networks": [
# {
# "prefix": "5001:1:1:1::/64",
# "route_map": "map01"
# }
# ]
# }
# ],
# "as_number": 100,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "allowas_in": 4,
# "as_override": true,
# "attribute_unchanged": {
# "med": true
# }
# },
# {
# "afi": "ipv6",
# "default_originate": "map01",
# "distribute_list": [
# {
# "acl": 10,
# "action": "export"
# }
# ]
# }
# ],
# "neighbor_address": "100.11.34.12"
# },
# {
# "address_family": [
# {
# "afi": "ipv4"
# },
# {
# "afi": "ipv6",
# "maximum_prefix": 45,
# "nexthop_self": true
# }
# ],
# "neighbor_address": "20.33.1.1/24"
# }
# ]
# },
# "changed": true,
# "commands": [
# "delete protocols bgp 100 neighbor 20.33.1.1/24 address-family",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast distribute-list",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast default-originate",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast attribute-unchanged",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast as-override",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast allowas-in",
# "delete protocols bgp 100 address-family ipv6 aggregate-address",
# "delete protocols bgp 100 address-family ipv6 network",
# "delete protocols bgp 100 address-family ipv4 network",
# "delete protocols bgp 100 address-family ipv4 redistribute",
# "set protocols bgp 100 address-family ipv4-unicast aggregate-address 60.9.2.0/24 summary-only",
# "set protocols bgp 100 address-family ipv6-unicast redistribute static metric 50",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast maximum-prefix 45",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast nexthop-self",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast route-map import map01"
# ],
#
# Using deleted:
# Before State:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast aggregate-address 60.9.2.0/24 summary-only
# set protocols bgp 100 address-family ipv4-unicast redistribute static metric '50'
# set protocols bgp 100 address-family ipv6-unicast redistribute static metric '50'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast allowas-in number '4'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast as-override
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged med
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast default-originate route-map 'map01'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast distribute-list export '10'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast maximum-prefix '45'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast nexthop-self
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map export 'map01'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map import 'map01'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast weight '50'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast maximum-prefix '45'
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast nexthop-self
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast route-map import 'map01'
# vyos@vyos:~$
- name: Delete
vyos.vyos.vyos_bgp_address_family:
config:
as_number: "100"
neighbors:
- neighbor_address: "20.33.1.1/24"
address_family:
- afi: "ipv6"
- neighbor_address: "100.11.34.12"
address_family:
- afi: "ipv4"
state: deleted
# After State:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv6-unicast redistribute static metric '50'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast allowas-in number '4'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast as-override
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged med
# set protocols bgp 100 neighbor 100.11.34.12
# vyos@vyos:~$
#
#
# Module Execution:
#
# "after": {
# "address_family": [
# {
# "afi": "ipv6",
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# }
# ],
# "as_number": 100,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "allowas_in": 4,
# "as_override": true,
# "attribute_unchanged": {
# "med": true
# }
# }
# ],
# "neighbor_address": "20.33.1.1/24"
# }
# ]
# },
# "before": {
# "address_family": [
# {
# "afi": "ipv4",
# "aggregate_address": [
# {
# "prefix": "60.9.2.0/24",
# "summary_only": true
# }
# ],
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# },
# {
# "afi": "ipv6",
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# }
# ],
# "as_number": 100,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "maximum_prefix": 45,
# "nexthop_self": true,
# "route_map": [
# {
# "action": "export",
# "route_map": "map01"
# },
# {
# "action": "import",
# "route_map": "map01"
# }
# ],
# "weight": 50
# },
# {
# "afi": "ipv6",
# "maximum_prefix": 45,
# "nexthop_self": true,
# "route_map": [
# {
# "action": "import",
# "route_map": "map01"
# }
# ]
# }
# ],
# "neighbor_address": "100.11.34.12"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "allowas_in": 4,
# "as_override": true,
# "attribute_unchanged": {
# "med": true
# }
# },
# {
# "afi": "ipv6",
# "default_originate": "map01",
# "distribute_list": [
# {
# "acl": 10,
# "action": "export"
# }
# ]
# }
# ],
# "neighbor_address": "20.33.1.1/24"
# }
# ]
# },
# "changed": true,
# "commands": [
# "delete protocols bgp 100 address-family ipv4-unicast",
# "delete protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast",
# "delete protocols bgp 100 neighbor 100.11.34.12 address-family"
# ],
#
# using parsed:
# parsed.cfg
# set protocols bgp 65536 address-family ipv4-unicast aggregate-address 192.0.2.0/24 as-set
# set protocols bgp 65536 address-family ipv4-unicast network 192.1.13.0/24 route-map 'map01'
# set protocols bgp 65536 address-family ipv4-unicast network 192.2.13.0/24 backdoor
# set protocols bgp 65536 address-family ipv6-unicast redistribute ripng metric '20'
# set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv4-unicast route-map export 'map01'
# set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv4-unicast soft-reconfiguration inbound
# set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged next-hop
- name: parse configs
vyos.vyos.vyos_bgp_address_family:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
# Module Execution:
# "parsed": {
# "address_family": [
# {
# "afi": "ipv4",
# "aggregate_address": [
# {
# "as_set": true,
# "prefix": "192.0.2.0/24"
# }
# ],
# "networks": [
# {
# "prefix": "192.1.13.0/24",
# "route_map": "map01"
# },
# {
# "backdoor": true,
# "prefix": "192.2.13.0/24"
# }
# ]
# },
# {
# "afi": "ipv6",
# "redistribute": [
# {
# "metric": 20,
# "protocol": "ripng"
# }
# ]
# }
# ],
# "as_number": 65536,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "route_map": [
# {
# "action": "export",
# "route_map": "map01"
# }
# ],
# "soft_reconfiguration": true
# }
# ],
# "neighbor_address": "192.0.2.25"
# },
# {
# "address_family": [
# {
# "afi": "ipv6",
# "attribute_unchanged": {
# "next_hop": true
# }
# }
# ],
# "neighbor_address": "203.0.113.5"
# }
# ]
#
# Using gathered:
# Native config:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast network 35.1.1.0/24 backdoor
# set protocols bgp 100 address-family ipv4-unicast redistribute static metric '50'
# set protocols bgp 100 address-family ipv6-unicast aggregate-address 6601:1:1:1::/64 summary-only
# set protocols bgp 100 address-family ipv6-unicast network 5001:1:1:1::/64 route-map 'map01'
# set protocols bgp 100 address-family ipv6-unicast redistribute static metric '50'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast allowas-in number '4'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast as-override
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged med
# set protocols bgp 100 neighbor 100.11.34.12
- name: gather configs
vyos.vyos.vyos_bgp_address_family:
state: gathered
# Module Execution:
# "gathered": {
# "address_family": [
# {
# "afi": "ipv4",
# "networks": [
# {
# "backdoor": true,
# "prefix": "35.1.1.0/24"
# }
# ],
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# },
# {
# "afi": "ipv6",
# "aggregate_address": [
# {
# "prefix": "6601:1:1:1::/64",
# "summary_only": true
# }
# ],
# "networks": [
# {
# "prefix": "5001:1:1:1::/64",
# "route_map": "map01"
# }
# ],
# "redistribute": [
# {
# "metric": 50,
# "protocol": "static"
# }
# ]
# }
# ],
# "as_number": 100,
# "neighbors": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "allowas_in": 4,
# "as_override": true,
# "attribute_unchanged": {
# "med": true
# }
# }
# ],
# "neighbor_address": "20.33.1.1/24"
# }
# ]
# Using rendered:
- name: Render
vyos.vyos.vyos_bgp_address_family:
config:
as_number: "100"
address_family:
- afi: "ipv4"
redistribute:
- protocol: "static"
metric: 50
neighbors:
- neighbor_address: "20.33.1.1/24"
address_family:
- afi: "ipv4"
allowas_in: 4
as_override: True
attribute_unchanged:
med: True
- afi: "ipv6"
default_originate: "map01"
distribute_list:
- action: "export"
acl: 10
- neighbor_address: "100.11.34.12"
address_family:
- afi: "ipv4"
maximum_prefix: 45
nexthop_self: True
route_map:
- action: "export"
route_map: "map01"
- action: "import"
route_map: "map01"
weight: 50
state: rendered
# Module Execution:
# "rendered": [
# "set protocols bgp 100 address-family ipv4-unicast redistribute static metric 50",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast allowas-in number 4",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast as-override",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged med",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast default-originate route-map map01",
# "set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv6-unicast distribute-list export 10",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast maximum-prefix 45",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast nexthop-self",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map export map01",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map import map01",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast weight 50"
# ]
```
### Authors
* Gomathi Selvi Srinivasan (@GomathiselviS)
| programming_docs |
ansible vyos.vyos.vyos_linkagg – (deprecated, removed after 2022-06-01) Manage link aggregation groups on VyOS network devices vyos.vyos.vyos\_linkagg – (deprecated, removed after 2022-06-01) Manage link aggregation groups on VyOS network devices
=======================================================================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_linkagg`.
New in version 1.0.0: of vyos.vyos
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Updated modules released with more functionality.
Alternative
vyos\_lag\_interfaces
Synopsis
--------
* This module provides declarative management of link aggregation groups on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aggregate** list / elements=dictionary | | List of link aggregation definitions. |
| | **members** list / elements=string | | List of members of the link aggregation group. |
| | **mode** string | **Choices:*** 802.3ad
* active-backup
* broadcast
* round-robin
* transmit-load-balance
* adaptive-load-balance
* xor-hash
* on
| Mode of the link aggregation group. |
| | **name** string / required | | Name of the link aggregation group. |
| | **state** string | **Choices:*** present
* absent
* up
* down
| State of the link aggregation group. |
| **members** list / elements=string | | List of members of the link aggregation group. |
| **mode** string | **Choices:*** **802.3ad** ←
* active-backup
* broadcast
* round-robin
* transmit-load-balance
* adaptive-load-balance
* xor-hash
* on
| Mode of the link aggregation group. |
| **name** string | | Name of the link aggregation group. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
* up
* down
| State of the link aggregation group. |
Notes
-----
Note
* Tested against VYOS 1.1.7
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: configure link aggregation group
vyos.vyos.vyos_linkagg:
name: bond0
members:
- eth0
- eth1
- name: remove configuration
vyos.vyos.vyos_linkagg:
name: bond0
state: absent
- name: Create aggregate of linkagg definitions
vyos.vyos.vyos_linkagg:
aggregate:
- {name: bond0, members: [eth1]}
- {name: bond1, members: [eth2]}
- name: Remove aggregate of linkagg definitions
vyos.vyos.vyos_linkagg:
aggregate:
- name: bond0
- name: bond1
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always, except for the platforms that use Netconf transport to manage the device. | The list of configuration mode commands to send to the device **Sample:** ['set interfaces bonding bond0', "set interfaces ethernet eth0 bond-group 'bond0'", "set interfaces ethernet eth1 bond-group 'bond0'"] |
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Ricardo Carrillo Cruz (@rcarrillocruz)
ansible vyos.vyos.vyos_lldp_interface – (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on VyOS network devices vyos.vyos.vyos\_lldp\_interface – (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on VyOS network devices
=====================================================================================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_lldp_interface`.
New in version 1.0.0: of vyos.vyos
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Updated modules released with more functionality.
Alternative
vyos\_lldp\_interfaces
Synopsis
--------
* This module provides declarative management of LLDP interfaces configuration on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aggregate** list / elements=dictionary | | List of interfaces LLDP should be configured on. |
| | **name** string / required | | Name of the interface LLDP should be configured on. |
| | **state** string | **Choices:*** present
* absent
* enabled
* disabled
| State of the LLDP configuration. |
| **name** string | | Name of the interface LLDP should be configured on. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
* enabled
* disabled
| State of the LLDP configuration. |
Notes
-----
Note
* Tested against VYOS 1.1.7
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: Enable LLDP on eth1
net_lldp_interface:
state: present
- name: Enable LLDP on specific interfaces
net_lldp_interface:
interfaces:
- eth1
- eth2
state: present
- name: Disable LLDP globally
net_lldp_interface:
state: disabled
- name: Create aggregate of LLDP interface configurations
vyos.vyos.vyos_lldp_interface:
aggregate:
- name: eth1
- name: eth2
state: present
- name: Delete aggregate of LLDP interface configurations
vyos.vyos.vyos_lldp_interface:
aggregate:
- name: eth1
- name: eth2
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always, except for the platforms that use Netconf transport to manage the device. | The list of configuration mode commands to send to the device **Sample:** ['set service lldp eth1', 'set service lldp eth2 disable'] |
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Ricardo Carrillo Cruz (@rcarrillocruz)
ansible vyos.vyos.vyos_ospfv3 – OSPFV3 resource module vyos.vyos.vyos\_ospfv3 – OSPFV3 resource module
===============================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_ospfv3`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This resource module configures and manages attributes of OSPFv3 routes on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | A provided OSPFv3 route configuration. |
| | **areas** list / elements=dictionary | | OSPFv3 area. |
| | | **area\_id** string | | OSPFv3 Area name/identity. |
| | | **export\_list** string | | Name of export-list. |
| | | **import\_list** string | | Name of import-list. |
| | | **range** list / elements=dictionary | | Summarize routes matching prefix (border routers only). |
| | | | **address** string | | border router IPv4 address. |
| | | | **advertise** boolean | **Choices:*** no
* yes
| Advertise this range. |
| | | | **not\_advertise** boolean | **Choices:*** no
* yes
| Don't advertise this range. |
| | **parameters** dictionary | | OSPFv3 specific parameters. |
| | | **router\_id** string | | Override the default router identifier. |
| | **redistribute** list / elements=dictionary | | Redistribute information from another routing protocol. |
| | | **route\_map** string | | Route map references. |
| | | **route\_type** string | **Choices:*** bgp
* connected
* kernel
* ripng
* static
| Route type to redistribute. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep ospfv3**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* deleted
* parsed
* gathered
* rendered
| The state the configuration should be left in. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep ospfv3
#
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_ospfv3:
config:
redistribute:
- route_type: bgp
parameters:
router_id: 192.0.2.10
areas:
- area_id: '2'
export_list: export1
import_list: import1
range:
- address: 2001:db10::/32
- address: 2001:db20::/32
- address: 2001:db30::/32
- area_id: '3'
range:
- address: 2001:db40::/32
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": {}
#
# "commands": [
# "set protocols ospfv3 redistribute bgp",
# "set protocols ospfv3 parameters router-id '192.0.2.10'",
# "set protocols ospfv3 area 2 range 2001:db10::/32",
# "set protocols ospfv3 area 2 range 2001:db20::/32",
# "set protocols ospfv3 area 2 range 2001:db30::/32",
# "set protocols ospfv3 area '2'",
# "set protocols ospfv3 area 2 export-list export1",
# "set protocols ospfv3 area 2 import-list import1",
# "set protocols ospfv3 area '3'",
# "set protocols ospfv3 area 3 range 2001:db40::/32"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "export_list": "export1",
# "import_list": "import1",
# "range": [
# {
# "address": "2001:db10::/32"
# },
# {
# "address": "2001:db20::/32"
# },
# {
# "address": "2001:db30::/32"
# }
# ]
# },
# {
# "area_id": "3",
# "range": [
# {
# "address": "2001:db40::/32"
# }
# ]
# }
# ],
# "parameters": {
# "router_id": "192.0.2.10"
# },
# "redistribute": [
# {
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospfv3
# set protocols ospfv3 area 2 export-list 'export1'
# set protocols ospfv3 area 2 import-list 'import1'
# set protocols ospfv3 area 2 range '2001:db10::/32'
# set protocols ospfv3 area 2 range '2001:db20::/32'
# set protocols ospfv3 area 2 range '2001:db30::/32'
# set protocols ospfv3 area 3 range '2001:db40::/32'
# set protocols ospfv3 parameters router-id '192.0.2.10'
# set protocols ospfv3 redistribute 'bgp'
# Using replaced
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep ospfv3
# set protocols ospfv3 area 2 export-list 'export1'
# set protocols ospfv3 area 2 import-list 'import1'
# set protocols ospfv3 area 2 range '2001:db10::/32'
# set protocols ospfv3 area 2 range '2001:db20::/32'
# set protocols ospfv3 area 2 range '2001:db30::/32'
# set protocols ospfv3 area 3 range '2001:db40::/32'
# set protocols ospfv3 parameters router-id '192.0.2.10'
# set protocols ospfv3 redistribute 'bgp'
#
- name: Replace ospfv3 routes attributes configuration.
vyos.vyos.vyos_ospfv3:
config:
redistribute:
- route_type: bgp
parameters:
router_id: 192.0.2.10
areas:
- area_id: '2'
export_list: export1
import_list: import1
range:
- address: 2001:db10::/32
- address: 2001:db30::/32
- address: 2001:db50::/32
- area_id: '4'
range:
- address: 2001:db60::/32
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "export_list": "export1",
# "import_list": "import1",
# "range": [
# {
# "address": "2001:db10::/32"
# },
# {
# "address": "2001:db20::/32"
# },
# {
# "address": "2001:db30::/32"
# }
# ]
# },
# {
# "area_id": "3",
# "range": [
# {
# "address": "2001:db40::/32"
# }
# ]
# }
# ],
# "parameters": {
# "router_id": "192.0.2.10"
# },
# "redistribute": [
# {
# "route_type": "bgp"
# }
# ]
# }
#
# "commands": [
# "delete protocols ospfv3 area 2 range 2001:db20::/32",
# "delete protocols ospfv3 area 3",
# "set protocols ospfv3 area 2 range 2001:db50::/32",
# "set protocols ospfv3 area '4'",
# "set protocols ospfv3 area 4 range 2001:db60::/32"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "export_list": "export1",
# "import_list": "import1",
# "range": [
# {
# "address": "2001:db10::/32"
# },
# {
# "address": "2001:db30::/32"
# },
# {
# "address": "2001:db50::/32"
# }
# ]
# },
# {
# "area_id": "4",
# "range": [
# {
# "address": "2001:db60::/32"
# }
# ]
# }
# ],
# "parameters": {
# "router_id": "192.0.2.10"
# },
# "redistribute": [
# {
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospfv3
# set protocols ospfv3 area 2 export-list 'export1'
# set protocols ospfv3 area 2 import-list 'import1'
# set protocols ospfv3 area 2 range '2001:db10::/32'
# set protocols ospfv3 area 2 range '2001:db30::/32'
# set protocols ospfv3 area 2 range '2001:db50::/32'
# set protocols ospfv3 area 4 range '2001:db60::/32'
# set protocols ospfv3 parameters router-id '192.0.2.10'
# set protocols ospfv3 redistribute 'bgp'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_ospfv3:
config:
redistribute:
- route_type: bgp
parameters:
router_id: 192.0.2.10
areas:
- area_id: '2'
export_list: export1
import_list: import1
range:
- address: 2001:db10::/32
- address: 2001:db20::/32
- address: 2001:db30::/32
- area_id: '3'
range:
- address: 2001:db40::/32
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# [
# "set protocols ospfv3 redistribute bgp",
# "set protocols ospfv3 parameters router-id '192.0.2.10'",
# "set protocols ospfv3 area 2 range 2001:db10::/32",
# "set protocols ospfv3 area 2 range 2001:db20::/32",
# "set protocols ospfv3 area 2 range 2001:db30::/32",
# "set protocols ospfv3 area '2'",
# "set protocols ospfv3 area 2 export-list export1",
# "set protocols ospfv3 area 2 import-list import1",
# "set protocols ospfv3 area '3'",
# "set protocols ospfv3 area 3 range 2001:db40::/32"
# ]
# Using parsed
#
#
- name: Parse the commands to provide structured configuration.
vyos.vyos.vyos_ospfv3:
running_config:
"set protocols ospfv3 area 2 export-list 'export1'
set protocols ospfv3 area 2 import-list 'import1'
set protocols ospfv3 area 2 range '2001:db10::/32'
set protocols ospfv3 area 2 range '2001:db20::/32'
set protocols ospfv3 area 2 range '2001:db30::/32'
set protocols ospfv3 area 3 range '2001:db40::/32'
set protocols ospfv3 parameters router-id '192.0.2.10'
set protocols ospfv3 redistribute 'bgp'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": {
# "areas": [
# {
# "area_id": "2",
# "export_list": "export1",
# "import_list": "import1",
# "range": [
# {
# "address": "2001:db10::/32"
# },
# {
# "address": "2001:db20::/32"
# },
# {
# "address": "2001:db30::/32"
# }
# ]
# },
# {
# "area_id": "3",
# "range": [
# {
# "address": "2001:db40::/32"
# }
# ]
# }
# ],
# "parameters": {
# "router_id": "192.0.2.10"
# },
# "redistribute": [
# {
# "route_type": "bgp"
# }
# ]
# }
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep ospfv3
# set protocols ospfv3 area 2 export-list 'export1'
# set protocols ospfv3 area 2 import-list 'import1'
# set protocols ospfv3 area 2 range '2001:db10::/32'
# set protocols ospfv3 area 2 range '2001:db20::/32'
# set protocols ospfv3 area 2 range '2001:db30::/32'
# set protocols ospfv3 area 3 range '2001:db40::/32'
# set protocols ospfv3 parameters router-id '192.0.2.10'
# set protocols ospfv3 redistribute 'bgp'
#
- name: Gather ospfv3 routes config with provided configurations
vyos.vyos.vyos_ospfv3:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": {
# "areas": [
# {
# "area_id": "2",
# "export_list": "export1",
# "import_list": "import1",
# "range": [
# {
# "address": "2001:db10::/32"
# },
# {
# "address": "2001:db20::/32"
# },
# {
# "address": "2001:db30::/32"
# }
# ]
# },
# {
# "area_id": "3",
# "range": [
# {
# "address": "2001:db40::/32"
# }
# ]
# }
# ],
# "parameters": {
# "router_id": "192.0.2.10"
# },
# "redistribute": [
# {
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospfv3
# set protocols ospfv3 area 2 export-list 'export1'
# set protocols ospfv3 area 2 import-list 'import1'
# set protocols ospfv3 area 2 range '2001:db10::/32'
# set protocols ospfv3 area 2 range '2001:db20::/32'
# set protocols ospfv3 area 2 range '2001:db30::/32'
# set protocols ospfv3 area 3 range '2001:db40::/32'
# set protocols ospfv3 parameters router-id '192.0.2.10'
# set protocols ospfv3 redistribute 'bgp'
# Using deleted
#
# Before state
# -------------
#
# vyos@192# run show configuration commands | grep ospfv3
# set protocols ospfv3 area 2 export-list 'export1'
# set protocols ospfv3 area 2 import-list 'import1'
# set protocols ospfv3 area 2 range '2001:db10::/32'
# set protocols ospfv3 area 2 range '2001:db20::/32'
# set protocols ospfv3 area 2 range '2001:db30::/32'
# set protocols ospfv3 area 3 range '2001:db40::/32'
# set protocols ospfv3 parameters router-id '192.0.2.10'
# set protocols ospfv3 redistribute 'bgp'
#
- name: Delete attributes of ospfv3 routes.
vyos.vyos.vyos_ospfv3:
config:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "export_list": "export1",
# "import_list": "import1",
# "range": [
# {
# "address": "2001:db10::/32"
# },
# {
# "address": "2001:db20::/32"
# },
# {
# "address": "2001:db30::/32"
# }
# ]
# },
# {
# "area_id": "3",
# "range": [
# {
# "address": "2001:db40::/32"
# }
# ]
# }
# ],
# "parameters": {
# "router_id": "192.0.2.10"
# },
# "redistribute": [
# {
# "route_type": "bgp"
# }
# ]
# }
# "commands": [
# "delete protocols ospfv3"
# ]
#
# "after": {}
# After state
# ------------
# vyos@192# run show configuration commands | grep ospfv3
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['set protocols ospf parameters router-id 192.0.1.1', "set protocols ospfv3 area 2 range '2001:db10::/32'"] |
### Authors
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_config – Manage VyOS configuration on remote device vyos.vyos.vyos\_config – Manage VyOS configuration on remote device
===================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_config`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration file management of VyOS devices. It provides arguments for managing both the configuration file and state of the active configuration. All configuration statements are based on `set` and `delete` commands in the device configuration.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **backup** boolean | **Choices:*** **no** ←
* yes
| The `backup` argument will backup the current devices active configuration to the Ansible control host prior to making any changes. If the `backup_options` value is not given, the backup file will be located in the backup folder in the playbook root directory or role root directory, if playbook is part of an ansible role. If the directory does not exist, it is created. |
| **backup\_options** dictionary | | This is a dict object containing configurable options related to backup file path. The value of this option is read only when `backup` is set to *yes*, if `backup` is set to *no* this option will be silently ignored. |
| | **dir\_path** path | | This option provides the path ending with directory name in which the backup configuration file will be stored. If the directory does not exist it will be first created and the filename is either the value of `filename` or default filename as described in `filename` options description. If the path value is not given in that case a *backup* directory will be created in the current working directory and backup configuration will be copied in `filename` within *backup* directory. |
| | **filename** string | | The filename to be used to store the backup configuration. If the filename is not given it will be generated based on the hostname, current time and date in format defined by <hostname>\_config.<current-date>@<current-time> |
| **comment** string | **Default:**"configured by vyos\_config" | Allows a commit description to be specified to be included when the configuration is committed. If the configuration is not changed or committed, this argument is ignored. |
| **config** string | | The `config` argument specifies the base configuration to use to compare against the desired configuration. If this value is not specified, the module will automatically retrieve the current active configuration from the remote device. The configuration lines in the option value should be similar to how it will appear if present in the running-configuration of the device including indentation to ensure idempotency and correct diff. |
| **lines** list / elements=string | | The ordered set of commands that should be configured in the section. The commands must be the exact same commands as found in the device running-config as found in the device running-config to ensure idempotency and correct diff. Be sure to note the configuration command syntax as some commands are automatically modified by the device config parser. |
| **match** string | **Choices:*** **line** ←
* none
| The `match` argument controls the method used to match against the current active configuration. By default, the desired config is matched against the active config and the deltas are loaded. If the `match` argument is set to `none` the active configuration is ignored and the configuration is always loaded. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **save** boolean | **Choices:*** **no** ←
* yes
| The `save` argument controls whether or not changes made to the active configuration are saved to disk. This is independent of committing the config. When set to True, the active configuration is saved. |
| **src** path | | The `src` argument specifies the path to the source config file to load. The source config file can either be in bracket format or set format. The source file can include Jinja2 template variables. The configuration lines in the source file should be similar to how it will appear if present in the running-configuration of the device including indentation to ensure idempotency and correct diff. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* To ensure idempotency and correct diff the configuration lines in the relevant module options should be similar to how they appear if present in the running configuration on device including the indentation.
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: configure the remote device
vyos.vyos.vyos_config:
lines:
- set system host-name {{ inventory_hostname }}
- set service lldp
- delete service dhcp-server
- name: backup and load from file
vyos.vyos.vyos_config:
src: vyos.cfg
backup: yes
- name: render a Jinja2 template onto the VyOS router
vyos.vyos.vyos_config:
src: vyos_template.j2
- name: for idempotency, use full-form commands
vyos.vyos.vyos_config:
lines:
# - set int eth eth2 description 'OUTSIDE'
- set interface ethernet eth2 description 'OUTSIDE'
- name: configurable backup path
vyos.vyos.vyos_config:
backup: yes
backup_options:
filename: backup.cfg
dir_path: /home/user
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **backup\_path** string | when backup is yes | The full path to the backup file **Sample:** /playbooks/ansible/backup/vyos\_config.2016-07-16@22:28:34 |
| **commands** list / elements=string | always | The list of configuration commands sent to the device **Sample:** ['...', '...'] |
| **date** string | when backup is yes | The date extracted from the backup file name **Sample:** 2016-07-16 |
| **filename** string | when backup is yes and filename is not specified in backup options | The name of the backup file **Sample:** vyos\_config.2016-07-16@22:28:34 |
| **filtered** list / elements=string | always | The list of configuration commands removed to avoid a load failure **Sample:** ['...', '...'] |
| **shortname** string | when backup is yes and filename is not specified in backup options | The full path to the backup file excluding the timestamp **Sample:** /playbooks/ansible/backup/vyos\_config |
| **time** string | when backup is yes | The time extracted from the backup file name **Sample:** 22:28:34 |
### Authors
* Nathaniel Case (@Qalthos)
ansible vyos.vyos.vyos_vlan – Manage VLANs on VyOS network devices vyos.vyos.vyos\_vlan – Manage VLANs on VyOS network devices
===========================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_vlan`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides declarative management of VLANs on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | Configure Virtual interface address. |
| **aggregate** list / elements=dictionary | | List of VLANs definitions. |
| | **address** string | | Configure Virtual interface address. |
| | **associated\_interfaces** list / elements=string | | This is a intent option and checks the operational state of the for given vlan `name` for associated interfaces. If the value in the `associated_interfaces` does not match with the operational state of vlan on device it will result in failure. |
| | **delay** integer | | Delay the play should wait to check for declarative intent params values. |
| | **interfaces** list / elements=string / required | | List of interfaces that should be associated to the VLAN. |
| | **name** string | | Name of the VLAN. |
| | **state** string | **Choices:*** present
* absent
| State of the VLAN configuration. |
| | **vlan\_id** integer / required | | ID of the VLAN. Range 0-4094. |
| **associated\_interfaces** list / elements=string | | This is a intent option and checks the operational state of the for given vlan `name` for associated interfaces. If the value in the `associated_interfaces` does not match with the operational state of vlan on device it will result in failure. |
| **delay** integer | **Default:**10 | Delay the play should wait to check for declarative intent params values. |
| **interfaces** list / elements=string | | List of interfaces that should be associated to the VLAN. |
| **name** string | | Name of the VLAN. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **purge** boolean | **Choices:*** **no** ←
* yes
| Purge VLANs not defined in the *aggregate* parameter. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the VLAN configuration. |
| **vlan\_id** integer | | ID of the VLAN. Range 0-4094. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: Create vlan
vyos.vyos.vyos_vlan:
vlan_id: 100
name: vlan-100
interfaces: eth1
state: present
- name: Add interfaces to VLAN
vyos.vyos.vyos_vlan:
vlan_id: 100
interfaces:
- eth1
- eth2
- name: Configure virtual interface address
vyos.vyos.vyos_vlan:
vlan_id: 100
interfaces: eth1
address: 172.26.100.37/24
- name: vlan interface config + intent
vyos.vyos.vyos_vlan:
vlan_id: 100
interfaces: eth0
associated_interfaces:
- eth0
- name: vlan intent check
vyos.vyos.vyos_vlan:
vlan_id: 100
associated_interfaces:
- eth3
- eth4
- name: Delete vlan
vyos.vyos.vyos_vlan:
vlan_id: 100
interfaces: eth1
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always | The list of configuration mode commands to send to the device **Sample:** ['set interfaces ethernet eth1 vif 100 description VLAN 100', 'set interfaces ethernet eth1 vif 100 address 172.26.100.37/24', 'delete interfaces ethernet eth1 vif 100'] |
### Authors
* Trishna Guha (@trishnaguha)
ansible vyos.vyos.vyos_static_route – (deprecated, removed after 2022-06-01) Manage static IP routes on Vyatta VyOS network devices vyos.vyos.vyos\_static\_route – (deprecated, removed after 2022-06-01) Manage static IP routes on Vyatta VyOS network devices
=============================================================================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_static_route`.
New in version 1.0.0: of vyos.vyos
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Updated modules released with more functionality.
Alternative
vyos\_static\_routes
Synopsis
--------
* This module provides declarative management of static IP routes on Vyatta VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **admin\_distance** integer | | Admin distance of the static route. |
| **aggregate** list / elements=dictionary | | List of static route definitions |
| | **admin\_distance** integer | | Admin distance of the static route. |
| | **mask** string | | Network prefix mask of the static route. |
| | **next\_hop** string | | Next hop IP of the static route. |
| | **prefix** string / required | | Network prefix of the static route. `mask` param should be ignored if `prefix` is provided with `mask` value `prefix/mask`. |
| | **state** string | **Choices:*** present
* absent
| State of the static route configuration. |
| **mask** string | | Network prefix mask of the static route. |
| **next\_hop** string | | Next hop IP of the static route. |
| **prefix** string | | Network prefix of the static route. `mask` param should be ignored if `prefix` is provided with `mask` value `prefix/mask`. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the static route configuration. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: configure static route
vyos.vyos.vyos_static_route:
prefix: 192.168.2.0
mask: 24
next_hop: 10.0.0.1
- name: configure static route prefix/mask
vyos.vyos.vyos_static_route:
prefix: 192.168.2.0/16
next_hop: 10.0.0.1
- name: remove configuration
vyos.vyos.vyos_static_route:
prefix: 192.168.2.0
mask: 16
next_hop: 10.0.0.1
state: absent
- name: configure aggregates of static routes
vyos.vyos.vyos_static_route:
aggregate:
- {prefix: 192.168.2.0, mask: 24, next_hop: 10.0.0.1}
- {prefix: 192.168.3.0, mask: 16, next_hop: 10.0.2.1}
- {prefix: 192.168.3.0/16, next_hop: 10.0.2.1}
- name: Remove static route collections
vyos.vyos.vyos_static_route:
aggregate:
- {prefix: 172.24.1.0/24, next_hop: 192.168.42.64}
- {prefix: 172.24.3.0/24, next_hop: 192.168.42.64}
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always | The list of configuration mode commands to send to the device **Sample:** ['set protocols static route 192.168.2.0/16 next-hop 10.0.0.1'] |
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Trishna Guha (@trishnaguha)
| programming_docs |
ansible vyos.vyos.vyos_ntp_global – Manages ntp modules of Vyos network devices vyos.vyos.vyos\_ntp\_global – Manages ntp modules of Vyos network devices
=========================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_ntp_global`.
New in version 2.4.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages ntp configuration on devices running Vyos
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | List of configurations for ntp module |
| | **allow\_clients** list / elements=string | | Network Time Protocol (NTP) server options |
| | **listen\_addresses** list / elements=string | | local IP addresses for service to listen on |
| | **servers** list / elements=dictionary | | Network Time Protocol (NTP) server |
| | | **options** list / elements=string | **Choices:*** noselect
* dynamic
* preempt
* prefer
| server options for NTP |
| | | **server** string | | server name for NTP |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VYOS device by executing the command **show configuration commands | grep ntp**. The states *replaced* and *overridden* have identical behaviour for this module. The state *parsed* reads the configuration from `show configuration commands | grep ntp` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** deleted
* **merged** ←
* overridden
* replaced
* gathered
* rendered
* parsed
| The state the configuration should be left in. |
Notes
-----
Note
* Tested against vyos 1.3
* This module works with connection `network_cli`.
Examples
--------
```
# # -------------------
# # 1. Using merged
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # Task
# # -------------
- name: Replace the existing ntp config with the new config
vyos.vyos.vyos_ntp_global:
config:
allow_clients:
- 10.6.6.0/24
listen_addresses:
- 10.1.3.1
servers:
- server: 203.0.113.0
options:
- prefer
# # Task output:
# # -------------
# "after": {
# "allow_clients": [
# "10.6.6.0/24"
# ],
# "listen_addresses": [
# "10.1.3.1"
# ],
# "servers": [
# {
# "server": "ser",
# "options": [
# "prefer"
# ]
# },
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
# ]
# },
# "before": {
# },
# "changed": true,
# "commands": [
# "set system ntp allow-clients address 10.6.6.0/24",
# "set system ntp listen-address 10.1.3.1",
# "set system ntp server 203.0.113.0 prefer"
# ]
# After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp allow-clients address '10.6.6.0/24'
# set system ntp listen-address '10.1.3.1'
# set system ntp server 203.0.113.0 prefer,
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # -------------------
# # 2. Using replaced
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp allow-clients address '10.4.9.0/24'
# set system ntp allow-clients address '10.4.7.0/24'
# set system ntp allow-clients address '10.1.2.0/24'
# set system ntp allow-clients address '10.2.3.0/24'
# set system ntp listen-address '10.1.9.16'
# set system ntp listen-address '10.5.3.2'
# set system ntp listen-address '10.7.9.21'
# set system ntp listen-address '10.8.9.4'
# set system ntp listen-address '10.4.5.1'
# set system ntp server 10.3.6.5 noselect
# set system ntp server 10.3.6.5 dynamic
# set system ntp server 10.3.6.5 preempt
# set system ntp server 10.3.6.5 prefer
# set system ntp server server4 noselect
# set system ntp server server4 dynamic
# set system ntp server server5
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # Task
# # -------------
- name: Replace the existing ntp config with the new config
vyos.vyos.vyos_ntp_global:
config:
allow_clients:
- 10.6.6.0/24
listen_addresses:
- 10.1.3.1
servers:
- server: 203.0.113.0
options:
- prefer
state: replaced
# # Task output:
# # -------------
# "after": {
# "allow_clients": [
# "10.6.6.0/24"
# ],
# "listen_addresses": [
# "10.1.3.1"
# ],
# "servers": [
# {
# "server": "ser",
# "options": [
# "prefer"
# ]
# },
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
# ]
# },
# "before": {
# "allow_clients": [
# "10.4.7.0/24",
# "10.2.3.0/24",
# "10.1.2.0/24",
# "10.4.9.0/24"
# ],
# "listen_addresses": [
# "10.7.9.21",
# "10.4.5.1",
# "10.5.3.2",
# "10.8.9.4",
# "10.1.9.16"
# ],
# "servers": [
# {
# "server": "10.3.6.5",
# "options": [
# "noselect",
# "dynamic",
# "preempt",
# "prefer"
# ]
# },
# {
# "server": "server4",
# "options": [
# "noselect",
# "dynamic"
# ]
# },
# {
# "server": "server5"
# },
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
# ]
# },
# "changed": true,
# "commands": [
# "delete system ntp allow-clients address 10.4.7.0/24",
# "delete system ntp allow-clients address 10.2.3.0/24",
# "delete system ntp allow-clients address 10.1.2.0/24",
# "delete system ntp allow-clients address 10.4.9.0/24",
# "delete system ntp listen-address 10.7.9.21",
# "delete system ntp listen-address 10.4.5.1",
# "delete system ntp listen-address 10.5.3.2",
# "delete system ntp listen-address 10.8.9.4",
# "delete system ntp listen-address 10.1.9.16",
# "delete system ntp server 10.3.6.5",
# "delete system ntp server server4",
# "delete system ntp server server5",
# "set system ntp allow-clients address 10.6.6.0/24",
# "set system ntp listen-address 10.1.3.1",
# "set system ntp server 203.0.113.0 prefer"
# ]
# After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp allow-clients address '10.6.6.0/24'
# set system ntp listen-address '10.1.3.1'
# set system ntp server 203.0.113.0 prefer,
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # -------------------
# # 3. Using overridden
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp allow-clients address '10.6.6.0/24'
# set system ntp listen-address '10.1.3.1'
# set system ntp server 203.0.113.0 prefer,
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # Task
# # -------------
- name: Override ntp config
vyos.vyos.vyos_ntp_global:
config:
allow_clients:
- 10.3.3.0/24
listen_addresses:
- 10.7.8.1
servers:
- server: server1
options:
- dynamic
- prefer
- server: server2
options:
- noselect
- preempt
- server: serv
state: overridden
# # Task output:
# # -------------
# "after": {
# "allow_clients": [
# "10.3.3.0/24"
# ],
# "listen_addresses": [
# "10.7.8.1"
# ],
# "servers": [
# {
# "server": "serv"
# },
# {
# "server": "server1",
# "options": [
# "dynamic",
# "prefer"
# ]
# },
# {
# "server": "server2",
# "options": [
# "noselect",
# "preempt"
# ]
# },
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
# ]
# },
# "before": {
# "allow_clients": [
# "10.6.6.0/24"
# ],
# "listen_addresses": [
# "10.1.3.1"
# ],
# "servers": [
# {
# "server": "ser",
# "options": [
# "prefer"
# ]
# },
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
# ]
# },
# "changed": true,
# "commands": [
# "delete system ntp allow-clients address 10.6.6.0/24",
# "delete system ntp listen-address 10.1.3.1",
# "delete system ntp server ser",
# "set system ntp allow-clients address 10.3.3.0/24",
# "set system ntp listen-address 10.7.8.1",
# "set system ntp server server1 dynamic",
# "set system ntp server server1 prefer",
# "set system ntp server server2 noselect",
# "set system ntp server server2 preempt",
# "set system ntp server serv"
# ]
# After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp allow-clients address '10.3.3.0/24'
# set system ntp listen-address '10.7.8.1'
# set system ntp server serv
# set system ntp server server1 dynamic
# set system ntp server server1 prefer
# set system ntp server server2 noselect
# set system ntp server server2 preempt
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # -------------------
# # 4. Using gathered
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp allow-clients address '10.3.3.0/24'
# set system ntp listen-address '10.7.8.1'
# set system ntp server serv
# set system ntp server server1 dynamic
# set system ntp server server1 prefer
# set system ntp server server2 noselect
# set system ntp server server2 preempt
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # Task
# # -------------
- name: Gather ntp config
vyos.vyos.vyos_ntp_global:
state: gathered
# # Task output:
# # -------------
# "gathered": {
# "allow_clients": [
# "10.3.3.0/24"
# ],
# "listen_addresses": [
# "10.7.8.1"
# ],
# "servers": [
# {
# "server": "serv"
# },
# {
# "server": "server1",
# "options": [
# "dynamic",
# "prefer"
# ]
# },
# {
# "server": "server2",
# "options": [
# "noselect",
# "preempt"
# ]
# },
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
# ]
# }
# After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp allow-clients address '10.3.3.0/24'
# set system ntp listen-address '10.7.8.1'
# set system ntp server serv
# set system ntp server server1 dynamic
# set system ntp server server1 prefer
# set system ntp server server2 noselect
# set system ntp server server2 preempt
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # -------------------
# # 5. Using deleted
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp allow-clients address '10.3.3.0/24'
# set system ntp listen-address '10.7.8.1'
# set system ntp server serv
# set system ntp server server1 dynamic
# set system ntp server server1 prefer
# set system ntp server server2 noselect
# set system ntp server server2 preempt
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # Task
# # -------------
- name: Delete ntp config
vyos.vyos.vyos_ntp_global:
state: deleted
# # Task output:
# # -------------
# "after": {
# "servers": [
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
# ]
# },
# "before": {
# "allow_clients": [
# "10.3.3.0/24"
# ],
# "listen_addresses": [
# "10.7.8.1"
# ],
# "servers": [
# {
# "server": "serv"
# },
# {
# "server": "server1",
# "options": [
# "dynamic",
# "prefer"
# ]
# },
# {
# "server": "server2",
# "options": [
# "noselect",
# "preempt"
# ]
# },
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
# ]
# },
# "changed": true,
# "commands": [
# "delete system ntp allow-clients",
# "delete system ntp listen-address",
# "delete system ntp server serv",
# "delete system ntp server server1",
# "delete system ntp server server2"
#
# ]
# After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # -------------------
# # 6. Using rendered
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep ntp
# set system ntp server time1.vyos.net
# set system ntp server time2.vyos.net
# set system ntp server time3.vyos.net
# vyos@vyos:~$
# # Task
# # -------------
- name: Gather ntp config
vyos.vyos.vyos_ntp_global:
config:
allow_clients:
- 10.7.7.0/24
- 10.8.8.0/24
listen_addresses:
- 10.7.9.1
servers:
- server: server7
- server: server45
options:
- noselect
- prefer
- server: time1.vyos.net
- server: time2.vyos.net
- server: time3.vyos.net
state: rendered
# # Task output:
# # -------------
# "rendered": [
# "set system ntp allow-clients address 10.7.7.0/24",
# "set system ntp allow-clients address 10.8.8.0/24",
# "set system ntp listen-address 10.7.9.1",
# "set system ntp server server7",
# "set system ntp server server45 noselect",
# "set system ntp server server45 prefer",
# "set system ntp server time1.vyos.net",
# "set system ntp server time2.vyos.net",
# "set system ntp server time3.vyos.net"
# ]
# # -------------------
# # 7. Using parsed
# # -------------------
# # sample_config.cfg:
# # -------------
# "set system ntp allow-clients address 10.7.7.0/24",
# "set system ntp listen-address 10.7.9.1",
# "set system ntp server server45 noselect",
# "set system ntp allow-clients addres 10.8.6.0/24",
# "set system ntp listen-address 10.5.4.1",
# "set system ntp server server45 dynamic",
# "set system ntp server time1.vyos.net",
# "set system ntp server time2.vyos.net",
# "set system ntp server time3.vyos.net"
# # Task:
# # -------------
- name: Parse externally provided ntp configuration
vyos.vyos.vyos_ntp_global:
running_config: "{{ lookup('file', './sample_config.cfg') }}"
state: parsed
# # Task output:
# # -------------
# parsed = {
# "allow_clients": [
# "10.7.7.0/24",
# "10.8.6.0/24
# ],
# "listen_addresses": [
# "10.5.4.1",
# "10.7.9.1"
# ],
# "servers": [
# {
# "server": "server45",
# "options": [
# "noselect",
# "dynamic"
#
# ]
# },
# {
# "server": "time1.vyos.net"
# },
# {
# "server": "time2.vyos.net"
# },
# {
# "server": "time3.vyos.net"
# }
#
# ]
# }
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** dictionary | when changed | The resulting configuration after module execution. **Sample:** This output will always be in the same format as the module argspec. |
| **before** dictionary | when *state* is `merged`, `replaced`, `overridden`, `deleted` or `purged` | The configuration prior to the module execution. **Sample:** This output will always be in the same format as the module argspec. |
| **commands** list / elements=string | when *state* is `merged`, `replaced`, `overridden`, `deleted` or `purged` | The set of commands pushed to the remote device. **Sample:** ['set system ntp server server1 dynamic', 'set system ntp server server1 prefer', 'set system ntp server server2 noselect', 'set system ntp server server2 preempt', 'set system ntp server server\_add preempt'] |
| **gathered** list / elements=string | when *state* is `gathered` | Facts about the network resource gathered from the remote device as structured data. **Sample:** This output will always be in the same format as the module argspec. |
| **parsed** list / elements=string | when *state* is `parsed` | The device native config provided in *running\_config* option parsed into structured data as per module argspec. **Sample:** This output will always be in the same format as the module argspec. |
| **rendered** list / elements=string | when *state* is `rendered` | The provided configuration in the task rendered in device-native format (offline). **Sample:** ['set system ntp server server1 dynamic', 'set system ntp server server1 prefer', 'set system ntp server server2 noselect', 'set system ntp server server2 preempt', 'set system ntp server server\_add preempt'] |
### Authors
* Varshitha Yataluru (@YVarshitha)
| programming_docs |
ansible vyos.vyos.vyos_interfaces – Interfaces resource module vyos.vyos.vyos\_interfaces – Interfaces resource module
=======================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_interfaces`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages the interface attributes on VyOS network devices.
* This module supports managing base attributes of Ethernet, Bonding, VXLAN, Loopback and Virtual Tunnel Interfaces.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | The provided interfaces configuration. |
| | **description** string | | Interface description. |
| | **duplex** string | **Choices:*** full
* half
* auto
| Interface duplex mode. Applicable for Ethernet interfaces only. |
| | **enabled** boolean | **Choices:*** no
* **yes** ←
| Administrative state of the interface. Set the value to `true` to administratively enable the interface or `false` to disable it. |
| | **mtu** integer | | MTU for a specific interface. Refer to vendor documentation for valid values. Applicable for Ethernet, Bonding, VXLAN and Virtual Tunnel interfaces. |
| | **name** string / required | | Full name of the interface, e.g. eth0, eth1, bond0, vti1, vxlan2. |
| | **speed** string | **Choices:*** auto
* 10
* 100
* 1000
* 2500
* 10000
| Interface link speed. Applicable for Ethernet interfaces only. |
| | **vifs** list / elements=dictionary | | Virtual sub-interfaces related configuration. 802.1Q VLAN interfaces are represented as virtual sub-interfaces in VyOS. |
| | | **description** string | | Virtual sub-interface description. |
| | | **enabled** boolean | **Choices:*** no
* **yes** ←
| Administrative state of the virtual sub-interface. Set the value to `true` to administratively enable the interface or `false` to disable it. |
| | | **mtu** integer | | MTU for the virtual sub-interface. Refer to vendor documentation for valid values. |
| | | **vlan\_id** integer | | Identifier for the virtual sub-interface. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep interfaces**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* rendered
* gathered
* parsed
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# -------------
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep interfaces
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 address 'dhcpv6'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:ea:0f:b9'
# set interfaces ethernet eth1 smp-affinity 'auto'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth2 smp-affinity 'auto'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces loopback lo
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_interfaces:
config:
- name: eth2
description: Configured by Ansible
enabled: true
vifs:
- vlan_id: 200
description: VIF 200 - ETH2
- name: eth3
description: Configured by Ansible
mtu: 1500
- name: bond1
description: Bond - 1
mtu: 1200
- name: vti2
description: VTI - 2
enabled: false
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "enabled": true,
# "name": "lo"
# },
# {
# "enabled": true,
# "name": "eth3"
# },
# {
# "enabled": true,
# "name": "eth2"
# },
# {
# "enabled": true,
# "name": "eth1"
# },
# {
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
# "commands": [
# "set interfaces ethernet eth2 description 'Configured by Ansible'",
# "set interfaces ethernet eth2 vif 200",
# "set interfaces ethernet eth2 vif 200 description 'VIF 200 - ETH2'",
# "set interfaces ethernet eth3 description 'Configured by Ansible'",
# "set interfaces ethernet eth3 mtu '1500'",
# "set interfaces bonding bond1",
# "set interfaces bonding bond1 description 'Bond - 1'",
# "set interfaces bonding bond1 mtu '1200'",
# "set interfaces vti vti2",
# "set interfaces vti vti2 description 'VTI - 2'",
# "set interfaces vti vti2 disable"
# ]
#
# "after": [
# {
# "description": "Bond - 1",
# "enabled": true,
# "mtu": 1200,
# "name": "bond1"
# },
# {
# "enabled": true,
# "name": "lo"
# },
# {
# "description": "VTI - 2",
# "enabled": false,
# "name": "vti2"
# },
# {
# "description": "Configured by Ansible",
# "enabled": true,
# "mtu": 1500,
# "name": "eth3"
# },
# {
# "description": "Configured by Ansible",
# "enabled": true,
# "name": "eth2",
# "vifs": [
# {
# "description": "VIF 200 - ETH2",
# "enabled": true,
# "vlan_id": "200"
# }
# ]
# },
# {
# "enabled": true,
# "name": "eth1"
# },
# {
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
#
# -------------
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep interfaces
# set interfaces bonding bond1 description 'Bond - 1'
# set interfaces bonding bond1 mtu '1200'
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 address 'dhcpv6'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:ea:0f:b9'
# set interfaces ethernet eth1 smp-affinity 'auto'
# set interfaces ethernet eth2 description 'Configured by Ansible'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth2 smp-affinity 'auto'
# set interfaces ethernet eth2 vif 200 description 'VIF 200 - ETH2'
# set interfaces ethernet eth3 description 'Configured by Ansible'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 mtu '1500'
# set interfaces loopback lo
# set interfaces vti vti2 description 'VTI - 2'
# set interfaces vti vti2 disable
#
# Using replaced
#
# -------------
# Before state:
# -------------
#
# vyos:~$ show configuration commands | grep eth
# set interfaces bonding bond1 description 'Bond - 1'
# set interfaces bonding bond1 mtu '1400'
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 description 'Management Interface for the Appliance'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:f3:6c:b5'
# set interfaces ethernet eth0 smp_affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 description 'Configured by Ansible Eng Team'
# set interfaces ethernet eth1 duplex 'full'
# set interfaces ethernet eth1 hw-id '08:00:27:ad:ef:65'
# set interfaces ethernet eth1 smp_affinity 'auto'
# set interfaces ethernet eth1 speed '100'
# set interfaces ethernet eth2 description 'Configured by Ansible'
# set interfaces ethernet eth2 duplex 'full'
# set interfaces ethernet eth2 hw-id '08:00:27:ab:4e:79'
# set interfaces ethernet eth2 mtu '500'
# set interfaces ethernet eth2 smp_affinity 'auto'
# set interfaces ethernet eth2 speed '100'
# set interfaces ethernet eth2 vif 200 description 'Configured by Ansible'
# set interfaces ethernet eth3 description 'Configured by Ansible'
# set interfaces ethernet eth3 duplex 'full'
# set interfaces ethernet eth3 hw-id '08:00:27:17:3c:85'
# set interfaces ethernet eth3 mtu '1500'
# set interfaces ethernet eth3 smp_affinity 'auto'
# set interfaces ethernet eth3 speed '100'
# set interfaces loopback lo
#
#
- name: Replace device configurations of listed interfaces with provided configurations
vyos.vyos.vyos_interfaces:
config:
- name: eth2
description: Replaced by Ansible
- name: eth3
description: Replaced by Ansible
- name: eth1
description: Replaced by Ansible
state: replaced
#
#
# -----------------------
# Module Execution Result
# -----------------------
#
# "before": [
# {
# "description": "Bond - 1",
# "enabled": true,
# "mtu": 1400,
# "name": "bond1"
# },
# {
# "enabled": true,
# "name": "lo"
# },
# {
# "description": "Configured by Ansible",
# "duplex": "full",
# "enabled": true,
# "mtu": 1500,
# "name": "eth3",
# "speed": "100"
# },
# {
# "description": "Configured by Ansible",
# "duplex": "full",
# "enabled": true,
# "mtu": 500,
# "name": "eth2",
# "speed": "100",
# "vifs": [
# {
# "description": "VIF 200 - ETH2",
# "enabled": true,
# "vlan_id": "200"
# }
# ]
# },
# {
# "description": "Configured by Ansible Eng Team",
# "duplex": "full",
# "enabled": true,
# "name": "eth1",
# "speed": "100"
# },
# {
# "description": "Management Interface for the Appliance",
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
# "commands": [
# "delete interfaces ethernet eth2 speed",
# "delete interfaces ethernet eth2 duplex",
# "delete interfaces ethernet eth2 mtu",
# "delete interfaces ethernet eth2 vif 200 description",
# "set interfaces ethernet eth2 description 'Replaced by Ansible'",
# "delete interfaces ethernet eth3 speed",
# "delete interfaces ethernet eth3 duplex",
# "delete interfaces ethernet eth3 mtu",
# "set interfaces ethernet eth3 description 'Replaced by Ansible'",
# "delete interfaces ethernet eth1 speed",
# "delete interfaces ethernet eth1 duplex",
# "set interfaces ethernet eth1 description 'Replaced by Ansible'"
# ]
#
# "after": [
# {
# "description": "Bond - 1",
# "enabled": true,
# "mtu": 1400,
# "name": "bond1"
# },
# {
# "enabled": true,
# "name": "lo"
# },
# {
# "description": "Replaced by Ansible",
# "enabled": true,
# "name": "eth3"
# },
# {
# "description": "Replaced by Ansible",
# "enabled": true,
# "name": "eth2",
# "vifs": [
# {
# "enabled": true,
# "vlan_id": "200"
# }
# ]
# },
# {
# "description": "Replaced by Ansible",
# "enabled": true,
# "name": "eth1"
# },
# {
# "description": "Management Interface for the Appliance",
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
#
# -------------
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep interfaces
# set interfaces bonding bond1 description 'Bond - 1'
# set interfaces bonding bond1 mtu '1400'
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 address 'dhcpv6'
# set interfaces ethernet eth0 description 'Management Interface for the Appliance'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 description 'Replaced by Ansible'
# set interfaces ethernet eth1 hw-id '08:00:27:ea:0f:b9'
# set interfaces ethernet eth1 smp-affinity 'auto'
# set interfaces ethernet eth2 description 'Replaced by Ansible'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth2 smp-affinity 'auto'
# set interfaces ethernet eth2 vif 200
# set interfaces ethernet eth3 description 'Replaced by Ansible'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces loopback lo
#
#
# Using overridden
#
#
# --------------
# Before state
# --------------
#
# vyos@vyos:~$ show configuration commands | grep interfaces
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 address 'dhcpv6'
# set interfaces ethernet eth0 description 'Ethernet Interface - 0'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 mtu '1200'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 description 'Configured by Ansible Eng Team'
# set interfaces ethernet eth1 hw-id '08:00:27:ea:0f:b9'
# set interfaces ethernet eth1 mtu '100'
# set interfaces ethernet eth1 smp-affinity 'auto'
# set interfaces ethernet eth1 vif 100 description 'VIF 100 - ETH1'
# set interfaces ethernet eth1 vif 100 disable
# set interfaces ethernet eth2 description 'Configured by Ansible Team (Admin Down)'
# set interfaces ethernet eth2 disable
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth2 mtu '600'
# set interfaces ethernet eth2 smp-affinity 'auto'
# set interfaces ethernet eth3 description 'Configured by Ansible Network'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces loopback lo
# set interfaces vti vti1 description 'Virtual Tunnel Interface - 1'
# set interfaces vti vti1 mtu '68'
#
#
- name: Overrides all device configuration with provided configuration
vyos.vyos.vyos_interfaces:
config:
- name: eth0
description: Outbound Interface For The Appliance
speed: auto
duplex: auto
- name: eth2
speed: auto
duplex: auto
- name: eth3
mtu: 1200
state: overridden
#
#
# ------------------------
# Module Execution Result
# ------------------------
#
# "before": [
# {
# "enabled": true,
# "name": "lo"
# },
# {
# "description": "Virtual Tunnel Interface - 1",
# "enabled": true,
# "mtu": 68,
# "name": "vti1"
# },
# {
# "description": "Configured by Ansible Network",
# "enabled": true,
# "name": "eth3"
# },
# {
# "description": "Configured by Ansible Team (Admin Down)",
# "enabled": false,
# "mtu": 600,
# "name": "eth2"
# },
# {
# "description": "Configured by Ansible Eng Team",
# "enabled": true,
# "mtu": 100,
# "name": "eth1",
# "vifs": [
# {
# "description": "VIF 100 - ETH1",
# "enabled": false,
# "vlan_id": "100"
# }
# ]
# },
# {
# "description": "Ethernet Interface - 0",
# "duplex": "auto",
# "enabled": true,
# "mtu": 1200,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
# "commands": [
# "delete interfaces vti vti1 description",
# "delete interfaces vti vti1 mtu",
# "delete interfaces ethernet eth1 description",
# "delete interfaces ethernet eth1 mtu",
# "delete interfaces ethernet eth1 vif 100 description",
# "delete interfaces ethernet eth1 vif 100 disable",
# "delete interfaces ethernet eth0 mtu",
# "set interfaces ethernet eth0 description 'Outbound Interface For The Appliance'",
# "delete interfaces ethernet eth2 description",
# "delete interfaces ethernet eth2 mtu",
# "set interfaces ethernet eth2 duplex 'auto'",
# "delete interfaces ethernet eth2 disable",
# "set interfaces ethernet eth2 speed 'auto'",
# "delete interfaces ethernet eth3 description",
# "set interfaces ethernet eth3 mtu '1200'"
# ],
#
# "after": [
# {
# "enabled": true,
# "name": "lo"
# },
# {
# "enabled": true,
# "name": "vti1"
# },
# {
# "enabled": true,
# "mtu": 1200,
# "name": "eth3"
# },
# {
# "duplex": "auto",
# "enabled": true,
# "name": "eth2",
# "speed": "auto"
# },
# {
# "enabled": true,
# "name": "eth1",
# "vifs": [
# {
# "enabled": true,
# "vlan_id": "100"
# }
# ]
# },
# {
# "description": "Outbound Interface For The Appliance",
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
#
# ------------
# After state
# ------------
#
# vyos@vyos:~$ show configuration commands | grep interfaces
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 address 'dhcpv6'
# set interfaces ethernet eth0 description 'Outbound Interface For The Appliance'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:ea:0f:b9'
# set interfaces ethernet eth1 smp-affinity 'auto'
# set interfaces ethernet eth1 vif 100
# set interfaces ethernet eth2 duplex 'auto'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth2 smp-affinity 'auto'
# set interfaces ethernet eth2 speed 'auto'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 mtu '1200'
# set interfaces loopback lo
# set interfaces vti vti1
#
#
# Using deleted
#
#
# -------------
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands | grep interfaces
# set interfaces bonding bond0 mtu '1300'
# set interfaces bonding bond1 description 'LAG - 1'
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 address 'dhcpv6'
# set interfaces ethernet eth0 description 'Outbound Interface for this appliance'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 description 'Configured by Ansible Network'
# set interfaces ethernet eth1 duplex 'full'
# set interfaces ethernet eth1 hw-id '08:00:27:ea:0f:b9'
# set interfaces ethernet eth1 smp-affinity 'auto'
# set interfaces ethernet eth1 speed '100'
# set interfaces ethernet eth2 description 'Configured by Ansible'
# set interfaces ethernet eth2 disable
# set interfaces ethernet eth2 duplex 'full'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth2 mtu '600'
# set interfaces ethernet eth2 smp-affinity 'auto'
# set interfaces ethernet eth2 speed '100'
# set interfaces ethernet eth3 description 'Configured by Ansible Network'
# set interfaces ethernet eth3 duplex 'full'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces ethernet eth3 speed '100'
# set interfaces loopback lo
#
#
- name: Delete attributes of given interfaces (Note - This won't delete the interfaces
themselves)
vyos.vyos.vyos_interfaces:
config:
- name: bond1
- name: eth1
- name: eth2
- name: eth3
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "enabled": true,
# "mtu": 1300,
# "name": "bond0"
# },
# {
# "description": "LAG - 1",
# "enabled": true,
# "name": "bond1"
# },
# {
# "enabled": true,
# "name": "lo"
# },
# {
# "description": "Configured by Ansible Network",
# "duplex": "full",
# "enabled": true,
# "name": "eth3",
# "speed": "100"
# },
# {
# "description": "Configured by Ansible",
# "duplex": "full",
# "enabled": false,
# "mtu": 600,
# "name": "eth2",
# "speed": "100"
# },
# {
# "description": "Configured by Ansible Network",
# "duplex": "full",
# "enabled": true,
# "name": "eth1",
# "speed": "100"
# },
# {
# "description": "Outbound Interface for this appliance",
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
# "commands": [
# "delete interfaces bonding bond1 description",
# "delete interfaces ethernet eth1 speed",
# "delete interfaces ethernet eth1 duplex",
# "delete interfaces ethernet eth1 description",
# "delete interfaces ethernet eth2 speed",
# "delete interfaces ethernet eth2 disable",
# "delete interfaces ethernet eth2 duplex",
# "delete interfaces ethernet eth2 disable",
# "delete interfaces ethernet eth2 description",
# "delete interfaces ethernet eth2 disable",
# "delete interfaces ethernet eth2 mtu",
# "delete interfaces ethernet eth2 disable",
# "delete interfaces ethernet eth3 speed",
# "delete interfaces ethernet eth3 duplex",
# "delete interfaces ethernet eth3 description"
# ]
#
# "after": [
# {
# "enabled": true,
# "mtu": 1300,
# "name": "bond0"
# },
# {
# "enabled": true,
# "name": "bond1"
# },
# {
# "enabled": true,
# "name": "lo"
# },
# {
# "enabled": true,
# "name": "eth3"
# },
# {
# "enabled": true,
# "name": "eth2"
# },
# {
# "enabled": true,
# "name": "eth1"
# },
# {
# "description": "Outbound Interface for this appliance",
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
#
# ------------
# After state
# ------------
#
# vyos@vyos:~$ show configuration commands | grep interfaces
# set interfaces bonding bond0 mtu '1300'
# set interfaces bonding bond1
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 address 'dhcpv6'
# set interfaces ethernet eth0 description 'Outbound Interface for this appliance'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:30:f0:22'
# set interfaces ethernet eth0 smp-affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 hw-id '08:00:27:ea:0f:b9'
# set interfaces ethernet eth1 smp-affinity 'auto'
# set interfaces ethernet eth2 hw-id '08:00:27:c2:98:23'
# set interfaces ethernet eth2 smp-affinity 'auto'
# set interfaces ethernet eth3 hw-id '08:00:27:43:70:8c'
# set interfaces loopback lo
#
#
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep interfaces
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:50:5e:19'
# set interfaces ethernet eth0 smp_affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 description 'Configured by Ansible'
# set interfaces ethernet eth1 duplex 'auto'
# set interfaces ethernet eth1 mtu '1500'
# set interfaces ethernet eth1 speed 'auto'
# set interfaces ethernet eth1 vif 200 description 'VIF - 200'
# set interfaces ethernet eth2 description 'Configured by Ansible'
# set interfaces ethernet eth2 duplex 'auto'
# set interfaces ethernet eth2 mtu '1500'
# set interfaces ethernet eth2 speed 'auto'
# set interfaces ethernet eth2 vif 200 description 'VIF - 200'
#
- name: Gather listed interfaces with provided configurations
vyos.vyos.vyos_interfaces:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "description": "Configured by Ansible",
# "duplex": "auto",
# "enabled": true,
# "mtu": 1500,
# "name": "eth2",
# "speed": "auto",
# "vifs": [
# {
# "description": "VIF - 200",
# "enabled": true,
# "vlan_id": 200
# }
# ]
# },
# {
# "description": "Configured by Ansible",
# "duplex": "auto",
# "enabled": true,
# "mtu": 1500,
# "name": "eth1",
# "speed": "auto",
# "vifs": [
# {
# "description": "VIF - 200",
# "enabled": true,
# "vlan_id": 200
# }
# ]
# },
# {
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
#
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep interfaces
# set interfaces ethernet eth0 address 'dhcp'
# set interfaces ethernet eth0 duplex 'auto'
# set interfaces ethernet eth0 hw-id '08:00:27:50:5e:19'
# set interfaces ethernet eth0 smp_affinity 'auto'
# set interfaces ethernet eth0 speed 'auto'
# set interfaces ethernet eth1 description 'Configured by Ansible'
# set interfaces ethernet eth1 duplex 'auto'
# set interfaces ethernet eth1 mtu '1500'
# set interfaces ethernet eth1 speed 'auto'
# set interfaces ethernet eth1 vif 200 description 'VIF - 200'
# set interfaces ethernet eth2 description 'Configured by Ansible'
# set interfaces ethernet eth2 duplex 'auto'
# set interfaces ethernet eth2 mtu '1500'
# set interfaces ethernet eth2 speed 'auto'
# set interfaces ethernet eth2 vif 200 description 'VIF - 200'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_interfaces:
config:
- name: eth0
enabled: true
duplex: auto
speed: auto
- name: eth1
description: Configured by Ansible - Interface 1
mtu: 1500
speed: auto
duplex: auto
enabled: true
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
enabled: true
- name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
enabled: false
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set interfaces ethernet eth0 duplex 'auto'",
# "set interfaces ethernet eth0 speed 'auto'",
# "delete interfaces ethernet eth0 disable",
# "set interfaces ethernet eth1 duplex 'auto'",
# "delete interfaces ethernet eth1 disable",
# "set interfaces ethernet eth1 speed 'auto'",
# "set interfaces ethernet eth1 description 'Configured by Ansible - Interface 1'",
# "set interfaces ethernet eth1 mtu '1500'",
# "set interfaces ethernet eth1 vif 100 description 'Eth1 - VIF 100'",
# "set interfaces ethernet eth1 vif 100 mtu '400'",
# "set interfaces ethernet eth1 vif 101 description 'Eth1 - VIF 101'",
# "set interfaces ethernet eth2 disable",
# "set interfaces ethernet eth2 description 'Configured by Ansible - Interface 2 (ADMIN DOWN)'",
# "set interfaces ethernet eth2 mtu '600'"
# ]
# Using parsed
#
#
- name: Parse the configuration.
vyos.vyos.vyos_interfaces:
running_config:
"set interfaces ethernet eth0 address 'dhcp'
set interfaces ethernet eth0 duplex 'auto'
set interfaces ethernet eth0 hw-id '08:00:27:50:5e:19'
set interfaces ethernet eth0 smp_affinity 'auto'
set interfaces ethernet eth0 speed 'auto'
set interfaces ethernet eth1 description 'Configured by Ansible'
set interfaces ethernet eth1 duplex 'auto'
set interfaces ethernet eth1 mtu '1500'
set interfaces ethernet eth1 speed 'auto'
set interfaces ethernet eth1 vif 200 description 'VIF - 200'
set interfaces ethernet eth2 description 'Configured by Ansible'
set interfaces ethernet eth2 duplex 'auto'
set interfaces ethernet eth2 mtu '1500'
set interfaces ethernet eth2 speed 'auto'
set interfaces ethernet eth2 vif 200 description 'VIF - 200'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "description": "Configured by Ansible",
# "duplex": "auto",
# "enabled": true,
# "mtu": 1500,
# "name": "eth2",
# "speed": "auto",
# "vifs": [
# {
# "description": "VIF - 200",
# "enabled": true,
# "vlan_id": 200
# }
# ]
# },
# {
# "description": "Configured by Ansible",
# "duplex": "auto",
# "enabled": true,
# "mtu": 1500,
# "name": "eth1",
# "speed": "auto",
# "vifs": [
# {
# "description": "VIF - 200",
# "enabled": true,
# "vlan_id": 200
# }
# ]
# },
# {
# "duplex": "auto",
# "enabled": true,
# "name": "eth0",
# "speed": "auto"
# }
# ]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['set interfaces ethernet eth1 mtu 1200', 'set interfaces ethernet eth2 vif 100 description VIF 100'] |
### Authors
* Nilashish Chakraborty (@nilashishc)
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_ospf_interfaces – OSPF Interfaces Resource Module. vyos.vyos.vyos\_ospf\_interfaces – OSPF Interfaces Resource Module.
===================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_ospf_interfaces`.
New in version 1.2.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module manages OSPF configuration of interfaces on devices running VYOS.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of OSPF configuration for interfaces. |
| | **address\_family** list / elements=dictionary | | OSPF settings on the interfaces in address-family context. |
| | | **afi** string / required | **Choices:*** ipv4
* ipv6
| Address Family Identifier (AFI) for OSPF settings on the interfaces. |
| | | **authentication** dictionary | | Authentication settings on the interface. |
| | | | **md5\_key** dictionary | | md5 parameters. |
| | | | | **key** string | | md5 key. |
| | | | | **key\_id** integer | | key id. |
| | | | **plaintext\_password** string | | Plain Text password. |
| | | **bandwidth** integer | | Bandwidth of interface (kilobits/sec) |
| | | **cost** integer | | metric associated with interface. |
| | | **dead\_interval** integer | | Time interval to detect a dead router. |
| | | **hello\_interval** integer | | Timer interval between transmission of hello packets. |
| | | **ifmtu** integer | | interface MTU. |
| | | **instance** string | | Instance ID. |
| | | **mtu\_ignore** boolean | **Choices:*** no
* yes
| if True, Disable MTU check for Database Description packets. |
| | | **network** string | | Interface type. |
| | | **passive** boolean | **Choices:*** no
* yes
| If True, disables forming adjacency. |
| | | **priority** integer | | Interface priority. |
| | | **retransmit\_interval** integer | | LSA retransmission interval. |
| | | **transmit\_delay** integer | | LSA transmission delay. |
| | **name** string | | Name/Identifier of the interface. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VYOS device by executing the command **show configuration commands | match "set interfaces"**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* gathered
* parsed
* rendered
| The state the configuration should be left in. |
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# @vyos:~$ show configuration commands | match "ospf"
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth1"
address_family:
- afi: "ipv4"
transmit_delay: 50
priority: 26
network: "point-to-point"
- afi: "ipv6"
dead_interval: 39
- name: "bond2"
address_family:
- afi: "ipv4"
transmit_delay: 45
bandwidth: 70
authentication:
md5_key:
key_id: 10
key: "1111111111232345"
- afi: "ipv6"
passive: True
state: merged
# After State:
# --------------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'
# set interfaces bonding bond2 ip ospf bandwidth '70'
# set interfaces bonding bond2 ip ospf transmit-delay '45'
# set interfaces bonding bond2 ipv6 ospfv3 'passive'
# set interfaces ethernet eth1 ip ospf network 'point-to-point'
# set interfaces ethernet eth1 ip ospf priority '26'
# set interfaces ethernet eth1 ip ospf transmit-delay '50'
# set interfaces ethernet eth1 ipv6 ospfv3 dead-interval '39'
# "after": [
# "
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "before": [
# {
# "name": "eth0"
# },
# {
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "changed": true,
# "commands": [
# "set interfaces ethernet eth1 ip ospf transmit-delay 50",
# "set interfaces ethernet eth1 ip ospf priority 26",
# "set interfaces ethernet eth1 ip ospf network point-to-point",
# "set interfaces ethernet eth1 ipv6 ospfv3 dead-interval 39",
# "set interfaces bonding bond2 ip ospf transmit-delay 45",
# "set interfaces bonding bond2 ip ospf bandwidth 70",
# "set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key 1111111111232345",
# "set interfaces bonding bond2 ipv6 ospfv3 passive"
# ],
# Using replaced:
# Before State:
# ------------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'
# set interfaces bonding bond2 ip ospf bandwidth '70'
# set interfaces bonding bond2 ip ospf transmit-delay '45'
# set interfaces bonding bond2 ipv6 ospfv3 'passive'
# set interfaces ethernet eth1 ip ospf network 'point-to-point'
# set interfaces ethernet eth1 ip ospf priority '26'
# set interfaces ethernet eth1 ip ospf transmit-delay '50'
# set interfaces ethernet eth1 ipv6 ospfv3 dead-interval '39'
- name: Replace provided configuration with device configuration
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth1"
address_family:
- afi: "ipv4"
cost: 100
- afi: "ipv6"
ifmtu: 33
- name: "bond2"
address_family:
- afi: "ipv4"
transmit_delay: 45
- afi: "ipv6"
passive: True
state: replaced
# After State:
# -----------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set interfaces bonding bond2 ip ospf transmit-delay '45'
# set interfaces bonding bond2 ipv6 ospfv3 'passive'
# set interfaces ethernet eth1 ip ospf cost '100'
# set interfaces ethernet eth1 ipv6 ospfv3 ifmtu '33'
# vyos@vyos:~$
# Module Execution
# ----------------
# "after": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 100
# },
# {
# "afi": "ipv6",
# "ifmtu": 33
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "changed": true,
# "commands": [
# "set interfaces ethernet eth1 ip ospf cost 100",
# "set interfaces ethernet eth1 ipv6 ospfv3 ifmtu 33",
# "delete interfaces ethernet eth1 ip ospf network point-to-point",
# "delete interfaces ethernet eth1 ip ospf priority 26",
# "delete interfaces ethernet eth1 ip ospf transmit-delay 50",
# "delete interfaces ethernet eth1 ipv6 ospfv3 dead-interval 39",
# "delete interfaces bonding bond2 ip ospf authentication",
# "delete interfaces bonding bond2 ip ospf bandwidth 70"
# ],
#
# Using Overridden:
# -----------------
# Before State:
# ------------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'
# set interfaces bonding bond2 ip ospf bandwidth '70'
# set interfaces bonding bond2 ip ospf transmit-delay '45'
# set interfaces bonding bond2 ipv6 ospfv3 'passive'
# set interfaces ethernet eth1 ip ospf cost '100'
# set interfaces ethernet eth1 ip ospf network 'point-to-point'
# set interfaces ethernet eth1 ip ospf priority '26'
# set interfaces ethernet eth1 ip ospf transmit-delay '50'
# set interfaces ethernet eth1 ipv6 ospfv3 dead-interval '39'
# set interfaces ethernet eth1 ipv6 ospfv3 ifmtu '33'
# vyos@vyos:~$
- name: Override device configuration with provided configuration
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth0"
address_family:
- afi: "ipv4"
cost: 100
- afi: "ipv6"
ifmtu: 33
passive: True
state: overridden
# After State:
# -----------
# 200~vyos@vyos:~$ show configuration commands | match "ospf"
# set interfaces ethernet eth0 ip ospf cost '100'
# set interfaces ethernet eth0 ipv6 ospfv3 ifmtu '33'
# set interfaces ethernet eth0 ipv6 ospfv3 'passive'
# vyos@vyos:~$
#
#
# "after": [
# {
# "name": "bond2"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 100
# },
# {
# "afi": "ipv6",
# "ifmtu": 33,
# "passive": true
# }
# ],
# "name": "eth0"
# },
# {
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 100,
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39,
# "ifmtu": 33
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "changed": true,
# "commands": [
# "delete interfaces bonding bond2 ip ospf",
# "delete interfaces bonding bond2 ipv6 ospfv3",
# "delete interfaces ethernet eth1 ip ospf",
# "delete interfaces ethernet eth1 ipv6 ospfv3",
# "set interfaces ethernet eth0 ip ospf cost 100",
# "set interfaces ethernet eth0 ipv6 ospfv3 ifmtu 33",
# "set interfaces ethernet eth0 ipv6 ospfv3 passive"
# ],
#
# Using deleted:
# -------------
# before state:
# -------------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'
# set interfaces bonding bond2 ip ospf bandwidth '70'
# set interfaces bonding bond2 ip ospf transmit-delay '45'
# set interfaces bonding bond2 ipv6 ospfv3 'passive'
# set interfaces ethernet eth0 ip ospf cost '100'
# set interfaces ethernet eth0 ipv6 ospfv3 ifmtu '33'
# set interfaces ethernet eth0 ipv6 ospfv3 'passive'
# set interfaces ethernet eth1 ip ospf network 'point-to-point'
# set interfaces ethernet eth1 ip ospf priority '26'
# set interfaces ethernet eth1 ip ospf transmit-delay '50'
# set interfaces ethernet eth1 ipv6 ospfv3 dead-interval '39'
# vyos@vyos:~$
- name: Delete device configuration
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth0"
state: deleted
# After State:
# -----------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'
# set interfaces bonding bond2 ip ospf bandwidth '70'
# set interfaces bonding bond2 ip ospf transmit-delay '45'
# set interfaces bonding bond2 ipv6 ospfv3 'passive'
# set interfaces ethernet eth1 ip ospf network 'point-to-point'
# set interfaces ethernet eth1 ip ospf priority '26'
# set interfaces ethernet eth1 ip ospf transmit-delay '50'
# set interfaces ethernet eth1 ipv6 ospfv3 dead-interval '39'
# vyos@vyos:~$
#
#
# "after": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 100
# },
# {
# "afi": "ipv6",
# "ifmtu": 33,
# "passive": true
# }
# ],
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "changed": true,
# "commands": [
# "delete interfaces ethernet eth0 ip ospf",
# "delete interfaces ethernet eth0 ipv6 ospfv3"
# ],
#
# Using parsed:
# parsed.cfg:
# set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'
# set interfaces bonding bond2 ip ospf bandwidth '70'
# set interfaces bonding bond2 ip ospf transmit-delay '45'
# set interfaces bonding bond2 ipv6 ospfv3 'passive'
# set interfaces ethernet eth0 ip ospf cost '50'
# set interfaces ethernet eth0 ip ospf priority '26'
# set interfaces ethernet eth0 ipv6 ospfv3 instance-id '33'
# set interfaces ethernet eth0 ipv6 ospfv3 'mtu-ignore'
# set interfaces ethernet eth1 ip ospf network 'point-to-point'
# set interfaces ethernet eth1 ip ospf priority '26'
# set interfaces ethernet eth1 ip ospf transmit-delay '50'
# set interfaces ethernet eth1 ipv6 ospfv3 dead-interval '39'
#
- name: parse configs
vyos.vyos.vyos_ospf_interfaces:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
# Module Execution:
# ----------------
# "parsed": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 50,
# "priority": 26
# },
# {
# "afi": "ipv6",
# "instance": "33",
# "mtu_ignore": true
# }
# ],
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# }
# ]
# Using rendered:
# --------------
- name: Render
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth1"
address_family:
- afi: "ipv4"
transmit_delay: 50
priority: 26
network: "point-to-point"
- afi: "ipv6"
dead_interval: 39
- name: "bond2"
address_family:
- afi: "ipv4"
transmit_delay: 45
bandwidth: 70
authentication:
md5_key:
key_id: 10
key: "1111111111232345"
- afi: "ipv6"
passive: True
state: rendered
# Module Execution:
# ----------------
# "rendered": [
# "set interfaces ethernet eth1 ip ospf transmit-delay 50",
# "set interfaces ethernet eth1 ip ospf priority 26",
# "set interfaces ethernet eth1 ip ospf network point-to-point",
# "set interfaces ethernet eth1 ipv6 ospfv3 dead-interval 39",
# "set interfaces bonding bond2 ip ospf transmit-delay 45",
# "set interfaces bonding bond2 ip ospf bandwidth 70",
# "set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key 1111111111232345",
# "set interfaces bonding bond2 ipv6 ospfv3 passive"
# ]
#
# Using Gathered:
# --------------
# Native Config:
# vyos@vyos:~$ show configuration commands | match "ospf"
# set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'
# set interfaces bonding bond2 ip ospf bandwidth '70'
# set interfaces bonding bond2 ip ospf transmit-delay '45'
# set interfaces bonding bond2 ipv6 ospfv3 'passive'
# set interfaces ethernet eth1 ip ospf network 'point-to-point'
# set interfaces ethernet eth1 ip ospf priority '26'
# set interfaces ethernet eth1 ip ospf transmit-delay '50'
# set interfaces ethernet eth1 ipv6 ospfv3 dead-interval '39'
# vyos@vyos:~$
- name: gather configs
vyos.vyos.vyos_ospf_interfaces:
state: gathered
# Module Execution:
# -----------------
# "gathered": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
```
### Authors
* Gomathi Selvi Srinivasan (@GomathiselviS)
| programming_docs |
ansible vyos.vyos.vyos_system – Run set system commands on VyOS devices vyos.vyos.vyos\_system – Run set system commands on VyOS devices
================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_system`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Runs one or more commands on remote devices running VyOS. This module can also be introspected to validate key parameters before returning successfully.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **domain\_name** string | | The new domain name to apply to the device. |
| **domain\_search** list / elements=string | | A list of domain names to search. Mutually exclusive with *name\_server*
|
| **host\_name** string | | Configure the device hostname parameter. This option takes an ASCII string value. |
| **name\_server** list / elements=string | | A list of name servers to use with the device. Mutually exclusive with *domain\_search*
aliases: name\_servers |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| Whether to apply (`present`) or remove (`absent`) the settings. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: configure hostname and domain-name
vyos.vyos.vyos_system:
host_name: vyos01
domain_name: test.example.com
- name: remove all configuration
vyos.vyos.vyos_system:
state: absent
- name: configure name servers
vyos.vyos.vyos_system: name_servers - 8.8.8.8 - 8.8.4.4
- name: configure domain search suffixes
vyos.vyos.vyos_system:
domain_search:
- sub1.example.com
- sub2.example.com
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always | The list of configuration mode commands to send to the device **Sample:** ['set system hostname vyos01', 'set system domain-name foo.example.com'] |
### Authors
* Nathaniel Case (@Qalthos)
ansible vyos.vyos.vyos_firewall_interfaces – FIREWALL interfaces resource module vyos.vyos.vyos\_firewall\_interfaces – FIREWALL interfaces resource module
==========================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_firewall_interfaces`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage firewall rules of interfaces on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of firewall rules options for interfaces. |
| | **access\_rules** list / elements=dictionary | | Specifies firewall rules attached to the interfaces. |
| | | **afi** string / required | **Choices:*** ipv4
* ipv6
| Specifies the AFI for the Firewall rules to be configured on this interface. |
| | | **rules** list / elements=dictionary | | Specifies the firewall rules for the provided AFI. |
| | | | **direction** string / required | **Choices:*** in
* local
* out
| Specifies the direction of packets that the firewall rule will be applied on. |
| | | | **name** string | | Specifies the name of the IPv4/IPv6 Firewall rule for the interface. |
| | **name** string / required | | Name/Identifier for the interface. |
| **running\_config** string | | The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The *running\_config* argument allows the implementer to pass in the configuration to use as the base config for comparison. This value of this option should be the output received from device by executing command C(show configuration commands | grep 'firewall' |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* parsed
* rendered
* gathered
| The state the configuration should be left in. |
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_firewall_interfaces:
config:
- access_rules:
- afi: ipv4
rules:
- name: INBOUND
direction: in
- name: OUTBOUND
direction: out
- name: LOCAL
direction: local
- afi: ipv6
rules:
- name: V6-LOCAL
direction: local
name: eth1
- access_rules:
- afi: ipv4
rules:
- name: INBOUND
direction: in
- name: OUTBOUND
direction: out
- name: LOCAL
direction: local
- afi: ipv6
rules:
- name: V6-LOCAL
direction: local
name: eth3
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": [
# {
# "name": "eth0"
# },
# {
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ]
#
# "commands": [
# "set interfaces ethernet eth1 firewall in name 'INBOUND'",
# "set interfaces ethernet eth1 firewall out name 'OUTBOUND'",
# "set interfaces ethernet eth1 firewall local name 'LOCAL'",
# "set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'",
# "set interfaces ethernet eth3 firewall in name 'INBOUND'",
# "set interfaces ethernet eth3 firewall out name 'OUTBOUND'",
# "set interfaces ethernet eth3 firewall local name 'LOCAL'",
# "set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'"
# ]
#
# "after": [
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall in name 'INBOUND'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall local name 'LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth3 firewall local name 'LOCAL'
# set interfaces ethernet eth3 firewall out name 'OUTBOUND'
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall in name 'INBOUND'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall local name 'LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth3 firewall local name 'LOCAL'
# set interfaces ethernet eth3 firewall out name 'OUTBOUND'
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_firewall_interfaces:
config:
- access_rules:
- afi: ipv4
rules:
- name: OUTBOUND
direction: in
- name: INBOUND
direction: out
name: eth1
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
#
# "commands": [
# "set interfaces ethernet eth1 firewall in name 'OUTBOUND'",
# "set interfaces ethernet eth1 firewall out name 'INBOUND'"
# ]
#
# "after": [
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "OUTBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "INBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall in name 'OUTBOUND'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall local name 'LOCAL'
# set interfaces ethernet eth1 firewall out name 'INBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth3 firewall local name 'LOCAL'
# set interfaces ethernet eth3 firewall out name 'OUTBOUND'
# Using replaced
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall in name 'INBOUND'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall local name 'LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth3 firewall local name 'LOCAL'
# set interfaces ethernet eth3 firewall out name 'OUTBOUND'
#
- name: Replace device configurations of listed firewall interfaces with provided
configurations
vyos.vyos.vyos_firewall_interfaces:
config:
- name: eth1
access_rules:
- afi: ipv4
rules:
- name: OUTBOUND
direction: out
- afi: ipv6
rules:
- name: V6-LOCAL
direction: local
- name: eth3
access_rules:
- afi: ipv4
rules:
- name: INBOUND
direction: in
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
#
# "commands": [
# "delete interfaces ethernet eth1 firewall in name",
# "delete interfaces ethernet eth1 firewall local name",
# "delete interfaces ethernet eth3 firewall local name",
# "delete interfaces ethernet eth3 firewall out name",
# "delete interfaces ethernet eth3 firewall local ipv6-name"
# ]
#
# "after": [
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall 'in'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall 'local'
# set interfaces ethernet eth3 firewall 'out'
# Using overridden
#
# Before state
# --------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall 'in'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall 'local'
# set interfaces ethernet eth3 firewall 'out'
#
- name: Overrides all device configuration with provided configuration
vyos.vyos.vyos_firewall_interfaces:
config:
- name: eth3
access_rules:
- afi: ipv4
rules:
- name: INBOUND
direction: out
state: overridden
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before":[
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
#
# "commands": [
# "delete interfaces ethernet eth1 firewall",
# "delete interfaces ethernet eth3 firewall in name",
# "set interfaces ethernet eth3 firewall out name 'INBOUND'"
#
#
# "after": [
# {
# "name": "eth0"
# },
# {
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "out",
# "name": "INBOUND"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
#
#
# After state
# ------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth3 firewall 'in'
# set interfaces ethernet eth3 firewall 'local'
# set interfaces ethernet eth3 firewall out name 'INBOUND'
# Using deleted per interface name
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall in name 'INBOUND'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall local name 'LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth3 firewall local name 'LOCAL'
# set interfaces ethernet eth3 firewall out name 'OUTBOUND'
#
- name: Delete firewall interfaces based on interface name.
vyos.vyos.vyos_firewall_interfaces:
config:
- name: eth1
- name: eth3
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
# "commands": [
# "delete interfaces ethernet eth1 firewall",
# "delete interfaces ethernet eth3 firewall"
# ]
#
# "after": [
# {
# "name": "eth0"
# },
# {
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ]
# After state
# ------------
# vyos@vyos# run show configuration commands | grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# Using deleted per afi
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall in name 'INBOUND'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall local name 'LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth3 firewall local name 'LOCAL'
# set interfaces ethernet eth3 firewall out name 'OUTBOUND'
#
- name: Delete firewall interfaces config per afi.
vyos.vyos.vyos_firewall_interfaces:
config:
- name: eth1
access_rules:
- afi: ipv4
- afi: ipv6
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "commands": [
# "delete interfaces ethernet eth1 firewall in name",
# "delete interfaces ethernet eth1 firewall out name",
# "delete interfaces ethernet eth1 firewall local name",
# "delete interfaces ethernet eth1 firewall local ipv6-name"
# ]
#
# After state
# ------------
# vyos@vyos# run show configuration commands | grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# Using deleted without config
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall in name 'INBOUND'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall local name 'LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth3 firewall local name 'LOCAL'
# set interfaces ethernet eth3 firewall out name 'OUTBOUND'
#
- name: Delete firewall interfaces config when empty config provided.
vyos.vyos.vyos_firewall_interfaces:
config:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "commands": [
# "delete interfaces ethernet eth1 firewall",
# "delete interfaces ethernet eth1 firewall"
# ]
#
# After state
# ------------
# vyos@vyos# run show configuration commands | grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# Using parsed
#
#
- name: Parse the provided configuration
vyos.vyos.vyos_firewall_interfaces:
running_config:
"set interfaces ethernet eth1 firewall in name 'INBOUND'
set interfaces ethernet eth1 firewall out name 'OUTBOUND'
set interfaces ethernet eth1 firewall local name 'LOCAL'
set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
set interfaces ethernet eth2 firewall in name 'INBOUND'
set interfaces ethernet eth2 firewall out name 'OUTBOUND'
set interfaces ethernet eth2 firewall local name 'LOCAL'
set interfaces ethernet eth2 firewall local ipv6-name 'V6-LOCAL'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# },
# {
# "direction": "local",
# "name": "LOCAL"
# },
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ]
# Using gathered
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall 'in'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall 'local'
# set interfaces ethernet eth3 firewall 'out'
#
- name: Gather listed firewall interfaces.
vyos.vyos.vyos_firewall_interfaces:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "name": "eth0"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "out",
# "name": "OUTBOUND"
# }
# ]
# },
# {
# "afi": "ipv6",
# "rules": [
# {
# "direction": "local",
# "name": "V6-LOCAL"
# }
# ]
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "access_rules": [
# {
# "afi": "ipv4",
# "rules": [
# {
# "direction": "in",
# "name": "INBOUND"
# }
# ]
# }
# ],
# "name": "eth3"
# }
# ]
#
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep firewall
# set firewall ipv6-name 'V6-LOCAL'
# set firewall name 'INBOUND'
# set firewall name 'LOCAL'
# set firewall name 'OUTBOUND'
# set interfaces ethernet eth1 firewall 'in'
# set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'
# set interfaces ethernet eth1 firewall out name 'OUTBOUND'
# set interfaces ethernet eth3 firewall in name 'INBOUND'
# set interfaces ethernet eth3 firewall 'local'
# set interfaces ethernet eth3 firewall 'out'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_firewall_interfaces:
config:
- name: eth2
access_rules:
- afi: ipv4
rules:
- direction: in
name: INGRESS
- direction: out
name: OUTGRESS
- direction: local
name: DROP
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set interfaces ethernet eth2 firewall in name 'INGRESS'",
# "set interfaces ethernet eth2 firewall out name 'OUTGRESS'",
# "set interfaces ethernet eth2 firewall local name 'DROP'",
# "set interfaces ethernet eth2 firewall local ipv6-name 'LOCAL'"
# ]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ["set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'", "set interfaces ethernet eth3 firewall in name 'INBOUND'"] |
### Authors
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_ping – Tests reachability using ping from VyOS network devices vyos.vyos.vyos\_ping – Tests reachability using ping from VyOS network devices
==============================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_ping`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Tests reachability using ping from a VyOS device to a remote destination.
* Tested against VyOS 1.1.8 (helium)
* For a general purpose network module, see the M(net\_ping) module.
* For Windows targets, use the M(win\_ping) module instead.
* For targets running Python, use the M(ping) module instead.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **count** integer | **Default:**5 | Number of packets to send to check reachability. |
| **dest** string / required | | The IP Address or hostname (resolvable by the device) of the remote node. |
| **interval** integer | | Determines the interval (in seconds) between consecutive pings. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **size** integer | | Determines the size (in bytes) of the ping packet(s). |
| **source** string | | The source interface or IP Address to use while sending the ping packet(s). |
| **state** string | **Choices:*** absent
* **present** ←
| Determines if the expected result is success or fail. |
| **ttl** integer | | The time-to-live value for the ICMP packet(s). |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* For a general purpose network module, see the M(net\_ping) module.
* For Windows targets, use the M(win\_ping) module instead.
* For targets running Python, use the M(ping) module instead.
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: Test reachability to 10.10.10.10
vyos.vyos.vyos_ping:
dest: 10.10.10.10
- name: Test reachability to 10.20.20.20 using source and ttl set
vyos.vyos.vyos_ping:
dest: 10.20.20.20
source: eth0
ttl: 128
- name: Test reachability to 10.30.30.30 using interval
vyos.vyos.vyos_ping:
dest: 10.30.30.30
interval: 3
state: absent
- name: Test reachability to 10.40.40.40 setting count and source
vyos.vyos.vyos_ping:
dest: 10.40.40.40
source: eth1
count: 20
size: 512
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always | List of commands sent. **Sample:** ['ping 10.8.38.44 count 10 interface eth0 ttl 128'] |
| **packet\_loss** string | always | Percentage of packets lost. **Sample:** 0% |
| **packets\_rx** integer | always | Packets successfully received. **Sample:** 20 |
| **packets\_tx** integer | always | Packets successfully transmitted. **Sample:** 20 |
| **rtt** dictionary | when ping succeeds | The round trip time (RTT) stats. **Sample:** {'avg': 2, 'max': 8, 'mdev': 24, 'min': 1} |
### Authors
* Nilashish Chakraborty (@NilashishC)
ansible vyos.vyos.vyos_lag_interfaces – LAG interfaces resource module vyos.vyos.vyos\_lag\_interfaces – LAG interfaces resource module
================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_lag_interfaces`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages attributes of link aggregation groups on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of link aggregation group configurations. |
| | **arp\_monitor** dictionary | | ARP Link monitoring parameters. |
| | | **interval** integer | | ARP link monitoring frequency in milliseconds. |
| | | **target** list / elements=string | | IP address to use for ARP monitoring. |
| | **hash\_policy** string | **Choices:*** layer2
* layer2+3
* layer3+4
| LAG or bonding transmit hash policy. |
| | **members** list / elements=dictionary | | List of member interfaces for the LAG (bond). |
| | | **member** string | | Name of the member interface. |
| | **mode** string | **Choices:*** 802.3ad
* active-backup
* broadcast
* round-robin
* transmit-load-balance
* adaptive-load-balance
* xor-hash
| LAG or bond mode. |
| | **name** string / required | | Name of the link aggregation group (LAG) or bond. |
| | **primary** string | | Primary device interfaces for the LAG (bond). |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep bond**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* parsed
* gathered
* rendered
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep bond
# set interfaces bonding bond2
# set interfaces bonding bond3
#
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_lag_interfaces:
config:
- name: bond2
mode: active-backup
members:
- member: eth2
- member: eth1
hash_policy: layer2
primary: eth2
- name: bond3
mode: active-backup
hash_policy: layer2+3
members:
- member: eth3
primary: eth3
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "name": "bond2"
# },
# {
# "name": "bond3"
# }
# ],
#
# "commands": [
# "set interfaces bonding bond2 hash-policy 'layer2'",
# "set interfaces bonding bond2 mode 'active-backup'",
# "set interfaces ethernet eth2 bond-group bond2",
# "set interfaces ethernet eth1 bond-group bond2",
# "set interfaces bonding bond2 primary 'eth2'",
# "set interfaces bonding bond3 hash-policy 'layer2+3'",
# "set interfaces bonding bond3 mode 'active-backup'",
# "set interfaces ethernet eth3 bond-group bond3",
# "set interfaces bonding bond3 primary 'eth3'"
# ]
#
# "after": [
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth1"
# },
# {
# "member": "eth2"
# }
# ],
# "mode": "active-backup",
# "name": "bond2",
# "primary": "eth2"
# },
# {
# "hash_policy": "layer2+3",
# "members": [
# {
# "member": "eth3"
# }
# ],
# "mode": "active-backup",
# "name": "bond3",
# "primary": "eth3"
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep bond
# set interfaces bonding bond2 hash-policy 'layer2'
# set interfaces bonding bond2 mode 'active-backup'
# set interfaces bonding bond2 primary 'eth2'
# set interfaces bonding bond3 hash-policy 'layer2+3'
# set interfaces bonding bond3 mode 'active-backup'
# set interfaces bonding bond3 primary 'eth3'
# set interfaces ethernet eth1 bond-group 'bond2'
# set interfaces ethernet eth2 bond-group 'bond2'
# set interfaces ethernet eth3 bond-group 'bond3'
# Using replaced
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep bond
# set interfaces bonding bond2 hash-policy 'layer2'
# set interfaces bonding bond2 mode 'active-backup'
# set interfaces bonding bond2 primary 'eth2'
# set interfaces bonding bond3 hash-policy 'layer2+3'
# set interfaces bonding bond3 mode 'active-backup'
# set interfaces bonding bond3 primary 'eth3'
# set interfaces ethernet eth1 bond-group 'bond2'
# set interfaces ethernet eth2 bond-group 'bond2'
# set interfaces ethernet eth3 bond-group 'bond3'
#
- name: Replace device configurations of listed LAGs with provided configurations
vyos.vyos.vyos_lag_interfaces:
config:
- name: bond3
mode: 802.3ad
hash_policy: layer2
members:
- member: eth3
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth1"
# },
# {
# "member": "eth2"
# }
# ],
# "mode": "active-backup",
# "name": "bond2",
# "primary": "eth2"
# },
# {
# "hash_policy": "layer2+3",
# "members": [
# {
# "member": "eth3"
# }
# ],
# "mode": "active-backup",
# "name": "bond3",
# "primary": "eth3"
# }
# ],
#
# "commands": [
# "delete interfaces bonding bond3 primary",
# "set interfaces bonding bond3 hash-policy 'layer2'",
# "set interfaces bonding bond3 mode '802.3ad'"
# ],
#
# "after": [
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth1"
# },
# {
# "member": "eth2"
# }
# ],
# "mode": "active-backup",
# "name": "bond2",
# "primary": "eth2"
# },
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth3"
# }
# ],
# "mode": "802.3ad",
# "name": "bond3"
# }
# ],
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep bond
# set interfaces bonding bond2 hash-policy 'layer2'
# set interfaces bonding bond2 mode 'active-backup'
# set interfaces bonding bond2 primary 'eth2'
# set interfaces bonding bond3 hash-policy 'layer2'
# set interfaces bonding bond3 mode '802.3ad'
# set interfaces ethernet eth1 bond-group 'bond2'
# set interfaces ethernet eth2 bond-group 'bond2'
# set interfaces ethernet eth3 bond-group 'bond3'
# Using overridden
#
# Before state
# --------------
#
# vyos@vyos:~$ show configuration commands | grep bond
# set interfaces bonding bond2 hash-policy 'layer2'
# set interfaces bonding bond2 mode 'active-backup'
# set interfaces bonding bond2 primary 'eth2'
# set interfaces bonding bond3 hash-policy 'layer2'
# set interfaces bonding bond3 mode '802.3ad'
# set interfaces ethernet eth1 bond-group 'bond2'
# set interfaces ethernet eth2 bond-group 'bond2'
# set interfaces ethernet eth3 bond-group 'bond3'
#
- name: Overrides all device configuration with provided configuration
vyos.vyos.vyos_lag_interfaces:
config:
- name: bond3
mode: active-backup
members:
- member: eth1
- member: eth2
- member: eth3
primary: eth3
hash_policy: layer2
state: overridden
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth1"
# },
# {
# "member": "eth2"
# }
# ],
# "mode": "active-backup",
# "name": "bond2",
# "primary": "eth2"
# },
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth3"
# }
# ],
# "mode": "802.3ad",
# "name": "bond3"
# }
# ],
#
# "commands": [
# "delete interfaces bonding bond2 hash-policy",
# "delete interfaces ethernet eth1 bond-group bond2",
# "delete interfaces ethernet eth2 bond-group bond2",
# "delete interfaces bonding bond2 mode",
# "delete interfaces bonding bond2 primary",
# "set interfaces bonding bond3 mode 'active-backup'",
# "set interfaces ethernet eth1 bond-group bond3",
# "set interfaces ethernet eth2 bond-group bond3",
# "set interfaces bonding bond3 primary 'eth3'"
# ],
#
# "after": [
# {
# "name": "bond2"
# },
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth1"
# },
# {
# "member": "eth2"
# },
# {
# "member": "eth3"
# }
# ],
# "mode": "active-backup",
# "name": "bond3",
# "primary": "eth3"
# }
# ],
#
#
# After state
# ------------
#
# vyos@vyos:~$ show configuration commands | grep bond
# set interfaces bonding bond2
# set interfaces bonding bond3 hash-policy 'layer2'
# set interfaces bonding bond3 mode 'active-backup'
# set interfaces bonding bond3 primary 'eth3'
# set interfaces ethernet eth1 bond-group 'bond3'
# set interfaces ethernet eth2 bond-group 'bond3'
# set interfaces ethernet eth3 bond-group 'bond3'
# Using deleted
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands | grep bond
# set interfaces bonding bond2 hash-policy 'layer2'
# set interfaces bonding bond2 mode 'active-backup'
# set interfaces bonding bond2 primary 'eth2'
# set interfaces bonding bond3 hash-policy 'layer2+3'
# set interfaces bonding bond3 mode 'active-backup'
# set interfaces bonding bond3 primary 'eth3'
# set interfaces ethernet eth1 bond-group 'bond2'
# set interfaces ethernet eth2 bond-group 'bond2'
# set interfaces ethernet eth3 bond-group 'bond3'
#
- name: Delete LAG attributes of given interfaces (Note This won't delete the interface
itself)
vyos.vyos.vyos_lag_interfaces:
config:
- name: bond2
- name: bond3
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth1"
# },
# {
# "member": "eth2"
# }
# ],
# "mode": "active-backup",
# "name": "bond2",
# "primary": "eth2"
# },
# {
# "hash_policy": "layer2+3",
# "members": [
# {
# "member": "eth3"
# }
# ],
# "mode": "active-backup",
# "name": "bond3",
# "primary": "eth3"
# }
# ],
# "commands": [
# "delete interfaces bonding bond2 hash-policy",
# "delete interfaces ethernet eth1 bond-group bond2",
# "delete interfaces ethernet eth2 bond-group bond2",
# "delete interfaces bonding bond2 mode",
# "delete interfaces bonding bond2 primary",
# "delete interfaces bonding bond3 hash-policy",
# "delete interfaces ethernet eth3 bond-group bond3",
# "delete interfaces bonding bond3 mode",
# "delete interfaces bonding bond3 primary"
# ],
#
# "after": [
# {
# "name": "bond2"
# },
# {
# "name": "bond3"
# }
# ],
#
# After state
# ------------
# vyos@vyos:~$ show configuration commands | grep bond
# set interfaces bonding bond2
# set interfaces bonding bond3
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep bond
# set interfaces bonding bond0 hash-policy 'layer2'
# set interfaces bonding bond0 mode 'active-backup'
# set interfaces bonding bond0 primary 'eth1'
# set interfaces bonding bond1 hash-policy 'layer2+3'
# set interfaces bonding bond1 mode 'active-backup'
# set interfaces bonding bond1 primary 'eth2'
# set interfaces ethernet eth1 bond-group 'bond0'
# set interfaces ethernet eth2 bond-group 'bond1'
#
- name: Gather listed lag interfaces with provided configurations
vyos.vyos.vyos_lag_interfaces:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "afi": "ipv6",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "This is ipv6 specific rule-set",
# "name": "UPLINK",
# "rules": [
# {
# "action": "accept",
# "description": "Fwipv6-Rule 1 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 1
# },
# {
# "action": "accept",
# "description": "Fwipv6-Rule 2 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 2
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv4",
# "rule_sets": [
# {
# "default_action": "accept",
# "description": "IPv4 INBOUND rule set",
# "name": "INBOUND",
# "rules": [
# {
# "action": "accept",
# "description": "Rule 101 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 101
# },
# {
# "action": "reject",
# "description": "Rule 102 is configured by Ansible",
# "ipsec": "match-ipsec",
# "number": 102
# },
# {
# "action": "accept",
# "description": "Rule 103 is configured by Ansible",
# "destination": {
# "group": {
# "address_group": "inbound"
# }
# },
# "number": 103,
# "source": {
# "address": "192.0.2.0"
# },
# "state": {
# "established": true,
# "invalid": false,
# "new": false,
# "related": true
# }
# }
# ]
# }
# ]
# }
# ]
#
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep bond
# set interfaces bonding bond0 hash-policy 'layer2'
# set interfaces bonding bond0 mode 'active-backup'
# set interfaces bonding bond0 primary 'eth1'
# set interfaces bonding bond1 hash-policy 'layer2+3'
# set interfaces bonding bond1 mode 'active-backup'
# set interfaces bonding bond1 primary 'eth2'
# set interfaces ethernet eth1 bond-group 'bond0'
# set interfaces ethernet eth2 bond-group 'bond1'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_lag_interfaces:
config:
- name: bond0
hash_policy: layer2
members:
- member: eth1
mode: active-backup
primary: eth1
- name: bond1
hash_policy: layer2+3
members:
- member: eth2
mode: active-backup
primary: eth2
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set interfaces bonding bond0 hash-policy 'layer2'",
# "set interfaces ethernet eth1 bond-group 'bond0'",
# "set interfaces bonding bond0 mode 'active-backup'",
# "set interfaces bonding bond0 primary 'eth1'",
# "set interfaces bonding bond1 hash-policy 'layer2+3'",
# "set interfaces ethernet eth2 bond-group 'bond1'",
# "set interfaces bonding bond1 mode 'active-backup'",
# "set interfaces bonding bond1 primary 'eth2'"
# ]
# Using parsed
#
#
- name: Parsed the commands for provided configuration
vyos.vyos.vyos_l3_interfaces:
running_config:
"set interfaces bonding bond0 hash-policy 'layer2'
set interfaces bonding bond0 mode 'active-backup'
set interfaces bonding bond0 primary 'eth1'
set interfaces bonding bond1 hash-policy 'layer2+3'
set interfaces bonding bond1 mode 'active-backup'
set interfaces bonding bond1 primary 'eth2'
set interfaces ethernet eth1 bond-group 'bond0'
set interfaces ethernet eth2 bond-group 'bond1'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "hash_policy": "layer2",
# "members": [
# {
# "member": "eth1"
# }
# ],
# "mode": "active-backup",
# "name": "bond0",
# "primary": "eth1"
# },
# {
# "hash_policy": "layer2+3",
# "members": [
# {
# "member": "eth2"
# }
# ],
# "mode": "active-backup",
# "name": "bond1",
# "primary": "eth2"
# }
# ]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['set interfaces bonding bond2', 'set interfaces bonding bond2 hash-policy layer2'] |
### Authors
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_logging – Manage logging on network devices vyos.vyos.vyos\_logging – Manage logging on network devices
===========================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_logging`.
New in version 1.0.0: of vyos.vyos
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2023-08-01
Why
Updated module released with more functionality.
Alternative
vyos\_logging\_global
Synopsis
--------
* This module provides declarative management of logging on Vyatta Vyos devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aggregate** list / elements=dictionary | | List of logging definitions. |
| | **dest** string | **Choices:*** console
* file
* global
* host
* user
| Destination of the logs. |
| | **facility** string | | Set logging facility. |
| | **level** string | | Set logging severity levels. |
| | **name** string | | If value of `dest` is *file* it indicates file-name, for *user* it indicates username and for *host* indicates the host name to be notified. |
| | **state** string | **Choices:*** present
* absent
| State of the logging configuration. |
| **dest** string | **Choices:*** console
* file
* global
* host
* user
| Destination of the logs. |
| **facility** string | | Set logging facility. |
| **level** string | | Set logging severity levels. |
| **name** string | | If value of `dest` is *file* it indicates file-name, for *user* it indicates username and for *host* indicates the host name to be notified. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the logging configuration. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: configure console logging
vyos.vyos.vyos_logging:
dest: console
facility: all
level: crit
- name: remove console logging configuration
vyos.vyos.vyos_logging:
dest: console
state: absent
- name: configure file logging
vyos.vyos.vyos_logging:
dest: file
name: test
facility: local3
level: err
- name: Add logging aggregate
vyos.vyos.vyos_logging:
aggregate:
- {dest: file, name: test1, facility: all, level: info}
- {dest: file, name: test2, facility: news, level: debug}
state: present
- name: Remove logging aggregate
vyos.vyos.vyos_logging:
aggregate:
- {dest: console, facility: all, level: info}
- {dest: console, facility: daemon, level: warning}
- {dest: file, name: test2, facility: news, level: debug}
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always | The list of configuration mode commands to send to the device **Sample:** ['set system syslog global facility all level notice'] |
Status
------
* This module will be removed in a major release after 2023-08-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Trishna Guha (@trishnaguha)
ansible vyos.vyos.vyos – Use vyos cliconf to run command on VyOS platform vyos.vyos.vyos – Use vyos cliconf to run command on VyOS platform
=================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* This vyos plugin provides low level abstraction apis for sending and receiving CLI commands from VyOS network devices.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **config\_commands** list / elements=string added in 2.0.0 of vyos.vyos | **Default:**[] | var: ansible\_vyos\_config\_commands | Specifies a list of commands that can make configuration changes to the target device. When `ansible\_network\_single\_user\_mode` is enabled, if a command sent to the device is present in this list, the existing cache is invalidated. |
### Authors
* Ansible Networking Team
ansible vyos.vyos.vyos_l3_interface – (deprecated, removed after 2022-06-01) Manage L3 interfaces on VyOS network devices vyos.vyos.vyos\_l3\_interface – (deprecated, removed after 2022-06-01) Manage L3 interfaces on VyOS network devices
===================================================================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_l3_interface`.
New in version 1.0.0: of vyos.vyos
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Updated modules released with more functionality.
Alternative
vyos\_l3\_interfaces
Synopsis
--------
* This module provides declarative management of L3 interfaces on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aggregate** list / elements=dictionary | | List of L3 interfaces definitions |
| | **ipv4** string | | IPv4 of the L3 interface. |
| | **ipv6** string | | IPv6 of the L3 interface. |
| | **name** string / required | | Name of the L3 interface. |
| | **state** string | **Choices:*** present
* absent
| State of the L3 interface configuration. |
| **ipv4** string | | IPv4 of the L3 interface. |
| **ipv6** string | | IPv6 of the L3 interface. |
| **name** string | | Name of the L3 interface. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the L3 interface configuration. |
Notes
-----
Note
* Tested against VYOS 1.1.7
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: Set eth0 IPv4 address
vyos.vyos.vyos_l3_interface:
name: eth0
ipv4: 192.168.0.1/24
- name: Remove eth0 IPv4 address
vyos.vyos.vyos_l3_interface:
name: eth0
state: absent
- name: Set IP addresses on aggregate
vyos.vyos.vyos_l3_interface:
aggregate:
- {name: eth1, ipv4: 192.168.2.10/24}
- {name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64"}
- name: Remove IP addresses on aggregate
vyos.vyos.vyos_l3_interface:
aggregate:
- {name: eth1, ipv4: 192.168.2.10/24}
- {name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64"}
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always, except for the platforms that use Netconf transport to manage the device. | The list of configuration mode commands to send to the device **Sample:** ["set interfaces ethernet eth0 address '192.168.0.1/24'"] |
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Ricardo Carrillo Cruz (@rcarrillocruz)
ansible vyos.vyos.vyos_prefix_lists – Prefix-Lists resource module for VyOS vyos.vyos.vyos\_prefix\_lists – Prefix-Lists resource module for VyOS
=====================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_prefix_lists`.
New in version 2.4.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages prefix-lists configuration on devices running VyOS
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of prefix-list options |
| | **afi** string / required | **Choices:*** ipv4
* ipv6
| The Address Family Indicator (AFI) for the prefix-lists |
| | **prefix\_lists** list / elements=dictionary | | A list of prefix-list configurations |
| | | **description** string | | A brief text description for the prefix-list |
| | | **entries** list / elements=dictionary | | Rule configurations for the prefix-list |
| | | | **action** string | **Choices:*** permit
* deny
| The action to be taken for packets matching a prefix list rule |
| | | | **description** string | | A brief text description for the prefix list rule |
| | | | **ge** integer | | Minimum prefix length to be matched |
| | | | **le** integer | | Maximum prefix list length to be matched |
| | | | **prefix** string | | IPv4 or IPv6 prefix in A.B.C.D/LEN or A:B::C:D/LEN format |
| | | | **sequence** integer / required | | A numeric identifier for the rule |
| | | **name** string / required | | The name of a defined prefix-list |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep prefix-list**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* gathered
* rendered
* parsed
| The state the configuration should be left in |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium)
* This module works with connection `network_cli`
Examples
--------
```
# # -------------------
# # 1. Using merged
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# vyos@vyos:~$
# # Task
# # -------------
# - name: Merge the provided configuration with the existing running configuration
# vyos.vyos.vyos_prefix_lists:
# config:
# - afi: "ipv4"
# prefix_lists:
# - name: "AnsibleIPv4PrefixList"
# description: "PL configured by ansible"
# entries:
# - sequence: 2
# description: "Rule 2 given by ansible"
# action: "permit"
# prefix: "92.168.10.0/26"
# le: 32
# - sequence: 3
# description: "Rule 3"
# action: "deny"
# prefix: "72.168.2.0/24"
# ge: 26
# - afi: "ipv6"
# prefix_lists:
# - name: "AllowIPv6Prefix"
# description: "Configured by ansible for allowing IPv6 networks"
# entries:
# - sequence: 5
# description: "Permit rule"
# action: "permit"
# prefix: "2001:db8:8000::/35"
# le: 37
# - name: DenyIPv6Prefix
# description: "Configured by ansible for disallowing IPv6 networks"
# entries:
# - sequence: 8
# action: deny
# prefix: "2001:db8:2000::/35"
# le: 37
# state: merged
# # Task output:
# # -------------
# "after": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ],
# "before": [],
# "changed": true,
# "commands": [
# "set policy prefix-list AnsibleIPv4PrefixList",
# "set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'",
# "set policy prefix-list6 AllowIPv6Prefix",
# "set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'",
# "set policy prefix-list6 AllowIPv6Prefix rule 5",
# "set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'",
# "set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'",
# "set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'",
# "set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'",
# "set policy prefix-list6 DenyIPv6Prefix",
# "set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'",
# "set policy prefix-list6 DenyIPv6Prefix rule 8",
# "set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'",
# "set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'",
# "set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'"
# ]
# After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'
# set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'
# set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'
# set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
# vyos@vyos:~$
# # -------------------
# # 2. Using replaced
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'
# set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'
# set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'
# set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
# vyos@vyos:~$
# # Task:
# # -------------
# - name: Replace prefix-lists configurations of listed prefix-lists with provided configurations
# vyos.vyos.vyos_prefix_lists:
# config:
# - afi: "ipv4"
# prefix_lists:
# - name: "AnsibleIPv4PrefixList"
# description: "Configuration replaced by ansible"
# entries:
# - sequence: 3
# description: "Rule 3 replaced by ansible"
# action: "permit"
# prefix: "82.168.2.0/24"
# ge: 26
# state: replaced
# # Task output:
# # -------------
# "after": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "Configuration replaced by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 3 replaced by ansible",
# "ge": 26,
# "sequence": 3,
# "prefix": "82.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ],
# "before": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ],
# "changed": true,
# "commands": [
# "set policy prefix-list AnsibleIPv4PrefixList description 'Configuration replaced by ansible'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'permit'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3 replaced by ansible'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '82.168.2.0/24'",
# "delete policy prefix-list AnsibleIPv4PrefixList rule 2"
# ]
# # After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'Configuration replaced by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3 replaced by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '82.168.2.0/24'
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'
# set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'
# set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'
# set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
# vyos@vyos:~$
# # -------------------
# # 3. Using overridden
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'
# set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'
# set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'
# set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
# vyos@vyos:~$
# # Task:
# # -------------
# - name: Override all prefix-lists configuration with provided configuration
# vyos.vyos.vyos_prefix_lists:
# config:
# - afi: "ipv4"
# prefix_lists:
# - name: "AnsibleIPv4PrefixList"
# description: Rule 2 overridden by ansible
# entries:
# - sequence: 2
# action: "deny"
# ge: 26
# prefix: "82.168.2.0/24"
# - name: "OverriddenPrefixList"
# description: Configuration overridden by ansible
# entries:
# - sequence: 10
# action: permit
# prefix: "203.0.113.96/27"
# le: 32
# state: overridden
# # Task output:
# # -------------
# "after": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "Rule 2 overridden by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "deny",
# "ge": 26,
# "sequence": 2,
# "prefix": "82.168.2.0/24"
# }
# ]
# },
# {
# "description": "Configuration overridden by ansible",
# "name": "OverriddenPrefixList",
# "entries": [
# {
# "action": "permit",
# "sequence": 10,
# "le": 32,
# "prefix": "203.0.113.96/27"
# }
# ]
# }
# ]
# }
# ],
# "before": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ],
# "changed": true,
# "commands": [
# "delete policy prefix-list6 AllowIPv6Prefix",
# "delete policy prefix-list6 DenyIPv6Prefix",
# "set policy prefix-list AnsibleIPv4PrefixList description 'Rule 2 overridden by ansible'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'deny'",
# "delete policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 ge '26'",
# "delete policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '82.168.2.0/24'",
# "delete policy prefix-list AnsibleIPv4PrefixList rule 3",
# "set policy prefix-list OverriddenPrefixList",
# "set policy prefix-list OverriddenPrefixList description 'Configuration overridden by ansible'",
# "set policy prefix-list OverriddenPrefixList rule 10",
# "set policy prefix-list OverriddenPrefixList rule 10 action 'permit'",
# "set policy prefix-list OverriddenPrefixList rule 10 le '32'",
# "set policy prefix-list OverriddenPrefixList rule 10 prefix '203.0.113.96/27'"
# ]
# # After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'Rule 2 overridden by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '82.168.2.0/24'
# set policy prefix-list OverriddenPrefixList description 'Configuration overridden by ansible'
# set policy prefix-list OverriddenPrefixList rule 10 action 'permit'
# set policy prefix-list OverriddenPrefixList rule 10 le '32'
# set policy prefix-list OverriddenPrefixList rule 10 prefix '203.0.113.96/27'
# vyos@vyos:~$
# # -------------------
# # 4(i). Using deleted (to delete all prefix lists from the device)
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'
# set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'
# set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'
# set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
# vyos@vyos:~$
# # Task:
# # -------------
# - name: Delete all prefix-lists
# vyos.vyos.vyos_prefix_lists:
# config:
# state: deleted
# # Task output:
# # -------------
# "after": [],
# "before": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ],
# "changed": true,
# "commands": [
# "delete policy prefix-list AnsibleIPv4PrefixList",
# "delete policy prefix-list6 AllowIPv6Prefix",
# "delete policy prefix-list6 DenyIPv6Prefix"
# ]
# # After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# vyos@vyos:~$
# # -------------------
# # 4(ii). Using deleted (to delete all prefix lists for an AFI)
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'
# set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'
# set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'
# set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
# vyos@vyos:~$
# # Task:
# # -------------
# - name: Delete all prefix-lists for IPv6 AFI
# vyos.vyos.vyos_prefix_lists:
# config:
# - afi: "ipv6"
# state: deleted
# # Task output:
# # -------------
# "after": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# }
# ],
# "before": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ],
# "changed": true,
# "commands": [
# "delete policy prefix-list6 AllowIPv6Prefix",
# "delete policy prefix-list6 DenyIPv6Prefix"
# ]
# # After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'
# vyos@vyos:~$
# # -------------------
# # 4(iii). Using deleted (to delete single prefix list by name in different AFIs)
# # -------------------
# # Before state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'
# set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'
# set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'
# set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
# vyos@vyos:~$
# # Task:
# # -------------
# - name: Delete a single prefix-list from different AFIs
# vyos.vyos.vyos_prefix_lists:
# config:
# - afi: "ipv4"
# prefix_lists:
# - name: "AnsibleIPv4PrefixList"
# - afi: "ipv6"
# prefix_lists:
# - name: "DenyIPv6Prefix"
# state: deleted
# # Task output:
# # -------------
# "after": [
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# }
# ]
# }
# ],
# "before": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ],
# "changed": true,
# "commands": [
# "delete policy prefix-list AnsibleIPv4PrefixList",
# "delete policy prefix-list6 DenyIPv6Prefix"
# ]
# # After state:
# # -------------
# vyos@vyos:~$ show configuration commands | grep prefix-list
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# vyos@vyos:~$
# # -------------------
# # 5. Using gathered
# # -------------------
# # Task:
# # -------------
# - name: Gather prefix-lists configurations
# vyos.vyos.vyos_prefix_lists:
# config:
# state: gathered
# # Task output:
# # -------------
# "gathered": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ]
# # -------------------
# # 6. Using rendered
# # -------------------
# # Task:
# # -------------
# - name: Render commands externally for the described prefix-list configurations
# vyos.vyos.vyos_prefix_lists:
# config:
# - afi: "ipv4"
# prefix_lists:
# - name: "AnsibleIPv4PrefixList"
# description: "PL configured by ansible"
# entries:
# - sequence: 2
# description: "Rule 2 given by ansible"
# action: "permit"
# prefix: "92.168.10.0/26"
# le: 32
# - sequence: 3
# description: "Rule 3"
# action: "deny"
# prefix: "72.168.2.0/24"
# ge: 26
# - afi: "ipv6"
# prefix_lists:
# - name: "AllowIPv6Prefix"
# description: "Configured by ansible for allowing IPv6 networks"
# entries:
# - sequence: 5
# description: "Permit rule"
# action: "permit"
# prefix: "2001:db8:8000::/35"
# le: 37
# - name: DenyIPv6Prefix
# description: "Configured by ansible for disallowing IPv6 networks"
# entries:
# - sequence: 8
# action: deny
# prefix: "2001:db8:2000::/35"
# le: 37
# state: rendered
# # Task output:
# # -------------
# "rendered": [
# "set policy prefix-list AnsibleIPv4PrefixList",
# "set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'",
# "set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'",
# "set policy prefix-list6 AllowIPv6Prefix",
# "set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'",
# "set policy prefix-list6 AllowIPv6Prefix rule 5",
# "set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'",
# "set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'",
# "set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'",
# "set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'",
# "set policy prefix-list6 DenyIPv6Prefix",
# "set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'",
# "set policy prefix-list6 DenyIPv6Prefix rule 8",
# "set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'",
# "set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'",
# "set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'"
# ]
# # -------------------
# # 7. Using parsed
# # -------------------
# # sample_config.cfg:
# # -------------
# set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'
# set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'
# set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'
# set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'
# set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'
# set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'
# set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'
# set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'
# set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'
# set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'
# set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'
# set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
# # Task:
# # -------------
# - name: Parse externally provided prefix-lists configuration
# vyos.vyos.vyos_prefix_lists:
# running_config: "{{ lookup('file', './sample_config.cfg') }}"
# state: parsed
# # Task output:
# # -------------
# "parsed": [
# {
# "afi": "ipv4",
# "prefix_lists": [
# {
# "description": "PL configured by ansible",
# "name": "AnsibleIPv4PrefixList",
# "entries": [
# {
# "action": "permit",
# "description": "Rule 2 given by ansible",
# "sequence": 2,
# "le": 32,
# "prefix": "92.168.10.0/26"
# },
# {
# "action": "deny",
# "description": "Rule 3",
# "ge": 26,
# "sequence": 3,
# "prefix": "72.168.2.0/24"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "prefix_lists": [
# {
# "description": "Configured by ansible for allowing IPv6 networks",
# "name": "AllowIPv6Prefix",
# "entries": [
# {
# "action": "permit",
# "description": "Permit rule",
# "sequence": 5,
# "le": 37,
# "prefix": "2001:db8:8000::/35"
# }
# ]
# },
# {
# "description": "Configured by ansible for disallowing IPv6 networks",
# "name": "DenyIPv6Prefix",
# "entries": [
# {
# "action": "deny",
# "sequence": 8,
# "le": 37,
# "prefix": "2001:db8:2000::/35"
# }
# ]
# }
# ]
# }
# ]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration after the module invocation. **Sample:** This output will always be in the same format as the module argspec. |
| **before** list / elements=string | when state is *merged*, *replaced*, *overridden* or *deleted* | The configuration prior to the module invocation. **Sample:** This output will always be in the same format as the module argspec. |
| **commands** list / elements=string | when state is *merged*, *replaced*, *overridden* or *deleted* | The set of commands pushed to the remote device for the required configurations to take place. **Sample:** ["set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'", "set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'", "set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'"] |
| **gathered** list / elements=string | when state is *gathered* | Facts about the network resource gathered from the remote device as structured data. **Sample:** This output will always be in the same format as the module argspec. |
| **parsed** list / elements=string | when state is *parsed* | The device native config provided in *running\_config* option parsed into structured data as per module argspec. **Sample:** This output will always be in the same format as the module argspec. |
| **rendered** list / elements=string | when state is *rendered* | The provided configuration in the task rendered in device-native format (offline). **Sample:** ["set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'", "set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'", "set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'"] |
### Authors
* Priyam Sahoo (@priyamsahoo)
| programming_docs |
ansible vyos.vyos.vyos_lldp_interfaces – LLDP interfaces resource module vyos.vyos.vyos\_lldp\_interfaces – LLDP interfaces resource module
==================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_lldp_interfaces`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages attributes of lldp interfaces on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of lldp interfaces configurations. |
| | **enable** boolean | **Choices:*** no
* **yes** ←
| to disable lldp on the interface. |
| | **location** dictionary | | LLDP-MED location data. |
| | | **civic\_based** dictionary | | Civic-based location data. |
| | | | **ca\_info** list / elements=dictionary | | LLDP-MED address info |
| | | | | **ca\_type** integer | | LLDP-MED Civic Address type. |
| | | | | **ca\_value** string | | LLDP-MED Civic Address value. |
| | | | **country\_code** string / required | | Country Code |
| | | **coordinate\_based** dictionary | | Coordinate-based location. |
| | | | **altitude** integer | | Altitude in meters. |
| | | | **datum** string | **Choices:*** WGS84
* NAD83
* MLLW
| Coordinate datum type. |
| | | | **latitude** string / required | | Latitude. |
| | | | **longitude** string / required | | Longitude. |
| | | **elin** string | | Emergency Call Service ELIN number (between 10-25 numbers). |
| | **name** string / required | | Name of the lldp interface. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep lldp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* rendered
* parsed
* gathered
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep lldp
#
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_lldp_interfaces:
config:
- name: eth1
location:
civic_based:
country_code: US
ca_info:
- ca_type: 0
ca_value: ENGLISH
- name: eth2
location:
coordinate_based:
altitude: 2200
datum: WGS84
longitude: 222.267255W
latitude: 33.524449N
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": []
#
# "commands": [
# "set service lldp interface eth1 location civic-based country-code 'US'",
# "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'",
# "set service lldp interface eth1",
# "set service lldp interface eth2 location coordinate-based latitude '33.524449N'",
# "set service lldp interface eth2 location coordinate-based altitude '2200'",
# "set service lldp interface eth2 location coordinate-based datum 'WGS84'",
# "set service lldp interface eth2 location coordinate-based longitude '222.267255W'",
# "set service lldp interface eth2 location coordinate-based latitude '33.524449N'",
# "set service lldp interface eth2 location coordinate-based altitude '2200'",
# "set service lldp interface eth2 location coordinate-based datum 'WGS84'",
# "set service lldp interface eth2 location coordinate-based longitude '222.267255W'",
# "set service lldp interface eth2"
#
# "after": [
# {
# "location": {
# "coordinate_based": {
# "altitude": 2200,
# "datum": "WGS84",
# "latitude": "33.524449N",
# "longitude": "222.267255W"
# }
# },
# "name": "eth2"
# },
# {
# "location": {
# "civic_based": {
# "ca_info": [
# {
# "ca_type": 0,
# "ca_value": "ENGLISH"
# }
# ],
# "country_code": "US"
# }
# },
# "name": "eth1"
# }
# ],
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep lldp
# set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
# set service lldp interface eth1 location civic-based country-code 'US'
# set service lldp interface eth2 location coordinate-based altitude '2200'
# set service lldp interface eth2 location coordinate-based datum 'WGS84'
# set service lldp interface eth2 location coordinate-based latitude '33.524449N'
# set service lldp interface eth2 location coordinate-based longitude '222.267255W'
# Using replaced
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep lldp
# set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
# set service lldp interface eth1 location civic-based country-code 'US'
# set service lldp interface eth2 location coordinate-based altitude '2200'
# set service lldp interface eth2 location coordinate-based datum 'WGS84'
# set service lldp interface eth2 location coordinate-based latitude '33.524449N'
# set service lldp interface eth2 location coordinate-based longitude '222.267255W'
#
- name: Replace device configurations of listed LLDP interfaces with provided configurations
vyos.vyos.vyos_lldp_interfaces:
config:
- name: eth2
location:
civic_based:
country_code: US
ca_info:
- ca_type: 0
ca_value: ENGLISH
- name: eth1
location:
coordinate_based:
altitude: 2200
datum: WGS84
longitude: 222.267255W
latitude: 33.524449N
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "location": {
# "coordinate_based": {
# "altitude": 2200,
# "datum": "WGS84",
# "latitude": "33.524449N",
# "longitude": "222.267255W"
# }
# },
# "name": "eth2"
# },
# {
# "location": {
# "civic_based": {
# "ca_info": [
# {
# "ca_type": 0,
# "ca_value": "ENGLISH"
# }
# ],
# "country_code": "US"
# }
# },
# "name": "eth1"
# }
# ]
#
# "commands": [
# "delete service lldp interface eth2 location",
# "set service lldp interface eth2 'disable'",
# "set service lldp interface eth2 location civic-based country-code 'US'",
# "set service lldp interface eth2 location civic-based ca-type 0 ca-value 'ENGLISH'",
# "delete service lldp interface eth1 location",
# "set service lldp interface eth1 'disable'",
# "set service lldp interface eth1 location coordinate-based latitude '33.524449N'",
# "set service lldp interface eth1 location coordinate-based altitude '2200'",
# "set service lldp interface eth1 location coordinate-based datum 'WGS84'",
# "set service lldp interface eth1 location coordinate-based longitude '222.267255W'"
# ]
#
# "after": [
# {
# "location": {
# "civic_based": {
# "ca_info": [
# {
# "ca_type": 0,
# "ca_value": "ENGLISH"
# }
# ],
# "country_code": "US"
# }
# },
# "name": "eth2"
# },
# {
# "location": {
# "coordinate_based": {
# "altitude": 2200,
# "datum": "WGS84",
# "latitude": "33.524449N",
# "longitude": "222.267255W"
# }
# },
# "name": "eth1"
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep lldp
# set service lldp interface eth1 'disable'
# set service lldp interface eth1 location coordinate-based altitude '2200'
# set service lldp interface eth1 location coordinate-based datum 'WGS84'
# set service lldp interface eth1 location coordinate-based latitude '33.524449N'
# set service lldp interface eth1 location coordinate-based longitude '222.267255W'
# set service lldp interface eth2 'disable'
# set service lldp interface eth2 location civic-based ca-type 0 ca-value 'ENGLISH'
# set service lldp interface eth2 location civic-based country-code 'US'
# Using overridden
#
# Before state
# --------------
#
# vyos@vyos:~$ show configuration commands | grep lldp
# set service lldp interface eth1 'disable'
# set service lldp interface eth1 location coordinate-based altitude '2200'
# set service lldp interface eth1 location coordinate-based datum 'WGS84'
# set service lldp interface eth1 location coordinate-based latitude '33.524449N'
# set service lldp interface eth1 location coordinate-based longitude '222.267255W'
# set service lldp interface eth2 'disable'
# set service lldp interface eth2 location civic-based ca-type 0 ca-value 'ENGLISH'
# set service lldp interface eth2 location civic-based country-code 'US'
#
- name: Overrides all device configuration with provided configuration
vyos.vyos.vyos_lldp_interfaces:
config:
- name: eth2
location:
elin: 0000000911
state: overridden
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "enable": false,
# "location": {
# "civic_based": {
# "ca_info": [
# {
# "ca_type": 0,
# "ca_value": "ENGLISH"
# }
# ],
# "country_code": "US"
# }
# },
# "name": "eth2"
# },
# {
# "enable": false,
# "location": {
# "coordinate_based": {
# "altitude": 2200,
# "datum": "WGS84",
# "latitude": "33.524449N",
# "longitude": "222.267255W"
# }
# },
# "name": "eth1"
# }
# ]
#
# "commands": [
# "delete service lldp interface eth2 location",
# "delete service lldp interface eth2 disable",
# "set service lldp interface eth2 location elin 0000000911"
#
#
# "after": [
# {
# "location": {
# "elin": 0000000911
# },
# "name": "eth2"
# }
# ]
#
#
# After state
# ------------
#
# vyos@vyos# run show configuration commands | grep lldp
# set service lldp interface eth2 location elin '0000000911'
# Using deleted
#
# Before state
# -------------
#
# vyos@vyos# run show configuration commands | grep lldp
# set service lldp interface eth2 location elin '0000000911'
#
- name: Delete lldp interface attributes of given interfaces.
vyos.vyos.vyos_lldp_interfaces:
config:
- name: eth2
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
before: [{location: {elin: 0000000911}, name: eth2}]
# "commands": [
# "commands": [
# "delete service lldp interface eth2"
# ]
#
# "after": []
# After state
# ------------
# vyos@vyos# run show configuration commands | grep lldp
# set service 'lldp'
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep lldp
# set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
# set service lldp interface eth1 location civic-based country-code 'US'
# set service lldp interface eth2 location coordinate-based altitude '2200'
# set service lldp interface eth2 location coordinate-based datum 'WGS84'
# set service lldp interface eth2 location coordinate-based latitude '33.524449N'
# set service lldp interface eth2 location coordinate-based longitude '222.267255W'
#
- name: Gather listed lldp interfaces from running configuration
vyos.vyos.vyos_lldp_interfaces:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "location": {
# "coordinate_based": {
# "altitude": 2200,
# "datum": "WGS84",
# "latitude": "33.524449N",
# "longitude": "222.267255W"
# }
# },
# "name": "eth2"
# },
# {
# "location": {
# "civic_based": {
# "ca_info": [
# {
# "ca_type": 0,
# "ca_value": "ENGLISH"
# }
# ],
# "country_code": "US"
# }
# },
# "name": "eth1"
# }
# ]
#
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep lldp
# set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
# set service lldp interface eth1 location civic-based country-code 'US'
# set service lldp interface eth2 location coordinate-based altitude '2200'
# set service lldp interface eth2 location coordinate-based datum 'WGS84'
# set service lldp interface eth2 location coordinate-based latitude '33.524449N'
# set service lldp interface eth2 location coordinate-based longitude '222.267255W'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_lldp_interfaces:
config:
- name: eth1
location:
civic_based:
country_code: US
ca_info:
- ca_type: 0
ca_value: ENGLISH
- name: eth2
location:
coordinate_based:
altitude: 2200
datum: WGS84
longitude: 222.267255W
latitude: 33.524449N
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set service lldp interface eth1 location civic-based country-code 'US'",
# "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'",
# "set service lldp interface eth1",
# "set service lldp interface eth2 location coordinate-based latitude '33.524449N'",
# "set service lldp interface eth2 location coordinate-based altitude '2200'",
# "set service lldp interface eth2 location coordinate-based datum 'WGS84'",
# "set service lldp interface eth2 location coordinate-based longitude '222.267255W'",
# "set service lldp interface eth2"
# ]
# Using parsed
#
#
- name: Parsed the commands to provide structured configuration.
vyos.vyos.vyos_lldp_interfaces:
running_config:
"set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
set service lldp interface eth1 location civic-based country-code 'US'
set service lldp interface eth2 location coordinate-based altitude '2200'
set service lldp interface eth2 location coordinate-based datum 'WGS84'
set service lldp interface eth2 location coordinate-based latitude '33.524449N'
set service lldp interface eth2 location coordinate-based longitude '222.267255W'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "location": {
# "coordinate_based": {
# "altitude": 2200,
# "datum": "WGS84",
# "latitude": "33.524449N",
# "longitude": "222.267255W"
# }
# },
# "name": "eth2"
# },
# {
# "location": {
# "civic_based": {
# "ca_info": [
# {
# "ca_type": 0,
# "ca_value": "ENGLISH"
# }
# ],
# "country_code": "US"
# }
# },
# "name": "eth1"
# }
# ]
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ["set service lldp interface eth2 'disable'", 'delete service lldp interface eth1 location'] |
### Authors
* Rohit Thakur (@rohitthakur2590)
ansible vyos.vyos.vyos_static_routes – Static routes resource module vyos.vyos.vyos\_static\_routes – Static routes resource module
==============================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_static_routes`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages attributes of static routes on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A provided static route configuration. |
| | **address\_families** list / elements=dictionary | | A dictionary specifying the address family to which the static route(s) belong. |
| | | **afi** string / required | **Choices:*** ipv4
* ipv6
| Specifies the type of route. |
| | | **routes** list / elements=dictionary | | A dictionary that specify the static route configurations. |
| | | | **blackhole\_config** dictionary | | Configured to silently discard packets. |
| | | | | **distance** integer | | Distance for the route. |
| | | | | **type** string | | This is to configure only blackhole. |
| | | | **dest** string / required | | An IPv4/v6 address in CIDR notation that specifies the destination network for the static route. |
| | | | **next\_hops** list / elements=dictionary | | Next hops to the specified destination. |
| | | | | **admin\_distance** integer | | Distance value for the route. |
| | | | | **enabled** boolean | **Choices:*** no
* yes
| Disable IPv4/v6 next-hop static route. |
| | | | | **forward\_router\_address** string / required | | The IP address of the next hop that can be used to reach the destination network. |
| | | | | **interface** string | | Name of the outgoing interface. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep static route**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* overridden
* deleted
* gathered
* rendered
* parsed
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep static
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 192.0.2.32/28
blackhole_config:
type: blackhole
next_hops:
- forward_router_address: 192.0.2.6
- forward_router_address: 192.0.2.7
- address_families:
- afi: ipv6
routes:
- dest: 2001:db8:1000::/36
blackhole_config:
distance: 2
next_hops:
- forward_router_address: 2001:db8:2000:2::1
- forward_router_address: 2001:db8:2000:2::2
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": []
#
# "commands": [
# "set protocols static route 192.0.2.32/28",
# "set protocols static route 192.0.2.32/28 blackhole",
# "set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'",
# "set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'",
# "set protocols static route6 2001:db8:1000::/36",
# "set protocols static route6 2001:db8:1000::/36 blackhole distance '2'",
# "set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'",
# "set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'"
# ]
#
# "after": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "blackhole_config": {
# "type": "blackhole"
# },
# "dest": "192.0.2.32/28",
# "next_hops": [
# {
# "forward_router_address": "192.0.2.6"
# },
# {
# "forward_router_address": "192.0.2.7"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "2001:db8:1000::/36",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::1"
# },
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 192.0.2.32/28 'blackhole'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'
# set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
# Using replaced
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 192.0.2.32/28 'blackhole'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'
# set protocols static route 192.0.2.33/28 'blackhole'
# set protocols static route 192.0.2.33/28 next-hop '192.0.2.3'
# set protocols static route 192.0.2.33/28 next-hop '192.0.2.4'
# set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
#
- name: Replace device configurations of listed static routes with provided configurations
vyos.vyos.vyos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 192.0.2.32/28
blackhole_config:
distance: 2
next_hops:
- forward_router_address: 192.0.2.7
enabled: false
- forward_router_address: 192.0.2.9
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "blackhole_config": {
# "type": "blackhole"
# },
# "dest": "192.0.2.32/28",
# "next_hops": [
# {
# "forward_router_address": "192.0.2.6"
# },
# {
# "forward_router_address": "192.0.2.7"
# }
# ]
# },
# {
# "blackhole_config": {
# "type": "blackhole"
# },
# "dest": "192.0.2.33/28",
# "next_hops": [
# {
# "forward_router_address": "192.0.2.3"
# },
# {
# "forward_router_address": "192.0.2.4"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "2001:db8:1000::/36",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::1"
# },
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
#
# "commands": [
# "delete protocols static route 192.0.2.32/28 next-hop '192.0.2.6'",
# "delete protocols static route 192.0.2.32/28 next-hop '192.0.2.7'",
# "set protocols static route 192.0.2.32/28 next-hop 192.0.2.7 'disable'",
# "set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'",
# "set protocols static route 192.0.2.32/28 next-hop '192.0.2.9'",
# "set protocols static route 192.0.2.32/28 blackhole distance '2'"
# ]
#
# "after": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "192.0.2.32/28",
# "next_hops": [
# {
# "enabled": false,
# "forward_router_address": "192.0.2.7"
# },
# {
# "forward_router_address": "192.0.2.9"
# }
# ]
# },
# {
# "blackhole_config": {
# "type": "blackhole"
# },
# "dest": "192.0.2.33/28",
# "next_hops": [
# {
# "forward_router_address": "192.0.2.3"
# },
# {
# "forward_router_address": "192.0.2.4"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "2001:db8:1000::/36",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::1"
# },
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 192.0.2.32/28 blackhole distance '2'
# set protocols static route 192.0.2.32/28 next-hop 192.0.2.7 'disable'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.9'
# set protocols static route 192.0.2.33/28 'blackhole'
# set protocols static route 192.0.2.33/28 next-hop '192.0.2.3'
# set protocols static route 192.0.2.33/28 next-hop '192.0.2.4'
# set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
# Using overridden
#
# Before state
# --------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 192.0.2.32/28 blackhole distance '2'
# set protocols static route 192.0.2.32/28 next-hop 192.0.2.7 'disable'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.9'
# set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
#
- name: Overrides all device configuration with provided configuration
vyos.vyos.vyos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 198.0.2.48/28
next_hops:
- forward_router_address: 192.0.2.18
state: overridden
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "192.0.2.32/28",
# "next_hops": [
# {
# "enabled": false,
# "forward_router_address": "192.0.2.7"
# },
# {
# "forward_router_address": "192.0.2.9"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "2001:db8:1000::/36",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::1"
# },
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
#
# "commands": [
# "delete protocols static route 192.0.2.32/28",
# "delete protocols static route6 2001:db8:1000::/36",
# "set protocols static route 198.0.2.48/28",
# "set protocols static route 198.0.2.48/28 next-hop '192.0.2.18'"
#
#
# "after": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "dest": "198.0.2.48/28",
# "next_hops": [
# {
# "forward_router_address": "192.0.2.18"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
#
#
# After state
# ------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 198.0.2.48/28 next-hop '192.0.2.18'
# Using deleted to delete static route based on afi
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 192.0.2.32/28 'blackhole'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'
# set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
#
- name: Delete static route based on afi.
vyos.vyos.vyos_static_routes:
config:
- address_families:
- afi: ipv4
- afi: ipv6
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "blackhole_config": {
# "type": "blackhole"
# },
# "dest": "192.0.2.32/28",
# "next_hops": [
# {
# "forward_router_address": "192.0.2.6"
# },
# {
# "forward_router_address": "192.0.2.7"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "2001:db8:1000::/36",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::1"
# },
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
# "commands": [
# "delete protocols static route",
# "delete protocols static route6"
# ]
#
# "after": []
# After state
# ------------
# vyos@vyos# run show configuration commands | grep static
# set protocols 'static'
# Using deleted to delete all the static routes when passes config is empty
#
# Before state
# -------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 192.0.2.32/28 'blackhole'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'
# set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
#
- name: Delete all the static routes.
vyos.vyos.vyos_static_routes:
config:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "blackhole_config": {
# "type": "blackhole"
# },
# "dest": "192.0.2.32/28",
# "next_hops": [
# {
# "forward_router_address": "192.0.2.6"
# },
# {
# "forward_router_address": "192.0.2.7"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "2001:db8:1000::/36",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::1"
# },
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
# "commands": [
# "delete protocols static route",
# "delete protocols static route6"
# ]
#
# "after": []
# After state
# ------------
# vyos@vyos# run show configuration commands | grep static
# set protocols 'static'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 192.0.2.32/28
blackhole_config:
type: blackhole
next_hops:
- forward_router_address: 192.0.2.6
- forward_router_address: 192.0.2.7
- address_families:
- afi: ipv6
routes:
- dest: 2001:db8:1000::/36
blackhole_config:
distance: 2
next_hops:
- forward_router_address: 2001:db8:2000:2::1
- forward_router_address: 2001:db8:2000:2::2
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set protocols static route 192.0.2.32/28",
# "set protocols static route 192.0.2.32/28 blackhole",
# "set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'",
# "set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'",
# "set protocols static route6 2001:db8:1000::/36",
# "set protocols static route6 2001:db8:1000::/36 blackhole distance '2'",
# "set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'",
# "set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'"
# ]
# Using parsed
#
#
- name: Parse the provided running configuration
vyos.vyos.vyos_static_routes:
running_config:
"set protocols static route 192.0.2.32/28 'blackhole'
set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'
set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'
set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "192.0.2.32/28",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "2001:db8:1000::/36",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
# Using gathered
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 192.0.2.32/28 'blackhole'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'
# set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
#
- name: Gather listed static routes with provided configurations
vyos.vyos.vyos_static_routes:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "address_families": [
# {
# "afi": "ipv4",
# "routes": [
# {
# "blackhole_config": {
# "type": "blackhole"
# },
# "dest": "192.0.2.32/28",
# "next_hops": [
# {
# "forward_router_address": "192.0.2.6"
# },
# {
# "forward_router_address": "192.0.2.7"
# }
# ]
# }
# ]
# },
# {
# "afi": "ipv6",
# "routes": [
# {
# "blackhole_config": {
# "distance": 2
# },
# "dest": "2001:db8:1000::/36",
# "next_hops": [
# {
# "forward_router_address": "2001:db8:2000:2::1"
# },
# {
# "forward_router_address": "2001:db8:2000:2::2"
# }
# ]
# }
# ]
# }
# ]
# }
# ]
#
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands| grep static
# set protocols static route 192.0.2.32/28 'blackhole'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'
# set protocols static route 192.0.2.32/28 next-hop '192.0.2.7'
# set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
# set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ["set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'", "set protocols static route 192.0.2.32/28 'blackhole'"] |
### Authors
* Rohit Thakur (@rohitthakur2590)
| programming_docs |
ansible vyos.vyos.vyos_lldp_global – LLDP global resource module vyos.vyos.vyos\_lldp\_global – LLDP global resource module
==========================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_lldp_global`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages link layer discovery protocol (LLDP) attributes on VyOS devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | The provided link layer discovery protocol (LLDP) configuration. |
| | **address** string | | This argument defines management-address. |
| | **enable** boolean | **Choices:*** no
* yes
| This argument is a boolean value to enable or disable LLDP. |
| | **legacy\_protocols** list / elements=string | **Choices:*** cdp
* edp
* fdp
* sonmp
| List of the supported legacy protocols. |
| | **snmp** string | | This argument enable the SNMP queries to LLDP database. |
| **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the VyOS device by executing the command **show configuration commands | grep lldp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. |
| **state** string | **Choices:*** **merged** ←
* replaced
* deleted
* gathered
* rendered
* parsed
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands|grep lldp
#
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_lldp_global:
config:
legacy_protocols:
- fdp
- cdp
snmp: enable
address: 192.0.2.11
state: merged
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": []
#
# "commands": [
# "set service lldp legacy-protocols fdp",
# "set service lldp legacy-protocols cdp",
# "set service lldp snmp enable",
# "set service lldp management-address '192.0.2.11'"
# ]
#
# "after": [
# {
# "snmp": "enable"
# },
# {
# "address": "192.0.2.11"
# },
# {
# "legacy_protocols": [
# "cdp",
# "fdp"
# ]
# }
# {
# "enable": true
# }
# ]
#
# After state:
# -------------
#
# set service lldp legacy-protocols cdp
# set service lldp legacy-protocols fdp
# set service lldp management-address '192.0.2.11'
# set service lldp snmp enable
# Using replaced
#
# Before state:
# -------------
#
# vyos@vyos:~$ show configuration commands | grep lldp
# set service lldp legacy-protocols cdp
# set service lldp legacy-protocols fdp
# set service lldp management-address '192.0.2.11'
# set service lldp snmp enable
#
- name: Replace device configurations with provided configurations
vyos.vyos.vyos_lldp_global:
config:
legacy_protocols:
- edp
- sonmp
- cdp
address: 192.0.2.14
state: replaced
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
#
# "before": [
# {
# "snmp": "enable"
# },
# {
# "address": "192.0.2.11"
# },
# {
# "legacy_protocols": [
# "cdp",
# "fdp"
# ]
# }
# {
# "enable": true
# }
# ]
# "commands": [
# "delete service lldp snmp",
# "delete service lldp legacy-protocols fdp",
# "set service lldp management-address '192.0.2.14'",
# "set service lldp legacy-protocols edp",
# "set service lldp legacy-protocols sonmp"
# ]
#
# "after": [
# {
# "address": "192.0.2.14"
# },
# {
# "legacy_protocols": [
# "cdp",
# "edp",
# "sonmp"
# ]
# }
# {
# "enable": true
# }
# ]
#
# After state:
# -------------
#
# vyos@vyos:~$ show configuration commands|grep lldp
# set service lldp legacy-protocols cdp
# set service lldp legacy-protocols edp
# set service lldp legacy-protocols sonmp
# set service lldp management-address '192.0.2.14'
# Using deleted
#
# Before state
# -------------
# vyos@vyos:~$ show configuration commands|grep lldp
# set service lldp legacy-protocols cdp
# set service lldp legacy-protocols edp
# set service lldp legacy-protocols sonmp
# set service lldp management-address '192.0.2.14'
#
- name: Delete attributes of given lldp service (This won't delete the LLDP service
itself)
vyos.vyos.vyos_lldp_global:
config:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": [
# {
# "address": "192.0.2.14"
# },
# {
# "legacy_protocols": [
# "cdp",
# "edp",
# "sonmp"
# ]
# }
# {
# "enable": true
# }
# ]
#
# "commands": [
# "delete service lldp management-address",
# "delete service lldp legacy-protocols"
# ]
#
# "after": [
# {
# "enable": true
# }
# ]
#
# After state
# ------------
# vyos@vyos:~$ show configuration commands | grep lldp
# set service lldp
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep lldp
# set service lldp legacy-protocols 'cdp'
# set service lldp management-address '192.0.2.17'
#
- name: Gather lldp global config with provided configurations
vyos.vyos.vyos_lldp_global:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "config_trap": true,
# "group": {
# "address_group": [
# {
# "description": "Sales office hosts address list",
# "members": [
# {
# "address": "192.0.3.1"
# },
# {
# "address": "192.0.3.2"
# }
# ],
# "name": "ENG-HOSTS"
# },
# {
# "description": "Sales office hosts address list",
# "members": [
# {
# "address": "192.0.2.1"
# },
# {
# "address": "192.0.2.2"
# },
# {
# "address": "192.0.2.3"
# }
# ],
# "name": "SALES-HOSTS"
# }
# ],
# "network_group": [
# {
# "description": "This group has the Management network addresses",
# "members": [
# {
# "address": "192.0.1.0/24"
# }
# ],
# "name": "MGMT"
# }
# ]
# },
# "log_martians": true,
# "ping": {
# "all": true,
# "broadcast": true
# },
# "route_redirects": [
# {
# "afi": "ipv4",
# "icmp_redirects": {
# "receive": false,
# "send": true
# },
# "ip_src_route": true
# }
# ],
# "state_policy": [
# {
# "action": "accept",
# "connection_type": "established",
# "log": true
# },
# {
# "action": "reject",
# "connection_type": "invalid"
# }
# ],
# "syn_cookies": true,
# "twa_hazards_protection": true,
# "validation": "strict"
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep lldp
# set service lldp legacy-protocols 'cdp'
# set service lldp management-address '192.0.2.17'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_lldp_global:
config:
address: 192.0.2.17
enable: true
legacy_protocols:
- cdp
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "set service lldp legacy-protocols 'cdp'",
# "set service lldp",
# "set service lldp management-address '192.0.2.17'"
# ]
#
# Using parsed
#
#
- name: Parse the provided commands to provide structured configuration
vyos.vyos.vyos_lldp_global:
running_config:
"set service lldp legacy-protocols 'cdp'
set service lldp legacy-protocols 'fdp'
set service lldp management-address '192.0.2.11'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": {
# "address": "192.0.2.11",
# "enable": true,
# "legacy_protocols": [
# "cdp",
# "fdp"
# ]
# }
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['set service lldp legacy-protocols sonmp', "set service lldp management-address '192.0.2.14'"] |
### Authors
* Rohit Thakur (@rohitthakur2590)
ansible vyos.vyos.vyos_facts – Get facts about vyos devices. vyos.vyos.vyos\_facts – Get facts about vyos devices.
=====================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_facts`.
New in version 1.0.0: of vyos.vyos
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Collects facts from network devices running the vyos operating system. This module places the facts gathered in the fact tree keyed by the respective resource name. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **available\_network\_resources** boolean | **Choices:*** **no** ←
* yes
| When 'True' a list of network resources for which resource modules are available will be provided. |
| **gather\_network\_resources** list / elements=string | | When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all and the resources like interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial `M(!`) to specify that a specific subset should not be collected. Valid subsets are 'all', 'interfaces', 'l3\_interfaces', 'lag\_interfaces', 'lldp\_global', 'lldp\_interfaces', 'static\_routes', 'firewall\_rules', 'firewall\_global', 'firewall\_interfaces', 'ospfv3', 'ospfv2'. |
| **gather\_subset** list / elements=string | **Default:**"!config" | When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, default, config, and neighbors. Can specify a list of values to include a larger subset. Values can also be used with an initial `M(!`) to specify that a specific subset should not be collected. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
Notes
-----
Note
* Tested against VyOS 1.1.8 (helium).
* This module works with connection `network_cli`. See [the VyOS OS Platform Options](../network/user_guide/platform_vyos).
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
# Gather all facts
- vyos.vyos.vyos_facts:
gather_subset: all
gather_network_resources: all
# collect only the config and default facts
- vyos.vyos.vyos_facts:
gather_subset: config
# collect everything exception the config
- vyos.vyos.vyos_facts:
gather_subset: '!config'
# Collect only the interfaces facts
- vyos.vyos.vyos_facts:
gather_subset:
- '!all'
- '!min'
gather_network_resources:
- interfaces
# Do not collect interfaces facts
- vyos.vyos.vyos_facts:
gather_network_resources:
- '!interfaces'
# Collect interfaces and minimal default facts
- vyos.vyos.vyos_facts:
gather_subset: min
gather_network_resources: interfaces
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **ansible\_net\_api** string | always | The name of the transport |
| **ansible\_net\_commits** list / elements=string | when present | The set of available configuration revisions |
| **ansible\_net\_config** string | when config is configured | The running-config from the device |
| **ansible\_net\_gather\_network\_resources** list / elements=string | always | The list of fact resource subsets collected from the device |
| **ansible\_net\_gather\_subset** list / elements=string | always | The list of subsets gathered by the module |
| **ansible\_net\_hostname** string | always | The configured system hostname |
| **ansible\_net\_model** string | always | The device model string |
| **ansible\_net\_neighbors** list / elements=string | when interface is configured | The set of LLDP neighbors |
| **ansible\_net\_python\_version** string | always | The Python version Ansible controller is using |
| **ansible\_net\_serialnum** string | always | The serial number of the device |
| **ansible\_net\_version** string | always | The version of the software running |
### Authors
* Nathaniel Case (@qalthos)
* Nilashish Chakraborty (@Nilashishc)
* Rohit Thakur (@rohitthakur2590)
ansible vyos.vyos.vyos_interface – (deprecated, removed after 2022-06-01) Manage Interface on VyOS network devices vyos.vyos.vyos\_interface – (deprecated, removed after 2022-06-01) Manage Interface on VyOS network devices
===========================================================================================================
Note
This plugin is part of the [vyos.vyos collection](https://galaxy.ansible.com/vyos/vyos) (version 2.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install vyos.vyos`.
To use it in a playbook, specify: `vyos.vyos.vyos_interface`.
New in version 1.0.0: of vyos.vyos
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Updated modules released with more functionality.
Alternative
vyos\_interfaces
Synopsis
--------
* This module provides declarative management of Interfaces on VyOS network devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aggregate** list / elements=dictionary | | List of Interfaces definitions. |
| | **delay** integer | | Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are *state* with values `up`/`down` and *neighbors*. |
| | **description** string | | Description of Interface. |
| | **duplex** string | **Choices:*** full
* half
* auto
| Interface link status. |
| | **enabled** boolean | **Choices:*** no
* yes
| Interface link status. |
| | **mtu** integer | | Maximum size of transmit packet. |
| | **name** string / required | | Name of the Interface. |
| | **neighbors** list / elements=dictionary | | Check the operational state of given interface `name` for LLDP neighbor. The following suboptions are available. |
| | | **host** string | | LLDP neighbor host for given interface `name`. |
| | | **port** string | | LLDP neighbor port to which given interface `name` is connected. |
| | **speed** string | | Interface link speed. |
| | **state** string | **Choices:*** present
* absent
* up
* down
| State of the Interface configuration, `up` means present and operationally up and `down` means present and operationally `down`
|
| **delay** integer | **Default:**10 | Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are *state* with values `up`/`down` and *neighbors*. |
| **description** string | | Description of Interface. |
| **duplex** string | **Choices:*** full
* half
* auto
| Interface link status. |
| **enabled** boolean | **Choices:*** no
* **yes** ←
| Interface link status. |
| **mtu** integer | | Maximum size of transmit packet. |
| **name** string | | Name of the Interface. |
| **neighbors** list / elements=dictionary | | Check the operational state of given interface `name` for LLDP neighbor. The following suboptions are available. |
| | **host** string | | LLDP neighbor host for given interface `name`. |
| | **port** string | | LLDP neighbor port to which given interface `name` is connected. |
| **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli`. For more information please see the [Network Guide](../network/getting_started/network_differences#multiple-communication-protocols). A dict object containing connection details. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. |
| | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **speed** string | | Interface link speed. |
| **state** string | **Choices:*** **present** ←
* absent
* up
* down
| State of the Interface configuration, `up` means present and operationally up and `down` means present and operationally `down`
|
Notes
-----
Note
* Tested against VYOS 1.1.7
* For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide)
Examples
--------
```
- name: configure interface
vyos.vyos.vyos_interface:
name: eth0
description: test-interface
- name: remove interface
vyos.vyos.vyos_interface:
name: eth0
state: absent
- name: make interface down
vyos.vyos.vyos_interface:
name: eth0
enabled: false
- name: make interface up
vyos.vyos.vyos_interface:
name: eth0
enabled: true
- name: Configure interface speed, mtu, duplex
vyos.vyos.vyos_interface:
name: eth5
state: present
speed: 100
mtu: 256
duplex: full
- name: Set interface using aggregate
vyos.vyos.vyos_interface:
aggregate:
- {name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512}
- {name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256}
- name: Disable interface on aggregate
net_interface:
aggregate:
- name: eth1
- name: eth2
enabled: false
- name: Delete interface using aggregate
net_interface:
aggregate:
- name: eth1
- name: eth2
state: absent
- name: Check lldp neighbors intent arguments
vyos.vyos.vyos_interface:
name: eth0
neighbors:
- port: eth0
host: netdev
- name: Config + intent
vyos.vyos.vyos_interface:
name: eth1
enabled: false
state: down
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always, except for the platforms that use Netconf transport to manage the device. | The list of configuration mode commands to send to the device **Sample:** ['set interfaces ethernet eth0 description "test-interface"', 'set interfaces ethernet eth0 speed 100', 'set interfaces ethernet eth0 mtu 256', 'set interfaces ethernet eth0 duplex full'] |
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Ganesh Nalawade (@ganeshrn)
| programming_docs |
ansible Collections in the Theforeman Namespace Collections in the Theforeman Namespace
=======================================
These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **theforeman** namespace.
* [theforeman.foreman](foreman/index#plugins-in-theforeman-foreman)
ansible theforeman.foreman.setting_info – Fetch information about Settings theforeman.foreman.setting\_info – Fetch information about Settings
===================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.setting_info`.
New in version 2.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Settings
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **location** string | | Label of the Location to scope the search for. |
| **name** string | | Name of the resource to fetch information for. Mutually exclusive with *search*. |
| **organization** string | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **search** string | | Search query to use If None, and *name* is not set, all resources are returned. Mutually exclusive with *name*. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Show a setting"
theforeman.foreman.setting_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "http_proxy"
- name: "Show all settings with proxy"
theforeman.foreman.setting_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
search: "name = proxy"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **setting** dictionary | success and *name* was passed | Details about the found setting |
| **settings** list / elements=dictionary | success and *search* was passed | List of all found settings and their details |
### Authors
* Eric Helms (@ehelms)
ansible theforeman.foreman.image – Manage Images theforeman.foreman.image – Manage Images
========================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.image`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Images
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **architecture** string / required | | architecture of the image |
| **compute\_resource** string / required | | Compute resource the image is assigned to |
| **image\_password** string | | Password that is used to login into the operating system |
| **image\_username** string / required | | Username that is used to login into the operating system |
| **name** string / required | | Image name |
| **operatingsystem** string / required | | Operating systems are looked up by their title which is composed as "<name> <major>.<minor>". You can omit the version part as long as you only have one operating system by that name. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **user\_data** boolean | **Choices:*** no
* yes
| Image supports user\_data |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **uuid** string / required | | UUID or Marketplace URN of the operatingsystem image
aliases: image\_uuid |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: create Image for EC2
image:
name: CentOS
image_uuid: "ami-0ff760d16d9497662"
image_username: "centos"
operatingsystem: "CentOS 7"
compute_resource: "AWS"
architecture: "x86_64"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **images** list / elements=dictionary | success | List of images. |
### Authors
* Mark Hlawatschek (@hlawatschek) ATIX AG
ansible theforeman.foreman.operatingsystem – Manage Operating Systems theforeman.foreman.operatingsystem – Manage Operating Systems
=============================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.operatingsystem`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Operating Systems
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **architectures** list / elements=string | | architectures, the operating system can be installed on |
| **description** string | | Description of the Operating System |
| **major** string | | major version of the Operating System |
| **media** list / elements=string | | list of installation media |
| **minor** string | | minor version of the Operating System |
| **name** string / required | | Name of the Operating System |
| **os\_family** string | **Choices:*** AIX
* Altlinux
* Archlinux
* Coreos
* Debian
* Freebsd
* Gentoo
* Junos
* NXOS
* Rancheros
* Redhat
* Solaris
* Suse
* Windows
* Xenserver
| Distribution family of the Operating System
aliases: family |
| **parameters** list / elements=dictionary | | Operating System specific host parameters |
| | **name** string / required | | Name of the parameter |
| | **parameter\_type** string | **Choices:*** **string** ←
* boolean
* integer
* real
* array
* hash
* yaml
* json
| Type of the parameter |
| | **value** raw / required | | Value of the parameter |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **password\_hash** string | **Choices:*** MD5
* SHA256
* SHA512
* Base64
* Base64-Windows
| hashing algorithm for passwd |
| **provisioning\_templates** list / elements=string | | List of provisioning templates that are associated with the operating system. Specify the full list of template names you want to associate with your OS. For example ["Kickstart default", "Kickstart default finish", "Kickstart default iPXE", "custom"]. After specifying the template associations, you can set the default association in the [theforeman.foreman.os\_default\_template](os_default_template_module) module. |
| **ptables** list / elements=string | | list of partitioning tables |
| **release\_name** string | | Release name of the operating system (recommended for debian) |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **updated\_name** string | | New operating system name. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create an Operating System"
theforeman.foreman.operatingsystem:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: Debian
release_name: stretch
family: Debian
major: 9
parameters:
- name: additional-packages
value: python vim
state: present
- name: "Ensure existence of an Operating System (provide default values)"
theforeman.foreman.operatingsystem:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: Centos
family: Redhat
major: 7
password_hash: SHA256
state: present_with_defaults
- name: "Delete an Operating System"
theforeman.foreman.operatingsystem:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: Debian
family: Debian
major: 9
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **operatinsystems** list / elements=dictionary | success | List of operatinsystems. |
### Authors
* Matthias M Dellweg (@mdellweg) ATIX AG
* Bernhard Hopfenmüller (@Fobhep) ATIX AG
ansible theforeman.foreman.global_parameter – Manage Global Parameters theforeman.foreman.global\_parameter – Manage Global Parameters
===============================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.global_parameter`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Global Parameter Entities
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **hidden\_value** boolean | **Choices:*** no
* yes
| Whether the value should be hidden in the GUI |
| **name** string / required | | Name of the Global Parameter |
| **parameter\_type** string | **Choices:*** **string** ←
* boolean
* integer
* real
* array
* hash
* yaml
* json
| Type of value |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **updated\_name** string | | New name of the Global Parameter. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **value** raw | | Value of the Global Parameter |
Notes
-----
Note
* The *parameter\_type* only has an effect on Foreman >= 1.22
Examples
--------
```
- name: "Create a Global Parameter"
theforeman.foreman.global_parameter:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "TheAnswer"
value: "42"
state: present_with_defaults
- name: "Update a Global Parameter"
theforeman.foreman.global_parameter:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "TheAnswer"
value: "43"
state: present
- name: "Delete a Global Parameter"
theforeman.foreman.global_parameter:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "TheAnswer"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **global\_parameters** list / elements=dictionary | success | List of global parameters. |
### Authors
* Bernhard Hopfenmueller (@Fobhep) ATIX AG
* Matthias Dellweg (@mdellweg) ATIX AG
* Manisha Singhal (@manisha15) ATIX AG
ansible theforeman.foreman.puppetclasses_import – Import Puppet Classes from a Proxy theforeman.foreman.puppetclasses\_import – Import Puppet Classes from a Proxy
=============================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.puppetclasses_import`.
New in version 2.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Import Puppet Classes from a Proxy
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **environment** string | | Puppet Environment to import Puppet Classes from |
| **except** list / elements=string | **Choices:*** new
* updated
* obsolete
| Which types of Puppet Classes to exclude from the import. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **smart\_proxy** string / required | | Smart Proxy to import Puppet Classes from |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: Import Puppet Classes
theforeman.foreman.puppetclasses_import:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
smart_proxy: "foreman.example.com"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** dictionary | success | Details about the Puppet Class import |
| | **environments\_ignored** integer | when *environment* not specificed | Number of ignored Puppet Environments |
| | **environments\_obsolete** integer | when *environment* not specificed | Number of Puppet Environments with removed Puppet Classes |
| | **environments\_updated\_puppetclasses** integer | when *environment* not specificed | Number of Puppet Environments with updated Puppet Classes |
| | **environments\_with\_new\_puppetclasses** integer | when *environment* not specificed | Number of Puppet Environments with new Puppet Classes |
| | **results** list / elements=string | success | List of Puppet Environments and the changes made to them |
### Authors
* Evgeni Golov (@evgeni)
| programming_docs |
ansible theforeman.foreman.foreman – Foreman inventory source theforeman.foreman.foreman – Foreman inventory source
=====================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.foreman`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Get inventory hosts from Foreman.
* Uses a YAML configuration file that ends with `foreman.(yml|yaml)`.
Requirements
------------
The below requirements are needed on the local controller node that executes this inventory.
* requests >= 1.1
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **batch\_size** integer | **Default:**250 | | Number of hosts per batch that will be retrieved from the Foreman API per individual call |
| **cache** boolean | **Choices:*** **no** ←
* yes
| ini entries: [inventory]cache = no env:ANSIBLE\_INVENTORY\_CACHE | Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work. |
| **cache\_connection** string | | ini entries: [defaults]fact\_caching\_connection = None [inventory]cache\_connection = None env:ANSIBLE\_CACHE\_PLUGIN\_CONNECTION env:ANSIBLE\_INVENTORY\_CACHE\_CONNECTION | Cache connection data or path, read cache plugin documentation for specifics. |
| **cache\_plugin** string | **Default:**"memory" | ini entries: [defaults]fact\_caching = memory [inventory]cache\_plugin = memory env:ANSIBLE\_CACHE\_PLUGIN env:ANSIBLE\_INVENTORY\_CACHE\_PLUGIN | Cache plugin to use for the inventory's source data. |
| **cache\_prefix** string | **Default:**"ansible\_inventory\_" | ini entries: [default]fact\_caching\_prefix = ansible\_inventory\_ [inventory]cache\_prefix = ansible\_inventory\_ env:ANSIBLE\_CACHE\_PLUGIN\_PREFIX env:ANSIBLE\_INVENTORY\_CACHE\_PLUGIN\_PREFIX | Prefix to use for cache plugin files/tables |
| **cache\_timeout** integer | **Default:**3600 | ini entries: [defaults]fact\_caching\_timeout = 3600 [inventory]cache\_timeout = 3600 env:ANSIBLE\_CACHE\_PLUGIN\_TIMEOUT env:ANSIBLE\_INVENTORY\_CACHE\_TIMEOUT | Cache duration in seconds |
| **compose** dictionary | **Default:**{} | | Create vars from jinja2 expressions. |
| **foreman** string | | | Foreman server related configuration, deprecated. You can pass *use\_reports\_api* in this dict to enable the Reporting API. Only for backward compatibility. |
| **group\_prefix** string | **Default:**"foreman\_" | | prefix to apply to foreman groups |
| **groups** dictionary | **Default:**{} | | Add hosts to group based on Jinja2 conditionals. |
| **host\_filters** string | | | This can be used to restrict the list of returned host |
| **hostnames** list / elements=string | **Default:**["name"] | | A list of templates in order of precedence to compose inventory\_hostname. If the template results in an empty string or None value it is ignored. |
| **keyed\_groups** list / elements=string | **Default:**[] | | Add hosts to group based on the values of a variable. |
| **leading\_separator** boolean added in 2.11 of ansible.builtin | **Choices:*** no
* **yes** ←
| | Use in conjunction with keyed\_groups. By default, a keyed group that does not have a prefix or a separator provided will have a name that starts with an underscore. This is because the default prefix is "" and the default separator is "\_". Set this option to False to omit the leading underscore (or other separator) if no prefix is given. If the group name is derived from a mapping the separator is still used to concatenate the items. To not use a separator in the group name at all, set the separator for the keyed group to an empty string instead. |
| **legacy\_hostvars** boolean | **Choices:*** **no** ←
* yes
| | Toggle, if true the plugin will build legacy hostvars present in the foreman script Places hostvars in a dictionary with keys `foreman`, `foreman\_facts`, and `foreman\_params` |
| **max\_timeout** integer | **Default:**600 | | Timeout before falling back to old host API when using report\_data endpoint while polling. |
| **password** string / required | | env:FOREMAN\_PASSWORD | Password of the user accessing the Foreman server. |
| **plugin** string / required | **Choices:*** theforeman.foreman.foreman
| | token that ensures this is a source file for the `foreman` plugin. |
| **poll\_interval** integer | **Default:**10 | | The polling interval between 2 calls to the report\_data endpoint while polling. |
| **report** dictionary | | | Report API specific configuration, deprecated. You can pass the Report API specific params as part of this dict, instead of the main configuration. Only for backward compatibility. |
| **strict** boolean | **Choices:*** **no** ←
* yes
| | If `yes` make invalid entries a fatal error, otherwise skip and continue. Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default. |
| **url** string | **Default:**"http://localhost:3000" | env:FOREMAN\_SERVER env:FOREMAN\_SERVER\_URL env:FOREMAN\_URL | URL of the Foreman server. |
| **use\_extra\_vars** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [inventory\_plugins]use\_extra\_vars = no env:ANSIBLE\_INVENTORY\_USE\_EXTRA\_VARS | Merge extra vars into the available variables for composition (highest precedence). |
| **use\_reports\_api** boolean | **Choices:*** **no** ←
* yes
| | Use Reporting API. |
| **user** string / required | | env:FOREMAN\_USER env:FOREMAN\_USERNAME | Username accessing the Foreman server. |
| **validate\_certs** boolean | **Choices:*** **no** ←
* yes
| env:FOREMAN\_VALIDATE\_CERTS | Whether or not to verify the TLS certificates of the Foreman server. |
| **vars\_prefix** string | **Default:**"foreman\_" | | prefix to apply to host variables, does not include facts nor params |
| **want\_content\_facet\_attributes** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch content view details that the host is tied to. |
| **want\_facts** boolean | **Choices:*** **no** ←
* yes
| | Toggle, if True the plugin will retrieve host facts from the server |
| **want\_host\_group** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch host\_groups and create groupings for the same. |
| **want\_hostcollections** boolean | **Choices:*** **no** ←
* yes
| | Toggle, if true the plugin will create Ansible groups for host collections |
| **want\_ipv4** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch ipv4 address of the host. |
| **want\_ipv6** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch ipv6 address of the host. |
| **want\_location** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch location the host belongs to and create groupings for the same. |
| **want\_organization** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch organization the host belongs to and create groupings for the same. |
| **want\_params** boolean | **Choices:*** **no** ←
* yes
| | Toggle, if true the inventory will retrieve 'all\_parameters' information as host vars |
| **want\_smart\_proxies** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch smart proxy that the host is registered to. |
| **want\_subnet** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch subnet. |
| **want\_subnet\_v6** boolean | **Choices:*** no
* **yes** ←
| | Toggle, if true the inventory will fetch ipv6 subnet. |
Examples
--------
```
# my.foreman.yml
plugin: theforeman.foreman.foreman
url: https://foreman.example.com
user: ansibleinventory
password: changeme
host_filters: 'organization="Web Engineering"'
# shortname.foreman.yml
plugin: theforeman.foreman.foreman
url: https://foreman.example.com
user: ansibleinventory
password: changeme
hostnames:
- name.split('.')[0]
```
ansible theforeman.foreman.architecture – Manage Architectures theforeman.foreman.architecture – Manage Architectures
======================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.architecture`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Architectures
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name of architecture |
| **operatingsystems** list / elements=string | | List of operating systems the entity should be assigned to. Operating systems are looked up by their title which is composed as "<name> <major>.<minor>". You can omit the version part as long as you only have one operating system by that name. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **updated\_name** string | | New architecture name. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create an Architecture"
theforeman.foreman.architecture:
name: "i386"
operatingsystems:
- "TestOS1"
- "TestOS2"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: "Update an Architecture"
theforeman.foreman.architecture:
name: "i386"
operatingsystems:
- "TestOS3"
- "TestOS4"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: "Delete an Architecture"
theforeman.foreman.architecture:
name: "i386"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **architectures** list / elements=dictionary | success | List of architectures. |
| | | **id** integer | success | Database id of the architecture. |
| | | **name** string | success | Name of the architecture. |
| | | **operatinsystem\_ids** list / elements=integer | success | Database ids of associated operatingsystems. |
### Authors
* Manisha Singhal (@Manisha15) ATIX AG
ansible theforeman.foreman.content_upload – Upload content to a repository theforeman.foreman.content\_upload – Upload content to a repository
===================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.content_upload`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Allows the upload of content to a repository
Requirements
------------
The below requirements are needed on the host that executes this module.
* python-debian (For deb Package upload)
* requests
* rpm (For rpm upload)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **product** string / required | | Product to which the repository lives in |
| **repository** string / required | | Repository to upload file in to |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **src** path / required | | File to upload
aliases: file |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Notes
-----
Note
* Currently only uploading to deb, RPM & file repositories is supported
* For anything but file repositories, a supporting library must be installed. See Requirements.
Examples
--------
```
- name: "Upload my.rpm"
theforeman.foreman.content_upload:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
src: "my.rpm"
repository: "Build RPMs"
product: "My Product"
organization: "Default Organization"
```
### Authors
* Eric D Helms (@ehelms)
ansible theforeman.foreman.compute_resource – Manage Compute Resources theforeman.foreman.compute\_resource – Manage Compute Resources
===============================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.compute_resource`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Compute Resources
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | compute resource description |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | compute resource name |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **provider** string | **Choices:*** vmware
* libvirt
* ovirt
* proxmox
* EC2
* AzureRm
* GCE
| Compute resource provider. Required if *state=present\_with\_defaults*. |
| **provider\_params** dictionary | | Parameter specific to compute resource provider. Required if *state=present\_with\_defaults*. |
| | **app\_ident** string | | AzureRM client id |
| | **caching\_enabled** boolean | **Choices:*** no
* yes
| enable caching for *provider=vmware*
|
| | **cloud** string added in 2.1.0 of theforeman.foreman | **Choices:*** azure
* azureusgovernment
* azurechina
* azuregermancloud
| cloud for *provider=AzureRm*
|
| | **datacenter** string | | Datacenter the compute resource is in, not valid for *provider=libvirt*
|
| | **display\_type** string | | Display type to use for the remote console, only valid for *provider=libvirt*
|
| | **email** string | | Email for *provider=GCE*
|
| | **key\_path** string | | Certificate path for *provider=GCE*
|
| | **keyboard\_layout** string added in 2.0.0 of theforeman.foreman | **Choices:*** ar
* da
* de
* de-ch
* en-gb
* en-us
* es
* et
* fi
* fo
* fr
* fr-be
* fr-ca
* fr-ch
* hr
* hu
* is
* it
* ja
* lt
* lv
* mk
* nl
* nl-be
* no
* pl
* pt
* pt-br
* ru
* sl
* sv
* th
* tr
| Default VNC Keyboard for *provider=ovirt*
|
| | **ovirt\_quota** string | | oVirt quota ID, only valid for *provider=ovirt*
|
| | **password** string | | Password for the compute resource connection, not valid for *provider=libvirt*
|
| | **project** string | | Project id for *provider=GCE*
|
| | **public\_key** string added in 2.0.0 of theforeman.foreman | | X509 Certification Authorities, only valid for *provider=ovirt*
|
| | **region** string | | AWS region, AZURE region |
| | **set\_console\_password** boolean added in 2.0.0 of theforeman.foreman | **Choices:*** no
* yes
| Set a randomly generated password on the display connection for *provider=vmware* and *provider=libvirt*
|
| | **ssl\_verify\_peer** boolean | **Choices:*** no
* yes
| verify ssl from provider *provider=proxmox*
|
| | **sub\_id** string added in 2.1.0 of theforeman.foreman | | Subscription ID for *provider=AzureRm*
|
| | **tenant** string | | AzureRM tenant |
| | **url** string | | URL of the compute resource |
| | **use\_v4** boolean | **Choices:*** no
* yes
| Use oVirt API v4, only valid for *provider=ovirt*
|
| | **user** string | | Username for the compute resource connection, not valid for *provider=libvirt*
|
| | **zone** string | | zone for *provider=GCE*
|
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **updated\_name** string | | new compute resource name |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: Create livirt compute resource
theforeman.foreman.compute_resource:
name: example_compute_resource
locations:
- Munich
organizations:
- ACME
provider: libvirt
provider_params:
url: libvirt.example.com
display_type: vnc
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Update libvirt compute resource
theforeman.foreman.compute_resource:
name: example_compute_resource
description: updated compute resource
locations:
- Munich
organizations:
- ACME
provider: libvirt
provider_params:
url: libvirt.example.com
display_type: vnc
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Delete libvirt compute resource
theforeman.foreman.compute_resource:
name: example_compute_resource
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: absent
- name: Create vmware compute resource
theforeman.foreman.compute_resource:
name: example_compute_resource
locations:
- Munich
organizations:
- ACME
provider: vmware
provider_params:
caching_enabled: false
url: vsphere.example.com
user: admin
password: secret
datacenter: ax01
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Create ovirt compute resource
theforeman.foreman.compute_resource:
name: ovirt_compute_resource
locations:
- France/Toulouse
organizations:
- Example Org
provider: ovirt
provider_params:
url: ovirt.example.com
user: [email protected]
password: ovirtsecret
datacenter: aa92fb54-0736-4066-8fa8-b8b9e3bd75ac
ovirt_quota: 24868ab9-c2a1-47c3-87e7-706f17d215ac
use_v4: true
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Create proxmox compute resource
theforeman.foreman.compute_resource:
name: proxmox_compute_resource
locations:
- Munich
organizations:
- ACME
provider: proxmox
provider_params:
url: https://proxmox.example.com:8006/api2/json
user: root@pam
password: secretpassword
ssl_verify_peer: true
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: create EC2 compute resource
theforeman.foreman.compute_resource:
name: EC2_compute_resource
description: EC2
locations:
- AWS
organizations:
- ACME
provider: EC2
provider_params:
user: AWS_ACCESS_KEY
password: AWS_SECRET_KEY
region: eu-west-1
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: create Azure compute resource
theforeman.foreman.compute_resource:
name: AzureRm_compute_resource
description: AzureRm
locations:
- Azure
organizations:
- ACME
provider: AzureRm
provider_params:
sub_id: SUBSCRIPTION_ID
tenant: TENANT_ID
app_ident: CLIENT_ID
password: CLIENT_SECRET
region: westeurope
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: create GCE compute resource
theforeman.foreman.compute_resource:
name: GCE compute resource
description: Google Cloud Engine
locations:
- GCE
organizations:
- ACME
provider: GCE
provider_params:
project: orcharhino
email: [email protected]
key_path: "/usr/share/foreman/gce_orcharhino_key.json"
zone: europe-west3-b
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **compute\_resources** list / elements=dictionary | success | List of compute resources. |
### Authors
* Philipp Joos (@philippj)
* Baptiste Agasse (@bagasse)
* Manisha Singhal (@Manisha15) ATIX AG
* Mark Hlawatschek (@hlawatschek) ATIX AG
| programming_docs |
ansible theforeman.foreman.redhat_manifest – Interact with a Red Hat Satellite Subscription Manifest theforeman.foreman.redhat\_manifest – Interact with a Red Hat Satellite Subscription Manifest
=============================================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.redhat_manifest`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Download and modify a Red Hat Satellite Subscription Manifest
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **content\_access\_mode** string | **Choices:*** org\_environment
* **entitlement** ←
| Content Access Mode of the Subscription Manifest. Setting *content\_access\_mode=org\_enviroment* enables Simple Content Access. |
| **name** string | | Manifest Name |
| **password** string / required | | Red Hat Portal password |
| **path** path | | path to export the manifest |
| **pool\_id** string | | Subscription pool\_id |
| **pool\_state** string | **Choices:*** **present** ←
* absent
| Subscription state |
| **portal** string | **Default:**"https://subscription.rhsm.redhat.com" | Red Hat Portal subscription access address |
| **quantity** integer | | quantity of pool\_id Subscriptions |
| **state** string | **Choices:*** **present** ←
* absent
| Manifest state |
| **username** string / required | | Red Hat Portal username |
| **uuid** string | | Manifest uuid |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Validate Portal SSL |
Examples
--------
```
- name: Create foreman.example.com Manifest and add 7 sub
theforeman.foreman.redhat_manifest:
name: "foreman.example.com"
username: "john-smith"
password: "changeme"
pool_id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
quantity: 7
- name: Ensure my manifest has 10 of one subs in it and export
theforeman.foreman.redhat_manifest:
uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
username: john-smith
password: changeme
pool_id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
quantity: 10
path: /root/manifest.zip
- name: Remove all of one subs from foreman.example.com
theforeman.foreman.redhat_manifest:
name: foreman.example.com
username: john-smith
password: changeme
pool_id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
pool_state: absent
```
### Authors
* Sean O’Keeffe (@sean797)
ansible Theforeman.Foreman Theforeman.Foreman
==================
Collection version 2.2.0
Plugin Index
------------
These are the plugins in the theforeman.foreman collection
### Callback Plugins
* [foreman](foreman_callback#ansible-collections-theforeman-foreman-foreman-callback) – Sends events to Foreman
### Inventory Plugins
* [foreman](foreman_inventory#ansible-collections-theforeman-foreman-foreman-inventory) – Foreman inventory source
### Modules
* [activation\_key](activation_key_module#ansible-collections-theforeman-foreman-activation-key-module) – Manage Activation Keys
* [architecture](architecture_module#ansible-collections-theforeman-foreman-architecture-module) – Manage Architectures
* [auth\_source\_ldap](auth_source_ldap_module#ansible-collections-theforeman-foreman-auth-source-ldap-module) – Manage LDAP Authentication Sources
* [bookmark](bookmark_module#ansible-collections-theforeman-foreman-bookmark-module) – Manage Bookmarks
* [compute\_attribute](compute_attribute_module#ansible-collections-theforeman-foreman-compute-attribute-module) – Manage Compute Attributes
* [compute\_profile](compute_profile_module#ansible-collections-theforeman-foreman-compute-profile-module) – Manage Compute Profiles
* [compute\_resource](compute_resource_module#ansible-collections-theforeman-foreman-compute-resource-module) – Manage Compute Resources
* [config\_group](config_group_module#ansible-collections-theforeman-foreman-config-group-module) – Manage (Puppet) Config Groups
* [content\_credential](content_credential_module#ansible-collections-theforeman-foreman-content-credential-module) – Manage Content Credentials
* [content\_upload](content_upload_module#ansible-collections-theforeman-foreman-content-upload-module) – Upload content to a repository
* [content\_view](content_view_module#ansible-collections-theforeman-foreman-content-view-module) – Manage Content Views
* [content\_view\_filter](content_view_filter_module#ansible-collections-theforeman-foreman-content-view-filter-module) – Manage Content View Filters
* [content\_view\_info](content_view_info_module#ansible-collections-theforeman-foreman-content-view-info-module) – Fetch information about Content Views
* [content\_view\_version](content_view_version_module#ansible-collections-theforeman-foreman-content-view-version-module) – Manage Content View Versions
* [content\_view\_version\_info](content_view_version_info_module#ansible-collections-theforeman-foreman-content-view-version-info-module) – Fetch information about Content Views
* [domain](domain_module#ansible-collections-theforeman-foreman-domain-module) – Manage Domains
* [domain\_info](domain_info_module#ansible-collections-theforeman-foreman-domain-info-module) – Fetch information about Domains
* [external\_usergroup](external_usergroup_module#ansible-collections-theforeman-foreman-external-usergroup-module) – Manage External User Groups
* [global\_parameter](global_parameter_module#ansible-collections-theforeman-foreman-global-parameter-module) – Manage Global Parameters
* [hardware\_model](hardware_model_module#ansible-collections-theforeman-foreman-hardware-model-module) – Manage Hardware Models
* [host](host_module#ansible-collections-theforeman-foreman-host-module) – Manage Hosts
* [host\_collection](host_collection_module#ansible-collections-theforeman-foreman-host-collection-module) – Manage Host Collections
* [host\_errata\_info](host_errata_info_module#ansible-collections-theforeman-foreman-host-errata-info-module) – Fetch information about Host Errata
* [host\_info](host_info_module#ansible-collections-theforeman-foreman-host-info-module) – Fetch information about Hosts
* [host\_power](host_power_module#ansible-collections-theforeman-foreman-host-power-module) – Manage Power State of Hosts
* [hostgroup](hostgroup_module#ansible-collections-theforeman-foreman-hostgroup-module) – Manage Hostgroups
* [http\_proxy](http_proxy_module#ansible-collections-theforeman-foreman-http-proxy-module) – Manage HTTP Proxies
* [image](image_module#ansible-collections-theforeman-foreman-image-module) – Manage Images
* [installation\_medium](installation_medium_module#ansible-collections-theforeman-foreman-installation-medium-module) – Manage Installation Media
* [job\_invocation](job_invocation_module#ansible-collections-theforeman-foreman-job-invocation-module) – Invoke Remote Execution Jobs
* [job\_template](job_template_module#ansible-collections-theforeman-foreman-job-template-module) – Manage Job Templates
* [lifecycle\_environment](lifecycle_environment_module#ansible-collections-theforeman-foreman-lifecycle-environment-module) – Manage Lifecycle Environments
* [location](location_module#ansible-collections-theforeman-foreman-location-module) – Manage Locations
* [operatingsystem](operatingsystem_module#ansible-collections-theforeman-foreman-operatingsystem-module) – Manage Operating Systems
* [organization](organization_module#ansible-collections-theforeman-foreman-organization-module) – Manage Organizations
* [os\_default\_template](os_default_template_module#ansible-collections-theforeman-foreman-os-default-template-module) – Manage Default Template Associations To Operating Systems
* [partition\_table](partition_table_module#ansible-collections-theforeman-foreman-partition-table-module) – Manage Partition Table Templates
* [product](product_module#ansible-collections-theforeman-foreman-product-module) – Manage Products
* [provisioning\_template](provisioning_template_module#ansible-collections-theforeman-foreman-provisioning-template-module) – Manage Provisioning Templates
* [puppet\_environment](puppet_environment_module#ansible-collections-theforeman-foreman-puppet-environment-module) – Manage Puppet Environments
* [puppetclasses\_import](puppetclasses_import_module#ansible-collections-theforeman-foreman-puppetclasses-import-module) – Import Puppet Classes from a Proxy
* [realm](realm_module#ansible-collections-theforeman-foreman-realm-module) – Manage Realms
* [redhat\_manifest](redhat_manifest_module#ansible-collections-theforeman-foreman-redhat-manifest-module) – Interact with a Red Hat Satellite Subscription Manifest
* [repository](repository_module#ansible-collections-theforeman-foreman-repository-module) – Manage Repositories
* [repository\_info](repository_info_module#ansible-collections-theforeman-foreman-repository-info-module) – Fetch information about Repositories
* [repository\_set](repository_set_module#ansible-collections-theforeman-foreman-repository-set-module) – Enable/disable Red Hat Repositories available through subscriptions
* [repository\_set\_info](repository_set_info_module#ansible-collections-theforeman-foreman-repository-set-info-module) – Fetch information about Red Hat Repositories
* [repository\_sync](repository_sync_module#ansible-collections-theforeman-foreman-repository-sync-module) – Sync a Repository or Product
* [resource\_info](resource_info_module#ansible-collections-theforeman-foreman-resource-info-module) – Gather information about resources
* [role](role_module#ansible-collections-theforeman-foreman-role-module) – Manage Roles
* [scap\_content](scap_content_module#ansible-collections-theforeman-foreman-scap-content-module) – Manage SCAP content
* [scap\_tailoring\_file](scap_tailoring_file_module#ansible-collections-theforeman-foreman-scap-tailoring-file-module) – Manage SCAP Tailoring Files
* [scc\_account](scc_account_module#ansible-collections-theforeman-foreman-scc-account-module) – Manage SUSE Customer Center Accounts
* [scc\_product](scc_product_module#ansible-collections-theforeman-foreman-scc-product-module) – Subscribe SUSE Customer Center Account Products
* [setting](setting_module#ansible-collections-theforeman-foreman-setting-module) – Manage Settings
* [setting\_info](setting_info_module#ansible-collections-theforeman-foreman-setting-info-module) – Fetch information about Settings
* [smart\_class\_parameter](smart_class_parameter_module#ansible-collections-theforeman-foreman-smart-class-parameter-module) – Manage Smart Class Parameters
* [smart\_proxy](smart_proxy_module#ansible-collections-theforeman-foreman-smart-proxy-module) – Manage Smart Proxies
* [snapshot](snapshot_module#ansible-collections-theforeman-foreman-snapshot-module) – Manage Snapshots
* [status\_info](status_info_module#ansible-collections-theforeman-foreman-status-info-module) – Get status info
* [subnet](subnet_module#ansible-collections-theforeman-foreman-subnet-module) – Manage Subnets
* [subnet\_info](subnet_info_module#ansible-collections-theforeman-foreman-subnet-info-module) – Fetch information about Subnets
* [subscription\_info](subscription_info_module#ansible-collections-theforeman-foreman-subscription-info-module) – Fetch information about Subscriptions
* [subscription\_manifest](subscription_manifest_module#ansible-collections-theforeman-foreman-subscription-manifest-module) – Manage Subscription Manifests
* [sync\_plan](sync_plan_module#ansible-collections-theforeman-foreman-sync-plan-module) – Manage Sync Plans
* [templates\_import](templates_import_module#ansible-collections-theforeman-foreman-templates-import-module) – Sync Templates from a repository
* [user](user_module#ansible-collections-theforeman-foreman-user-module) – Manage Users
* [usergroup](usergroup_module#ansible-collections-theforeman-foreman-usergroup-module) – Manage User Groups
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible theforeman.foreman.resource_info – Gather information about resources theforeman.foreman.resource\_info – Gather information about resources
======================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.resource_info`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about resources
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **full\_details** boolean | **Choices:*** **no** ←
* yes
| If `True` all details about the found resources are returned
aliases: info |
| **organization** string | | Scope the searched resource by organization |
| **params** dictionary | | Add parameters to the API call if necessary If not specified, no additional parameters are passed |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **resource** string / required | | Resource to search Set to an invalid choice like *foo* see all available options. |
| **search** string | | Search query to use If None, all resources are returned |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Notes
-----
Note
* Some resources don’t support scoping and will return errors when you pass *organization* or unknown data in *params*.
Examples
--------
```
- name: "Read a Setting"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: settings
search: name = foreman_url
register: result
- debug:
var: result.resources[0].value
- name: "Read all Registries"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: registries
register: result
- debug:
var: item.name
with_items: "{{ result.resources }}"
- name: "Read all Organizations with full details"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: organizations
full_details: true
register: result
- debug:
var: result.resources
- name: Get all existing subscriptions for organization with id 1
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: subscriptions
params:
organization_id: 1
register: result
- debug:
var: result
- name: Get all existing activation keys for organization ACME
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: activation_keys
organization: ACME
register: result
- debug:
var: result
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **resources** list / elements=string | always | Resource information |
### Authors
* Sean O’Keeffe (@sean797)
ansible theforeman.foreman.content_view_info – Fetch information about Content Views theforeman.foreman.content\_view\_info – Fetch information about Content Views
==============================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.content_view_info`.
New in version 2.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Content Views
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **location** string | | Label of the Location to scope the search for. |
| **name** string | | Name of the resource to fetch information for. Mutually exclusive with *search*. |
| **organization** string | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **search** string | | Search query to use If None, and *name* is not set, all resources are returned. Mutually exclusive with *name*. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Show a content_view"
theforeman.foreman.content_view_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "CentOS 8"
- name: "Show all content_views with name CentOS 8"
theforeman.foreman.content_view_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
search: 'name = "CentOS 8"'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **content\_view** dictionary | success and *name* was passed | Details about the found content\_view |
| **content\_views** list / elements=dictionary | success and *search* was passed | List of all found content\_views and their details |
### Authors
* Eric Helms (@ehelms)
| programming_docs |
ansible theforeman.foreman.provisioning_template – Manage Provisioning Templates theforeman.foreman.provisioning\_template – Manage Provisioning Templates
=========================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.provisioning_template`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Provisioning Templates
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **audit\_comment** string | | Content of the audit comment field |
| **file\_name** path | | The path of a template file, that shall be imported. Either this or *template* is required as a source for the Provisioning Template "content". |
| **kind** string | **Choices:*** Bootdisk
* cloud-init
* finish
* iPXE
* job\_template
* kexec
* POAP
* provision
* ptable
* PXEGrub
* PXEGrub2
* PXELinux
* registration
* script
* snippet
* user\_data
* ZTP
| The provisioning template kind |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **locked** boolean | **Choices:*** no
* yes
| Determines whether the template shall be locked |
| **name** string | | The name of the Provisioning Template. If omited, will be determined from the `name` header of the template or the filename (in that order). The special value "\*" can be used to perform bulk actions (modify, delete) on all existing templates. |
| **operatingsystems** list / elements=string | | List of operating systems the entity should be assigned to. Operating systems are looked up by their title which is composed as "<name> <major>.<minor>". You can omit the version part as long as you only have one operating system by that name. |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **template** string | | The content of the provisioning template. Either this or *file\_name* is required as a source for the Provisioning Template "content". |
| **updated\_name** string | | New provisioning template name. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
# Keep in mind, that in this case, the inline parameters will be overwritten
- name: "Create a Provisioning Template inline"
theforeman.foreman.provisioning_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: A New Finish Template
kind: finish
state: present
template: |
<%#
name: Finish timetravel
kind: finish
%>
cd /
rm -rf *
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Create a Provisioning Template from a file"
theforeman.foreman.provisioning_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: timeywimey_template.erb
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
# Due to the module logic, deleting requires a template dummy,
# either inline or from a file.
- name: "Delete a Provisioning Template"
theforeman.foreman.provisioning_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: timeywimey_template
template: |
<%#
dummy:
%>
state: absent
- name: "Create a Provisioning Template from a file and modify with parameter"
theforeman.foreman.provisioning_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: timeywimey_template.erb
name: Wibbly Wobbly Template
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
# Providing a name in this case wouldn't be very sensible.
# Alternatively make use of with_filetree to parse recursively with filter.
- name: "Parsing a directory of provisioning templates"
theforeman.foreman.provisioning_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: "{{ item }}"
state: present
locations:
- SKARO
organizations:
- DALEK INC
with_fileglob:
- "./arsenal_templates/*.erb"
# If the templates are stored locally and the ansible module is executed on a remote host
- name: Ensure latest version of all Provisioning Community Templates
theforeman.foreman.provisioning_template:
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
template: '{{ lookup("file", item.src) }}'
with_filetree: '/path/to/provisioning/templates'
when: item.state == 'file'
# with name set to "*" bulk actions can be performed
- name: "Delete *ALL* provisioning templates"
theforeman.foreman.provisioning_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: absent
- name: "Assign all provisioning templates to the same organization(s)"
theforeman.foreman.provisioning_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: present
organizations:
- DALEK INC
- sky.net
- Doc Brown's garage
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **provisioning\_templates** list / elements=dictionary | success | List of provisioning templates. |
### Authors
* Bernhard Hopfenmueller (@Fobhep) ATIX AG
* Matthias Dellweg (@mdellweg) ATIX AG
ansible theforeman.foreman.content_view_version_info – Fetch information about Content Views theforeman.foreman.content\_view\_version\_info – Fetch information about Content Views
=======================================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.content_view_version_info`.
New in version 2.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Content Views
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **content\_view** string / required | | Content View to which the Version belongs |
| **location** string | | Label of the Location to scope the search for. |
| **organization** string / required | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **search** string | | Search query to use If None, all resources are returned. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Show a content view version"
theforeman.foreman.content_view_version_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
content_view: "CentOS 8 View"
search: 'version = "4.0"'
- name: "Show all content view_versions for a content view"
theforeman.foreman.content_view_version_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
content_view: "CentOS 8 View"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **content\_view\_versions** list / elements=dictionary | success and *search* was passed | List of all found content\_view\_versions and their details |
### Authors
* Eric Helms (@ehelms)
ansible theforeman.foreman.scap_tailoring_file – Manage SCAP Tailoring Files theforeman.foreman.scap\_tailoring\_file – Manage SCAP Tailoring Files
======================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.scap_tailoring_file`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete SCAP Tailoring Files
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | Name of the tailoring file. |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **original\_filename** string | | Original file name of the XML file. If unset, the filename of *scap\_file* will be used. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **scap\_file** path | | File containing XML DataStream content. Required when creating a new DataStream. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **updated\_name** string | | New name of the tailoring file. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: Create SCAP tailoring file
theforeman.foreman.scap_tailoring_file:
name: "Red Hat firefox default content"
scap_file: "/home/user/Downloads/ssg-firefox-ds-tailoring.xml"
original_filename: "ssg-firefox-ds-tailoring.xml"
organizations:
- "Default Organization"
locations:
- "Default Location"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Update SCAP tailoring file
theforeman.foreman.scap_tailoring_file:
name: "Red Hat firefox default content"
updated_name: "Updated tailoring file name"
scap_file: "/home/user/Downloads/updated-ssg-firefox-ds-tailoring.xml"
original_filename: "updated-ssg-firefox-ds-tailoring.xml"
organizations:
- "Org One"
- "Org Two"
locations:
- "Loc One"
- "Loc Two"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Delete SCAP tailoring file
theforeman.foreman.scap_tailoring_file:
name: "Red Hat firefox default content"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **scap\_tailoring\_files** list / elements=dictionary | success | List of scap tailoring files. |
### Authors
* Evgeni Golov (@evgeni)
ansible theforeman.foreman.job_template – Manage Job Templates theforeman.foreman.job\_template – Manage Job Templates
=======================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.job_template`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Remote Execution Job Templates
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **audit\_comment** string | | Content of the audit comment field |
| **description\_format** string | | description of the job template. Template inputs can be referenced. |
| **file\_name** path | | The path of a template file, that shall be imported. Either this or *template* is required as a source for the Job Template "content". |
| **job\_category** string | | The category the template should be assigend to |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **locked** boolean | **Choices:*** **no** ←
* yes
| Determines whether the template shall be locked |
| **name** string | | The name of the Job Template. If omited, will be determined from the `name` header of the template or the filename (in that order). The special value "\*" can be used to perform bulk actions (modify, delete) on all existing templates. |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **provider\_type** string | | Determines via which provider the template shall be executed |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **snippet** boolean | **Choices:*** no
* yes
| Determines whether the template shall be a snippet |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **template** string | | The content of the Job Template. Either this or *file\_name* is required as a source for the Job Template "content". |
| **template\_inputs** list / elements=dictionary | | The template inputs used in the Job Template |
| | **advanced** boolean | **Choices:*** no
* yes
| Template Input is advanced |
| | **description** string | | description of the Template Input |
| | **fact\_name** string | | Fact name to use. Required when *input\_type=fact*. |
| | **input\_type** string / required | **Choices:*** user
* fact
* variable
* puppet\_parameter
| input type |
| | **name** string / required | | name of the Template Input |
| | **options** list / elements=raw | | Template values for user inputs. Must be an array of any type. |
| | **puppet\_class\_name** string | | Puppet class name. Required when *input\_type=puppet\_parameter*. |
| | **puppet\_parameter\_name** string | | Puppet parameter name. Required when *input\_type=puppet\_parameter*. |
| | **required** boolean | **Choices:*** no
* yes
| Is the input required |
| | **resource\_type** string | | Type of the resource |
| | **value\_type** string | **Choices:*** plain
* search
* date
| Type of the value |
| | **variable\_name** string | | Variable name to use. Required when *input\_type=variable*. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create a Job Template inline"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: A New Job Template
state: present
template: |
<%#
name: A Job Template
%>
rm -rf <%= input("toDelete") %>
template_inputs:
- name: toDelete
input_type: user
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Create a Job Template from a file"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: a new job template
file_name: timeywimey_template.erb
template_inputs:
- name: a new template input
input_type: user
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "remove a job template's template inputs"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: a new job template
template_inputs: []
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Delete a Job Template"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: timeywimey
state: absent
- name: "Create a Job Template from a file and modify with parameter(s)"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: timeywimey_template.erb
name: Wibbly Wobbly Template
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
# Providing a name in this case wouldn't be very sensible.
# Alternatively make use of with_filetree to parse recursively with filter.
- name: Parsing a directory of Job templates
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: "{{ item }}"
state: present
locations:
- SKARO
organizations:
- DALEK INC
with_fileglob:
- "./arsenal_templates/*.erb"
# If the templates are stored locally and the ansible module is executed on a remote host
- name: Ensure latest version of all your Job Templates
theforeman.foreman.job_template:
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
template: '{{ lookup("file", item.src) }}'
with_filetree: '/path/to/job/templates'
when: item.state == 'file'
# with name set to "*" bulk actions can be performed
- name: "Delete *ALL* Job Templates"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: absent
- name: "Assign all Job Templates to the same organization(s)"
theforeman.foreman.job_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: present
organizations:
- DALEK INC
- sky.net
- Doc Brown's garage
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **job\_templates** list / elements=dictionary | success | List of job templates. |
| | **template\_inputs** list / elements=dictionary | success | List of template inputs associated with the job template. |
### Authors
* Manuel Bonk (@manuelbonk) ATIX AG
* Matthias Dellweg (@mdellweg) ATIX AG
| programming_docs |
ansible theforeman.foreman.compute_attribute – Manage Compute Attributes theforeman.foreman.compute\_attribute – Manage Compute Attributes
=================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.compute_attribute`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Compute Attributes
* This beta version can create, and update compute attributes
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **compute\_profile** string / required | | Name of compute profile |
| **compute\_resource** string / required | | Name of compute resource |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **vm\_attrs** dictionary | | Hash containing the data of vm\_attrs
aliases: vm\_attributes |
Examples
--------
```
- name: "Create compute attribute"
theforeman.foreman.compute_attribute:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
compute_profile: "Test Compute Profile"
compute_resource: "Test Compute Resource"
vm_attrs:
memory_mb: '2048'
cpu: '2'
state: present
- name: "Update compute attribute"
theforeman.foreman.compute_attribute:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
compute_profile: "Test Compute Profile"
compute_resource: "Test Compute Resource"
vm_attrs:
memory_mb: '1024'
cpu: '1'
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **compute\_attributes** list / elements=dictionary | success | List of compute attributes. |
| | | **attributes** dictionary | success | Effective attributes for the given combination of compute profile and resource. |
| | | **compute\_profile\_id** integer | success | Database id of the associated compute profile. |
| | | **compute\_profile\_name** string | success | Name of the associated compute profile. |
| | | **compute\_resource\_id** integer | success | Database id of the associated compute resource. |
| | | **compute\_resource\_name** string | success | Name of the associated compute resource. |
| | | **created\_at** string | success | Creation date of the compute attribute. |
| | | **id** integer | success | Database id of the compute\_attribute. |
| | | **name** string | success | Generated friendly name for the compute attribute. |
| | | **provider\_friendly\_name** string | success | Name of the provider type of the compute resource. |
| | | **updated\_at** string | success | Date of last change to the compute attribute. |
| | | **vm\_attrs** dictionary | success | Configured attributes. |
### Authors
* Manisha Singhal (@Manisha15) ATIX AG
ansible theforeman.foreman.compute_profile – Manage Compute Profiles theforeman.foreman.compute\_profile – Manage Compute Profiles
=============================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.compute_profile`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Compute Profiles
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **compute\_attributes** list / elements=dictionary | | Compute attributes related to this compute profile. Some of these attributes are specific to the underlying compute resource type |
| | **compute\_resource** string | | Name of the compute resource the attribute should be for |
| | **vm\_attrs** dictionary | | Hash containing the data of vm\_attrs
aliases: vm\_attributes |
| **name** string / required | | compute profile name |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **updated\_name** string | | new compute profile name |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: compute profile
theforeman.foreman.compute_profile:
name: example_compute_profile
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: another compute profile
theforeman.foreman.compute_profile:
name: another_example_compute_profile
compute_attributes:
- compute_resource: ovirt_compute_resource1
vm_attrs:
cluster: 'a96d44a4-f14a-1015-82c6-f80354acdf01'
template: 'c88af4b7-a24a-453b-9ac2-bc647ca2ef99'
instance_type: 'cb8927e7-a404-40fb-a6c1-06cbfc92e077'
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: compute profile2
theforeman.foreman.compute_profile:
name: example_compute_profile2
compute_attributes:
- compute_resource: ovirt_compute_resource01
vm_attrs:
cluster: a96d44a4-f14a-1015-82c6-f80354acdf01
cores: 1
sockets: 1
memory: 1073741824
ha: 0
interfaces_attributes:
0:
name: ""
network: 390666e1-dab3-4c99-9f96-006b2e2fd801
interface: virtio
volumes_attributes:
0:
size_gb: 16
storage_domain: 19c50090-1ab4-4023-a63f-75ee1018ed5e
preallocate: '1'
wipe_after_delete: '0'
interface: virtio_scsi
bootable: 'true'
- compute_resource: libvirt_compute_resource03
vm_attrs:
cpus: 1
memory: 2147483648
nics_attributes:
0:
type: bridge
bridge: ""
model: virtio
volumes_attributes:
0:
pool_name: default
capacity: 16G
allocation: 16G
format_type: raw
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Remove compute profile
theforeman.foreman.compute_profile:
name: example_compute_profile2
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **compute\_profiles** list / elements=dictionary | success | List of compute profiles. |
| | | **compute\_attributes** list / elements=string | success | Attributes for this compute profile. |
| | | **id** integer | success | Database id of the compute profile. |
| | | **name** string | success | Name of the compute profile. |
### Authors
* Philipp Joos (@philippj)
* Baptiste Agasse (@bagasse)
ansible theforeman.foreman.installation_medium – Manage Installation Media theforeman.foreman.installation\_medium – Manage Installation Media
===================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.installation_medium`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Installation Media
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | The full installation medium name. The special name "\*" (only possible as parameter) is used to perform bulk actions (modify, delete) on all existing partition tables. |
| **operatingsystems** list / elements=string | | List of operating systems the entity should be assigned to. Operating systems are looked up by their title which is composed as "<name> <major>.<minor>". You can omit the version part as long as you only have one operating system by that name. |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **os\_family** string | **Choices:*** AIX
* Altlinux
* Archlinux
* Coreos
* Debian
* Freebsd
* Gentoo
* Junos
* NXOS
* Rancheros
* Redhat
* Solaris
* Suse
* Windows
* Xenserver
| The OS family the template shall be assigned with. If no os\_family is set but a operatingsystem, the value will be derived from it. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **path** string | | Path to the installation medium |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **updated\_name** string | | New full installation medium name. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: create new debian medium
theforeman.foreman.installation_medium:
name: "wheezy"
locations:
- "Munich"
organizations:
- "ACME"
operatingsystems:
- "Debian"
path: "http://debian.org/mirror/"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **media** list / elements=dictionary | success | List of installation media. |
### Authors
* Manuel Bonk(@manuelbonk) ATIX AG
ansible theforeman.foreman.hardware_model – Manage Hardware Models theforeman.foreman.hardware\_model – Manage Hardware Models
===========================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.hardware_model`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage hardware models
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **hardware\_model** string | | The class of CPU supplied in this machine. This is primarily used by Sparc Solaris builds and can be left blank for other architectures. |
| **info** string | | General description of the hardware model |
| **name** string / required | | Name of the hardware model |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **vendor\_class** string | | The class of the machine as reported by the OpenBoot PROM. This is primarily used by Solaris SPARC builds and can be left blank for other architectures. |
Examples
--------
```
- name: "Create ACME Laptop model"
theforeman.foreman.hardware_model:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "acme laptop"
info: "this is the acme laptop"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **hardware\_models** list / elements=dictionary | success | List of hardware models. |
### Authors
* Evgeni Golov (@evgeni)
ansible theforeman.foreman.partition_table – Manage Partition Table Templates theforeman.foreman.partition\_table – Manage Partition Table Templates
======================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.partition_table`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Partition Table Templates
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **file\_name** path | | The path of a template file, that shall be imported. Either this or *layout* is required as a source for the Partition Template "content". |
| **layout** string | | The content of the Partitioning Table Template Either this or *file\_name* is required as a source for the Partition Template "content". |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **locked** boolean | **Choices:*** no
* yes
| Determines whether the template shall be locked |
| **name** string | | The name of the Partition Table. If omited, will be determined from the `name` header of the template or the filename (in that order). The special value "\*" can be used to perform bulk actions (modify, delete) on all existing Partition Tables. |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **os\_family** string | **Choices:*** AIX
* Altlinux
* Archlinux
* Coreos
* Debian
* Freebsd
* Gentoo
* Junos
* NXOS
* Rancheros
* Redhat
* Solaris
* Suse
* Windows
* Xenserver
| The OS family the template shall be assigned with. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **updated\_name** string | | New name of the template. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
# Keep in mind, that in this case, the inline parameters will be overwritten
- name: "Create a Partition Table inline"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: A New Partition Template
state: present
layout: |
<%#
name: A Partition Template
%>
zerombr
clearpart --all --initlabel
autopart
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Create a Partition Template from a file"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: timeywimey_template.erb
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
- name: "Delete a Partition Template"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: timeywimey
layout: |
<%#
dummy:
%>
state: absent
- name: "Create a Partition Template from a file and modify with parameter(s)"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: timeywimey_template.erb
name: Wibbly Wobbly Template
state: present
locations:
- Gallifrey
organizations:
- TARDIS INC
# Providing a name in this case wouldn't be very sensible.
# Alternatively make use of with_filetree to parse recursively with filter.
- name: "Parsing a directory of partition templates"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
file_name: "{{ item }}"
state: present
locations:
- SKARO
organizations:
- DALEK INC
with_fileglob:
- "./arsenal_templates/*.erb"
# If the templates are stored locally and the ansible module is executed on a remote host
- name: Ensure latest version of all Ptable Community Templates
theforeman.foreman.partition_table:
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
layout: '{{ lookup("file", item.src) }}'
with_filetree: '/path/to/partition/tables'
when: item.state == 'file'
# with name set to "*" bulk actions can be performed
- name: "Delete *ALL* partition tables"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: absent
- name: "Assign all partition tables to the same organization(s)"
theforeman.foreman.partition_table:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "*"
state: present
organizations:
- DALEK INC
- sky.net
- Doc Brown's garage
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **ptables** list / elements=dictionary | success | List of partition tables. |
### Authors
* Bernhard Hopfenmueller (@Fobhep) ATIX AG
* Matthias Dellweg (@mdellweg) ATIX AG
| programming_docs |
ansible theforeman.foreman.organization – Manage Organizations theforeman.foreman.organization – Manage Organizations
======================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.organization`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Organizations
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Description of the Organization |
| **label** string | | Label of the Organization |
| **name** string / required | | Name of the Organization |
| **parameters** list / elements=dictionary | | Entity domain specific host parameters |
| | **name** string / required | | Name of the parameter |
| | **parameter\_type** string | **Choices:*** **string** ←
* boolean
* integer
* real
* array
* hash
* yaml
* json
| Type of the parameter |
| | **value** raw / required | | Value of the parameter |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create CI Organization"
theforeman.foreman.organization:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My Cool New Organization"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **organizations** list / elements=dictionary | success | List of organizations. |
### Authors
* Eric D Helms (@ehelms)
* Matthias M Dellweg (@mdellweg) ATIX AG
ansible theforeman.foreman.subscription_info – Fetch information about Subscriptions theforeman.foreman.subscription\_info – Fetch information about Subscriptions
=============================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.subscription_info`.
New in version 2.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Subscriptions
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **location** string | | Label of the Location to scope the search for. |
| **name** string | | Name of the resource to fetch information for. Mutually exclusive with *search*. |
| **organization** string / required | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **search** string | | Search query to use If None, and *name* is not set, all resources are returned. Mutually exclusive with *name*. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Show a subscription"
theforeman.foreman.subscription_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Red Hat Satellite Infrastructure Subscription"
- name: "Show all subscriptions with a certain name"
theforeman.foreman.subscription_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
search: name="Red Hat Satellite Infrastructure Subscription"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **subscription** dictionary | success and *name* was passed | Details about the found subscription |
| **subscriptions** list / elements=dictionary | success and *search* was passed | List of all found subscriptions and their details |
### Authors
* Evgeni Golov (@evgeni)
ansible theforeman.foreman.external_usergroup – Manage External User Groups theforeman.foreman.external\_usergroup – Manage External User Groups
====================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.external_usergroup`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete external user groups
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **auth\_source** string / required | | Name of the authentication source to be used for this group
aliases: auth\_source\_ldap |
| **name** string / required | | Name of the group |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **usergroup** string / required | | Name of the linked usergroup |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: Create an external user group
theforeman.foreman.external_usergroup:
name: test
auth_source: "My LDAP server"
usergroup: "Internal Usergroup"
state: present
- name: Link a group from FreeIPA
theforeman.foreman.external_usergroup:
name: ipa_users
auth_source: "External"
usergroup: "Internal Usergroup"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **external\_usergroups** list / elements=dictionary | success | List of external usergroups. |
### Authors
* Kirill Shirinkin (@Fodoj)
ansible theforeman.foreman.repository_set – Enable/disable Red Hat Repositories available through subscriptions theforeman.foreman.repository\_set – Enable/disable Red Hat Repositories available through subscriptions
========================================================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.repository_set`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Enable/disable Red Hat Repositories that are available through subscriptions
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **all\_repositories** boolean | **Choices:*** no
* yes
| Affect all available repositories in the repository set instead of listing them in *repositories*. Required when *repositories* is unset or an empty list. |
| **label** string | | Label of the repository set, can be used in place of *name* & *product*
|
| **name** string | | Name of the repository set |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **product** string | | Name of the parent product |
| **repositories** list / elements=dictionary | | Release version and base architecture of the repositories to enable. Some reposotory sets require only *basearch* or only *releasever* to be set. See the examples how you can obtain this information using [theforeman.foreman.resource\_info](resource_info_module). Required when *all\_repositories* is unset or `false`. |
| | **basearch** string | | Basearch of the repository to enable. |
| | **releasever** string | | Releasever of the repository to enable. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **enabled** ←
* disabled
| Whether the repositories are enabled or not |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Enable RHEL 7 RPMs repositories"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Red Hat Enterprise Linux 7 Server (RPMs)"
organization: "Default Organization"
product: "Red Hat Enterprise Linux Server"
repositories:
- releasever: "7.0"
basearch: "x86_64"
- releasever: "7.1"
basearch: "x86_64"
- releasever: "7.2"
basearch: "x86_64"
- releasever: "7.3"
basearch: "x86_64"
state: enabled
- name: "Enable RHEL 7 RPMs repositories with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: rhel-7-server-rpms
repositories:
- releasever: "7.0"
basearch: "x86_64"
- releasever: "7.1"
basearch: "x86_64"
- releasever: "7.2"
basearch: "x86_64"
- releasever: "7.3"
basearch: "x86_64"
state: enabled
- name: "Disable RHEL 7 Extras RPMs repository"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: Red Hat Enterprise Linux 7 Server - Extras (RPMs)
organization: "Default Organization"
product: Red Hat Enterprise Linux Server
state: disabled
repositories:
- basearch: x86_64
- name: "Enable RHEL 8 BaseOS RPMs repository with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: rhel-8-for-x86_64-baseos-rpms
repositories:
- releasever: "8"
- name: "Enable Red Hat Virtualization Manager RPMs repository with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "rhel-7-server-rhv-4.2-manager-rpms"
repositories:
- basearch: x86_64
state: enabled
- name: "Enable Red Hat Virtualization Manager RPMs repository without specifying basearch"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "rhel-7-server-rhv-4.2-manager-rpms"
all_repositories: true
state: enabled
- name: "Search for possible repository sets of a product"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
resource: repository_sets
search: product_name="Red Hat Virtualization Manager"
register: data
- name: "Output found repository sets, see the contentUrl section for possible repository substitutions"
debug:
var: data
- name: "Search for possible repository sets by label"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
resource: repository_sets
search: label=rhel-7-server-rhv-4.2-manager-rpms
register: data
- name: "Output found repository sets, see the contentUrl section for possible repository substitutions"
debug:
var: data
- name: Enable set with and without all_repositories at the same time
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "{{ item.label }}"
repositories: "{{ item.repositories | default(omit) }}"
all_repositories: "{{ item.repositories is not defined }}"
state: enabled
loop:
- label: rhel-7-server-rpms
repositories:
- releasever: "7Server"
basearch: "x86_64"
- label: rhel-7-server-rhv-4.2-manager-rpms
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **repository\_sets** list / elements=dictionary | success | List of repository sets. |
### Authors
* Andrew Kofink (@akofink)
ansible theforeman.foreman.location – Manage Locations theforeman.foreman.location – Manage Locations
==============================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.location`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Locations
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name of the Location |
| **organizations** list / elements=string | | List of organizations the location should be assigned to |
| **parameters** list / elements=dictionary | | Entity domain specific host parameters |
| | **name** string / required | | Name of the parameter |
| | **parameter\_type** string | **Choices:*** **string** ←
* boolean
* integer
* real
* array
* hash
* yaml
* json
| Type of the parameter |
| | **value** raw / required | | Value of the parameter |
| **parent** string | | Title of a parent Location for nesting |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
# Create a simple location
- name: "Create CI Location"
theforeman.foreman.location:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My Cool New Location"
organizations:
- "Default Organization"
state: present
# Create a nested location
- name: "Create Nested CI Location"
theforeman.foreman.location:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My Nested location"
parent: "My Cool New Location"
state: present
# Create a new nested location with parent included in name
- name: "Create New Nested Location"
theforeman.foreman.location:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My Cool New Location/New nested location"
state: present
# Move a nested location to another parent
- name: "Create Nested CI Location"
theforeman.foreman.location:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My Cool New Location/New nested location"
parent: "My Cool New Location/My Nested location"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **locations** list / elements=dictionary | success | List of locations. |
### Authors
* Matthias M Dellweg (@mdellweg) ATIX AG
| programming_docs |
ansible theforeman.foreman.os_default_template – Manage Default Template Associations To Operating Systems theforeman.foreman.os\_default\_template – Manage Default Template Associations To Operating Systems
====================================================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.os_default_template`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage OSDefaultTemplate Entities
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **operatingsystem** string / required | | Operating systems are looked up by their title which is composed as "<name> <major>.<minor>". You can omit the version part as long as you only have one operating system by that name. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **provisioning\_template** string | | name of provisioning template |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **template\_kind** string / required | **Choices:*** Bootdisk
* cloud-init
* finish
* iPXE
* job\_template
* kexec
* POAP
* provision
* ptable
* PXEGrub
* PXEGrub2
* PXELinux
* registration
* script
* user\_data
* ZTP
| name of the template kind |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create an Association"
theforeman.foreman.os_default_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
operatingsystem: "CoolOS"
template_kind: "finish"
provisioning_template: "CoolOS finish"
state: present
- name: "Delete an Association"
theforeman.foreman.os_default_template:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
operatingsystem: "CoolOS"
template_kind: "finish"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **os\_default\_templates** list / elements=dictionary | success | List of operatingsystem default templates. |
### Authors
* Matthias M Dellweg (@mdellweg) ATIX AG
ansible theforeman.foreman.templates_import – Sync Templates from a repository theforeman.foreman.templates\_import – Sync Templates from a repository
=======================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.templates_import`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Sync provisioning templates, report\_templates, partition tables and job templates from external git repository or file system.
* Based on foreman\_templates plugin <https://github.com/theforeman/foreman_templates>.
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **associate** string | **Choices:*** always
* new
* never
| Associate to Operatingsystems, Locations and Organizations based on metadata. |
| **branch** string | | Branch of the *repo*. Only for git-based repositories. |
| **dirname** string | | The directory within Git repo containing the templates. |
| **filter** string | | Sync only templates with name matching this regular expression, after *prefix* was applied. Case-insensitive, snippets are not filtered. |
| **force** boolean | **Choices:*** no
* yes
| Update templates that are locked. |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **lock** boolean | **Choices:*** no
* yes
| Lock imported templates. |
| **negate** boolean | **Choices:*** no
* yes
| Negate the filter condition. |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **prefix** string | | Adds specified string to beginning of all imported templates that do not yet have that prefix. |
| **repo** string | | Filesystem path or repo (with protocol), for example /tmp/dir or git://example.com/repo.git or https://example.com/repo.git. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **verbose** boolean | **Choices:*** no
* yes
| Add template reports to the output. |
Notes
-----
Note
* Due to a bug in the foreman\_templates plugin, this module won’t report `changed=true` when the only change is the Organization/Location association of the imported templates. Please see <https://projects.theforeman.org/issues/29534> for details.
* Default values for all module options can be set using [theforeman.foreman.setting](setting_module#ansible-collections-theforeman-foreman-setting-module) for TemplateSync category or on the settings page in WebUI.
Examples
--------
```
- name: Sync templates from git repo
theforeman.foreman.templates_import:
repo: https://github.com/theforeman/community-templates.git
branch: 1.24-stable
associate: new
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **message** dictionary | success | Information about the import. |
| | **branch** string | success | Branch used in the repository. |
| | **repo** string | success | Repository, the templates were imported from. |
| **report** dictionary | success | Report of the import. |
| | **changed** list / elements=string | success | List of templates that have been updated. |
| | **new** list / elements=string | success | List of templates that have been created. |
| **templates** dictionary | success | Final state of the templates. |
### Authors
* Anton Nesterov (@nesanton)
ansible theforeman.foreman.domain_info – Fetch information about Domains theforeman.foreman.domain\_info – Fetch information about Domains
=================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.domain_info`.
New in version 2.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Domains
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **location** string | | Label of the Location to scope the search for. |
| **name** string | | Name of the resource to fetch information for. Mutually exclusive with *search*. |
| **organization** string | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **search** string | | Search query to use If None, and *name* is not set, all resources are returned. Mutually exclusive with *name*. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Show a domain"
theforeman.foreman.domain_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "example.com"
- name: "Show all domains with domain example.com"
theforeman.foreman.domain_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
search: "name = example.com"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **domain** dictionary | success and *name* was passed | Details about the found domain |
| **domains** list / elements=dictionary | success and *search* was passed | List of all found domains and their details |
### Authors
* Eric Helms (@ehelms)
ansible theforeman.foreman.repository_set_info – Fetch information about Red Hat Repositories theforeman.foreman.repository\_set\_info – Fetch information about Red Hat Repositories
=======================================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.repository_set_info`.
New in version 2.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Red Hat Repositories
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **location** string | | Label of the Location to scope the search for. |
| **name** string | | Name of the resource to fetch information for. Mutually exclusive with *search*. |
| **organization** string / required | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **product** string | | Name of the parent product |
| **search** string | | Search query to use If None, and *name* is not set, all resources are returned. Mutually exclusive with *name*. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Find repository set by name and product."
theforeman.foreman.repository_set_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
name: "Red Hat Enterprise Linux 7 Server (RPMs)"
product: "Red Hat Enterprise Linux Server"
- name: "Find repository set by label."
theforeman.foreman.repository_set_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
search: 'label = "rhel-7-server-rpms"'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **repository\_set** dictionary | success and *name* was passed | Details about the found Red Hat Repository. |
| **repository\_sets** list / elements=dictionary | success and *search* was passed | List of all found Red Hat Repositories and their details. |
### Authors
* William Bradford Clark (@wbclark)
ansible theforeman.foreman.host_info – Fetch information about Hosts theforeman.foreman.host\_info – Fetch information about Hosts
=============================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.host_info`.
New in version 2.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Hosts
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **location** string | | Label of the Location to scope the search for. |
| **name** string | | Name of the resource to fetch information for. Mutually exclusive with *search*. |
| **organization** string | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **search** string | | Search query to use If None, and *name* is not set, all resources are returned. Mutually exclusive with *name*. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Show a host"
theforeman.foreman.host_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "host.example.com"
- name: "Show all hosts with domain example.com"
theforeman.foreman.host_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
search: "domain = example.com"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host** dictionary | success and *name* was passed | Details about the found host |
| **hosts** list / elements=dictionary | success and *search* was passed | List of all found hosts and their details |
### Authors
* Evgeni Golov (@evgeni)
ansible theforeman.foreman.job_invocation – Invoke Remote Execution Jobs theforeman.foreman.job\_invocation – Invoke Remote Execution Jobs
=================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.job_invocation`.
New in version 1.4.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Invoke and schedule Remote Execution Jobs
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **bookmark** string | | Bookmark to infer the search query from |
| **command** string | | Command to be executed on host. Required for command templates |
| **concurrency\_control** dictionary | | Control concurrency level and distribution over time |
| | **concurrency\_level** integer | | Maximum jobs to be executed at once |
| | **time\_span** integer | | Distribute tasks over given number of seconds |
| **execution\_timeout\_interval** integer | | Override the timeout interval from the template for this invocation only |
| **inputs** dictionary | | Inputs to use |
| **job\_template** string / required | | Job template to execute |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **randomized\_ordering** boolean | **Choices:*** no
* yes
| Whether to order the selected hosts randomly |
| **recurrence** dictionary | | Schedule a recurring job |
| | **cron\_line** string | | How often the job should occur, in the cron format |
| | **end\_time** string | | Perform no more executions after this time |
| | **max\_iteration** integer | | Repeat a maximum of N times |
| **scheduling** dictionary | | Schedule the job to start at a later time |
| | **start\_at** string | | Schedule the job for a future time |
| | **start\_before** string | | Indicates that the action should be cancelled if it cannot be started before this time. |
| **search\_query** string | | Search query to identify hosts |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **ssh** dictionary | | ssh related options |
| | **effective\_user** string | | What user should be used to run the script (using sudo-like mechanisms) Defaults to a template parameter or global setting |
| **targeting\_type** string | **Choices:*** **static\_query** ←
* dynamic\_query
| Dynamic query updates the search results before execution (useful for scheduled jobs) |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Run remote command on a single host once"
job_invocation:
search_query: "name ^ (foreman.example.com)"
command: 'ls'
job_template: "Run Command - SSH Default"
ssh:
effective_user: "tester"
- name: "Run ansible command on active hosts once a day"
job_invocation:
bookmark: 'active'
command: 'pwd'
job_template: "Run Command - Ansible Default"
recurrence:
cron_line: "30 2 * * *"
concurrency_control:
concurrency_level: 2
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **job\_invocations** list / elements=dictionary | success | List of job invocations |
### Authors
* Peter Ondrejka (@pondrejk)
| programming_docs |
ansible theforeman.foreman.subnet_info – Fetch information about Subnets theforeman.foreman.subnet\_info – Fetch information about Subnets
=================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.subnet_info`.
New in version 2.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Subnets
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **location** string | | Label of the Location to scope the search for. |
| **name** string | | Name of the resource to fetch information for. Mutually exclusive with *search*. |
| **organization** string | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **search** string | | Search query to use If None, and *name* is not set, all resources are returned. Mutually exclusive with *name*. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Show a subnet"
theforeman.foreman.subnet_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "subnet.example.com"
- name: "Show all subnets with domain example.com"
theforeman.foreman.subnet_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
search: "domain = example.com"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **subnet** dictionary | success and *name* was passed | Details about the found subnet |
| **subnets** list / elements=dictionary | success and *search* was passed | List of all found subnets and their details |
### Authors
* Evgeni Golov (@evgeni)
ansible theforeman.foreman.repository_info – Fetch information about Repositories theforeman.foreman.repository\_info – Fetch information about Repositories
==========================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.repository_info`.
New in version 2.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Repositories
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **location** string | | Label of the Location to scope the search for. |
| **name** string | | Name of the resource to fetch information for. Mutually exclusive with *search*. |
| **organization** string / required | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **product** string / required | | Product to which the repository lives in |
| **search** string | | Search query to use If None, and *name* is not set, all resources are returned. Mutually exclusive with *name*. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Find repository by name"
theforeman.foreman.repository_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My repository"
product: "My Product"
organization: "Default Organization"
- name: "Find repository using a search"
theforeman.foreman.repository_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
product: "My Product"
organization: "Default Organization"
search: 'name = "My repository"'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **repositories** list / elements=dictionary | success and *search* was passed | List of all found repositories and their details |
| **repository** dictionary | success and *name* was passed | Details about the found repository |
### Authors
* Evgeni Golov (@evgeni)
ansible theforeman.foreman.content_view – Manage Content Views theforeman.foreman.content\_view – Manage Content Views
=======================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.content_view`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage content views
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **auto\_publish** boolean | **Choices:*** **no** ←
* yes
| Auto publish composite view when a new version of a component content view is created. Also note auto publish will only happen when the component is marked "latest". |
| **components** list / elements=dictionary | | List of content views to includes content\_view and either version or latest. Ignored if *composite=False*. |
| | **content\_view** string / required | | Content View name to be added to the Composite Content View |
| | **content\_view\_version** string | | Version of the Content View to add
aliases: version |
| | **latest** boolean | **Choices:*** **no** ←
* yes
| Always use the latest Content View Version |
| **composite** boolean | **Choices:*** **no** ←
* yes
| A composite view contains other content views. |
| **description** string | | Description of the Content View |
| **name** string / required | | Name of the Content View |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **repositories** list / elements=dictionary | | List of repositories that include name and product. Cannot be combined with *composite=True*. |
| | **name** string / required | | Name of the Repository to be added |
| | **product** string / required | | Product of the Repository to be added |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **solve\_dependencies** boolean | **Choices:*** no
* yes
| Solve RPM dependencies by default on Content View publish |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create or update Fedora content view"
theforeman.foreman.content_view:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Fedora CV"
organization: "My Cool new Organization"
repositories:
- name: 'Fedora 26'
product: 'Fedora'
- name: "Create a composite content view"
theforeman.foreman.content_view:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Fedora CCV"
organization: "My Cool new Organization"
composite: true
auto_publish: true
components:
- content_view: Fedora CV
content_view_version: 1.0
- content_view: Internal CV
latest: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **content\_views** list / elements=dictionary | success | List of content views. |
### Authors
* Eric D Helms (@ehelms)
ansible theforeman.foreman.status_info – Get status info theforeman.foreman.status\_info – Get status info
=================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.status_info`.
New in version 1.3.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Get status information from the server
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: status
theforeman.foreman.status_info:
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **ping** dictionary | if supported by server | Detailed service status. |
| **status** dictionary | always | Basic status of the server. |
### Authors
* Evgeni Golov (@evgeni)
ansible theforeman.foreman.sync_plan – Manage Sync Plans theforeman.foreman.sync\_plan – Manage Sync Plans
=================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.sync_plan`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage sync plans
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cron\_expression** string | | A cron expression as found in crontab files This must be provided together with *interval='custom cron'*. |
| **description** string | | Description of the sync plan |
| **enabled** boolean / required | **Choices:*** no
* yes
| Whether the sync plan is active |
| **interval** string / required | **Choices:*** hourly
* daily
* weekly
* custom cron
| How often synchronization should run |
| **name** string / required | | Name of the sync plan |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **products** list / elements=string | | List of products to include in the sync plan |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **sync\_date** string / required | | Start date and time of the first synchronization |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create or update weekly RHEL sync plan"
theforeman.foreman.sync_plan:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Weekly RHEL Sync"
organization: "Default Organization"
interval: "weekly"
enabled: false
sync_date: "2017-01-01 00:00:00 UTC"
products:
- 'Red Hat Enterprise Linux Server'
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **sync\_plans** list / elements=dictionary | success | List of sync plans. |
### Authors
* Andrew Kofink (@akofink)
* Matthis Dellweg (@mdellweg) ATIX-AG
ansible theforeman.foreman.product – Manage Products theforeman.foreman.product – Manage Products
============================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.product`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage products
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Possibly long description to show the user in detail view |
| **gpg\_key** string | | Content GPG key name attached to this product |
| **label** string | | Label to show the user |
| **name** string / required | | Name of the product |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **ssl\_ca\_cert** string | | Content SSL CA certificate name attached to this product |
| **ssl\_client\_cert** string | | Content SSL client certificate name attached to this product |
| **ssl\_client\_key** string | | Content SSL client private key name attached to this product |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **sync\_plan** string | | Sync plan name attached to this product |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create Fedora product with a sync plan"
theforeman.foreman.product:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Fedora"
organization: "My Cool new Organization"
sync_plan: "Fedora repos sync"
state: present
- name: "Create CentOS 7 product with content credentials"
theforeman.foreman.product:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "CentOS 7"
gpg_key: "RPM-GPG-KEY-CentOS7"
organization: "My Cool new Organization"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **products** list / elements=dictionary | success | List of products. |
### Authors
* Eric D Helms (@ehelms)
* Matthias Dellweg (@mdellweg) ATIX AG
| programming_docs |
ansible theforeman.foreman.bookmark – Manage Bookmarks theforeman.foreman.bookmark – Manage Bookmarks
==============================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.bookmark`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Bookmark Entities
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **controller** string / required | | Controller for the bookmark |
| **name** string / required | | Name of the bookmark |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **public** boolean | **Choices:*** no
* **yes** ←
| Make bookmark available for all users |
| **query** string | | Query of the bookmark |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create a Bookmark"
theforeman.foreman.bookmark:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "recent"
controller: "job_invocations"
query: "started_at > '24 hours ago'"
state: present_with_defaults
- name: "Update a Bookmark"
theforeman.foreman.bookmark:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "recent"
controller: "job_invocations"
query: "started_at > '12 hours ago'"
state: present
- name: "Delete a Bookmark"
theforeman.foreman.bookmark:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "recent"
controller: "job_invocations"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **bookmarks** list / elements=dictionary | success | List of bookmarks. |
| | | **controller** string | success | Controller, the query is performed on. |
| | | **id** integer | success | Database id of the bookmark. |
| | | **name** string | success | Name of the bookmark. |
| | | **owner\_id** integer | success | Database id of the owner entity. |
| | | **owner\_type** string | success | Class of the owner entity. |
| | | **public** boolean | success | Publicity of the bookmark. |
| | | **query** string | success | Query to be performed on the controller. |
### Authors
* Bernhard Hopfenmueller (@Fobhep) ATIX AG
* Christoffer Reijer (@ephracis) Basalt AB
ansible theforeman.foreman.subscription_manifest – Manage Subscription Manifests theforeman.foreman.subscription\_manifest – Manage Subscription Manifests
=========================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.subscription_manifest`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Upload, refresh and delete Subscription Manifests
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **manifest\_path** path | | Path to the manifest zip file This parameter will be ignored if *state=absent* or *state=refreshed*
|
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **repository\_url** string | | URL to retrieve content from
aliases: redhat\_repository\_url |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** absent
* **present** ←
* refreshed
| The state of the manifest |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Upload the RHEL developer edition manifest"
theforeman.foreman.subscription_manifest:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
state: present
manifest_path: "/tmp/manifest.zip"
```
### Authors
* Andrew Kofink (@akofink)
ansible theforeman.foreman.host – Manage Hosts theforeman.foreman.host – Manage Hosts
======================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.host`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Hosts
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **activation\_keys** string | | Activation Keys used for deployment. Comma separated list. Only available for Katello installations. |
| **architecture** string | | Architecture name |
| **build** boolean | **Choices:*** no
* yes
| Whether or not to setup build context for the host |
| **comment** string | | Comment about the host. |
| **compute\_attributes** dictionary | | Additional compute resource specific attributes. When this parameter is set, the module will not be idempotent. When you provide a *cluster* here and *compute\_resource* is set, the cluster id will be automatically looked up. |
| **compute\_profile** string | | Compute profile name |
| **compute\_resource** string | | Compute resource name |
| **config\_groups** list / elements=string | | Config groups list |
| **content\_source** string | | Content source. Only available for Katello installations. |
| **content\_view** string | | Content view. Only available for Katello installations. |
| **domain** string | | Domain name |
| **enabled** boolean | **Choices:*** no
* yes
| Include this host within reporting |
| **environment** string | | Puppet environment name |
| **hostgroup** string | | Name of related hostgroup. |
| **image** string | | The image to use when *provision\_method=image*. The *compute\_resource* parameter is required to find the correct image. |
| **interfaces\_attributes** list / elements=dictionary added in 1.5.0 of theforeman.foreman | | Additional interfaces specific attributes. |
| | **attached\_devices** list / elements=string | | Identifiers of attached interfaces, e.g. ['eth1', 'eth2']. For bond interfaces those are the slaves. Only for bond and bridges interfaces. |
| | **attached\_to** string | | Identifier of the interface to which this interface belongs, e.g. eth1. Only for virtual interfaces. |
| | **bond\_options** string | | Space separated options, e.g. miimon=100. Only for bond interfaces. |
| | **compute\_attributes** dictionary | | Additional compute resource specific attributes for the interface. When this parameter is set, the module will not be idempotent. When you provide a *network* here and *compute\_resource* is set, the network id will be automatically looked up. On oVirt/RHV *cluster* is required in the hosts *compute\_attributes* for the lookup to work. |
| | **domain** string | | Domain name Required for primary interfaces on managed hosts. |
| | **identifier** string | | Device identifier, e.g. eth0 or eth1.1 You need to set one of *identifier*, *name* or *mac* to be able to update existing interfaces and make execution idempotent. |
| | **ip** string | | IPv4 address of interface |
| | **ip6** string | | IPv6 address of interface |
| | **mac** string | | MAC address of interface. Required for managed interfaces on bare metal. Please include leading zeros and separate nibbles by colons, otherwise the execution will not be idempotent. Example EE:BB:01:02:03:04 You need to set one of *identifier*, *name* or *mac* to be able to update existing interfaces and make execution idempotent. |
| | **managed** boolean | **Choices:*** no
* yes
| Should this interface be managed via DHCP and DNS smart proxy and should it be configured during provisioning? |
| | **mode** string | **Choices:*** balance-rr
* active-backup
* balance-xor
* broadcast
* 802.3ad
* balance-tlb
* balance-alb
| Bond mode of the interface. Only for bond interfaces. |
| | **mtu** integer | | MTU, this attribute has precedence over the subnet MTU. |
| | **name** string | | Interface's DNS name You need to set one of *identifier*, *name* or *mac* to be able to update existing interfaces and make execution idempotent. |
| | **password** string | | Password for BMC authentication. Only for BMC interfaces. |
| | **primary** boolean | **Choices:*** no
* yes
| Should this interface be used for constructing the FQDN of the host? Each managed hosts needs to have one primary interface. |
| | **provider** string | **Choices:*** IPMI
* Redfish
* SSH
| Interface provider, e.g. IPMI. Only for BMC interfaces. |
| | **provision** boolean | **Choices:*** no
* yes
| Should this interface be used for TFTP of PXELinux (or SSH for image-based hosts)? Each managed hosts needs to have one provision interface. |
| | **subnet** string | | IPv4 Subnet name |
| | **subnet6** string | | IPv6 Subnet name |
| | **tag** string | | VLAN tag, this attribute has precedence over the subnet VLAN ID. Only for virtual interfaces. |
| | **type** string | **Choices:*** interface
* bmc
* bond
* bridge
| Interface type. |
| | **username** string | | Username for BMC authentication. Only for BMC interfaces. |
| | **virtual** boolean | **Choices:*** no
* yes
| Alias or VLAN device |
| **ip** string | | IP address of the primary interface of the host. |
| **kickstart\_repository** string | | Kickstart repository name. You need to provide this to use the "Synced Content" feature. Mutually exclusive with *medium*. Only available for Katello installations. |
| **lifecycle\_environment** string | | Lifecycle environment. Only available for Katello installations. |
| **location** string | | Name of related location |
| **mac** string | | MAC address of the primary interface of the host. Please include leading zeros and separate nibbles by colons, otherwise the execution will not be idempotent. Example EE:BB:01:02:03:04 |
| **managed** boolean | **Choices:*** no
* yes
| Whether a host is managed or unmanaged. Forced to true when *build=true*
|
| **medium** string | | Medium name Mutually exclusive with *kickstart\_repository*.
aliases: media |
| **name** string / required | | Fully Qualified Domain Name of host |
| **openscap\_proxy** string | | OpenSCAP proxy name. Only available when the OpenSCAP plugin is installed. |
| **operatingsystem** string | | Operating systems are looked up by their title which is composed as "<name> <major>.<minor>". You can omit the version part as long as you only have one operating system by that name. |
| **organization** string | | Name of related organization |
| **owner** string | | Owner (user) of the host. Users are looked up by their `login`. Mutually exclusive with *owner\_group*. |
| **owner\_group** string | | Owner (user group) of the host. Mutually excluside with *owner*. |
| **parameters** list / elements=dictionary | | Entity domain specific host parameters |
| | **name** string / required | | Name of the parameter |
| | **parameter\_type** string | **Choices:*** **string** ←
* boolean
* integer
* real
* array
* hash
* yaml
* json
| Type of the parameter |
| | **value** raw / required | | Value of the parameter |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **provision\_method** string | **Choices:*** build
* image
* bootdisk
| The method used to provision the host.
*provision\_method=bootdisk* is only available if the bootdisk plugin is installed. |
| **ptable** string | | Partition table name |
| **puppet\_ca\_proxy** string | | Puppet CA proxy name |
| **puppet\_proxy** string | | Puppet server proxy name |
| **puppetclasses** list / elements=string | | List of puppet classes to include in this host group. Must exist for hostgroup's puppet environment. |
| **pxe\_loader** string | **Choices:*** PXELinux BIOS
* PXELinux UEFI
* Grub UEFI
* Grub2 BIOS
* Grub2 ELF
* Grub2 UEFI
* Grub2 UEFI SecureBoot
* Grub2 UEFI HTTP
* Grub2 UEFI HTTPS
* Grub2 UEFI HTTPS SecureBoot
* iPXE Embedded
* iPXE UEFI HTTP
* iPXE Chain BIOS
* iPXE Chain UEFI
* None
| PXE Bootloader |
| **realm** string | | Realm name |
| **root\_pass** string | | Root password. Will result in the entity always being updated, as the current password cannot be retrieved. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **subnet** string | | IPv4 Subnet name |
| **subnet6** string | | IPv6 Subnet name |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create a host"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
hostgroup: my_hostgroup
state: present
- name: "Create a host with build context"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
hostgroup: my_hostgroup
build: true
state: present
- name: "Create an unmanaged host"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
managed: false
state: present
- name: "Create a VM with 2 CPUs and 4GB RAM"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
compute_attributes:
cpus: 2
memory_mb: 4096
state: present
- name: "Create a VM and start it after creation"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
compute_attributes:
start: "1"
state: present
- name: "Create a VM on specific ovirt network"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
interfaces_attributes:
- type: "interface"
compute_attributes:
name: "nic1"
network: "969efbe6-f9e0-4383-a19a-a7ee65ad5007"
interface: "virtio"
state: present
- name: "Create a VM with 2 NICs on specific ovirt networks"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
interfaces_attributes:
- type: "interface"
primary: true
compute_attributes:
name: "nic1"
network: "969efbe6-f9e0-4383-a19a-a7ee65ad5007"
interface: "virtio"
- type: "interface"
name: "new_host_nic2"
managed: true
compute_attributes:
name: "nic2"
network: "969efbe6-f9e0-4383-a19a-a7ee65ad5008"
interface: "e1000"
state: present
- name: "Delete a host"
theforeman.foreman.host:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "new_host"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **hosts** list / elements=dictionary | success | List of hosts. |
### Authors
* Bernhard Hopfenmueller (@Fobhep) ATIX AG
ansible theforeman.foreman.content_credential – Manage Content Credentials theforeman.foreman.content\_credential – Manage Content Credentials
===================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.content_credential`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage content credentials
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **content** string / required | | Content of the content credential |
| **content\_type** string / required | **Choices:*** gpg\_key
* cert
| Type of credential |
| **name** string / required | | Name of the content credential |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create katello client GPG key"
theforeman.foreman.content_credential:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "RPM-GPG-KEY-my-repo"
content_type: gpg_key
organization: "Default Organization"
content: "{{ lookup('file', 'RPM-GPG-KEY-my-repo') }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **content\_credentials** list / elements=dictionary | success | List of content credentials. |
### Authors
* Baptiste Agasse (@bagasse)
| programming_docs |
ansible theforeman.foreman.realm – Manage Realms theforeman.foreman.realm – Manage Realms
========================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.realm`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Realms
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | Name of the realm |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **realm\_proxy** string / required | | Proxy to use for this realm |
| **realm\_type** string / required | **Choices:*** Red Hat Identity Management
* FreeIPA
* Active Directory
| Realm type |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create EXAMPLE.LOCAL Realm"
theforeman.foreman.realm:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "EXAMPLE.COM"
realm_proxy: "foreman.example.com"
realm_type: "Red Hat Identity Management"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **realms** list / elements=dictionary | success | List of realms. |
### Authors
* Lester R Claudio (@claudiol1)
ansible theforeman.foreman.role – Manage Roles theforeman.foreman.role – Manage Roles
======================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.role`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Roles
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Description of the role |
| **filters** list / elements=dictionary | | Filters with permissions for this role |
| | **permissions** list / elements=string / required | | List of permissions |
| | **search** string | | Filter condition for the resources |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | The name of the role |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: role
theforeman.foreman.role:
name: "Provisioner"
description: "Only provision on libvirt"
locations:
- "Uppsala"
organizations:
- "ACME"
filters:
- permissions:
- view_hosts
search: "owner_type = Usergroup and owner_id = 4"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **roles** list / elements=dictionary | success | List of roles. |
### Authors
* Christoffer Reijer (@ephracis) Basalt AB
ansible theforeman.foreman.smart_class_parameter – Manage Smart Class Parameters theforeman.foreman.smart\_class\_parameter – Manage Smart Class Parameters
==========================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.smart_class_parameter`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Update Smart Class Parameters.
* Smart Class Parameters are created/deleted for Puppet classes during import and cannot be created or deleted otherwise.
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **avoid\_duplicates** boolean | **Choices:*** no
* yes
| Remove duplicate values (only array type) |
| **default\_value** raw | | Value to use by default. |
| **description** string | | Description of the Smart Class Parameter |
| **hidden\_value** boolean | **Choices:*** no
* yes
| When enabled the parameter is hidden in the UI. |
| **merge\_default** boolean | **Choices:*** no
* yes
| Include default value when merging all matching values. |
| **merge\_overrides** boolean | **Choices:*** no
* yes
| Merge all matching values (only array/hash type). |
| **omit** boolean | **Choices:*** no
* yes
| Don't send this parameter in classification output. Puppet will use the value defined in the Puppet manifest for this parameter. |
| **override** boolean | **Choices:*** no
* yes
| Whether the smart class parameter value is managed by Foreman |
| **override\_value\_order** list / elements=string | | The order in which values are resolved. |
| **override\_values** list / elements=dictionary | | Value overrides |
| | **match** string / required | | Override match |
| | **omit** boolean | **Choices:*** no
* yes
| Don't send this parameter in classification output, replaces use\_puppet\_default. |
| | **value** raw | | Override value, required if omit is false |
| **parameter** string / required | | Name of the parameter |
| **parameter\_type** string | **Choices:*** string
* boolean
* integer
* real
* array
* hash
* yaml
* json
* none
| Types of variable values. If `none`, set the parameter type to empty value. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **puppetclass\_name** string / required | | Name of the puppetclass that own the parameter |
| **required** boolean | **Choices:*** no
* yes
| If true, will raise an error if there is no default value and no matcher provide a value. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
| State of the entity. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **validator\_rule** string | | Used to enforce certain values for the parameter values. |
| **validator\_type** string | **Choices:*** regexp
* list
| Types of validation values. |
Examples
--------
```
- name: "Update prometheus::server alertmanagers_config param default value"
theforeman.foreman.smart_class_parameter:
puppetclass_name: "prometheus::server"
parameter: alertmanagers_config
override: true
required: true
default_value: /etc/prometheus/alert.yml
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: "Update prometheus::server alertmanagers_config param default value"
theforeman.foreman.smart_class_parameter:
puppetclass_name: "prometheus::server"
parameter: alertmanagers_config
override: true
override_value_order:
- fqdn
- hostgroup
- domain
required: true
default_value: /etc/prometheus/alert.yml
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
override_values:
- match: domain=example.com
value: foo
- match: domain=foo.example.com
omit: true
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **smart\_class\_parameters** list / elements=dictionary | success | List of smart class parameters. |
### Authors
* Baptiste Agasse (@bagasse)
ansible theforeman.foreman.host_power – Manage Power State of Hosts theforeman.foreman.host\_power – Manage Power State of Hosts
============================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.host_power`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage power state of a host
* This beta version can start and stop an existing foreman host and question the current power state.
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name (FQDN) of the host
aliases: hostname |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** on
* start
* off
* stop
* soft
* reboot
* cycle
* reset
* **state** ←
* status
| Desired power state |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Switch a host on"
theforeman.foreman.host_power:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
hostname: "test-host.domain.test"
state: on
- name: "Switch a host off"
theforeman.foreman.host_power:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
hostname: "test-host.domain.test"
state: off
- name: "Query host power state"
theforeman.foreman.host_power:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
hostname: "test-host.domain.test"
state: state
register: result
- debug:
msg: "Host power state is {{ result.power_state }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **power\_state** string | always | current power state of host **Sample:** off |
### Authors
* Bernhard Hopfenmueller (@Fobhep) ATIX AG
* Baptiste Agasse (@bagasse)
ansible theforeman.foreman.hostgroup – Manage Hostgroups theforeman.foreman.hostgroup – Manage Hostgroups
================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.hostgroup`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Hostgroups
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **activation\_keys** string | | Activation Keys used for deployment. Comma separated list. Only available for Katello installations. |
| **ansible\_roles** list / elements=string added in 2.1.0 of theforeman.foreman | | A list of ansible roles to associate with the hostgroup. The foreman-ansible plugin must be installed to use this parameter. |
| **architecture** string | | Architecture name |
| **compute\_profile** string | | Compute profile name |
| **compute\_resource** string | | Compute resource name |
| **config\_groups** list / elements=string | | Config groups list |
| **content\_source** string | | Content source. Only available for Katello installations. |
| **content\_view** string | | Content view. Only available for Katello installations. |
| **description** string | | Description of hostgroup |
| **domain** string | | Domain name |
| **environment** string | | Puppet environment name |
| **kickstart\_repository** string | | Kickstart repository name. You need to provide this to use the "Synced Content" feature. Mutually exclusive with *medium*. Only available for Katello installations. |
| **lifecycle\_environment** string | | Lifecycle environment. Only available for Katello installations. |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **medium** string | | Medium name Mutually exclusive with *kickstart\_repository*.
aliases: media |
| **name** string / required | | Name of hostgroup |
| **openscap\_proxy** string | | OpenSCAP proxy name. Only available when the OpenSCAP plugin is installed. |
| **operatingsystem** string | | Operating systems are looked up by their title which is composed as "<name> <major>.<minor>". You can omit the version part as long as you only have one operating system by that name. |
| **organization** string | | Organization for scoped resources attached to the hostgroup. Only used for Katello installations. This organization will implicitly be added to the *organizations* parameter if needed. |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **parameters** list / elements=dictionary | | Hostgroup specific host parameters |
| | **name** string / required | | Name of the parameter |
| | **parameter\_type** string | **Choices:*** **string** ←
* boolean
* integer
* real
* array
* hash
* yaml
* json
| Type of the parameter |
| | **value** raw / required | | Value of the parameter |
| **parent** string | | Hostgroup parent name |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **ptable** string | | Partition table name |
| **puppet\_ca\_proxy** string | | Puppet CA proxy name |
| **puppet\_proxy** string | | Puppet server proxy name |
| **puppetclasses** list / elements=string | | List of puppet classes to include in this host group. Must exist for hostgroup's puppet environment. |
| **pxe\_loader** string | **Choices:*** PXELinux BIOS
* PXELinux UEFI
* Grub UEFI
* Grub2 BIOS
* Grub2 ELF
* Grub2 UEFI
* Grub2 UEFI SecureBoot
* Grub2 UEFI HTTP
* Grub2 UEFI HTTPS
* Grub2 UEFI HTTPS SecureBoot
* iPXE Embedded
* iPXE UEFI HTTP
* iPXE Chain BIOS
* iPXE Chain UEFI
* None
| PXE Bootloader |
| **realm** string | | Realm name |
| **root\_pass** string | | Root password. Will result in the entity always being updated, as the current password cannot be retrieved. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **subnet** string | | IPv4 Subnet name |
| **subnet6** string | | IPv6 Subnet name |
| **updated\_name** string | | New name of hostgroup. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create a Hostgroup"
theforeman.foreman.hostgroup:
name: "new_hostgroup"
architecture: "architecture_name"
operatingsystem: "operatingsystem_name"
medium: "media_name"
ptable: "Partition_table_name"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: "Update a Hostgroup"
theforeman.foreman.hostgroup:
name: "new_hostgroup"
architecture: "updated_architecture_name"
operatingsystem: "updated_operatingsystem_name"
organizations:
- Org One
- Org Two
locations:
- Loc One
- Loc Two
- Loc One/Nested loc
medium: "updated_media_name"
ptable: "updated_Partition_table_name"
root_pass: "password"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: "My nested hostgroup"
theforeman.foreman.hostgroup:
parent: "new_hostgroup"
name: "my nested hostgroup"
- name: "My hostgroup with some proxies"
theforeman.foreman.hostgroup:
name: "my hostgroup"
environment: production
puppet_proxy: puppet-proxy.example.com
puppet_ca_proxy: puppet-proxy.example.com
openscap_proxy: openscap-proxy.example.com
- name: "My katello related hostgroup"
theforeman.foreman.hostgroup:
organization: "My Org"
name: "kt hostgroup"
content_source: capsule.example.com
lifecycle_environment: "Production"
content_view: "My content view"
parameters:
- name: "kt_activation_keys"
value: "my_prod_ak"
- name: "Delete a Hostgroup"
theforeman.foreman.hostgroup:
name: "new_hostgroup"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **hostgroups** list / elements=dictionary | success | List of hostgroups. |
### Authors
* Manisha Singhal (@Manisha15) ATIX AG
* Baptiste Agasse (@bagasse)
| programming_docs |
ansible theforeman.foreman.scc_account – Manage SUSE Customer Center Accounts theforeman.foreman.scc\_account – Manage SUSE Customer Center Accounts
======================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.scc_account`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage SUSE Customer Center Accounts
* This module requires the foreman\_scc\_manager plugin set up in the server
* See <https://github.com/ATIX-AG/foreman_scc_manager>
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **base\_url** string | | URL of SUSE for suse customer center account |
| **interval** string | **Choices:*** never
* daily
* weekly
* monthly
| Interval for syncing suse customer center account |
| **login** string | | Login id of suse customer center account |
| **name** string / required | | Name of the suse customer center account |
| **organization** string / required | | Name of related organization |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **scc\_account\_password** string | | Password of suse customer center account |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
* synced
| State of the suse customer center account |
| **sync\_date** string | | Last Sync time of suse customer center account |
| **test\_connection** boolean | **Choices:*** **no** ←
* yes
| Test suse customer center account credentials that connects to the server |
| **updated\_name** string | | Name to be updated of suse customer center account |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create a suse customer center account"
theforeman.foreman.scc_account:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Test"
login: "abcde"
scc_account_password: "12345"
base_url: "https://scc.suse.com"
state: present
- name: "Update a suse customer center account"
theforeman.foreman.scc_account:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Test1"
state: present
- name: "Delete a suse customer center account"
theforeman.foreman.scc_account:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Test"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **scc\_accounts** list / elements=dictionary | success | List of scc accounts. |
### Authors
* Manisha Singhal (@manisha15) ATIX AG
ansible theforeman.foreman.usergroup – Manage User Groups theforeman.foreman.usergroup – Manage User Groups
=================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.usergroup`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete user groups
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **admin** boolean | **Choices:*** **no** ←
* yes
| Whether or not the users in this group are administrators |
| **name** string / required | | Name of the group |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **roles** list / elements=string | | List of roles assigned to the group |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **updated\_name** string | | New user group name. When this parameter is set, the module will not be idempotent. |
| **usergroups** list / elements=string | | List of other groups assigned to the group |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **users** list / elements=string | | List of users assigned to the group |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: Create a user group
theforeman.foreman.usergroup:
name: test
admin: no
roles:
- Manager
users:
- myuser1
- myuser2
usergroups:
- mynestedgroup
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **usergroups** list / elements=dictionary | success | List of usergroups. |
### Authors
* Baptiste Agasse (@bagasse)
ansible theforeman.foreman.scc_product – Subscribe SUSE Customer Center Account Products theforeman.foreman.scc\_product – Subscribe SUSE Customer Center Account Products
=================================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.scc_product`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Manage SUSE Customer Center Products
* This module requires the foreman\_scc\_manager plugin set up in the server
* See <https://github.com/ATIX-AG/foreman_scc_manager>
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **scc\_account** string / required | | Name of the suse customer center account associated with product |
| **scc\_product** string / required | | Full name of the product of suse customer center account. The *friendly\_name* alias is deprecated as it refers to an attribute that does not uniquely identify a product and not used for product lookups since SCC Manager 1.8.6.
aliases: friendly\_name |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Subscribe to suse customer center product"
theforeman.foreman.scc_product:
scc_product: "Product1"
scc_account: "Test"
organization: "Test Organization"
```
### Authors
* Manisha Singhal (@manisha15) ATIX AG
ansible theforeman.foreman.config_group – Manage (Puppet) Config Groups theforeman.foreman.config\_group – Manage (Puppet) Config Groups
================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.config_group`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete (Puppet) config groups
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | The config group name |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **puppetclasses** list / elements=string | | List of puppet classes to include in this group |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **updated\_name** string | | New config group name. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: create new config group
theforeman.foreman.config_group:
name: "My config group"
puppetclasses:
- ntp
- mymodule::myclass
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **config\_groups** list / elements=dictionary | success | List of config groups. |
### Authors
* Baptiste Agasse (@bagasse)
ansible theforeman.foreman.puppet_environment – Manage Puppet Environments theforeman.foreman.puppet\_environment – Manage Puppet Environments
===================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.puppet_environment`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Puppet Environments
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | The full environment name |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: create new environment
theforeman.foreman.puppet_environment:
name: "testing"
locations:
- "Munich"
organizations:
- "ACME"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **puppet\_environments** list / elements=dictionary | success | List of puppet environments. |
### Authors
* Bernhard Suttner (@\_sbernhard) ATIX AG
* Christoffer Reijer (@ephracis) Basalt AB
ansible theforeman.foreman.subnet – Manage Subnets theforeman.foreman.subnet – Manage Subnets
==========================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.subnet`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Subnets
Requirements
------------
The below requirements are needed on the host that executes this module.
* ipaddress
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **bmc\_proxy** string added in 2.1.0 of theforeman.foreman | | BMC Smart proxy for this subnet |
| **boot\_mode** string | **Choices:*** **DHCP** ←
* Static
| Boot mode used by hosts in this subnet |
| **cidr** integer | | CIDR prefix length; Required if *network\_type=IPv4* and no *mask* provided |
| **description** string | | Description of the subnet |
| **dhcp\_proxy** string | | DHCP Smart proxy for this subnet |
| **discovery\_proxy** string | | Discovery Smart proxy for this subnet This option is only available if the discovery plugin is installed. |
| **dns\_primary** string | | Primary DNS server for this subnet |
| **dns\_proxy** string | | Reverse DNS Smart proxy for this subnet |
| **dns\_secondary** string | | Secondary DNS server for this subnet |
| **domains** list / elements=string | | List of DNS domains the subnet should assigned to |
| **externalipam\_group** string added in 1.5.0 of theforeman.foreman | | External IPAM group for this subnet. Only relevant if *ipam=External IPAM*. |
| **externalipam\_proxy** string | | External IPAM proxy for this subnet. Only relevant if *ipam=External IPAM*. |
| **from\_ip** string | | First IP address of the host IP allocation pool |
| **gateway** string | | Subnet gateway IP address |
| **httpboot\_proxy** string | | HTTP Boot Smart proxy for this subnet |
| **ipam** string | **Choices:*** **DHCP** ←
* Internal DB
* Random DB
* EUI-64
* External IPAM
* None
| IPAM mode for this subnet |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **mask** string | | Subnet netmask. Required if *network\_type=IPv4* and no *cidr* prefix length provided |
| **mtu** integer | | MTU |
| **name** string / required | | Subnet name |
| **network** string / required | | Subnet IP address |
| **network\_type** string | **Choices:*** **IPv4** ←
* IPv6
| Subnet type |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **parameters** list / elements=dictionary | | Subnet specific host parameters |
| | **name** string / required | | Name of the parameter |
| | **parameter\_type** string | **Choices:*** **string** ←
* boolean
* integer
* real
* array
* hash
* yaml
* json
| Type of the parameter |
| | **value** raw / required | | Value of the parameter |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **remote\_execution\_proxies** list / elements=string | | Remote execution Smart proxies for this subnet This option is only available if the remote\_execution plugin is installed. This will always report *changed=true* when used with *remote\_execution < 4.1.0*, due to a bug in the plugin. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **template\_proxy** string | | Template Smart proxy for this subnet |
| **tftp\_proxy** string | | TFTP Smart proxy for this subnet |
| **to\_ip** string | | Last IP address of the host IP allocation pool |
| **updated\_name** string | | New subnet name. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **vlanid** integer | | VLAN ID |
Examples
--------
```
- name: My subnet
theforeman.foreman.subnet:
name: "My subnet"
description: "My description"
network: "192.168.0.0"
mask: "255.255.255.192"
gateway: "192.168.0.1"
from_ip: "192.168.0.2"
to_ip: "192.168.0.42"
boot_mode: "Static"
dhcp_proxy: "smart-proxy1.foo.example.com"
tftp_proxy: "smart-proxy1.foo.example.com"
dns_proxy: "smart-proxy2.foo.example.com"
template_proxy: "smart-proxy2.foo.example.com"
vlanid: 452
mtu: 9000
domains:
- "foo.example.com"
- "bar.example.com"
organizations:
- "Example Org"
locations:
- "Toulouse"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **subnets** list / elements=dictionary | success | List of subnets. |
### Authors
* Baptiste Agasse (@bagasse)
| programming_docs |
ansible theforeman.foreman.repository – Manage Repositories theforeman.foreman.repository – Manage Repositories
===================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.repository`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage repositories
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **ansible\_collection\_requirements** string | | Contents of requirement yaml file to sync from URL |
| **auto\_enabled** boolean | **Choices:*** no
* yes
| repositories will be automatically enabled on a registered host subscribed to this product |
| **checksum\_type** string | **Choices:*** sha1
* sha256
| Checksum of the repository |
| **content\_type** string / required | **Choices:*** deb
* docker
* file
* ostree
* puppet
* yum
* ansible\_collection
| The content type of the repository |
| **deb\_architectures** string | | comma separated list of architectures to be synced from deb-archive only available for *content\_type=deb*
|
| **deb\_components** string | | comma separated list of repo components to be synced from deb-archive only available for *content\_type=deb*
|
| **deb\_errata\_url** string | | URL to sync Debian or Ubuntu errata information from only available on Orcharhino only available for *content\_type=deb*
|
| **deb\_releases** string | | comma separated list of releases to be synced from deb-archive only available for *content\_type=deb*
|
| **description** string | | Description of the repository |
| **docker\_tags\_whitelist** list / elements=string | | list of tags to sync for Container Image repository only available for *content\_type=docker*
|
| **docker\_upstream\_name** string | | name of the upstream docker repository only available for *content\_type=docker*
|
| **download\_policy** string | **Choices:*** background
* immediate
* on\_demand
| download policy for sync from upstream |
| **gpg\_key** string | | Repository GPG key |
| **http\_proxy** string | | Name of the http proxy to use for content synching Should be combined with *http\_proxy\_policy='use\_selected\_http\_proxy'*
|
| **http\_proxy\_policy** string | **Choices:*** global\_default\_http\_proxy
* none
* use\_selected\_http\_proxy
| Which proxy to use for content synching |
| **ignorable\_content** list / elements=string | | List of content units to ignore while syncing a yum repository. Must be subset of rpm,drpm,srpm,distribution,erratum. |
| **ignore\_global\_proxy** boolean | **Choices:*** no
* yes
| Whether content sync should use or ignore the global http proxy setting This is deprecated with Katello 3.13 It has been superseeded by *http\_proxy\_policy*
|
| **label** string | | label of the repository |
| **mirror\_on\_sync** boolean | **Choices:*** no
* **yes** ←
| toggle "mirror on sync" where the state of the repository mirrors that of the upstream repository at sync time |
| **name** string / required | | Name of the repository |
| **organization** string / required | | Organization that the entity is in |
| **os\_versions** list / elements=string | **Choices:*** rhel-6
* rhel-7
* rhel-8
| Identifies whether the repository should be disabled on a client with a non-matching OS version. A maximum of one OS version can be selected. Set to `[]` to disable filtering again. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **product** string / required | | Product to which the repository lives in |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **ssl\_ca\_cert** string | | Repository SSL CA certificate |
| **ssl\_client\_cert** string | | Repository SSL client certificate |
| **ssl\_client\_key** string | | Repository SSL client private key |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
| State of the entity
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **unprotected** boolean | **Choices:*** no
* yes
| publish the repository via HTTP |
| **upstream\_password** string | | password to access upstream repository |
| **upstream\_username** string | | username to access upstream repository |
| **url** string | | Repository URL to sync from |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **verify\_ssl\_on\_sync** boolean | **Choices:*** no
* yes
| verify the upstream certifcates are signed by a trusted CA |
Notes
-----
Note
* You can configure certain aspects of existing Red Hat Repositories (like *download\_policy*) using this module, but you can’t create (enable) or delete (disable) them.
* If you want to enable or disable Red Hat Repositories available through your subscription, please use the [theforeman.foreman.repository\_set](repository_set_module#ansible-collections-theforeman-foreman-repository-set-module) module instead.
Examples
--------
```
- name: "Create repository"
theforeman.foreman.repository:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My repository"
state: present
content_type: "yum"
product: "My Product"
organization: "Default Organization"
url: "http://yum.theforeman.org/plugins/latest/el7/x86_64/"
mirror_on_sync: true
download_policy: background
- name: "Create repository with content credentials"
theforeman.foreman.repository:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My repository 2"
state: present
content_type: "yum"
product: "My Product"
organization: "Default Organization"
url: "http://yum.theforeman.org/releases/latest/el7/x86_64/"
download_policy: background
mirror_on_sync: true
gpg_key: RPM-GPG-KEY-my-product2
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **repositories** list / elements=dictionary | success | List of repositories. |
### Authors
* Eric D Helms (@ehelms)
ansible theforeman.foreman.content_view_version – Manage Content View Versions theforeman.foreman.content\_view\_version – Manage Content View Versions
========================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.content_view_version`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Publish, Promote or Remove a Content View Version
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **content\_view** string / required | | Name of the content view |
| **current\_lifecycle\_environment** string | | The lifecycle environment that is already associated with the content view version Helpful for promoting a content view version |
| **description** string | | Description of the Content View Version |
| **force\_promote** boolean | **Choices:*** **no** ←
* yes
| Force content view promotion and bypass lifecycle environment restriction
aliases: force |
| **force\_yum\_metadata\_regeneration** boolean | **Choices:*** **no** ←
* yes
| Force metadata regeneration when performing Publish and Promote tasks |
| **lifecycle\_environments** list / elements=string | | The lifecycle environments the Content View Version should be in. |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **version** string | | The content view version number (i.e. 1.0) |
Notes
-----
Note
* You cannot use this to remove a Content View Version from a Lifecycle environment, you should promote another version first.
* For idempotency you must specify either `version` or `current_lifecycle_environment`.
Examples
--------
```
- name: "Ensure content view version 2.0 is in Test & Pre Prod"
theforeman.foreman.content_view_version:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
content_view: "CV 1"
organization: "Default Organization"
version: "2.0"
lifecycle_environments:
- Test
- Pre Prod
- name: "Ensure content view version in Test is also in Pre Prod"
theforeman.foreman.content_view_version:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
content_view: "CV 1"
organization: "Default Organization"
current_lifecycle_environment: Test
lifecycle_environments:
- Pre Prod
- name: "Publish a content view, not idempotent"
theforeman.foreman.content_view_version:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
content_view: "CV 1"
organization: "Default Organization"
- name: "Publish a content view and promote that version to Library & Dev, not idempotent"
theforeman.foreman.content_view_version:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
content_view: "CV 1"
organization: "Default Organization"
lifecycle_environments:
- Library
- Dev
- name: "Ensure content view version 1.0 doesn't exist"
theforeman.foreman.content_view_version:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
content_view: "Web Servers"
organization: "Default Organization"
version: "1.0"
state: absent
# Obtain information about a Content View and its versions
- name: find all CVs
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
resource: content_views
search: 'name="Example Content"'
register: example_content
# Obtain more details about all versions of a specific Content View
- name: "find content view versions of {{ cv_id }}"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
resource: content_view_versions
params:
content_view_id: "{{ example_content.resources[0].id }}"
register: version_information
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **content\_view\_versions** list / elements=dictionary | success | List of content view versions. |
### Authors
* Sean O’Keeffe (@sean797)
ansible theforeman.foreman.activation_key – Manage Activation Keys theforeman.foreman.activation\_key – Manage Activation Keys
===========================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.activation_key`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage activation keys
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **auto\_attach** boolean | **Choices:*** no
* yes
| Set Auto-Attach on or off |
| **content\_overrides** list / elements=dictionary | | List of content overrides that include label and override state ('enabled', 'disabled' or 'default') |
| | **label** string / required | | Label of the content override |
| | **override** string / required | **Choices:*** enabled
* disabled
* default
| Override value |
| **content\_view** string | | Name of the content view |
| **description** string | | Description of the activation key |
| **host\_collections** list / elements=string | | List of host collections to add to activation key |
| **lifecycle\_environment** string | | Name of the lifecycle environment |
| **max\_hosts** integer | | Maximum number of registered content hosts. Required if *unlimited\_hosts=false*
|
| **name** string / required | | Name of the activation key |
| **new\_name** string | | Name of the new activation key when state == copied |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **purpose\_addons** list / elements=string | | Sets the system purpose add-ons |
| **purpose\_role** string | | Sets the system purpose role |
| **purpose\_usage** string | | Sets the system purpose usage |
| **release\_version** string | | Set the content release version |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **service\_level** string | **Choices:*** Self-Support
* Standard
* Premium
| Set the service level |
| **state** string | **Choices:*** **present** ←
* present\_with\_defaults
* absent
* copied
| State of the Activation Key If `copied` the key will be copied to a new one with *new\_name* as the name and all other fields left untouched
`present_with_defaults` will ensure the entity exists, but won't update existing ones |
| **subscriptions** list / elements=dictionary | | List of subscriptions that include either Name, Pool ID, or Upstream Pool ID. Pool IDs are preferred since Names and Upstream Pool IDs are not guaranteed to be unique. The module will fail if it finds more than one match. |
| | **name** string | | Name of the Subscription to be added. Mutually exclusive with *pool\_id* and *upstream\_pool\_id*. |
| | **pool\_id** string | | Pool ID of the Subscription to be added. Mutually exclusive with *name* and *upstream\_pool\_id*. Also named `Candlepin Id` in the CSV export of the subscriptions, it is as well the `UUID` as output by `hammer subscription list`. |
| | **upstream\_pool\_id** string | | Upstream Pool ID of the Subscription to be added. Mutually exclusive with *name* and *pool\_id*. Also named `Master Pools` in the Red Hat Portal. |
| **unlimited\_hosts** boolean | **Choices:*** no
* yes
| Can the activation key have unlimited hosts |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create client activation key"
theforeman.foreman.activation_key:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Clients"
organization: "Default Organization"
lifecycle_environment: "Library"
content_view: 'client content view'
host_collections:
- rhel7-servers
- rhel7-production
subscriptions:
- pool_id: "8a88e9826db22df5016dd018abdd029b"
- pool_id: "8a88e9826db22df5016dd01a23270344"
- name: "Red Hat Enterprise Linux"
content_overrides:
- label: rhel-7-server-optional-rpms
override: enabled
auto_attach: False
release_version: 7Server
service_level: Standard
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **activation\_keys** list / elements=dictionary | success | List of activation keys. |
### Authors
* Andrew Kofink (@akofink)
| programming_docs |
ansible theforeman.foreman.scap_content – Manage SCAP content theforeman.foreman.scap\_content – Manage SCAP content
======================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.scap_content`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete SCAP content
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **original\_filename** string | | Original file name of the XML file. If unset, the filename of *scap\_file* will be used. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **scap\_file** path | | File containing XML DataStream content. Required when creating a new DataStream. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **title** string / required | | Title of SCAP content. |
| **updated\_title** string | | New SCAP content title. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: Create SCAP content
theforeman.foreman.scap_content:
title: "Red Hat firefox default content"
scap_file: "/home/user/Downloads/ssg-firefox-ds.xml"
original_filename: "ssg-firefox-ds.xml"
organizations:
- "Default Organization"
locations:
- "Default Location"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Update SCAP content
theforeman.foreman.scap_content:
title: "Red Hat firefox default content"
updated_title: "Updated scap content title"
scap_file: "/home/user/Downloads/updated-ssg-firefox-ds.xml"
original_filename: "updated-ssg-firefox-ds.xml"
organizations:
- "Org One"
- "Org Two"
locations:
- "Loc One"
- "Loc Two"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
- name: Delete SCAP content
theforeman.foreman.scap_content:
title: "Red Hat firefox default content"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **scap\_contents** list / elements=dictionary | success | List of scap contents. |
### Authors
* Jameer Pathan (@jameerpathan111)
ansible theforeman.foreman.repository_sync – Sync a Repository or Product theforeman.foreman.repository\_sync – Sync a Repository or Product
==================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.repository_sync`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Sync a repository or product
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **product** string / required | | Product to which the *repository* lives in |
| **repository** string | | Name of the repository to sync If omitted, all repositories in *product* are synched. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Sync repository"
theforeman.foreman.repository_sync:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
repository: "My repository"
product: "My Product"
organization: "Default Organization"
```
### Authors
* Eric D Helms (@ehelms)
* Matthias M Dellweg (@mdellweg) ATIX AG
ansible theforeman.foreman.lifecycle_environment – Manage Lifecycle Environments theforeman.foreman.lifecycle\_environment – Manage Lifecycle Environments
=========================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.lifecycle_environment`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage lifecycle environments
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Description of the lifecycle environment |
| **label** string | | Label of the lifecycle environment. This field cannot be updated. |
| **name** string / required | | Name of the lifecycle environment |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **prior** string | | Name of the parent lifecycle environment |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Add a production lifecycle environment"
theforeman.foreman.lifecycle_environment:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Production"
label: "production"
organization: "Default Organization"
prior: "Library"
description: "The production environment"
state: "present"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **lifecycle\_environments** list / elements=dictionary | success | List of lifecycle environments. |
### Authors
* Andrew Kofink (@akofink)
* Baptiste Agasse (@bagasse)
ansible theforeman.foreman.host_collection – Manage Host Collections theforeman.foreman.host\_collection – Manage Host Collections
=============================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.host_collection`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and Manage host collections
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Description of the host collection |
| **name** string / required | | Name of the host collection |
| **organization** string / required | | Organization that the entity is in |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **updated\_name** string | | New name of the host collection. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create Foo host collection"
theforeman.foreman.host_collection:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Foo"
description: "Foo host collection for Foo servers"
organization: "My Cool new Organization"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **host\_collections** list / elements=dictionary | success | List of host collections. |
### Authors
* Maxim Burgerhout (@wzzrd)
* Christoffer Reijer (@ephracis)
ansible theforeman.foreman.setting – Manage Settings theforeman.foreman.setting – Manage Settings
============================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.setting`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Settings
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name of the Setting |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **value** raw | | value to set the Setting to if missing, reset to default |
Examples
--------
```
- name: "Set a Setting"
theforeman.foreman.setting:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "http_proxy"
value: "http://localhost:8088"
- name: "Reset a Setting"
theforeman.foreman.setting:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "http_proxy"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **foreman\_setting** dictionary | success | Created / Updated state of the setting |
### Authors
* Matthias M Dellweg (@mdellweg) ATIX AG
ansible theforeman.foreman.host_errata_info – Fetch information about Host Errata theforeman.foreman.host\_errata\_info – Fetch information about Host Errata
===========================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.host_errata_info`.
New in version 2.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch information about Host Errata
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **content\_view** string | | Calculate Applicable Errata based on a particular Content View. Required together with *lifecycle\_environment*. If this is set, *organization* also needs to be set. |
| **host** string / required | | Name of the host to fetch errata for. |
| **lifecycle\_environment** string | | Calculate Applicable Errata based on a particular Lifecycle Environment. Required together with *content\_view*. If this is set, *organization* also needs to be set. |
| **location** string | | Label of the Location to scope the search for. |
| **organization** string | | Name of the Organization to scope the search for. |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **search** string | | Search query to use If None, all resources are returned. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "List installable errata for host"
theforeman.foreman.host_errata_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
host: "host.example.com"
- name: "List applicable errata for host"
theforeman.foreman.host_errata_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
host: "host.example.com"
lifecycle_environment: "Library"
content_view: "Default Organization View"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_errata** list / elements=dictionary | success | List of all found errata for the host and their details |
### Authors
* Evgeni Golov (@evgeni)
| programming_docs |
ansible theforeman.foreman.http_proxy – Manage HTTP Proxies theforeman.foreman.http\_proxy – Manage HTTP Proxies
====================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.http_proxy`.
New in version 1.1.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete HTTP Proxies
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | The HTTP Proxy name |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **proxy\_password** string | | Password used to authenticate with the HTTP Proxy When this parameter is set, the module will not be idempotent. |
| **proxy\_username** string | | Username used to authenticate with the HTTP Proxy |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **url** string | | URL of the HTTP Proxy Required when creating a new HTTP Proxy. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: create example.org proxy
theforeman.foreman.http_proxy:
name: "example.org"
url: "http://example.org:3128"
locations:
- "Munich"
organizations:
- "ACME"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **http\_proxies** list / elements=dictionary | success | List of HTTP proxies. |
### Authors
* Evgeni Golov (@evgeni)
ansible theforeman.foreman.user – Manage Users theforeman.foreman.user – Manage Users
======================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.user`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete users
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **admin** boolean | **Choices:*** **no** ←
* yes
| Whether or not the user is an administrator |
| **auth\_source** string | | Authentication source where the user exists |
| **default\_location** string | | The location that the user uses by default |
| **default\_organization** string | | The organizxation that the user uses by default |
| **description** string | | Description of the user |
| **firstname** string | | First name of the user |
| **lastname** string | | Last name of the user |
| **locale** string | **Choices:*** ca
* de
* en
* en\_GB
* es
* fr
* gl
* it
* ja
* ko
* nl\_NL
* pl
* pt\_BR
* ru
* sv\_SE
* zh\_CN
* zh\_TW
| The language locale for the user |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **login** string / required | | Name of the user
aliases: name |
| **mail** string | | Email address of the user Required when creating a new user |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **roles** list / elements=string | | List of roles assigned to the user |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **timezone** string | **Choices:*** International Date Line West
* American Samoa
* Midway Island
* Hawaii
* Alaska
* Pacific Time (US & Canada)
* Tijuana
* Arizona
* Chihuahua
* Mazatlan
* Mountain Time (US & Canada)
* Central America
* Central Time (US & Canada)
* Guadalajara
* Mexico City
* Monterrey
* Saskatchewan
* Bogota
* Eastern Time (US & Canada)
* Indiana (East)
* Lima
* Quito
* Atlantic Time (Canada)
* Caracas
* Georgetown
* La Paz
* Puerto Rico
* Santiago
* Newfoundland
* Brasilia
* Buenos Aires
* Greenland
* Montevideo
* Mid-Atlantic
* Azores
* Cape Verde Is.
* Dublin
* Edinburgh
* Lisbon
* London
* Monrovia
* UTC
* Amsterdam
* Belgrade
* Berlin
* Bern
* Bratislava
* Brussels
* Budapest
* Casablanca
* Copenhagen
* Ljubljana
* Madrid
* Paris
* Prague
* Rome
* Sarajevo
* Skopje
* Stockholm
* Vienna
* Warsaw
* West Central Africa
* Zagreb
* Zurich
* Athens
* Bucharest
* Cairo
* Harare
* Helsinki
* Jerusalem
* Kaliningrad
* Kyiv
* Pretoria
* Riga
* Sofia
* Tallinn
* Vilnius
* Baghdad
* Istanbul
* Kuwait
* Minsk
* Moscow
* Nairobi
* Riyadh
* St. Petersburg
* Tehran
* Abu Dhabi
* Baku
* Muscat
* Samara
* Tbilisi
* Volgograd
* Yerevan
* Kabul
* Ekaterinburg
* Islamabad
* Karachi
* Tashkent
* Chennai
* Kolkata
* Mumbai
* New Delhi
* Sri Jayawardenepura
* Kathmandu
* Almaty
* Astana
* Dhaka
* Urumqi
* Rangoon
* Bangkok
* Hanoi
* Jakarta
* Krasnoyarsk
* Novosibirsk
* Beijing
* Chongqing
* Hong Kong
* Irkutsk
* Kuala Lumpur
* Perth
* Singapore
* Taipei
* Ulaanbaatar
* Osaka
* Sapporo
* Seoul
* Tokyo
* Yakutsk
* Adelaide
* Darwin
* Brisbane
* Canberra
* Guam
* Hobart
* Melbourne
* Port Moresby
* Sydney
* Vladivostok
* Magadan
* New Caledonia
* Solomon Is.
* Srednekolymsk
* Auckland
* Fiji
* Kamchatka
* Marshall Is.
* Wellington
* Chatham Is.
* Nuku'alofa
* Samoa
* Tokelau Is.
| Timezone for the user If blank it will use the browser timezone. |
| **user\_password** string | | Password for the user |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: Create a user
theforeman.foreman.user:
name: test
firstname: Test
lastname: Userson
mail: [email protected]
description: Dr. Test Userson
admin: no
user_password: s3cret
default_location: Test Location
default_organization: Test Organization
auth_source: Internal
timezone: Stockholm
locale: sv_SE
roles:
- Manager
locations:
- Test Location
organizations:
- Test Organization
state: present
- name: Update a user
theforeman.foreman.user:
name: test
firstname: Tester
state: present
- name: Change password
theforeman.foreman.user:
name: test
user_password: newp@ss
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **users** list / elements=dictionary | success | List of users. |
### Authors
* Christoffer Reijer (@ephracis) Basalt AB
ansible theforeman.foreman.foreman – Sends events to Foreman theforeman.foreman.foreman – Sends events to Foreman
====================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.foreman`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
Synopsis
--------
* This callback will report facts and task events to Foreman
Requirements
------------
The below requirements are needed on the local controller node that executes this callback.
* whitelisting in configuration
* requests (python library)
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **client\_cert** string | **Default:**"/etc/foreman/client\_cert.pem" | ini entries: [callback\_foreman]ssl\_cert = /etc/foreman/client\_cert.pem [callback\_foreman]client\_cert = /etc/foreman/client\_cert.pem env:FOREMAN\_SSL\_CERT | X509 certificate to authenticate to Foreman if https is used
aliases: ssl\_cert |
| **client\_key** string | **Default:**"/etc/foreman/client\_key.pem" | ini entries: [callback\_foreman]ssl\_key = /etc/foreman/client\_key.pem [callback\_foreman]client\_key = /etc/foreman/client\_key.pem env:FOREMAN\_SSL\_KEY | the corresponding private key
aliases: ssl\_key |
| **dir\_store** string | **Default:**"" | ini entries: [callback\_foreman]dir\_store = env:FOREMAN\_DIR\_STORE | When set, callback does not perform HTTP calls but stores results in a given directory. For each report, new file in the form of SEQ\_NO-hostname.json is created. For each facts, new file in the form of SEQ\_NO-hostname.json is created. The value must be a valid directory. This is meant for debugging and testing purposes. When set to blank (default) this functionality is turned off. |
| **disable\_callback** string | **Default:**0 | env:FOREMAN\_CALLBACK\_DISABLE | Toggle to make the callback plugin disable itself even if it is loaded. It can be set to '1' to prevent the plugin from being used even if it gets loaded. |
| **url** string / required | **Default:**"http://localhost:3000" | ini entries: [callback\_foreman]url = http://localhost:3000 env:FOREMAN\_URL env:FOREMAN\_SERVER\_URL env:FOREMAN\_SERVER | URL of the Foreman server. |
| **verify\_certs** string | **Default:**1 | ini entries: [callback\_foreman]verify\_certs = 1 env:FOREMAN\_SSL\_VERIFY | Toggle to decide whether to verify the Foreman certificate. It can be set to '1' to verify SSL certificates using the installed CAs or to a path pointing to a CA bundle. Set to '0' to disable certificate checking. |
ansible theforeman.foreman.snapshot – Manage Snapshots theforeman.foreman.snapshot – Manage Snapshots
==============================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.snapshot`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Snapshots for Host Entities
* This module can create, update, revert and delete snapshots
* This module requires the foreman\_snapshot\_management plugin set up in the server
* See: <https://github.com/ATIX-AG/foreman_snapshot_management>
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Description of Snapshot |
| **host** string / required | | Name of related Host |
| **name** string / required | | Name of Snapshot |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* reverted
* absent
| State of Snapshot |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: "Create a Snapshot"
theforeman.foreman.snapshot:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "snapshot_before_software_upgrade"
host: "server.example.com"
state: present
- name: "Update a Snapshot"
theforeman.foreman.snapshot:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "snapshot_before_software_upgrade"
host: "server.example.com"
description: "description of snapshot"
state: present
- name: "Revert a Snapshot"
theforeman.foreman.snapshot:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "snapshot_before_software_upgrade"
host: "server.example.com"
state: reverted
- name: "Delete a Snapshot"
theforeman.foreman.snapshot:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "snapshot_before_software_upgrade"
host: "server.example.com"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **snapshots** list / elements=dictionary | success | List of snapshots. |
### Authors
* Manisha Singhal (@Manisha15) ATIX AG
ansible theforeman.foreman.content_view_filter – Manage Content View Filters theforeman.foreman.content\_view\_filter – Manage Content View Filters
======================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.content_view_filter`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage content View filters
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **architecture** string | | package architecture |
| **content\_view** string / required | | Name of the content view |
| **date\_type** string | **Choices:*** issued
* **updated** ←
| Search using the 'Issued On' or 'Updated On' Only valid on *filter\_type=erratum*. |
| **description** string | | Description of the Content View Filter |
| **end\_date** string | | erratum end date (YYYY-MM-DD) |
| **errata\_id** string | | erratum id |
| **filter\_state** string | **Choices:*** **present** ←
* absent
| State of the content view filter |
| **filter\_type** string / required | **Choices:*** rpm
* package\_group
* erratum
* docker
| Content view filter type |
| **inclusion** boolean | **Choices:*** **no** ←
* yes
| Create an include filter |
| **max\_version** string | | package maximum version |
| **min\_version** string | | package minimum version |
| **name** string / required | | Name of the Content View Filter |
| **organization** string / required | | Organization that the entity is in |
| **original\_packages** boolean | **Choices:*** no
* yes
| Include all RPMs with no errata |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **repositories** list / elements=dictionary | **Default:**[] | List of repositories that include name and product An empty Array means all current and future repositories |
| **rule\_name** string | | Content view filter rule name or package name If omitted, the value of *name* will be used if necessary
aliases: package\_name, package\_group, tag |
| **rule\_state** string | **Choices:*** **present** ←
* absent
| State of the content view filter rule |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **start\_date** string | | erratum start date (YYYY-MM-DD) |
| **types** list / elements=string | **Default:**["bugfix", "enhancement", "security"] | erratum types (enhancement, bugfix, security) |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
| **version** string | | package version |
Examples
--------
```
- name: Exclude csh
theforeman.foreman.content_view_filter:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "package filter 1"
organization: "Default Organization"
content_view: Web Servers
filter_type: "rpm"
package_name: tcsh
- name: Include newer csh versions
theforeman.foreman.content_view_filter:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "package filter 1"
organization: "Default Organization"
content_view: Web Servers
filter_type: "rpm"
package_name: tcsh
min_version: 6.20.00
inclusion: True
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **content\_view\_filters** list / elements=dictionary | success | List of content view filters. |
### Authors
* Sean O’Keeffe (@sean797)
| programming_docs |
ansible theforeman.foreman.smart_proxy – Manage Smart Proxies theforeman.foreman.smart\_proxy – Manage Smart Proxies
======================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.smart_proxy`.
New in version 1.4.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update and delete Smart Proxies
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **download\_policy** string | **Choices:*** background
* immediate
* on\_demand
| The download policy for the Smart Proxy Only available for Katello installations. |
| **lifecycle\_environments** list / elements=string | | Lifecycle Environments synced to the Smart Proxy. Only available for Katello installations. |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | Name of the Smart Proxy |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **url** string / required | | URL of the Smart Proxy |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Notes
-----
Note
* Even with *state=present* this module does not install a new Smart Proxy.
* It can only associate an existing Smart Proxy listening at the specified *url*.
* Consider using *foreman-installer* to create Smart Proxies.
Examples
--------
```
# Create a local Smart Proxy
- name: "Create Smart Proxy"
theforeman.foreman.smart_proxy:
username: "admin"
password: "changeme"
server_url: "https://{{ ansible_fqdn }}"
name: "{{ ansible_fqdn }}"
url: "https://{{ ansible_fqdn }}:9090"
download_policy: "immediate"
lifecycle_environments:
- "Development"
organizations:
- "Default Organization"
locations:
- "Default Location"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **smart\_proxies** list / elements=dictionary | success | List of smart\_proxies. |
### Authors
* James Stuart (@jstuart)
* Matthias M Dellweg (@mdellweg)
* Jeffrey van Pelt (@Thulium-Drake)
ansible theforeman.foreman.domain – Manage Domains theforeman.foreman.domain – Manage Domains
==========================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.domain`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete Domains
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Full name describing the domain
aliases: fullname |
| **dns\_proxy** string | | DNS proxy to use within this domain for managing A records
aliases: dns |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | The full DNS domain name |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **parameters** list / elements=dictionary | | Domain specific host parameters |
| | **name** string / required | | Name of the parameter |
| | **parameter\_type** string | **Choices:*** **string** ←
* boolean
* integer
* real
* array
* hash
* yaml
* json
| Type of the parameter |
| | **value** raw / required | | Value of the parameter |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **updated\_name** string | | New domain name. When this parameter is set, the module will not be idempotent. |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: domain
theforeman.foreman.domain:
name: "example.org"
description: "Example Domain"
locations:
- "Munich"
organizations:
- "ACME"
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **domains** list / elements=dictionary | success | List of domains. |
### Authors
* Markus Bucher (@m-bucher) ATIX AG
ansible theforeman.foreman.auth_source_ldap – Manage LDAP Authentication Sources theforeman.foreman.auth\_source\_ldap – Manage LDAP Authentication Sources
==========================================================================
Note
This plugin is part of the [theforeman.foreman collection](https://galaxy.ansible.com/theforeman/foreman) (version 2.2.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install theforeman.foreman`.
To use it in a playbook, specify: `theforeman.foreman.auth_source_ldap`.
New in version 1.0.0: of theforeman.foreman
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, and delete LDAP authentication sources
Requirements
------------
The below requirements are needed on the host that executes this module.
* requests
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **account** string | | Account name to use when accessing the LDAP server. |
| **account\_password** string | | Account password to use when accessing the LDAP server. Required when using *onthefly\_register*. When this parameter is set, the module will not be idempotent. |
| **attr\_firstname** string | | Attribute containing first name. Required when using *onthefly\_register*. |
| **attr\_lastname** string | | Attribute containing last name. Required when using *onthefly\_register*. |
| **attr\_login** string | | Attribute containing login ID. Required when using *onthefly\_register*. |
| **attr\_mail** string | | Attribute containing email address. Required when using *onthefly\_register*. |
| **attr\_photo** string | | Attribute containing user photo |
| **base\_dn** string | | The base DN to use when searching. |
| **groups\_base** string | | Base DN where groups reside. |
| **host** string / required | | The hostname of the LDAP server |
| **ldap\_filter** string | | Filter to apply to LDAP searches |
| **locations** list / elements=string | | List of locations the entity should be assigned to |
| **name** string / required | | The name of the LDAP authentication source |
| **onthefly\_register** boolean | **Choices:*** no
* yes
| Whether or not to register users on the fly. |
| **organizations** list / elements=string | | List of organizations the entity should be assigned to |
| **password** string / required | | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_PASSWORD` will be used instead. |
| **port** integer | **Default:**389 | The port number of the LDAP server |
| **server\_type** string | **Choices:*** free\_ipa
* active\_directory
* posix
| Type of the LDAP server |
| **server\_url** string / required | | URL of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_SERVER_URL` will be used instead. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the entity |
| **tls** boolean | **Choices:*** no
* yes
| Whether or not to use TLS when contacting the LDAP server. |
| **use\_netgroups** boolean | **Choices:*** no
* yes
| Whether to use NIS netgroups instead of posix groups, not valid for *server\_type=active\_directory*
|
| **usergroup\_sync** boolean | **Choices:*** no
* yes
| Whether or not to sync external user groups on login |
| **username** string / required | | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_USERNAME` will be used instead. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable `FOREMAN_VALIDATE_CERTS` will be used instead. |
Examples
--------
```
- name: LDAP Authentication source
theforeman.foreman.auth_source_ldap:
name: "Example LDAP"
host: "ldap.example.org"
server_url: "https://foreman.example.com"
locations:
- "Uppsala"
organizations:
- "Sweden"
username: "admin"
password: "changeme"
state: present
- name: LDAP Authentication with automatic registration
theforeman.foreman.auth_source_ldap:
name: "Example LDAP"
host: "ldap.example.org"
onthefly_register: True
account: uid=ansible,cn=sysaccounts,cn=etc,dc=example,dc=com
account_password: secret
base_dn: dc=example,dc=com
groups_base: cn=groups,cn=accounts, dc=example,dc=com
server_type: free_ipa
attr_login: uid
attr_firstname: givenName
attr_lastname: sn
attr_mail: mail
attr_photo: jpegPhoto
server_url: "https://foreman.example.com"
username: "admin"
password: "changeme"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entity** dictionary | success | Final state of the affected entities grouped by their type. |
| | **auth\_source\_ldaps** list / elements=dictionary | success | List of auth sources for LDAP. |
### Authors
* Christoffer Reijer (@ephracis) Basalt AB
ansible Collections in the Splunk Namespace Collections in the Splunk Namespace
===================================
These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **splunk** namespace.
* [splunk.es](es/index#plugins-in-splunk-es)
ansible splunk.es.correlation_search_info – Manage Splunk Enterprise Security Correlation Searches splunk.es.correlation\_search\_info – Manage Splunk Enterprise Security Correlation Searches
============================================================================================
Note
This plugin is part of the [splunk.es collection](https://galaxy.ansible.com/splunk/es) (version 1.0.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install splunk.es`.
To use it in a playbook, specify: `splunk.es.correlation_search_info`.
New in version 1.0.0: of splunk.es
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module allows for the query of Splunk Enterprise Security Correlation Searches
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | | Name of coorelation search |
Examples
--------
```
- name: Example usage of splunk.es.correlation_search_info
splunk.es.correlation_search_info:
name: "Name of correlation search"
register: scorrelation_search_info
- name: debug display information gathered
debug:
var: scorrelation_search_info
```
### Authors
* Ansible Security Automation Team (@maxamillion) <<https://github.com/ansible-security>>
ansible Splunk.Es Splunk.Es
=========
Collection version 1.0.2
Plugin Index
------------
These are the plugins in the splunk.es collection
### Httpapi Plugins
* [splunk](splunk_httpapi#ansible-collections-splunk-es-splunk-httpapi) – HttpApi Plugin for Splunk
### Modules
* [adaptive\_response\_notable\_event](adaptive_response_notable_event_module#ansible-collections-splunk-es-adaptive-response-notable-event-module) – Manage Splunk Enterprise Security Notable Event Adaptive Responses
* [correlation\_search](correlation_search_module#ansible-collections-splunk-es-correlation-search-module) – Manage Splunk Enterprise Security Correlation Searches
* [correlation\_search\_info](correlation_search_info_module#ansible-collections-splunk-es-correlation-search-info-module) – Manage Splunk Enterprise Security Correlation Searches
* [data\_input\_monitor](data_input_monitor_module#ansible-collections-splunk-es-data-input-monitor-module) – Manage Splunk Data Inputs of type Monitor
* [data\_input\_network](data_input_network_module#ansible-collections-splunk-es-data-input-network-module) – Manage Splunk Data Inputs of type TCP or UDP
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible splunk.es.data_input_monitor – Manage Splunk Data Inputs of type Monitor splunk.es.data\_input\_monitor – Manage Splunk Data Inputs of type Monitor
==========================================================================
Note
This plugin is part of the [splunk.es collection](https://galaxy.ansible.com/splunk/es) (version 1.0.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install splunk.es`.
To use it in a playbook, specify: `splunk.es.data_input_monitor`.
New in version 1.0.0: of splunk.es
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module allows for addition or deletion of File and Directory Monitor Data Inputs in Splunk.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **blacklist** string | | Specify a regular expression for a file path. The file path that matches this regular expression is not indexed. |
| **check\_index** boolean | **Choices:*** **no** ←
* yes
| If set to `True`, the index value is checked to ensure that it is the name of a valid index. |
| **check\_path** boolean | **Choices:*** no
* yes
| If set to `True`, the name value is checked to ensure that it exists. |
| **crc\_salt** string | | A string that modifies the file tracking identity for files in this input. The magic value <SOURCE> invokes special behavior (see admin documentation). |
| **disabled** boolean | **Choices:*** **no** ←
* yes
| Indicates if input monitoring is disabled. |
| **followTail** boolean | **Choices:*** **no** ←
* yes
| If set to `True`, files that are seen for the first time is read from the end. |
| **host** string | | The value to populate in the host field for events from this data input. |
| **host\_regex** string | | Specify a regular expression for a file path. If the path for a file matches this regular expression, the captured value is used to populate the host field for events from this data input. The regular expression must have one capture group. |
| **host\_segment** integer | | Use the specified slash-separate segment of the filepath as the host field value. |
| **ignore\_older\_than** string | | Specify a time value. If the modification time of a file being monitored falls outside of this rolling time window, the file is no longer being monitored. |
| **index** string | | Which index events from this input should be stored in. Defaults to default. |
| **name** string / required | | The file or directory path to monitor on the system. |
| **recursive** boolean | **Choices:*** **no** ←
* yes
| Setting this to False prevents monitoring of any subdirectories encountered within this data input. |
| **rename\_source** string | | The value to populate in the source field for events from this data input. The same source should not be used for multiple data inputs. |
| **sourcetype** string | | The value to populate in the sourcetype field for incoming events. |
| **state** string / required | **Choices:*** present
* absent
| Add or remove a data source. |
| **time\_before\_close** integer | | When Splunk software reaches the end of a file that is being read, the file is kept open for a minimum of the number of seconds specified in this value. After this period has elapsed, the file is checked again for more data. |
| **whitelist** string | | Specify a regular expression for a file path. Only file paths that match this regular expression are indexed. |
Examples
--------
```
- name: Example adding data input monitor with splunk.es.data_input_monitor
splunk.es.data_input_monitor:
name: "/var/log/example.log"
state: "present"
recursive: True
```
### Authors
* Ansible Security Automation Team (@maxamillion) <<https://github.com/ansible-security>>
| programming_docs |
ansible splunk.es.adaptive_response_notable_event – Manage Splunk Enterprise Security Notable Event Adaptive Responses splunk.es.adaptive\_response\_notable\_event – Manage Splunk Enterprise Security Notable Event Adaptive Responses
=================================================================================================================
Note
This plugin is part of the [splunk.es collection](https://galaxy.ansible.com/splunk/es) (version 1.0.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install splunk.es`.
To use it in a playbook, specify: `splunk.es.adaptive_response_notable_event`.
New in version 1.0.0: of splunk.es
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module allows for creation, deletion, and modification of Splunk Enterprise Security Notable Event Adaptive Responses that are associated with a correlation search
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **asset\_extraction** list / elements=string | **Choices:*** **src** ←
* **dest** ←
* **dvc** ←
* **orig\_host** ←
**Default:**["src", "dest", "dvc", "orig\_host"] | list of assets to extract, select any one or many of the available choices defaults to all available choices |
| **correlation\_search\_name** string / required | | Name of correlation search to associate this notable event adaptive response with |
| **default\_owner** string | | Default owner of the notable event, if unset it will default to Splunk System Defaults |
| **default\_status** string | **Choices:*** unassigned
* new
* in progress
* pending
* resolved
* closed
| Default status of the notable event, if unset it will default to Splunk System Defaults |
| **description** string / required | | Description of the notable event, this will populate the description field for the web console |
| **drill\_down\_earliest\_offset** string | **Default:**"$info\_min\_time$" | Set the amount of time before the triggering event to search for related events. For example, 2h. Use "$info\_min\_time$" to set the drill-down time to match the earliest time of the search |
| **drill\_down\_latest\_offset** string | **Default:**"$info\_max\_time$" | Set the amount of time after the triggering event to search for related events. For example, 1m. Use "$info\_max\_time$" to set the drill-down time to match the latest time of the search |
| **drill\_down\_name** string | | Name for drill down search, Supports variable substitution with fields from the matching event. |
| **drill\_down\_search** string | | Drill down search, Supports variable substitution with fields from the matching event. |
| **identity\_extraction** list / elements=string | **Choices:*** **user** ←
* **src\_user** ←
**Default:**["user", "src\_user"] | list of identity fields to extract, select any one or many of the available choices defaults to all available choices |
| **investigation\_profiles** string | | Investigation profile to assiciate the notable event with. |
| **name** string / required | | Name of notable event |
| **next\_steps** list / elements=string | | List of adaptive responses that should be run next Describe next steps and response actions that an analyst could take to address this threat. |
| **recommended\_actions** list / elements=string | | List of adaptive responses that are recommended to be run next Identifying Recommended Adaptive Responses will highlight those actions for the analyst when looking at the list of response actions available, making it easier to find them among the longer list of available actions. |
| **security\_domain** string | **Choices:*** access
* endpoint
* network
* **threat** ←
* identity
* audit
| Splunk Security Domain |
| **severity** string | **Choices:*** informational
* low
* medium
* **high** ←
* critical
* unknown
| Severity rating |
| **state** string / required | **Choices:*** present
* absent
| Add or remove a data source. |
Examples
--------
```
- name: Example of using splunk.es.adaptive_response_notable_event module
splunk.es.adaptive_response_notable_event:
name: "Example notable event from Ansible"
correlation_search_name: "Example Correlation Search From Ansible"
description: "Example notable event from Ansible, description."
state: "present"
next_steps:
- ping
- nslookup
recommended_actions:
- script
- ansiblesecurityautomation
```
### Authors
* Ansible Security Automation Team (@maxamillion) <<https://github.com/ansible-security>>
ansible splunk.es.correlation_search – Manage Splunk Enterprise Security Correlation Searches splunk.es.correlation\_search – Manage Splunk Enterprise Security Correlation Searches
======================================================================================
Note
This plugin is part of the [splunk.es collection](https://galaxy.ansible.com/splunk/es) (version 1.0.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install splunk.es`.
To use it in a playbook, specify: `splunk.es.correlation_search`.
New in version 1.0.0: of splunk.es
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module allows for creation, deletion, and modification of Splunk Enterprise Security Correlation Searches
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **app** string | **Default:**"SplunkEnterpriseSecuritySuite" | Splunk app to associate the correlation seach with |
| **cron\_schedule** string | **Default:**"\*/5 \* \* \* \*" | Enter a cron-style schedule. For example `'*/5 * * * *'` (every 5 minutes) or `'0 21 * * *'` (every day at 9 PM). Real-time searches use a default schedule of `'*/5 * * * *'`. |
| **description** string / required | | Description of the coorelation search, this will populate the description field for the web console |
| **name** string / required | | Name of coorelation search |
| **schedule\_priority** string | **Choices:*** **Default** ←
* Higher
* Highest
| Raise the scheduling priority of a report. Set to "Higher" to prioritize it above other searches of the same scheduling mode, or "Highest" to prioritize it above other searches regardless of mode. Use with discretion. |
| **schedule\_window** string | **Default:**"0" | Let report run at any time within a window that opens at its scheduled run time, to improve efficiency when there are many concurrently scheduled reports. The "auto" setting automatically determines the best window width for the report. |
| **scheduling** string | **Choices:*** **real-time** ←
* continuous
| Controls the way the scheduler computes the next execution time of a scheduled search. Learn more: https://docs.splunk.com/Documentation/Splunk/7.2.3/Report/Configurethepriorityofscheduledreports#Real-time\_scheduling\_and\_continuous\_scheduling |
| **search** string / required | | SPL search string |
| **state** string / required | **Choices:*** present
* absent
* enabled
* disabled
| Add, remove, enable, or disiable a correlation search. |
| **suppress\_alerts** boolean | **Choices:*** **no** ←
* yes
| To suppress alerts from this correlation search or not |
| **throttle\_fields\_to\_group\_by** string | | Type the fields to consider for matching events for throttling. |
| **throttle\_window\_duration** string | | How much time to ignore other events that match the field values specified in Fields to group by. |
| **time\_earliest** string | **Default:**"-24h" | Earliest time using relative time modifiers. |
| **time\_latest** string | **Default:**"now" | Latest time using relative time modifiers. |
| **trigger\_alert\_when** string | **Choices:*** **number of events** ←
* number of results
* number of hosts
* number of sources
| Raise the scheduling priority of a report. Set to "Higher" to prioritize it above other searches of the same scheduling mode, or "Highest" to prioritize it above other searches regardless of mode. Use with discretion. |
| **trigger\_alert\_when\_condition** string | **Choices:*** **greater than** ←
* less than
* equal to
* not equal to
* drops by
* rises by
| Conditional to pass to `trigger_alert_when`
|
| **trigger\_alert\_when\_value** string | **Default:**"10" | Value to pass to `trigger_alert_when`
|
| **ui\_dispatch\_context** string | | Set an app to use for links such as the drill-down search in a notable event or links in an email adaptive response action. If None, uses the Application Context. |
Notes
-----
Note
* The following options are not yet supported: throttle\_window\_duration, throttle\_fields\_to\_group\_by, and adaptive\_response\_actions
Examples
--------
```
- name: Example of creating a correlation search with splunk.es.coorelation_search
splunk.es.correlation_search:
name: "Example Coorelation Search From Ansible"
description: "Example Coorelation Search From Ansible, description."
search: 'source="/var/log/snort.log"'
state: "present"
```
### Authors
* Ansible Security Automation Team (@maxamillion) <<https://github.com/ansible-security>>
ansible splunk.es.data_input_network – Manage Splunk Data Inputs of type TCP or UDP splunk.es.data\_input\_network – Manage Splunk Data Inputs of type TCP or UDP
=============================================================================
Note
This plugin is part of the [splunk.es collection](https://galaxy.ansible.com/splunk/es) (version 1.0.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install splunk.es`.
To use it in a playbook, specify: `splunk.es.data_input_network`.
New in version 1.0.0: of splunk.es
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module allows for addition or deletion of TCP and UDP Data Inputs in Splunk.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **connection\_host** string | **Choices:*** **ip** ←
* dns
* none
| Set the host for the remote server that is sending data.
`ip` sets the host to the IP address of the remote server sending data.
`dns` sets the host to the reverse DNS entry for the IP address of the remote server sending data.
`none` leaves the host as specified in inputs.conf, which is typically the Splunk system hostname. |
| **datatype** string | **Choices:*** cooked
* **raw** ←
| Forwarders can transmit three types of data: raw, unparsed, or parsed. `cooked` data refers to parsed and unparsed formats. |
| **host** string | | Host from which the indexer gets data. |
| **index** string | | default Index to store generated events. |
| **name** string / required | | The input port which receives raw data. |
| **protocol** string / required | **Choices:*** tcp
* udp
| Choose between tcp or udp |
| **queue** string | **Choices:*** **parsingQueue** ←
* indexQueue
| Specifies where the input processor should deposit the events it reads. Defaults to parsingQueue. Set queue to parsingQueue to apply props.conf and other parsing rules to your data. For more information about props.conf and rules for timestamping and linebreaking, refer to props.conf and the online documentation at "Monitor files and directories with inputs.conf" Set queue to indexQueue to send your data directly into the index. |
| **rawTcpDoneTimeout** integer | **Default:**10 | Specifies in seconds the timeout value for adding a Done-key. If a connection over the port specified by name remains idle after receiving data for specified number of seconds, it adds a Done-key. This implies the last event is completely received. |
| **restrictToHost** string | | Allows for restricting this input to only accept data from the host specified here. |
| **source** string | | Sets the source key/field for events from this input. Defaults to the input file path. Sets the source key initial value. The key is used during parsing/indexing, in particular to set the source field during indexing. It is also the source field used at search time. As a convenience, the chosen string is prepended with 'source::'. Note: Overriding the source key is generally not recommended. Typically, the input layer provides a more accurate string to aid in problem analysis and investigation, accurately recording the file from which the data was retrieved. Consider use of source types, tagging, and search wildcards before overriding this value. |
| **sourcetype** string | | Set the source type for events from this input. "sourcetype=" is automatically prepended to <string>. Defaults to audittrail (if signedaudit=True) or fschange (if signedaudit=False). |
| **ssl** boolean | **Choices:*** no
* yes
| Enable or disble ssl for the data stream |
| **state** string | **Choices:*** **present** ←
* absent
* enabled
* disable
| Enable, disable, create, or destroy |
Examples
--------
```
- name: Example adding data input network with splunk.es.data_input_network
splunk.es.data_input_network:
name: "8099"
protocol: "tcp"
state: "present"
```
### Authors
* Ansible Security Automation Team (@maxamillion) <<https://github.com/ansible-security>>
ansible splunk.es.splunk – HttpApi Plugin for Splunk splunk.es.splunk – HttpApi Plugin for Splunk
============================================
Note
This plugin is part of the [splunk.es collection](https://galaxy.ansible.com/splunk/es) (version 1.0.2).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install splunk.es`.
To use it in a playbook, specify: `splunk.es.splunk`.
New in version 1.0: of splunk.es
Synopsis
--------
* This HttpApi plugin provides methods to connect to Splunk over a HTTP(S)-based api.
### Authors
* Ansible Security Automation Team
ansible Collections in the Netapp_eseries Namespace Collections in the Netapp\_eseries Namespace
============================================
These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **netapp\_eseries** namespace.
* [netapp\_eseries.santricity](santricity/index#plugins-in-netapp-eseries-santricity)
ansible netapp_eseries.santricity.netapp_e_snapshot_volume – NetApp E-Series manage snapshot volumes. netapp\_eseries.santricity.netapp\_e\_snapshot\_volume – NetApp E-Series manage snapshot volumes.
=================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_snapshot_volume`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, remove snapshot volumes for NetApp E/EF-Series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **api\_url** string / required | | The url to the SANtricity WebServices Proxy or embedded REST API. |
| **api\_username** string / required | | The username to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **full\_threshold** integer | **Default:**85 | The repository utilization warning threshold percentage |
| **name** string / required | | The name you wish to give the snapshot volume |
| **repo\_percentage** integer | **Default:**20 | The size of the view in relation to the size of the base volume |
| **snapshot\_image\_id** string / required | | The identifier of the snapshot image used to create the new snapshot volume. Note: You'll likely want to use the M(netapp\_e\_facts) module to find the ID of the image you want. |
| **ssid** string / required | | storage array ID |
| **state** string / required | **Choices:*** absent
* present
| Whether to create or remove the snapshot volume |
| **storage\_pool\_name** string / required | | Name of the storage pool on which to allocate the repository volume. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **view\_mode** string / required | **Choices:*** **readOnly** ←
* readWrite
* modeUnknown
* \_\_Undefined
| The snapshot volume access mode |
Notes
-----
Note
* Only *full\_threshold* is supported for update operations. If the snapshot volume already exists and the threshold matches, then an `ok` status will be returned, no other changes can be made to a pre-existing snapshot volume.
Examples
--------
```
- name: Snapshot volume
netapp_e_snapshot_volume:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}/"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
state: present
storage_pool_name: "{{ snapshot_volume_storage_pool_name }}"
snapshot_image_id: "{{ snapshot_volume_image_id }}"
name: "{{ snapshot_volume_name }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Success message **Sample:** Json facts for the volume that was created. |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.netapp_e_flashcache – NetApp E-Series manage SSD caches netapp\_eseries.santricity.netapp\_e\_flashcache – NetApp E-Series manage SSD caches
====================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_flashcache`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create or remove SSD caches on a NetApp E-Series storage array.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **api\_url** string / required | | The url to the SANtricity WebServices Proxy or embedded REST API. |
| **api\_username** string / required | | The username to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **cache\_size\_min** integer | | The minimum size (in size\_units) of the ssd cache. The cache will be expanded if this exceeds the current size of the cache. |
| **criteria\_disk\_phy\_type** string | **Choices:*** sas
* sas4k
* fibre
* fibre520b
* scsi
* sata
* pata
| Type of physical disk |
| **disk\_count** integer | | The minimum number of disks to use for building the cache. The cache will be expanded if this number exceeds the number of disks already in place |
| **disk\_refs** list / elements=string | | List of disk references |
| **io\_type** string | **Choices:*** **filesystem** ←
* database
* media
| The type of workload to optimize the cache for. |
| **log\_mode** string | | Log mode |
| **log\_path** string | | Log path |
| **name** string / required | | The name of the SSD cache to manage |
| **size\_unit** string | **Choices:*** bytes
* b
* kb
* mb
* **gb** ←
* tb
* pb
* eb
* zb
* yb
| The unit to be applied to size arguments |
| **ssid** string / required | | The ID of the array to manage (as configured on the web services proxy). |
| **state** string / required | **Choices:*** **present** ←
* absent
| Whether the specified SSD cache should exist or not. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Examples
--------
```
- name: Flash Cache
netapp_e_flashcache:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
name: SSDCacheBuiltByAnsible
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Success message **Sample:** json for newly created flash cache |
### Authors
* Kevin Hulquest (@hulquest)
| programming_docs |
ansible netapp_eseries.santricity.netapp_e_facts – NetApp E-Series retrieve facts about NetApp E-Series storage arrays netapp\_eseries.santricity.netapp\_e\_facts – NetApp E-Series retrieve facts about NetApp E-Series storage arrays
=================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_facts`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The netapp\_e\_facts module returns a collection of facts regarding NetApp E-Series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
---
- name: Get array facts
netapp_e_facts:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** ['Gathered facts for storage array. Array ID [1].', 'Gathered facts for web services proxy.'] |
| **storage\_array\_facts** complex | on successful inquiry from from embedded web services rest api | provides details about the array, controllers, management interfaces, hostside interfaces, driveside interfaces, disks, storage pools, volumes, snapshots, and features. |
| | **netapp\_controllers** complex | success | storage array controller list that contains basic controller identification and status **Sample:** [[{'name': 'A', 'serial': '021632007299', 'status': 'optimal'}, {'name': 'B', 'serial': '021632007300', 'status': 'failed'}]] |
| | **netapp\_disks** complex | success | drive list that contains identification, type, and status information for each drive **Sample:** [[{'available': False, 'firmware\_version': 'MS02', 'id': '01000000500003960C8B67880000000000000000', 'media\_type': 'ssd', 'product\_id': 'PX02SMU080 ', 'serial\_number': '15R0A08LT2BA', 'status': 'optimal', 'tray\_ref': '0E00000000000000000000000000000000000000', 'usable\_bytes': '799629205504'}]] |
| | **netapp\_driveside\_interfaces** complex | success | drive side interface list that contains identification, type, and speed for each interface **Sample:** [[{'controller': 'A', 'interface\_speed': '12g', 'interface\_type': 'sas'}], [{'controller': 'B', 'interface\_speed': '10g', 'interface\_type': 'iscsi'}]] |
| | **netapp\_enabled\_features** complex | on success | specifies the enabled features on the storage array. **Sample:** [['flashReadCache', 'performanceTier', 'protectionInformation', 'secureVolume']] |
| | **netapp\_host\_groups** complex | on success | specifies the host groups on the storage arrays. **Sample:** [[{'id': '85000000600A098000A4B28D003610705C40B964', 'name': 'group1'}]] |
| | **netapp\_host\_types** complex | on success | lists the available host types on the storage array. **Sample:** [[{'index': 0, 'type': 'FactoryDefault'}, {'index': 1, 'type': 'W2KNETNCL'}, {'index': 2, 'type': 'SOL'}, {'index': 5, 'type': 'AVT\_4M'}, {'index': 6, 'type': 'LNX'}, {'index': 7, 'type': 'LnxALUA'}, {'index': 8, 'type': 'W2KNETCL'}, {'index': 9, 'type': 'AIX MPIO'}, {'index': 10, 'type': 'VmwTPGSALUA'}, {'index': 15, 'type': 'HPXTPGS'}, {'index': 17, 'type': 'SolTPGSALUA'}, {'index': 18, 'type': 'SVC'}, {'index': 22, 'type': 'MacTPGSALUA'}, {'index': 23, 'type': 'WinTPGSALUA'}, {'index': 24, 'type': 'LnxTPGSALUA'}, {'index': 25, 'type': 'LnxTPGSALUA\_PM'}, {'index': 26, 'type': 'ONTAP\_ALUA'}, {'index': 27, 'type': 'LnxTPGSALUA\_SF'}, {'index': 28, 'type': 'LnxDHALUA'}, {'index': 29, 'type': 'ATTOClusterAllOS'}]] |
| | **netapp\_hosts** complex | on success | specifies the hosts on the storage arrays. **Sample:** [[{'group\_id': '85000000600A098000A4B28D003610705C40B964', 'host\_type\_index': 28, 'id': '8203800000000000000000000000000000000000', 'name': 'host1', 'ports': [{'address': '1000FF7CFFFFFF01', 'label': 'FC\_1', 'type': 'fc'}, {'address': '1000FF7CFFFFFF00', 'label': 'FC\_2', 'type': 'fc'}]}]] |
| | **netapp\_hostside\_interfaces** complex | success | host side interface list that contains identification, configuration, type, speed, and status information for each interface **Sample:** [[{'iscsi': [{'controller': 'A', 'current\_interface\_speed': '10g', 'ipv4\_address': '10.10.10.1', 'ipv4\_enabled': True, 'ipv4\_gateway': '10.10.10.1', 'ipv4\_subnet\_mask': '255.255.255.0', 'ipv6\_enabled': False, 'iqn': 'iqn.1996-03.com.netapp:2806.600a098000a81b6d0000000059d60c76', 'link\_status': 'up', 'mtu': 9000, 'supported\_interface\_speeds': ['10g']}]}]] |
| | **netapp\_management\_interfaces** complex | success | management interface list that contains identification, configuration, and status for each interface **Sample:** [[{'alias': 'ict-2800-A', 'channel': 1, 'controller': 'A', 'dns\_config\_method': 'dhcp', 'dns\_servers': [], 'ipv4\_address': '10.1.1.1', 'ipv4\_address\_config\_method': 'static', 'ipv4\_enabled': True, 'ipv4\_gateway': '10.113.1.1', 'ipv4\_subnet\_mask': '255.255.255.0', 'ipv6\_enabled': False, 'link\_status': 'up', 'mac\_address': '00A098A81B5D', 'name': 'wan0', 'ntp\_config\_method': 'disabled', 'ntp\_servers': [], 'remote\_ssh\_access': False}]] |
| | **netapp\_storage\_array** dictionary | success | provides storage array identification, firmware version, and available capabilities **Sample:** [{'cacheBlockSizes': [4096, 8192, 16384, 32768], 'chassis\_serial': '021540006043', 'firmware': '08.40.00.01', 'name': 'ict-2800-11\_40', 'supportedSegSizes': [8192, 16384, 32768, 65536, 131072, 262144, 524288], 'wwn': '600A098000A81B5D0000000059D60C76'}] |
| | **netapp\_storage\_pools** complex | success | storage pool list that contains identification and capacity information for each pool **Sample:** [[{'available\_capacity': '3490353782784', 'id': '04000000600A098000A81B5D000002B45A953A61', 'name': 'Raid6', 'total\_capacity': '5399466745856', 'used\_capacity': '1909112963072'}]] |
| | **netapp\_volumes** complex | success | storage volume list that contains identification and capacity information for each volume **Sample:** [[{'capacity': '5368709120', 'id': '02000000600A098000AAC0C3000002C45A952BAA', 'is\_thin\_provisioned': False, 'name': '5G', 'parent\_storage\_pool\_id': '04000000600A098000A81B5D000002B45A953A61'}]] |
| | **netapp\_volumes\_by\_initiators** complex | success | list of available volumes keyed by the mapped initiators. **Sample:** [{'192\_168\_1\_1': [{'id': '02000000600A098000A4B9D1000015FD5C8F7F9E', 'meta\_data': {'filetype': 'xfs', 'public': True}, 'name': 'some\_volume', 'workload\_name': 'test2\_volumes', 'wwn': '600A098000A4B9D1000015FD5C8F7F9E'}]}] |
| | **netapp\_workload\_tags** complex | success | workload tag list **Sample:** [[{'id': '87e19568-43fb-4d8d-99ea-2811daaa2b38', 'name': 'ftp\_server', 'workloadAttributes': [{'key': 'use', 'value': 'general'}]}]] |
| | **snapshot\_images** complex | success | snapshot image list that contains identification, capacity, and status information for each snapshot image **Sample:** [[{'active\_cow': True, 'creation\_method': 'user', 'id': '34000000600A098000A81B5D00630A965B0535AC', 'pit\_capacity': '5368709120', 'reposity\_cap\_utilization': '0', 'rollback\_source': False, 'status': 'optimal'}]] |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_hostgroup – NetApp E-Series manage array host groups netapp\_eseries.santricity.netapp\_e\_hostgroup – NetApp E-Series manage array host groups
==========================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_hostgroup`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update or destroy host groups on a NetApp E-Series storage array.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **hosts** list / elements=string | | List of host names/labels to add to the group |
| **id** string | | Host reference identifier for the host group to manage. This option is mutually exclusive with *name*. |
| **name** string | | Name of the host group to manage This option is mutually exclusive with *id*. |
| **new\_name** string | | Specify this when you need to update the name of a host group |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string / required | **Choices:*** present
* absent
| Whether the specified host group should exist or not. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Configure Hostgroup
netapp_e_hostgroup:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **clusterRef** string | always except when state is absent | The unique identification value for this object. Other objects may use this reference value to refer to the cluster. **Sample:** 3233343536373839303132333100000000000000 |
| **confirmLUNMappingCreation** boolean | always | If true, indicates that creation of LUN-to-volume mappings should require careful confirmation from the end-user, since such a mapping will alter the volume access rights of other clusters, in addition to this one. |
| **hosts** list / elements=string | always except when state is absent | A list of the hosts that are part of the host group after all operations. **Sample:** ['HostA', 'HostB'] |
| **id** string | always except when state is absent | The id number of the hostgroup **Sample:** 3233343536373839303132333100000000000000 |
| **isSAControlled** boolean | always except when state is absent | If true, indicates that I/O accesses from this cluster are subject to the storage array's default LUN-to-volume mappings. If false, indicates that I/O accesses from the cluster are subject to cluster-specific LUN-to-volume mappings. |
| **label** string | always | The user-assigned, descriptive label string for the cluster. **Sample:** MyHostGroup |
| **name** string | always except when state is absent | same as label **Sample:** MyHostGroup |
| **protectionInformationCapableAccessMethod** boolean | always except when state is absent | This field is true if the host has a PI capable access method. **Sample:** True |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_firmware – NetApp E-Series manage firmware. netapp\_eseries.santricity.na\_santricity\_firmware – NetApp E-Series manage firmware.
======================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_firmware`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Ensure specific firmware versions are activated on E-Series storage system.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **clear\_mel\_events** boolean | **Choices:*** **no** ←
* yes
| This flag will force firmware to be activated in spite of the storage system mel-event issues. Warning! This will clear all storage system mel-events. Use at your own risk! |
| **firmware** string / required | | Path to the firmware file. Due to concurrency issues, use M(na\_santricity\_proxy\_firmware\_upload) to upload firmware and nvsram to SANtricity Web Services Proxy when upgrading multiple systems at the same time on the same instance of the proxy. |
| **nvsram** string | | Path to the NVSRAM file. NetApp recommends upgrading the NVSRAM when upgrading firmware. Due to concurrency issues, use M(na\_santricity\_proxy\_firmware\_upload) to upload firmware and nvsram to SANtricity Web Services Proxy when upgrading multiple systems at the same time on the same instance of the proxy. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **wait\_for\_completion** boolean | **Choices:*** **no** ←
* yes
| This flag will cause module to wait for any upgrade actions to complete. When changes are required to both firmware and nvsram and task is executed against SANtricity Web Services Proxy, the firmware will have to complete before nvsram can be installed. |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Ensure correct firmware versions
na_santricity_firmware:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
nvsram: "path/to/nvsram"
firmware: "path/to/bundle"
wait_for_completion: true
clear_mel_events: true
- name: Ensure correct firmware versions
na_santricity_firmware:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
nvsram: "path/to/nvsram"
firmware: "path/to/firmware"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | Status and version of firmware and NVSRAM. |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_volume – NetApp E-Series manage storage volumes (standard and thin) netapp\_eseries.santricity.na\_santricity\_volume – NetApp E-Series manage storage volumes (standard and thin)
==============================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_volume`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create or remove volumes (standard and thin) for NetApp E/EF-series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **cache\_without\_batteries** boolean | **Choices:*** **no** ←
* yes
| Indicates whether caching should be used without battery backup. Warning, M(cache\_without\_batteries==true) and the storage system looses power and there is no battery backup, data will be lost! |
| **data\_assurance\_enabled** boolean | **Choices:*** **no** ←
* yes
| Determines whether data assurance (DA) should be enabled for the volume Only available when creating a new volume and on a storage pool with drives supporting the DA capability. |
| **name** string / required | | The name of the volume to manage. |
| **owning\_controller** string | **Choices:*** A
* B
| Specifies which controller will be the primary owner of the volume Not specifying will allow the controller to choose ownership. |
| **read\_ahead\_enable** boolean | **Choices:*** no
* **yes** ←
| Indicates whether or not automatic cache read-ahead is enabled. This option has no effect on thinly provisioned volumes since the architecture for thin volumes cannot benefit from read ahead caching. |
| **read\_cache\_enable** boolean | **Choices:*** no
* **yes** ←
| Indicates whether read caching should be enabled for the volume. |
| **segment\_size\_kb** integer | **Default:**128 | Segment size of the volume All values are in kibibytes. Some common choices include 8, 16, 32, 64, 128, 256, and 512 but options are system dependent. Retrieve the definitive s ystem list from M(na\_santricity\_facts) under segment\_sizes. When the storage pool is a raidDiskPool then the segment size must be 128kb. Segment size migrations are not allowed in this module |
| **size** float / required | | Required only when *state=="present"*. Size of the volume in *size\_unit*. Size of the virtual volume in the case of a thin volume in *size\_unit*. Maximum virtual volume size of a thin provisioned volume is 256tb; however other OS-level restrictions may exist. |
| **size\_unit** string | **Choices:*** bytes
* b
* kb
* mb
* **gb** ←
* tb
* pb
* eb
* zb
* yb
* pct
| The unit used to interpret the size parameter pct unit defines a percent of total usable storage pool size. |
| **ssd\_cache\_enabled** boolean | **Choices:*** **no** ←
* yes
| Whether an existing SSD cache should be enabled on the volume (fails if no SSD cache defined) The default value is to ignore existing SSD cache setting. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **present** ←
* absent
| Whether the specified volume should exist |
| **storage\_pool\_name** string | | Required only when requested *state=="present"*. Name of the storage pool wherein the volume should reside. |
| **thin\_provision** boolean | **Choices:*** **no** ←
* yes
| Whether the volume should be thin provisioned. Thin volumes can only be created when *raid\_level=="raidDiskPool"*. Generally, use of thin-provisioning is not recommended due to performance impacts. |
| **thin\_volume\_expansion\_policy** string | **Choices:*** **automatic** ←
* manual
| This is the thin volume expansion policy. When *thin\_volume\_expansion\_policy=="automatic"* and *thin\_volume\_growth\_alert\_threshold* is exceed the *thin\_volume\_max\_repo\_size* will be automatically expanded. When *thin\_volume\_expansion\_policy=="manual"* and *thin\_volume\_growth\_alert\_threshold* is exceeded the storage system will wait for manual intervention. The thin volume\_expansion policy can not be modified on existing thin volumes in this module. Generally speaking you should almost always use *thin\_volume\_expansion\_policy=="automatic*. |
| **thin\_volume\_growth\_alert\_threshold** integer | **Default:**95 | This is the thin provision repository utilization threshold (in percent). When the pct of used storage of the maximum repository size exceeds this value then a alert will be issued and the *thin\_volume\_expansion\_policy* will be executed. Values must be between or equal to 10 and 99. |
| **thin\_volume\_max\_repo\_size** float | | This is the maximum amount the thin volume repository will be allowed to grow. Only has significance when *thin\_volume\_expansion\_policy=="automatic"*. When the pct *thin\_volume\_repo\_size* of *thin\_volume\_max\_repo\_size* exceeds *thin\_volume\_growth\_alert\_threshold* then a warning will be issued and the storage array will execute the *thin\_volume\_expansion\_policy* policy. Expansion operations when *thin\_volume\_expansion\_policy=="automatic"* will increase the maximum repository size. Default will be the same as *size*. |
| **thin\_volume\_repo\_size** integer | | This value (in size\_unit) sets the allocated space for the thin provisioned repository. Initial value must between or equal to 4gb and 256gb in increments of 4gb. During expansion operations the increase must be between or equal to 4gb and 256gb in increments of 4gb. This option has no effect during expansion if *thin\_volume\_expansion\_policy=="automatic"*. Generally speaking you should almost always use *thin\_volume\_expansion\_policy=="automatic*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **volume\_metadata** dictionary | | Dictionary containing metadata for the volume itself. Dictionary key cannot be longer than 14 characters Dictionary values cannot be longer than 240 characters |
| **wait\_for\_initialization** boolean | **Choices:*** **no** ←
* yes
| Forces the module to wait for expansion operations to complete before continuing. |
| **workload\_metadata** dictionary | | Dictionary containing meta data for the use, user, location, etc of the volume (dictionary is arbitrarily defined for whatever the user deems useful) When *workload\_name* exists on the storage array but the metadata is different then the workload definition will be updated. (Changes will update all associated volumes!)
*workload\_name* must be specified when *metadata* are defined. Dictionary key cannot be longer than 16 characters Dictionary values cannot be longer than 60 characters
aliases: metadata |
| **workload\_name** string | | Label for the workload defined by the metadata. When *workload\_name* and *metadata* are specified then the defined workload will be added to the storage array. When *workload\_name* exists on the storage array but the metadata is different then the workload definition will be updated. (Changes will update all associated volumes!) Existing workloads can be retrieved using M(na\_santricity\_facts). |
| **write\_cache\_enable** boolean | **Choices:*** no
* **yes** ←
| Indicates whether write-back caching should be enabled for the volume. |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Create simple volume with workload tags (volume meta data)
na_santricity_volume:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: present
name: volume
storage_pool_name: storage_pool
size: 300
size_unit: gb
workload_name: volume_tag
metadata:
key1: value1
key2: value2
- name: Create a thin volume
na_santricity_volume:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: present
name: volume1
storage_pool_name: storage_pool
size: 131072
size_unit: gb
thin_provision: true
thin_volume_repo_size: 32
thin_volume_max_repo_size: 1024
- name: Expand thin volume's virtual size
na_santricity_volume:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: present
name: volume1
storage_pool_name: storage_pool
size: 262144
size_unit: gb
thin_provision: true
thin_volume_repo_size: 32
thin_volume_max_repo_size: 1024
- name: Expand thin volume's maximum repository size
na_santricity_volume:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: present
name: volume1
storage_pool_name: storage_pool
size: 262144
size_unit: gb
thin_provision: true
thin_volume_repo_size: 32
thin_volume_max_repo_size: 2048
- name: Delete volume
na_santricity_volume:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: absent
name: volume
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | State of volume **Sample:** Standard volume [workload\_vol\_1] has been created. |
### Authors
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.na_santricity_lun_mapping – NetApp E-Series manage lun mappings netapp\_eseries.santricity.na\_santricity\_lun\_mapping – NetApp E-Series manage lun mappings
=============================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_lun_mapping`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, delete, or modify mappings between a volume and a targeted host/host+ group.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **lun** integer | | The LUN value you wish to give the mapping. If the supplied *volume\_name* is associated with a different LUN, it will be updated to what is supplied here. LUN value will be determine by the storage-system when not specified. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **present** ←
* absent
| Present will ensure the mapping exists, absent will remove the mapping. |
| **target** string | | The name of host or hostgroup you wish to assign to the mapping If omitted, the default hostgroup is used. If the supplied *volume\_name* is associated with a different target, it will be updated to what is supplied here. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **volume\_name** string / required | | The name of the volume you wish to include in the mapping. Use ACCESS\_VOLUME to reference the in-band access management volume.
aliases: volume |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
---
- name: Map volume1 to the host target host1
na_santricity_lun_mapping:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: present
target: host1
volume: volume1
- name: Delete the lun mapping between volume1 and host1
na_santricity_lun_mapping:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: absent
target: host1
volume: volume1
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | success of the module **Sample:** Lun mapping is complete |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_global – NetApp E-Series manage global settings configuration netapp\_eseries.santricity.na\_santricity\_global – NetApp E-Series manage global settings configuration
========================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_global`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allow the user to configure several of the global settings associated with an E-Series storage-system
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **automatic\_load\_balancing** string | **Choices:*** enabled
* disabled
| Enable automatic load balancing to allow incoming traffic from the hosts to be dynamically managed and balanced across both controllers. Automatic load balancing requires host connectivity reporting to be enabled. |
| **cache\_block\_size** integer | | Size of the cache's block size. All volumes on the storage system share the same cache space; therefore, the volumes can have only one cache block size. See M(na\_santricity\_facts) for available sizes. |
| **cache\_flush\_threshold** integer | | This is the percentage threshold of the amount of unwritten data that is allowed to remain on the storage array's cache before flushing. |
| **default\_host\_type** string | | Default host type for the storage system. Either one of the following names can be specified, Linux DM-MP, VMWare, Windows, Windows Clustered, or a host type index which can be found in M(na\_santricity\_facts) |
| **host\_connectivity\_reporting** string | **Choices:*** enabled
* disabled
| Enable host connectivity reporting to allow host connections to be monitored for connection and multipath driver problems. When M(automatic\_load\_balancing==enabled) then M(host\_connectivity\_reporting) must be enabled |
| **login\_banner\_message** string | | Text message that appears prior to the login page.
*login\_banner\_message==""* will delete any existing banner message. |
| **name** string | | Set the name of the E-Series storage-system This label/name doesn't have to be unique. May be up to 30 characters in length.
aliases: label |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* This module requires Web Services API v1.3 or newer.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Set the storage-system name
na_santricity_global:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
name: myArrayName
cache_block_size: 32768
cache_flush_threshold: 80
automatic_load_balancing: enabled
default_host_type: Linux DM-MP
- name: Set the storage-system name
na_santricity_global:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
name: myOtherArrayName
cache_block_size: 8192
cache_flush_threshold: 60
automatic_load_balancing: disabled
default_host_type: 28
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **array\_name** string | on success | Current storage array's name **Sample:** arrayName |
| **automatic\_load\_balancing** string | on success | Whether automatic load balancing feature has been enabled **Sample:** enabled |
| **cache\_settings** dictionary | on success | Current cache block size and flushing threshold values **Sample:** {'cache\_block\_size': 32768, 'cache\_flush\_threshold': 80} |
| **changed** boolean | on success | Whether global settings were changed **Sample:** True |
| **default\_host\_type\_index** integer | on success | Current default host type index **Sample:** 28 |
| **host\_connectivity\_reporting** string | on success | Whether host connectivity reporting feature has been enabled **Sample:** enabled |
| **login\_banner\_message** string | on success | Current banner message **Sample:** Banner message here! |
### Authors
* Michael Price (@lmprice)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_snapshot_images – NetApp E-Series create and delete snapshot images netapp\_eseries.santricity.netapp\_e\_snapshot\_images – NetApp E-Series create and delete snapshot images
==========================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_snapshot_images`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and delete snapshots images on snapshot groups for NetApp E-series storage arrays.
* Only the oldest snapshot image can be deleted so consistency is preserved.
* Related: Snapshot volumes are created from snapshot images.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **api\_url** string / required | | The url to the SANtricity WebServices Proxy or embedded REST API. |
| **api\_username** string / required | | The username to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **snapshot\_group** string / required | | The name of the snapshot group in which you want to create a snapshot image. |
| **ssid** string | | Storage system identifier |
| **state** string / required | **Choices:*** create
* remove
| Whether a new snapshot image should be created or oldest be deleted. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Examples
--------
```
- name: Create Snapshot
netapp_e_snapshot_images:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ validate_certs }}"
snapshot_group: "3300000060080E5000299C24000005B656D9F394"
state: 'create'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **image\_id** string | state == created | ID of snapshot image **Sample:** 3400000060080E5000299B640063074057BC5C5E |
| **msg** string | always | State of operation **Sample:** Created snapshot image |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.na_santricity_facts – NetApp E-Series retrieve facts about NetApp E-Series storage arrays netapp\_eseries.santricity.na\_santricity\_facts – NetApp E-Series retrieve facts about NetApp E-Series storage arrays
======================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_facts`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The na\_santricity\_facts module returns a collection of facts regarding NetApp E-Series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
---
- name: Get array facts
na_santricity_facts:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** ['Gathered facts for storage array. Array ID [1].', 'Gathered facts for web services proxy.'] |
| **proxy\_facts** complex | on successful inquiry from from web services proxy's rest api | proxy storage system list |
| | **array\_status** string | success | storage system status **Sample:** optimal |
| | **asup\_enabled** boolean | success | storage system auto-support status **Sample:** True |
| | **certificate\_status** string | success | storage system ssl certificate status **Sample:** untrusted |
| | **chassis\_serial** string | success | storage system chassis serial number **Sample:** SX0810032 |
| | **controller** complex | success | controller list that contains identification, ip addresses, and certificate information for each controller **Sample:** [{'certificateStatus': 'selfSigned', 'controllerId': '070000000000000000000001', 'ipAddresses': ['172.17.0.5', '3.3.3.3']}] |
| | **drive\_types** list / elements=string | success | all available storage system drive types **Sample:** ['sas', 'fibre'] |
| | **firmware\_version** string | success | storage system install firmware version **Sample:** 08.50.42.99 |
| | **model** string | success | NetApp E-Series model number **Sample:** 5700 |
| | **name** string | success | storage system name **Sample:** EF570-NVMe |
| | **password\_status** string | success | storage system password status **Sample:** invalid |
| | **ssid** string | success | storage system id **Sample:** ec8ed9d2-eba3-4cac-88fb-0954f327f1d4 |
| | **unconfigured\_space** string | success | unconfigured storage system space in bytes **Sample:** 982259020595200 |
| | **wwn** string | success | storage system unique identifier **Sample:** AC1100051E1E1E1E1E1E1E1E1E1E1E1E |
| **storage\_array\_facts** complex | on successful inquiry from from embedded web services rest api | provides details about the array, controllers, management interfaces, hostside interfaces, driveside interfaces, disks, storage pools, volumes, snapshots, and features. |
| | **netapp\_controllers** complex | success | storage array controller list that contains basic controller identification and status **Sample:** [[{'name': 'A', 'serial': '021632007299', 'status': 'optimal'}, {'name': 'B', 'serial': '021632007300', 'status': 'failed'}]] |
| | **netapp\_disks** complex | success | drive list that contains identification, type, and status information for each drive **Sample:** [[{'available': False, 'firmware\_version': 'MS02', 'id': '01000000500003960C8B67880000000000000000', 'media\_type': 'ssd', 'product\_id': 'PX02SMU080 ', 'serial\_number': '15R0A08LT2BA', 'status': 'optimal', 'tray\_ref': '0E00000000000000000000000000000000000000', 'usable\_bytes': '799629205504'}]] |
| | **netapp\_driveside\_interfaces** complex | success | drive side interface list that contains identification, type, and speed for each interface **Sample:** [[{'controller': 'A', 'interface\_speed': '12g', 'interface\_type': 'sas'}], [{'controller': 'B', 'interface\_speed': '10g', 'interface\_type': 'iscsi'}]] |
| | **netapp\_enabled\_features** complex | on success | specifies the enabled features on the storage array. **Sample:** [['flashReadCache', 'performanceTier', 'protectionInformation', 'secureVolume']] |
| | **netapp\_host\_groups** complex | on success | specifies the host groups on the storage arrays. **Sample:** [[{'id': '85000000600A098000A4B28D003610705C40B964', 'name': 'group1'}]] |
| | **netapp\_host\_types** complex | on success | lists the available host types on the storage array. **Sample:** [[{'index': 0, 'type': 'FactoryDefault'}, {'index': 1, 'type': 'W2KNETNCL'}, {'index': 2, 'type': 'SOL'}, {'index': 5, 'type': 'AVT\_4M'}, {'index': 6, 'type': 'LNX'}, {'index': 7, 'type': 'LnxALUA'}, {'index': 8, 'type': 'W2KNETCL'}, {'index': 9, 'type': 'AIX MPIO'}, {'index': 10, 'type': 'VmwTPGSALUA'}, {'index': 15, 'type': 'HPXTPGS'}, {'index': 17, 'type': 'SolTPGSALUA'}, {'index': 18, 'type': 'SVC'}, {'index': 22, 'type': 'MacTPGSALUA'}, {'index': 23, 'type': 'WinTPGSALUA'}, {'index': 24, 'type': 'LnxTPGSALUA'}, {'index': 25, 'type': 'LnxTPGSALUA\_PM'}, {'index': 26, 'type': 'ONTAP\_ALUA'}, {'index': 27, 'type': 'LnxTPGSALUA\_SF'}, {'index': 28, 'type': 'LnxDHALUA'}, {'index': 29, 'type': 'ATTOClusterAllOS'}]] |
| | **netapp\_hosts** complex | on success | specifies the hosts on the storage arrays. **Sample:** [[{'group\_id': '85000000600A098000A4B28D003610705C40B964', 'host\_type\_index': 28, 'id': '8203800000000000000000000000000000000000', 'name': 'host1', 'ports': [{'address': '1000FF7CFFFFFF01', 'label': 'FC\_1', 'type': 'fc'}, {'address': '1000FF7CFFFFFF00', 'label': 'FC\_2', 'type': 'fc'}]}]] |
| | **netapp\_hostside\_interfaces** complex | success | host side interface list that contains identification, configuration, type, speed, and status information for each interface **Sample:** [[{'iscsi': [{'controller': 'A', 'current\_interface\_speed': '10g', 'ipv4\_address': '10.10.10.1', 'ipv4\_enabled': True, 'ipv4\_gateway': '10.10.10.1', 'ipv4\_subnet\_mask': '255.255.255.0', 'ipv6\_enabled': False, 'iqn': 'iqn.1996-03.com.netapp:2806.600a098000a81b6d0000000059d60c76', 'link\_status': 'up', 'mtu': 9000, 'supported\_interface\_speeds': ['10g']}]}]] |
| | **netapp\_management\_interfaces** complex | success | management interface list that contains identification, configuration, and status for each interface **Sample:** [[{'alias': 'ict-2800-A', 'channel': 1, 'controller': 'A', 'dns\_config\_method': 'dhcp', 'dns\_servers': [], 'ipv4\_address': '10.1.1.1', 'ipv4\_address\_config\_method': 'static', 'ipv4\_enabled': True, 'ipv4\_gateway': '10.113.1.1', 'ipv4\_subnet\_mask': '255.255.255.0', 'ipv6\_enabled': False, 'link\_status': 'up', 'mac\_address': '00A098A81B5D', 'name': 'wan0', 'ntp\_config\_method': 'disabled', 'ntp\_servers': [], 'remote\_ssh\_access': False}]] |
| | **netapp\_storage\_array** dictionary | success | provides storage array identification, firmware version, and available capabilities **Sample:** [{'cacheBlockSizes': [4096, 8192, 16384, 32768], 'chassis\_serial': '021540006043', 'firmware': '08.40.00.01', 'name': 'ict-2800-11\_40', 'supportedSegSizes': [8192, 16384, 32768, 65536, 131072, 262144, 524288], 'wwn': '600A098000A81B5D0000000059D60C76'}] |
| | **netapp\_storage\_pools** complex | success | storage pool list that contains identification and capacity information for each pool **Sample:** [[{'available\_capacity': '3490353782784', 'id': '04000000600A098000A81B5D000002B45A953A61', 'name': 'Raid6', 'total\_capacity': '5399466745856', 'used\_capacity': '1909112963072'}]] |
| | **netapp\_volumes** complex | success | storage volume list that contains identification and capacity information for each volume **Sample:** [[{'capacity': '5368709120', 'id': '02000000600A098000AAC0C3000002C45A952BAA', 'is\_thin\_provisioned': False, 'name': '5G', 'parent\_storage\_pool\_id': '04000000600A098000A81B5D000002B45A953A61'}]] |
| | **netapp\_volumes\_by\_initiators** complex | success | list of available volumes keyed by the mapped initiators. **Sample:** [{'beegfs\_host': [{'eui': '0000139A3885FA4500A0980000EAA272V', 'host\_types': ['nvmeof'], 'id': '02000000600A098000A4B9D1000015FD5C8F7F9E', 'meta\_data': {'filetype': 'ext4', 'public': True}, 'name': 'some\_volume', 'volume\_metadata': '{"format\_type": "ext4", "format\_options": "-i 2048 -I 512 -J size=400 -Odir\_index,filetype", "mount\_options": "noatime,nodiratime,nobarrier,\_netdev", "mount\_directory": "/data/beegfs/"}', 'workload\_metadata': {'filetype': 'ext4', 'public': True}, 'workload\_name': 'beegfs\_metadata', 'wwn': '600A098000A4B9D1000015FD5C8F7F9E'}]}] |
| | **netapp\_workload\_tags** complex | success | workload tag list **Sample:** [[{'id': '87e19568-43fb-4d8d-99ea-2811daaa2b38', 'name': 'ftp\_server', 'workloadAttributes': [{'key': 'use', 'value': 'general'}]}]] |
| | **snapshot\_images** complex | success | snapshot image list that contains identification, capacity, and status information for each snapshot image **Sample:** [[{'active\_cow': True, 'creation\_method': 'user', 'id': '34000000600A098000A81B5D00630A965B0535AC', 'pit\_capacity': '5368709120', 'reposity\_cap\_utilization': '0', 'rollback\_source': False, 'status': 'optimal'}]] |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.netapp_e_ldap – NetApp E-Series manage LDAP integration to use for authentication netapp\_eseries.santricity.netapp\_e\_ldap – NetApp E-Series manage LDAP integration to use for authentication
==============================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_ldap`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure an E-Series system to allow authentication via an LDAP server
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **attributes** list / elements=string | **Default:**"memberOf" | The user attributes that should be considered for the group to role mapping. Typically this is used with something like 'memberOf', and a user's access is tested against group membership or lack thereof. |
| **identifier** string | | This is a unique identifier for the configuration (for cases where there are multiple domains configured). If this is not specified, but *state=present*, we will utilize a default value of 'default'. |
| **log\_path** string | | A local path to a file to be used for debug logging |
| **name** list / elements=string | | The domain name[s] that will be utilized when authenticating to identify which domain to utilize. Default to use the DNS name of the *server*. The only requirement is that the name[s] be resolvable. Example: [email protected] |
| **password** string / required | | This is the password for the bind user account.
aliases: bind\_password |
| **role\_mappings** dictionary / required | | This is where you specify which groups should have access to what permissions for the storage-system. For example, all users in group A will be assigned all 4 available roles, which will allow access to all the management functionality of the system (super-user). Those in group B only have the storage.monitor role, which will allow only read-only access. This is specified as a mapping of regular expressions to a list of roles. See the examples. The roles that will be assigned to to the group/groups matching the provided regex. storage.admin allows users full read/write access to storage objects and operations. storage.monitor allows users read-only access to storage objects and operations. support.admin allows users access to hardware, diagnostic information, the Major Event Log, and other critical support-related functionality, but not the storage configuration. security.admin allows users access to authentication/authorization configuration, as well as the audit log configuration, and certification management. |
| **search\_base** string / required | | The search base is used to find group memberships of the user. Example: ou=users,dc=example,dc=com |
| **server** string / required | | This is the LDAP server url. The connection string should be specified as using the ldap or ldaps protocol along with the port information.
aliases: server\_url |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **present** ←
* absent
| Enable/disable LDAP support on the system. Disabling will clear out any existing defined domains. |
| **user\_attribute** string | **Default:**"sAMAccountName" | This is the attribute we will use to match the provided username when a user attempts to authenticate. |
| **username** string / required | | This is the user account that will be used for querying the LDAP server. Example: CN=MyBindAcct,OU=ServiceAccounts,DC=example,DC=com
aliases: bind\_username |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* This module allows you to define one or more LDAP domains identified uniquely by *identifier* to use for authentication. Authorization is determined by *role\_mappings*, in that different groups of users may be given different (or no), access to certain aspects of the system and API.
* The local user accounts will still be available if the LDAP server becomes unavailable/inaccessible.
* Generally, you’ll need to get the details of your organization’s LDAP server before you’ll be able to configure the system for using LDAP authentication; every implementation is likely to be very different.
* This API is currently only supported with the Embedded Web Services API v2.0 and higher, or the Web Services Proxy v3.0 and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Disable LDAP authentication
netapp_e_ldap:
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
ssid: "1"
state: absent
- name: Remove the 'default' LDAP domain configuration
netapp_e_ldap:
state: absent
identifier: default
- name: Define a new LDAP domain, utilizing defaults where possible
netapp_e_ldap:
state: present
bind_username: "CN=MyBindAccount,OU=ServiceAccounts,DC=example,DC=com"
bind_password: "mySecretPass"
server: "ldap://example.com:389"
search_base: 'OU=Users,DC=example,DC=com'
role_mappings:
".*dist-dev-storage.*":
- storage.admin
- security.admin
- support.admin
- storage.monitor
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The ldap settings have been updated. |
### Authors
* Michael Price (@lmprice)
ansible netapp_eseries.santricity.na_santricity_client_certificate – NetApp E-Series manage remote server certificates. netapp\_eseries.santricity.na\_santricity\_client\_certificate – NetApp E-Series manage remote server certificates.
===================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_client_certificate`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage NetApp E-Series storage array’s remote server certificates.
Requirements
------------
The below requirements are needed on the host that executes this module.
* cryptography
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **certificates** list / elements=string | | List of certificate files Each item must include the path to the file |
| **reload\_certificates** boolean | **Choices:*** no
* **yes** ←
| Whether to reload certificates when certificates have been added or removed. Certificates will not be available or removed until the servers have been reloaded. |
| **remove\_unspecified\_user\_certificates** boolean | **Choices:*** **no** ←
* yes
| Whether to remove user install client certificates that are not specified in *certificates*. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Set *ssid==”0”* or *ssid==”proxy”* to specifically reference SANtricity Web Services Proxy.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Upload certificates
na_santricity_client_certificate:
ssid: 1
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
certificates: ["/path/to/certificates.crt", "/path/to/another_certificate.crt"]
- name: Remove all certificates
na_santricity_client_certificate:
ssid: 1
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **add\_certificates** list / elements=string | always | Any SSL certificates that were added. **Sample:** ['added\_cerificiate.crt'] |
| **changed** boolean | always | Whether changes have been made. **Sample:** True |
| **removed\_certificates** list / elements=string | always | Any SSL certificates that were removed. **Sample:** ['removed\_cerificiate.crt'] |
### Authors
* Nathan Swartz (@ndswartz)
ansible Netapp_Eseries.Santricity Netapp\_Eseries.Santricity
==========================
Collection version 1.2.13
Plugin Index
------------
These are the plugins in the netapp\_eseries.santricity collection
### Lookup Plugins
* [santricity\_host](santricity_host_lookup#ansible-collections-netapp-eseries-santricity-santricity-host-lookup) –
* [santricity\_host\_detail](santricity_host_detail_lookup#ansible-collections-netapp-eseries-santricity-santricity-host-detail-lookup) – Expands the host information from santricity\_host lookup
* [santricity\_storage\_pool](santricity_storage_pool_lookup#ansible-collections-netapp-eseries-santricity-santricity-storage-pool-lookup) – Storage pool information
### Modules
* [na\_santricity\_alerts](na_santricity_alerts_module#ansible-collections-netapp-eseries-santricity-na-santricity-alerts-module) – NetApp E-Series manage email notification settings
* [na\_santricity\_alerts\_syslog](na_santricity_alerts_syslog_module#ansible-collections-netapp-eseries-santricity-na-santricity-alerts-syslog-module) – NetApp E-Series manage syslog servers receiving storage system alerts.
* [na\_santricity\_asup](na_santricity_asup_module#ansible-collections-netapp-eseries-santricity-na-santricity-asup-module) – NetApp E-Series manage auto-support settings
* [na\_santricity\_auditlog](na_santricity_auditlog_module#ansible-collections-netapp-eseries-santricity-na-santricity-auditlog-module) – NetApp E-Series manage audit-log configuration
* [na\_santricity\_auth](na_santricity_auth_module#ansible-collections-netapp-eseries-santricity-na-santricity-auth-module) – NetApp E-Series set or update the password for a storage array device or SANtricity Web Services Proxy.
* [na\_santricity\_client\_certificate](na_santricity_client_certificate_module#ansible-collections-netapp-eseries-santricity-na-santricity-client-certificate-module) – NetApp E-Series manage remote server certificates.
* [na\_santricity\_discover](na_santricity_discover_module#ansible-collections-netapp-eseries-santricity-na-santricity-discover-module) – NetApp E-Series discover E-Series storage systems
* [na\_santricity\_drive\_firmware](na_santricity_drive_firmware_module#ansible-collections-netapp-eseries-santricity-na-santricity-drive-firmware-module) – NetApp E-Series manage drive firmware
* [na\_santricity\_facts](na_santricity_facts_module#ansible-collections-netapp-eseries-santricity-na-santricity-facts-module) – NetApp E-Series retrieve facts about NetApp E-Series storage arrays
* [na\_santricity\_firmware](na_santricity_firmware_module#ansible-collections-netapp-eseries-santricity-na-santricity-firmware-module) – NetApp E-Series manage firmware.
* [na\_santricity\_global](na_santricity_global_module#ansible-collections-netapp-eseries-santricity-na-santricity-global-module) – NetApp E-Series manage global settings configuration
* [na\_santricity\_host](na_santricity_host_module#ansible-collections-netapp-eseries-santricity-na-santricity-host-module) – NetApp E-Series manage eseries hosts
* [na\_santricity\_hostgroup](na_santricity_hostgroup_module#ansible-collections-netapp-eseries-santricity-na-santricity-hostgroup-module) – NetApp E-Series manage array host groups
* [na\_santricity\_ib\_iser\_interface](na_santricity_ib_iser_interface_module#ansible-collections-netapp-eseries-santricity-na-santricity-ib-iser-interface-module) – NetApp E-Series manage InfiniBand iSER interface configuration
* [na\_santricity\_iscsi\_interface](na_santricity_iscsi_interface_module#ansible-collections-netapp-eseries-santricity-na-santricity-iscsi-interface-module) – NetApp E-Series manage iSCSI interface configuration
* [na\_santricity\_iscsi\_target](na_santricity_iscsi_target_module#ansible-collections-netapp-eseries-santricity-na-santricity-iscsi-target-module) – NetApp E-Series manage iSCSI target configuration
* [na\_santricity\_ldap](na_santricity_ldap_module#ansible-collections-netapp-eseries-santricity-na-santricity-ldap-module) – NetApp E-Series manage LDAP integration to use for authentication
* [na\_santricity\_lun\_mapping](na_santricity_lun_mapping_module#ansible-collections-netapp-eseries-santricity-na-santricity-lun-mapping-module) – NetApp E-Series manage lun mappings
* [na\_santricity\_mgmt\_interface](na_santricity_mgmt_interface_module#ansible-collections-netapp-eseries-santricity-na-santricity-mgmt-interface-module) – NetApp E-Series manage management interface configuration
* [na\_santricity\_nvme\_interface](na_santricity_nvme_interface_module#ansible-collections-netapp-eseries-santricity-na-santricity-nvme-interface-module) – NetApp E-Series manage NVMe interface configuration
* [na\_santricity\_proxy\_drive\_firmware\_upload](na_santricity_proxy_drive_firmware_upload_module#ansible-collections-netapp-eseries-santricity-na-santricity-proxy-drive-firmware-upload-module) – NetApp E-Series manage proxy drive firmware files
* [na\_santricity\_proxy\_firmware\_upload](na_santricity_proxy_firmware_upload_module#ansible-collections-netapp-eseries-santricity-na-santricity-proxy-firmware-upload-module) – NetApp E-Series manage proxy firmware uploads.
* [na\_santricity\_proxy\_systems](na_santricity_proxy_systems_module#ansible-collections-netapp-eseries-santricity-na-santricity-proxy-systems-module) – NetApp E-Series manage SANtricity web services proxy storage arrays
* [na\_santricity\_server\_certificate](na_santricity_server_certificate_module#ansible-collections-netapp-eseries-santricity-na-santricity-server-certificate-module) – NetApp E-Series manage the storage system’s server SSL certificates.
* [na\_santricity\_snapshot](na_santricity_snapshot_module#ansible-collections-netapp-eseries-santricity-na-santricity-snapshot-module) – NetApp E-Series storage system’s snapshots.
* [na\_santricity\_storagepool](na_santricity_storagepool_module#ansible-collections-netapp-eseries-santricity-na-santricity-storagepool-module) – NetApp E-Series manage volume groups and disk pools
* [na\_santricity\_syslog](na_santricity_syslog_module#ansible-collections-netapp-eseries-santricity-na-santricity-syslog-module) – NetApp E-Series manage syslog settings
* [na\_santricity\_volume](na_santricity_volume_module#ansible-collections-netapp-eseries-santricity-na-santricity-volume-module) – NetApp E-Series manage storage volumes (standard and thin)
* [netapp\_e\_alerts](netapp_e_alerts_module#ansible-collections-netapp-eseries-santricity-netapp-e-alerts-module) – NetApp E-Series manage email notification settings
* [netapp\_e\_amg](netapp_e_amg_module#ansible-collections-netapp-eseries-santricity-netapp-e-amg-module) – NetApp E-Series create, remove, and update asynchronous mirror groups
* [netapp\_e\_amg\_role](netapp_e_amg_role_module#ansible-collections-netapp-eseries-santricity-netapp-e-amg-role-module) – NetApp E-Series update the role of a storage array within an Asynchronous Mirror Group (AMG).
* [netapp\_e\_amg\_sync](netapp_e_amg_sync_module#ansible-collections-netapp-eseries-santricity-netapp-e-amg-sync-module) – NetApp E-Series conduct synchronization actions on asynchronous mirror groups.
* [netapp\_e\_asup](netapp_e_asup_module#ansible-collections-netapp-eseries-santricity-netapp-e-asup-module) – NetApp E-Series manage auto-support settings
* [netapp\_e\_auditlog](netapp_e_auditlog_module#ansible-collections-netapp-eseries-santricity-netapp-e-auditlog-module) – NetApp E-Series manage audit-log configuration
* [netapp\_e\_auth](netapp_e_auth_module#ansible-collections-netapp-eseries-santricity-netapp-e-auth-module) – NetApp E-Series set or update the password for a storage array.
* [netapp\_e\_drive\_firmware](netapp_e_drive_firmware_module#ansible-collections-netapp-eseries-santricity-netapp-e-drive-firmware-module) – NetApp E-Series manage drive firmware
* [netapp\_e\_facts](netapp_e_facts_module#ansible-collections-netapp-eseries-santricity-netapp-e-facts-module) – NetApp E-Series retrieve facts about NetApp E-Series storage arrays
* [netapp\_e\_firmware](netapp_e_firmware_module#ansible-collections-netapp-eseries-santricity-netapp-e-firmware-module) – NetApp E-Series manage firmware.
* [netapp\_e\_flashcache](netapp_e_flashcache_module#ansible-collections-netapp-eseries-santricity-netapp-e-flashcache-module) – NetApp E-Series manage SSD caches
* [netapp\_e\_global](netapp_e_global_module#ansible-collections-netapp-eseries-santricity-netapp-e-global-module) – NetApp E-Series manage global settings configuration
* [netapp\_e\_host](netapp_e_host_module#ansible-collections-netapp-eseries-santricity-netapp-e-host-module) – NetApp E-Series manage eseries hosts
* [netapp\_e\_hostgroup](netapp_e_hostgroup_module#ansible-collections-netapp-eseries-santricity-netapp-e-hostgroup-module) – NetApp E-Series manage array host groups
* [netapp\_e\_iscsi\_interface](netapp_e_iscsi_interface_module#ansible-collections-netapp-eseries-santricity-netapp-e-iscsi-interface-module) – NetApp E-Series manage iSCSI interface configuration
* [netapp\_e\_iscsi\_target](netapp_e_iscsi_target_module#ansible-collections-netapp-eseries-santricity-netapp-e-iscsi-target-module) – NetApp E-Series manage iSCSI target configuration
* [netapp\_e\_ldap](netapp_e_ldap_module#ansible-collections-netapp-eseries-santricity-netapp-e-ldap-module) – NetApp E-Series manage LDAP integration to use for authentication
* [netapp\_e\_lun\_mapping](netapp_e_lun_mapping_module#ansible-collections-netapp-eseries-santricity-netapp-e-lun-mapping-module) – NetApp E-Series create, delete, or modify lun mappings
* [netapp\_e\_mgmt\_interface](netapp_e_mgmt_interface_module#ansible-collections-netapp-eseries-santricity-netapp-e-mgmt-interface-module) – NetApp E-Series management interface configuration
* [netapp\_e\_snapshot\_group](netapp_e_snapshot_group_module#ansible-collections-netapp-eseries-santricity-netapp-e-snapshot-group-module) – NetApp E-Series manage snapshot groups
* [netapp\_e\_snapshot\_images](netapp_e_snapshot_images_module#ansible-collections-netapp-eseries-santricity-netapp-e-snapshot-images-module) – NetApp E-Series create and delete snapshot images
* [netapp\_e\_snapshot\_volume](netapp_e_snapshot_volume_module#ansible-collections-netapp-eseries-santricity-netapp-e-snapshot-volume-module) – NetApp E-Series manage snapshot volumes.
* [netapp\_e\_storage\_system](netapp_e_storage_system_module#ansible-collections-netapp-eseries-santricity-netapp-e-storage-system-module) – NetApp E-Series Web Services Proxy manage storage arrays
* [netapp\_e\_storagepool](netapp_e_storagepool_module#ansible-collections-netapp-eseries-santricity-netapp-e-storagepool-module) – NetApp E-Series manage volume groups and disk pools
* [netapp\_e\_syslog](netapp_e_syslog_module#ansible-collections-netapp-eseries-santricity-netapp-e-syslog-module) – NetApp E-Series manage syslog settings
* [netapp\_e\_volume](netapp_e_volume_module#ansible-collections-netapp-eseries-santricity-netapp-e-volume-module) – NetApp E-Series manage storage volumes (standard and thin)
* [netapp\_e\_volume\_copy](netapp_e_volume_copy_module#ansible-collections-netapp-eseries-santricity-netapp-e-volume-copy-module) – NetApp E-Series create volume copy pairs
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
| programming_docs |
ansible netapp_eseries.santricity.netapp_e_lun_mapping – NetApp E-Series create, delete, or modify lun mappings netapp\_eseries.santricity.netapp\_e\_lun\_mapping – NetApp E-Series create, delete, or modify lun mappings
===========================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_lun_mapping`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, delete, or modify mappings between a volume and a targeted host/host+ group.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **lun** integer added in 2.7 of netapp\_eseries.santricity | | The LUN value you wish to give the mapping. If the supplied *volume\_name* is associated with a different LUN, it will be updated to what is supplied here. LUN value will be determine by the storage-system when not specified. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string / required | **Choices:*** present
* absent
| Present will ensure the mapping exists, absent will remove the mapping. |
| **target** string | | The name of host or hostgroup you wish to assign to the mapping If omitted, the default hostgroup is used. If the supplied *volume\_name* is associated with a different target, it will be updated to what is supplied here. |
| **target\_type** string added in 2.7 of netapp\_eseries.santricity | **Choices:*** host
* group
| This option specifies the whether the target should be a host or a group of hosts Only necessary when the target name is used for both a host and a group of hosts |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **volume\_name** string / required | | The name of the volume you wish to include in the mapping.
aliases: volume |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
---
- name: Map volume1 to the host target host1
netapp_e_lun_mapping:
ssid: 1
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: no
state: present
target: host1
volume: volume1
- name: Delete the lun mapping between volume1 and host1
netapp_e_lun_mapping:
ssid: 1
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: yes
state: absent
target: host1
volume: volume1
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | success of the module **Sample:** Lun mapping is complete |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_nvme_interface – NetApp E-Series manage NVMe interface configuration netapp\_eseries.santricity.na\_santricity\_nvme\_interface – NetApp E-Series manage NVMe interface configuration
================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_nvme_interface`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure settings of an E-Series NVMe interface
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | The IPv4 address to assign to the NVMe interface |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **channel** integer | | This option specifies the which NVMe controller channel to configure. The list of choices is not necessarily comprehensive. It depends on the number of ports that are available in the system. The numerical value represents the number of the channel (typically from left to right on the HIC), beginning with a value of 1. |
| **config\_method** string | **Choices:*** **dhcp** ←
* static
| The configuration method type to use for this interface. Only applicable when configuring RoCE dhcp is mutually exclusive with *address*, *subnet\_mask*, and *gateway*. |
| **controller** string | **Choices:*** A
* B
| The controller that owns the port you want to configure. Controller names are presented alphabetically, with the first controller as A and the second as B. |
| **gateway** string | | The IPv4 gateway address to utilize for the interface. Only applicable when configuring RoCE Mutually exclusive with *config\_method=dhcp*
|
| **mtu** integer | **Default:**1500 | The maximum transmission units (MTU), in bytes. Only applicable when configuring RoCE This allows you to configure a larger value for the MTU, in order to enable jumbo frames (any value > 1500). Generally, it is necessary to have your host, switches, and other components not only support jumbo frames, but also have it configured properly. Therefore, unless you know what you're doing, it's best to leave this at the default.
aliases: max\_frame\_size |
| **speed** string | **Default:**"auto" | This is the ethernet port speed measured in Gb/s. Value must be a supported speed or auto for automatically negotiating the speed with the port. Only applicable when configuring RoCE The configured ethernet port speed should match the speed capability of the SFP on the selected port. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **enabled** ←
* disabled
| Whether or not the specified RoCE interface should be enabled. Only applicable when configuring RoCE |
| **subnet\_mask** string | | The subnet mask to utilize for the interface. Only applicable when configuring RoCE Mutually exclusive with *config\_method=dhcp*
|
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The interface settings have been updated. |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_host – NetApp E-Series manage eseries hosts netapp\_eseries.santricity.netapp\_e\_host – NetApp E-Series manage eseries hosts
=================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_host`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, remove hosts on NetApp E-series storage arrays
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **force\_port** boolean added in 2.7 of netapp\_eseries.santricity | **Choices:*** no
* yes
| Allow ports that are already assigned to be re-assigned to your current host |
| **group** string | | The unique identifier of the host-group you want the host to be a member of; this is used for clustering.
aliases: cluster |
| **host\_type** string | | This is the type of host to be mapped Required when `state=present`
Either one of the following names can be specified, Linux DM-MP, VMWare, Windows, Windows Clustered, or a host type index which can be found in M(netapp\_e\_facts)
aliases: host\_type\_index |
| **log\_path** string added in 2.7 of netapp\_eseries.santricity | | A local path to a file to be used for debug logging |
| **name** string / required | | If the host doesn't yet exist, the label/name to assign at creation time. If the hosts already exists, this will be used to uniquely identify the host to make any required changes
aliases: label |
| **ports** list / elements=string | | A list of host ports you wish to associate with the host. Host ports are uniquely identified by their WWN or IQN. Their assignments to a particular host are uniquely identified by a label and these must be unique. |
| | **label** string / required | | A unique label to assign to this port assignment. |
| | **port** string / required | | The WWN or IQN of the hostPort to assign to this port definition. |
| | **type** string / required | **Choices:*** iscsi
* sas
* fc
* ib
* nvmeof
* ethernet
| The interface type of the port to define. Acceptable choices depend on the capabilities of the target hardware/software platform. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string added in 2.7 of netapp\_eseries.santricity | **Choices:*** absent
* **present** ←
| Set to absent to remove an existing host Set to present to modify or create a new host definition |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Define or update an existing host named 'Host1'
netapp_e_host:
ssid: "1"
api_url: "10.113.1.101:8443"
api_username: admin
api_password: myPassword
name: "Host1"
state: present
host_type_index: Linux DM-MP
ports:
- type: 'iscsi'
label: 'PORT_1'
port: 'iqn.1996-04.de.suse:01:56f86f9bd1fe'
- type: 'fc'
label: 'FC_1'
port: '10:00:FF:7C:FF:FF:FF:01'
- type: 'fc'
label: 'FC_2'
port: '10:00:FF:7C:FF:FF:FF:00'
- name: Ensure a host named 'Host2' doesn't exist
netapp_e_host:
ssid: "1"
api_url: "10.113.1.101:8443"
api_username: admin
api_password: myPassword
name: "Host2"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **api\_url** string added in 2.6 of netapp\_eseries.santricity | on success | the url of the API that this request was processed by **Sample:** https://webservices.example.com:8443 |
| **id** string added in 2.6 of netapp\_eseries.santricity | on success when state=present | the unique identifier of the host on the E-Series storage-system **Sample:** 00000000600A098000AAC0C3003004700AD86A52 |
| **msg** string | on success | A user-readable description of the actions performed. **Sample:** The host has been created. |
| **ssid** string added in 2.6 of netapp\_eseries.santricity | on success | the unique identifier of the E-Series storage-system with the current api **Sample:** 1 |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_hostgroup – NetApp E-Series manage array host groups netapp\_eseries.santricity.na\_santricity\_hostgroup – NetApp E-Series manage array host groups
===============================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_hostgroup`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update or destroy host groups on a NetApp E-Series storage array.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **hosts** list / elements=string | | List of host names/labels to add to the group |
| **name** string | | Name of the host group to manage |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **present** ←
* absent
| Whether the specified host group should exist or not. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Configure Hostgroup
na_santricity_hostgroup:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: present
name: example_hostgroup
hosts:
- host01
- host02
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **clusterRef** string | always except when state is absent | The unique identification value for this object. Other objects may use this reference value to refer to the cluster. **Sample:** 3233343536373839303132333100000000000000 |
| **confirmLUNMappingCreation** boolean | always | If true, indicates that creation of LUN-to-volume mappings should require careful confirmation from the end-user, since such a mapping will alter the volume access rights of other clusters, in addition to this one. |
| **hosts** list / elements=string | always except when state is absent | A list of the hosts that are part of the host group after all operations. **Sample:** ['HostA', 'HostB'] |
| **id** string | always except when state is absent | The id number of the hostgroup **Sample:** 3233343536373839303132333100000000000000 |
| **isSAControlled** boolean | always except when state is absent | If true, indicates that I/O accesses from this cluster are subject to the storage array's default LUN-to-volume mappings. If false, indicates that I/O accesses from the cluster are subject to cluster-specific LUN-to-volume mappings. |
| **label** string | always | The user-assigned, descriptive label string for the cluster. **Sample:** MyHostGroup |
| **name** string | always except when state is absent | same as label **Sample:** MyHostGroup |
| **protectionInformationCapableAccessMethod** boolean | always except when state is absent | This field is true if the host has a PI capable access method. **Sample:** True |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.netapp_e_volume_copy – NetApp E-Series create volume copy pairs netapp\_eseries.santricity.netapp\_e\_volume\_copy – NetApp E-Series create volume copy pairs
=============================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_volume_copy`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and delete snapshots images on volume groups for NetApp E-series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **api\_url** string / required | | The url to the SANtricity WebServices Proxy or embedded REST API, for example `https://prod-1.wahoo.acme.com/devmgr/v2`. |
| **api\_username** string / required | | The username to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **copy\_priority** integer | **Default:**0 | Copy priority level |
| **create\_copy\_pair\_if\_does\_not\_exist** boolean | **Choices:*** no
* **yes** ←
| Defines if a copy pair will be created if it does not exist. If set to True destination\_volume\_id and source\_volume\_id are required. |
| **destination\_volume\_id** string | | The id of the volume copy destination. If used, must be paired with source\_volume\_id Mutually exclusive with volume\_copy\_pair\_id, and search\_volume\_id |
| **onlineCopy** boolean | **Choices:*** **no** ←
* yes
| Whether copy should be online |
| **search\_volume\_id** string | | Searches for all valid potential target and source volumes that could be used in a copy\_pair Mutually exclusive with volume\_copy\_pair\_id, destination\_volume\_id and source\_volume\_id |
| **source\_volume\_id** string | | The id of the volume copy source. If used, must be paired with destination\_volume\_id Mutually exclusive with volume\_copy\_pair\_id, and search\_volume\_id |
| **ssid** string | **Default:**"1" | Storage system identifier |
| **start\_stop\_copy** string | **Choices:*** start
* stop
| starts a re-copy or stops a copy in progress Note: If you stop the initial file copy before it it done the copy pair will be destroyed Requires volume\_copy\_pair\_id |
| **state** string / required | **Choices:*** present
* absent
| Whether the specified volume copy pair should exist or not. |
| **targetWriteProtected** boolean | **Choices:*** no
* **yes** ←
| Whether target should be write protected |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **volume\_copy\_pair\_id** string | | The id of a given volume copy pair Mutually exclusive with destination\_volume\_id, source\_volume\_id, and search\_volume\_id Can use to delete or check presence of volume pairs Must specify this or (destination\_volume\_id and source\_volume\_id) |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
---
msg:
description: Success message
returned: success
type: str
sample: Json facts for the volume copy that was created.
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Success message **Sample:** Created Volume Copy Pair with ID |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.netapp_e_firmware – NetApp E-Series manage firmware. netapp\_eseries.santricity.netapp\_e\_firmware – NetApp E-Series manage firmware.
=================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_firmware`.
New in version 2.9: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Ensure specific firmware versions are activated on E-Series storage system.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **firmware** string / required | | Path to the firmware file. |
| **ignore\_health\_check** boolean | **Choices:*** **no** ←
* yes
| This flag will force firmware to be activated in spite of the health check. Use at your own risk. Certain non-optimal states could result in data loss. |
| **nvsram** string / required | | Path to the NVSRAM file. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **wait\_for\_completion** boolean | **Choices:*** **no** ←
* yes
| This flag will cause module to wait for any upgrade actions to complete. |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Ensure correct firmware versions
netapp_e_firmware:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
nvsram: "path/to/nvsram"
bundle: "path/to/bundle"
wait_for_completion: true
- name: Ensure correct firmware versions
netapp_e_firmware:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
nvsram: "path/to/nvsram"
firmware: "path/to/firmware"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | Status and version of firmware and NVSRAM. |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_amg_sync – NetApp E-Series conduct synchronization actions on asynchronous mirror groups. netapp\_eseries.santricity.netapp\_e\_amg\_sync – NetApp E-Series conduct synchronization actions on asynchronous mirror groups.
================================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_amg_sync`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allows for the initialization, suspension and resumption of an asynchronous mirror group’s synchronization for NetApp E-series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **api\_url** string / required | | The url to the SANtricity WebServices Proxy or embedded REST API. |
| **api\_username** string / required | | The username to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **delete\_recovery\_point** boolean | **Choices:*** **no** ←
* yes
| Indicates whether the failures point can be deleted on the secondary if necessary to achieve the synchronization. If true, and if the amount of unsynchronized data exceeds the CoW repository capacity on the secondary for any member volume, the last failures point will be deleted and synchronization will continue. If false, the synchronization will be suspended if the amount of unsynchronized data exceeds the CoW Repository capacity on the secondary and the failures point will be preserved. NOTE: This only has impact for newly launched syncs. |
| **name** string / required | | The name of the async mirror group you wish to target |
| **ssid** string | | The ID of the storage array containing the AMG you wish to target |
| **state** string / required | **Choices:*** running
* suspended
| The synchronization action you'd like to take. If `running` then it will begin syncing if there is no active sync or will resume a suspended sync. If there is already a sync in progress, it will return with an OK status. If `suspended` it will suspend any ongoing sync action, but return OK if there is no active sync or if the sync is already suspended |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Examples
--------
```
- name: start AMG async
netapp_e_amg_sync:
name: "{{ amg_sync_name }}"
state: running
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **json** string | success | The object attributes of the AMG. **Sample:** {'changed': False, 'connectionType': 'fc', 'groupRef': '3700000060080E5000299C24000006EF57ACAC70', 'groupState': 'optimal', 'id': '3700000060080E5000299C24000006EF57ACAC70', 'label': 'made\_with\_ansible', 'localRole': 'primary', 'mirrorChannelRemoteTarget': '9000000060080E5000299C24005B06E557AC7EEC', 'orphanGroup': False, 'recoveryPointAgeAlertThresholdMinutes': 20, 'remoteRole': 'secondary', 'remoteTarget': {'nodeName': {'ioInterfaceType': 'fc', 'iscsiNodeName': None, 'remoteNodeWWN': '20040080E5299F1C'}, 'remoteRef': '9000000060080E5000299C24005B06E557AC7EEC', 'scsiinitiatorTargetBaseProperties': {'ioInterfaceType': 'fc', 'iscsiinitiatorTargetBaseParameters': None}}, 'remoteTargetId': 'ansible2', 'remoteTargetName': 'Ansible2', 'remoteTargetWwn': '60080E5000299F880000000056A25D56', 'repositoryUtilizationWarnThreshold': 80, 'roleChangeProgress': 'none', 'syncActivity': 'idle', 'syncCompletionTimeAlertThresholdMinutes': 10, 'syncIntervalMinutes': 10, 'worldWideName': '60080E5000299C24000006EF57ACAC70'} |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.netapp_e_iscsi_interface – NetApp E-Series manage iSCSI interface configuration netapp\_eseries.santricity.netapp\_e\_iscsi\_interface – NetApp E-Series manage iSCSI interface configuration
=============================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_iscsi_interface`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure settings of an E-Series iSCSI interface
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | The IPv4 address to assign to the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **config\_method** string | **Choices:*** **dhcp** ←
* static
| The configuration method type to use for this interface. dhcp is mutually exclusive with *address*, *subnet\_mask*, and *gateway*. |
| **controller** string / required | **Choices:*** A
* B
| The controller that owns the port you want to configure. Controller names are presented alphabetically, with the first controller as A, the second as B, and so on. Current hardware models have either 1 or 2 available controllers, but that is not a guaranteed hard limitation and could change in the future. |
| **gateway** string | | The IPv4 gateway address to utilize for the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **log\_path** string | | A local path to a file to be used for debug logging |
| **mtu** integer | **Default:**1500 | The maximum transmission units (MTU), in bytes. This allows you to configure a larger value for the MTU, in order to enable jumbo frames (any value > 1500). Generally, it is necessary to have your host, switches, and other components not only support jumbo frames, but also have it configured properly. Therefore, unless you know what you're doing, it's best to leave this at the default.
aliases: max\_frame\_size |
| **name** integer / required | | The channel of the port to modify the configuration of. The list of choices is not necessarily comprehensive. It depends on the number of ports that are available in the system. The numerical value represents the number of the channel (typically from left to right on the HIC), beginning with a value of 1.
aliases: channel |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **enabled** ←
* disabled
| When enabled, the provided configuration will be utilized. When disabled, the IPv4 configuration will be cleared and IPv4 connectivity disabled. |
| **subnet\_mask** string | | The subnet mask to utilize for the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* The interface settings are applied synchronously, but changes to the interface itself (receiving a new IP address via dhcp, etc), can take seconds or minutes longer to take effect.
* This module will not be useful/usable on an E-Series system without any iSCSI interfaces.
* This module requires a Web Services API version of >= 1.3.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Configure the first port on the A controller with a static IPv4 address
netapp_e_iscsi_interface:
name: "1"
controller: "A"
config_method: static
address: "192.168.1.100"
subnet_mask: "255.255.255.0"
gateway: "192.168.1.1"
ssid: "1"
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
- name: Disable ipv4 connectivity for the second port on the B controller
netapp_e_iscsi_interface:
name: "2"
controller: "B"
state: disabled
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
- name: Enable jumbo frames for the first 4 ports on controller A
netapp_e_iscsi_interface:
name: "{{ item | int }}"
controller: "A"
state: enabled
mtu: 9000
config_method: dhcp
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
loop:
- 1
- 2
- 3
- 4
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **enabled** boolean | on success | Indicates whether IPv4 connectivity has been enabled or disabled. This does not necessarily indicate connectivity. If dhcp was enabled without a dhcp server, for instance, it is unlikely that the configuration will actually be valid. **Sample:** True |
| **msg** string | on success | Success message **Sample:** The interface settings have been updated. |
### Authors
* Michael Price (@lmprice)
ansible netapp_eseries.santricity.na_santricity_snapshot – NetApp E-Series storage system’s snapshots. netapp\_eseries.santricity.na\_santricity\_snapshot – NetApp E-Series storage system’s snapshots.
=================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_snapshot`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage NetApp E-Series manage the storage system’s snapshots.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **alert\_threshold\_pct** integer | **Default:**75 | Percent of filled reserve capacity to issue alert. |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **group\_name** string / required | | Name of the snapshot consistency group or snapshot volume. Be sure to use different names for snapshot consistency groups and snapshot volumes to avoid name conflicts. |
| **maximum\_snapshots** integer | **Default:**32 | Total number of snapshot images to maintain. |
| **pit\_description** string | | Arbitrary description for a consistency group's snapshot images |
| **pit\_name** string | | Name of a consistency group's snapshot images. |
| **pit\_timestamp** string | | Snapshot image timestamp in the YYYY-MM-DD HH:MM:SS (AM|PM) (hours, minutes, seconds, and day-period are optional) Define only as much time as necessary to distinguish the desired snapshot image from the others. 24 hour time will be assumed if day-period indicator (AM, PM) is not specified. The terms latest and oldest may be used to select newest and oldest consistency group images. Mutually exclusive with *pit\_name or pit\_description*
|
| **preferred\_reserve\_storage\_pool** string | | Default preferred storage pool or volume group for the reserve capacity volume. The base volume's storage pool or volume group will be selected by default if not defined. Used to specify storage pool or volume group for both snapshot consistency group volume members and snapshot volumes |
| **reserve\_capacity\_full\_policy** string | **Choices:*** **purge** ←
* reject
| Policy for full reserve capacity. Purge deletes the oldest snapshot image for the base volume in the consistency group. Reject writes to base volume (keep snapshot images valid). |
| **reserve\_capacity\_pct** integer | **Default:**40 | Default percentage of base volume capacity to reserve for snapshot copy-on-writes (COW). Used to define reserve capacity for both snapshot consistency group volume members and snapshot volumes. |
| **rollback\_backup** boolean | **Choices:*** no
* **yes** ←
| Whether a point-in-time snapshot should be taken prior to performing a rollback. |
| **rollback\_priority** string | **Choices:*** highest
* high
* **medium** ←
* low
* lowest
| Storage system priority given to restoring snapshot point in time. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** absent
* **present** ←
* rollback
| When *state==absent* ensures the *type* has been removed. When *state==present* ensures the *type* is available. When *state==rollback* the consistency group will be rolled back to the point-in-time snapshot images selected by *pit\_name or pit\_timestamp*.
*state==rollback* will always return changed since it is not possible to evaluate the current state of the base volume in relation to a snapshot image. |
| **type** string | **Choices:*** **group** ←
* pit
* view
| Type of snapshot object to effect. Group indicates a snapshot consistency group; consistency groups may have one or more base volume members which are defined in *volumes*. Pit indicates a snapshot consistency group point-in-time image(s); a snapshot image will be taken of each base volume when *state==present*. Warning! When *state==absent and type==pit*, *pit\_name* or *pit\_timestamp* must be defined and all point-in-time images created prior to the selection will also be deleted. View indicates a consistency group snapshot volume of particular point-in-time image(s); snapshot volumes will be created for each base volume member. Views are created from images from a single point-in-time so once created they cannot be modified. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **view\_host** string | | Default host or host group to map snapshot volumes. |
| **view\_name** string | | Consistency group snapshot volume group. Required when *state==volume* or when ensuring the views absence when *state==absent*. |
| **view\_validate** boolean | **Choices:*** **no** ←
* yes
| Default whether snapshop volumes should be validated. |
| **view\_writable** boolean | **Choices:*** no
* **yes** ←
| Default whether snapshot volumes should be writable. |
| **volumes** list / elements=string | | Details for each consistency group base volume for defining reserve capacity, preferred reserve capacity storage pool, and snapshot volume options. When *state==present and type==group* the volume entries will be used to add or remove base volume from a snapshot consistency group. When *state==present and type==view* the volume entries will be used to select images from a point-in-time for their respective snapshot volumes. If *state==present and type==view* and *volume* is not specified then all volumes will be selected with the defaults. Views are created from images from a single point-in-time so once created they cannot be modified. When *state==rollback* then *volumes* can be used to specify which base volumes to rollback; otherwise all consistency group volumes will rollback. |
| | **preferred\_reserve\_storage\_pool** string | | Preferred storage pool or volume group for the reserve capacity volume. The base volume's storage pool or volume group will be selected by default if not defined. Used to specify storage pool or volume group for both snapshot consistency group volume members and snapshot volumes |
| | **reserve\_capacity\_pct** integer | **Default:**40 | Percentage of base volume capacity to reserve for snapshot copy-on-writes (COW). Used to define reserve capacity for both snapshot consistency group volume members and snapshot volumes. |
| | **snapshot\_volume\_host** string | | Host or host group to map snapshot volume. |
| | **snapshot\_volume\_validate** boolean | **Choices:*** **no** ←
* yes
| Whether snapshot volume should be validated which includes both a media scan and parity validation. |
| | **snapshot\_volume\_writable** boolean | **Choices:*** no
* **yes** ←
| Whether snapshot volume of base volume images should be writable. |
| | **volume** string / required | | Base volume for consistency group. |
Notes
-----
Note
* Key-value pairs are used to keep track of snapshot names and descriptions since the snapshot point-in-time images do have metadata associated with their data structures; therefore, it is necessary to clean out old keys that are no longer associated with an actual image. This cleaning action is performed each time this module is executed.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Ensure snapshot consistency group exists.
na_santricity_snapshot:
ssid: "1"
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
state: present
type: group
group_name: snapshot_group1
volumes:
- volume: vol1
reserve_capacity_pct: 20
preferred_reserve_storage_pool: vg1
- volume: vol2
reserve_capacity_pct: 30
- volume: vol3
alert_threshold_pct: 80
maximum_snapshots: 30
- name: Take the current consistency group's base volumes point-in-time snapshot images.
na_santricity_snapshot:
ssid: "1"
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
state: present
type: pit
group_name: snapshot_group1
pit_name: pit1
pit_description: Initial consistency group's point-in-time snapshot images.
- name: Ensure snapshot consistency group view exists and is mapped to host group.
na_santricity_snapshot:
ssid: "1"
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
state: present
type: view
group_name: snapshot_group1
pit_name: pit1
view_name: view1
view_host: view1_hosts_group
volumes:
- volume: vol1
reserve_capacity_pct: 20
preferred_reserve_storage_pool: vg4
snapshot_volume_writable: false
snapshot_volume_validate: true
- volume: vol2
reserve_capacity_pct: 20
preferred_reserve_storage_pool: vg4
snapshot_volume_writable: true
snapshot_volume_validate: true
- volume: vol3
reserve_capacity_pct: 20
preferred_reserve_storage_pool: vg4
snapshot_volume_writable: false
snapshot_volume_validate: true
alert_threshold_pct: 80
maximum_snapshots: 30
- name: Rollback base volumes to consistency group's point-in-time pit1.
na_santricity_snapshot:
ssid: "1"
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
state: present
type: group
group_name: snapshot_group1
pit_name: pit1
rollback: true
rollback_priority: high
- name: Ensure snapshot consistency group view no longer exists.
na_santricity_snapshot:
ssid: "1"
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
state: absent
type: view
group_name: snapshot_group1
view_name: view1
- name: Ensure that the consistency group's base volumes point-in-time snapshot images pit1 no longer exists.
na_santricity_snapshot:
ssid: "1"
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
state: absent
type: image
group_name: snapshot_group1
pit_name: pit1
- name: Ensure snapshot consistency group no longer exists.
na_santricity_snapshot:
ssid: "1"
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
state: absent
type: group
group_name: snapshot_group1
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | Whether changes have been made. |
| **deleted\_metadata\_keys** list / elements=string | always | Keys that were purged from the key-value datastore. |
| **group\_changes** dictionary | always | All changes performed to the consistency group. |
### Authors
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.netapp_e_amg – NetApp E-Series create, remove, and update asynchronous mirror groups netapp\_eseries.santricity.netapp\_e\_amg – NetApp E-Series create, remove, and update asynchronous mirror groups
=================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_amg`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allows for the creation, removal and updating of Asynchronous Mirror Groups for NetApp E-series storage arrays
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **interfaceType** string | **Choices:*** iscsi
* fibre
| The intended protocol to use if both Fibre and iSCSI are available. |
| **manualSync** boolean | **Choices:*** **no** ←
* yes
| Setting this to true will cause other synchronization values to be ignored |
| **name** string / required | | The name of the async array you wish to target, or create. If `state` is present and the name isn't found, it will attempt to create. |
| **new\_name** string | | New async array name |
| **recoveryWarnThresholdMinutes** integer | **Default:**20 | Recovery point warning threshold (minutes). The user will be warned when the age of the last good failures point exceeds this value |
| **repoUtilizationWarnThreshold** integer | **Default:**80 | Recovery point warning threshold |
| **secondaryArrayId** string / required | | The ID of the secondary array to be used in mirroring process |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string / required | **Choices:*** absent
* present
| A `state` of present will either create or update the async mirror group. A `state` of absent will remove the async mirror group. |
| **syncIntervalMinutes** integer | **Default:**10 | The synchronization interval in minutes |
| **syncWarnThresholdMinutes** integer | **Default:**10 | The threshold (in minutes) for notifying the user that periodic synchronization has taken too long to complete. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: AMG removal
na_eseries_amg:
state: absent
ssid: "{{ ssid }}"
secondaryArrayId: "{{amg_secondaryArrayId}}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
new_name: "{{amg_array_name}}"
name: "{{amg_name}}"
when: amg_create
- name: AMG create
netapp_e_amg:
state: present
ssid: "{{ ssid }}"
secondaryArrayId: "{{amg_secondaryArrayId}}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
new_name: "{{amg_array_name}}"
name: "{{amg_name}}"
when: amg_create
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Successful creation **Sample:** {"changed": true, "connectionType": "fc", "groupRef": "3700000060080E5000299C24000006E857AC7EEC", "groupState": "optimal", "id": "3700000060080E5000299C24000006E857AC7EEC", "label": "amg\_made\_by\_ansible", "localRole": "primary", "mirrorChannelRemoteTarget": "9000000060080E5000299C24005B06E557AC7EEC", "orphanGroup": false, "recoveryPointAgeAlertThresholdMinutes": 20, "remoteRole": "secondary", "remoteTarget": {"nodeName": {"ioInterfaceType": "fc", "iscsiNodeName": null, "remoteNodeWWN": "20040080E5299F1C"}, "remoteRef": "9000000060080E5000299C24005B06E557AC7EEC", "scsiinitiatorTargetBaseProperties": {"ioInterfaceType": "fc", "iscsiinitiatorTargetBaseParameters": null}}, "remoteTargetId": "ansible2", "remoteTargetName": "Ansible2", "remoteTargetWwn": "60080E5000299F880000000056A25D56", "repositoryUtilizationWarnThreshold": 80, "roleChangeProgress": "none", "syncActivity": "idle", "syncCompletionTimeAlertThresholdMinutes": 10, "syncIntervalMinutes": 10, "worldWideName": "60080E5000299C24000006E857AC7EEC"} |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.na_santricity_host – NetApp E-Series manage eseries hosts netapp\_eseries.santricity.na\_santricity\_host – NetApp E-Series manage eseries hosts
======================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_host`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, remove hosts on NetApp E-series storage arrays
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **force\_port** boolean | **Choices:*** no
* yes
| Allow ports that are already assigned to be re-assigned to your current host |
| **host\_type** string | | Host type includes operating system and multipath considerations. If not specified, the default host type will be utilized. Default host type can be set using [netapp\_eseries.santricity.na\_santricity\_global](na_santricity_global_module). For storage array specific options see [netapp\_eseries.santricity.na\_santricity\_facts](na_santricity_facts_module). All values are case-insensitive. AIX MPIO - The Advanced Interactive Executive (AIX) OS and the native MPIO driver AVT 4M - Silicon Graphics, Inc. (SGI) proprietary multipath driver HP-UX - The HP-UX OS with native multipath driver Linux ATTO - The Linux OS and the ATTO Technology, Inc. driver (must use ATTO FC HBAs) Linux DM-MP - The Linux OS and the native DM-MP driver Linux Pathmanager - The Linux OS and the SGI proprietary multipath driver Mac - The Mac OS and the ATTO Technology, Inc. driver ONTAP - FlexArray Solaris 11 or later - The Solaris 11 or later OS and the native MPxIO driver Solaris 10 or earlier - The Solaris 10 or earlier OS and the native MPxIO driver SVC - IBM SAN Volume Controller VMware - ESXi OS Windows - Windows Server OS and Windows MPIO with a DSM driver Windows Clustered - Clustered Windows Server OS and Windows MPIO with a DSM driver Windows ATTO - Windows OS and the ATTO Technology, Inc. driver
aliases: host\_type\_index |
| **name** string / required | | If the host doesn't yet exist, the label/name to assign at creation time. If the hosts already exists, this will be used to uniquely identify the host to make any required changes
aliases: label |
| **ports** list / elements=string | | A list of host ports you wish to associate with the host. Host ports are uniquely identified by their WWN or IQN. Their assignments to a particular host are uniquely identified by a label and these must be unique. |
| | **label** string / required | | A unique label to assign to this port assignment. |
| | **port** string / required | | The WWN or IQN of the hostPort to assign to this port definition. |
| | **type** string / required | **Choices:*** iscsi
* sas
* fc
* ib
* nvmeof
| The interface type of the port to define. Acceptable choices depend on the capabilities of the target hardware/software platform. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** absent
* **present** ←
| Set to absent to remove an existing host Set to present to modify or create a new host definition |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Define or update an existing host named "Host1"
na_santricity_host:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
name: "Host1"
state: present
host_type_index: Linux DM-MP
ports:
- type: "iscsi"
label: "PORT_1"
port: "iqn.1996-04.de.suse:01:56f86f9bd1fe"
- type: "fc"
label: "FC_1"
port: "10:00:FF:7C:FF:FF:FF:01"
- type: "fc"
label: "FC_2"
port: "10:00:FF:7C:FF:FF:FF:00"
- name: Ensure a host named "Host2" doesn"t exist
na_santricity_host:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
name: "Host2"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **api\_url** string | on success | the url of the API that this request was proccessed by **Sample:** https://webservices.example.com:8443 |
| **id** string | on success when state=present | the unique identifier of the host on the E-Series storage-system **Sample:** 00000000600A098000AAC0C3003004700AD86A52 |
| **msg** string | on success | A user-readable description of the actions performed. **Sample:** The host has been created. |
| **ssid** string | on success | the unique identifer of the E-Series storage-system with the current api **Sample:** 1 |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_alerts – NetApp E-Series manage email notification settings netapp\_eseries.santricity.na\_santricity\_alerts – NetApp E-Series manage email notification settings
======================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_alerts`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Certain E-Series systems have the capability to send email notifications on potentially critical events.
* This module will allow the owner of the system to specify email recipients for these messages.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **contact** string | | Allows the owner to specify some free-form contact information to be included in the emails. This is typically utilized to provide a contact phone number. |
| **recipients** list / elements=string | | The email addresses that will receive the email notifications. Required when *state=enabled*. |
| **sender** string | | This is the sender that the recipient will see. It doesn't necessarily need to be a valid email account. Required when *state=enabled*. |
| **server** string | | A fully qualified domain name, IPv4 address, or IPv6 address of a mail server. To use a fully qualified domain name, you must configure a DNS server on both controllers using M(na\_santricity\_mgmt\_interface). - Required when *state=enabled*. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **enabled** ←
* disabled
| Enable/disable the sending of email-based alerts. |
| **test** boolean | **Choices:*** **no** ←
* yes
| When a change is detected in the configuration, a test email will be sent. This may take a few minutes to process. Only applicable if *state=enabled*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* Alertable messages are a subset of messages shown by the Major Event Log (MEL), of the storage-system. Examples of alertable messages include drive failures, failed controllers, loss of redundancy, and other warning/critical events.
* This API is currently only supported with the Embedded Web Services API v2.0 and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Enable email-based alerting
na_santricity_alerts:
state: enabled
sender: [email protected]
server: [email protected]
contact: "Phone: 1-555-555-5555"
recipients:
- [email protected]
- [email protected]
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
- name: Disable alerting
na_santricity_alerts:
state: disabled
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
### Authors
* Michael Price (@lmprice)
ansible netapp_eseries.santricity.santricity_host_detail – Expands the host information from santricity_host lookup netapp\_eseries.santricity.santricity\_host\_detail – Expands the host information from santricity\_host lookup
===============================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.santricity_host_detail`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* Expands the host information from santricity\_host lookup to include system and port information
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **host\_interface\_ports** list / elements=string / required | | | List of dictionaries containing "stdout\_lines" which is a list of iqn/wwpns for each expected\_hosts from the results of the santricity\_host lookup plugin. Register the results from the shell module that is looped over each host in expected\_hosts. The command issued should result in a newline delineated list of iqns, nqns, or wwpns. |
| **hosts** list / elements=string / required | | | E-Series storage array inventory, hostvars[inventory\_hostname]. Run na\_santricity\_facts prior to calling |
| **hosts\_info** list / elements=string / required | | | The registered results from the setup module from each expected\_hosts, hosts\_info['results']. Collected results from the setup module for each expected\_hosts from the results of the santricity\_host lookup plugin. |
| **protocol** string / required | | | Storage system interface protocol (iscsi, sas, fc, ib-iser, ib-srp, nvme\_ib, nvme\_fc, or nvme\_roce) |
### Authors
* Nathan Swartz
ansible netapp_eseries.santricity.na_santricity_server_certificate – NetApp E-Series manage the storage system’s server SSL certificates. netapp\_eseries.santricity.na\_santricity\_server\_certificate – NetApp E-Series manage the storage system’s server SSL certificates.
=====================================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_server_certificate`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage NetApp E-Series storage system’s server SSL certificates.
Requirements
------------
The below requirements are needed on the host that executes this module.
* cryptography
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **certificates** list / elements=string | | Unordered list of all server certificate files which include PEM and DER encoded certificates as well as private keys. When *certificates* is not defined then a self-signed certificate will be expected. |
| **controller** string | **Choices:*** A
* B
| The controller that owns the port you want to configure. Controller names are represented alphabetically, with the first controller as A, the second as B, and so on. Current hardware models have either 1 or 2 available controllers, but that is not a guaranteed hard limitation and could change in the future.
*controller* must be specified unless managing SANtricity Web Services Proxy (ie *ssid="proxy"*) |
| **passphrase** string | | Passphrase for PEM encoded private key encryption. If *passphrase* is not supplied then Ansible will prompt for private key certificate. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Set *ssid==’0’* or *ssid==’proxy’* to specifically reference SANtricity Web Services Proxy.
* Certificates can be the following filetypes - PEM (.pem, .crt, .cer, or .key) or DER (.der or .cer)
* When *certificates* is not defined then a self-signed certificate will be expected.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Ensure signed certificate is installed.
na_santricity_server_certificate:
ssid: 1
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
controller: A
certificates:
- 'root_auth_cert.pem'
- 'intermediate_auth1_cert.pem'
- 'intermediate_auth2_cert.pem'
- 'public_cert.pem'
- 'private_key.pem'
passphrase: keypass
- name: Ensure signed certificate bundle is installed.
na_santricity_server_certificate:
ssid: 1
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
controller: B
certificates:
- 'cert_bundle.pem'
passphrase: keypass
- name: Ensure storage system generated self-signed certificate is installed.
na_santricity_server_certificate:
ssid: 1
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
controller: A
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **added\_certificates** list / elements=string | always | Any SSL certificates that were added. **Sample:** ['added\_certificiate.crt'] |
| **changed** boolean | always | Whether changes have been made. **Sample:** True |
| **removed\_certificates** list / elements=string | always | Any SSL certificates that were removed. **Sample:** ['removed\_certificiate.crt'] |
| **signed\_server\_certificate** boolean | always | Whether the public server certificate is signed. **Sample:** True |
### Authors
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.netapp_e_iscsi_target – NetApp E-Series manage iSCSI target configuration netapp\_eseries.santricity.netapp\_e\_iscsi\_target – NetApp E-Series manage iSCSI target configuration
=======================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_iscsi_target`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure the settings of an E-Series iSCSI target
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **chap\_secret** string | | Enable Challenge-Handshake Authentication Protocol (CHAP), utilizing this value as the password. When this value is specified, we will always trigger an update (changed=True). We have no way of verifying whether or not the password has changed. The chap secret may only use ascii characters with values between 32 and 126 decimal. The chap secret must be no less than 12 characters, but no greater than 57 characters in length. The chap secret is cleared when not specified or an empty string.
aliases: chap, password |
| **log\_path** string | | A local path (on the Ansible controller), to a file to be used for debug logging. |
| **name** string | | The name/alias to assign to the iSCSI target. This alias is often used by the initiator software in order to make an iSCSI target easier to identify.
aliases: alias |
| **ping** boolean | **Choices:*** no
* **yes** ←
| Enable ICMP ping responses from the configured iSCSI ports. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **unnamed\_discovery** boolean | **Choices:*** no
* **yes** ←
| When an initiator initiates a discovery session to an initiator port, it is considered an unnamed discovery session if the iSCSI target iqn is not specified in the request. This option may be disabled to increase security if desired. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* Some of the settings are dependent on the settings applied to the iSCSI interfaces. These can be configured using M(netapp\_e\_iscsi\_interface).
* This module requires a Web Services API version of >= 1.3.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Enable ping responses and unnamed discovery sessions for all iSCSI ports
netapp_e_iscsi_target:
api_url: "https://localhost:8443/devmgr/v2"
api_username: admin
api_password: myPassword
ssid: "1"
validate_certs: no
name: myTarget
ping: yes
unnamed_discovery: yes
- name: Set the target alias and the CHAP secret
netapp_e_iscsi_target:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
name: myTarget
chap: password1234
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **alias** string | on success | The alias assigned to the iSCSI target. **Sample:** myArray |
| **iqn** string | on success | The iqn (iSCSI Qualified Name), assigned to the iSCSI target. **Sample:** iqn.1992-08.com.netapp:2800.000a132000b006d2000000005a0e8f45 |
| **msg** string | on success | Success message **Sample:** The iSCSI target settings have been updated. |
### Authors
* Michael Price (@lmprice)
ansible netapp_eseries.santricity.netapp_e_syslog – NetApp E-Series manage syslog settings netapp\_eseries.santricity.netapp\_e\_syslog – NetApp E-Series manage syslog settings
=====================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_syslog`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allow the syslog settings to be configured for an individual E-Series storage-system
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | The syslog server's IPv4 address or a fully qualified hostname. All existing syslog configurations will be removed when *state=absent* and *address=None*. |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **components** list / elements=string | **Default:**["auditLog"] | The e-series logging components define the specific logs to transfer to the syslog server. At the time of writing, 'auditLog' is the only logging component but more may become available. |
| **log\_path** string | | This argument specifies a local path for logging purposes. |
| **port** integer | **Default:**514 | This is the port the syslog server is using. |
| **protocol** string | **Choices:*** **udp** ←
* tcp
* tls
| This is the transmission protocol the syslog server's using to receive syslog messages. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **present** ←
* absent
| Add or remove the syslog server configuration for E-Series storage array. Existing syslog server configuration will be removed or updated when its address matches *address*. Fully qualified hostname that resolve to an IPv4 address that matches *address* will not be treated as a match. |
| **test** boolean | **Choices:*** **no** ←
* yes
| This forces a test syslog message to be sent to the stated syslog server. Only attempts transmission when *state=present*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* This API is currently only supported with the Embedded Web Services API v2.12 (bundled with SANtricity OS 11.40.2) and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Add two syslog server configurations to NetApp E-Series storage array.
netapp_e_syslog:
state: present
address: "{{ item }}"
port: 514
protocol: tcp
component: "auditLog"
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
loop:
- "192.168.1.1"
- "192.168.1.100"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
| **syslog** boolean | on success | True if syslog server configuration has been added to e-series storage array. **Sample:** True |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_storage_system – NetApp E-Series Web Services Proxy manage storage arrays netapp\_eseries.santricity.netapp\_e\_storage\_system – NetApp E-Series Web Services Proxy manage storage arrays
================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_storage_system`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage the arrays accessible via a NetApp Web Services Proxy for NetApp E-series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **api\_url** string / required | | The url to the SANtricity WebServices Proxy or embedded REST API. |
| **api\_username** string / required | | The username to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **array\_password** string | | The management password of the array to manage, if set. |
| **array\_status\_timeout\_sec** integer | **Default:**60 | Array status timeout measured in seconds |
| **array\_wwn** string | | The WWN of the array to manage. Only necessary if in-band managing multiple arrays on the same agent host. Mutually exclusive of controller\_addresses parameter. |
| **controller\_addresses** list / elements=string / required | | The list addresses for the out-of-band management adapter or the agent host. Mutually exclusive of array\_wwn parameter. |
| **enable\_trace** boolean | **Choices:*** **no** ←
* yes
| Enable trace logging for SYMbol calls to the storage system. |
| **meta\_tags** list / elements=string | | Optional meta tags to associate to this storage system |
| **ssid** string / required | | The ID of the array to manage. This value must be unique for each array. |
| **state** string / required | **Choices:*** present
* absent
| Whether the specified array should be configured on the Web Services Proxy or not. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Examples
--------
```
---
- name: Presence of storage system
netapp_e_storage_system:
ssid: "{{ item.key }}"
state: present
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
controller_addresses:
- "{{ item.value.address1 }}"
- "{{ item.value.address2 }}"
with_dict: "{{ storage_systems }}"
when: check_storage_system
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | State of request **Sample:** Storage system removed. |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.na_santricity_ldap – NetApp E-Series manage LDAP integration to use for authentication netapp\_eseries.santricity.na\_santricity\_ldap – NetApp E-Series manage LDAP integration to use for authentication
===================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_ldap`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure an E-Series system to allow authentication via an LDAP server
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **bind\_password** string | | This is the password for the bind user account. Required when *bind\_user* is specified. |
| **bind\_user** string | | This is the user account that will be used for querying the LDAP server. Required when *bind\_password* is specified. Example: CN=MyBindAcct,OU=ServiceAccounts,DC=example,DC=com |
| **group\_attributes** list / elements=string | **Default:**["memberOf"] | The user attributes that should be considered for the group to role mapping. Typically this is used with something like "memberOf", and a user"s access is tested against group membership or lack thereof. |
| **identifier** string | **Default:**"default" | This is a unique identifier for the configuration (for cases where there are multiple domains configured). |
| **names** list / elements=string | | The domain name[s] that will be utilized when authenticating to identify which domain to utilize. Default to use the DNS name of the *server*. The only requirement is that the name[s] be resolvable. Example: [email protected] |
| **role\_mappings** dictionary | | This is where you specify which groups should have access to what permissions for the storage-system. For example, all users in group A will be assigned all 4 available roles, which will allow access to all the management functionality of the system (super-user). Those in group B only have the storage.monitor role, which will allow only read-only access. This is specified as a mapping of regular expressions to a list of roles. See the examples. The roles that will be assigned to to the group/groups matching the provided regex. storage.admin allows users full read/write access to storage objects and operations. storage.monitor allows users read-only access to storage objects and operations. support.admin allows users access to hardware, diagnostic information, the Major Event Log, and other critical support-related functionality, but not the storage configuration. security.admin allows users access to authentication/authorization configuration, as well as the audit log configuration, and certification management. |
| **search\_base** string | | The search base is used to find group memberships of the user. Example: ou=users,dc=example,dc=com |
| **server\_url** string | | This is the LDAP server url. The connection string should be specified as using the ldap or ldaps protocol along with the port information. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **present** ←
* absent
* disabled
| When *state=="present"* the defined LDAP domain will be added to the storage system. When *state=="absent"* the domain specified will be removed from the storage system.
*state=="disabled"* will result in deleting all existing LDAP domains on the storage system. |
| **user\_attribute** string | **Default:**"sAMAccountName" | This is the attribute we will use to match the provided username when a user attempts to authenticate. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported
* This module allows you to define one or more LDAP domains identified uniquely by *identifier* to use for authentication. Authorization is determined by *role\_mappings*, in that different groups of users may be given different (or no), access to certain aspects of the system and API.
* The local user accounts will still be available if the LDAP server becomes unavailable/inaccessible.
* Generally, you”ll need to get the details of your organization”s LDAP server before you”ll be able to configure the system for using LDAP authentication; every implementation is likely to be very different.
* This API is currently only supported with the Embedded Web Services API v2.0 and higher, or the Web Services Proxy v3.0 and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Disable LDAP authentication
na_santricity_ldap:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: absent
- name: Remove the "default" LDAP domain configuration
na_santricity_ldap:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: absent
identifier: default
- name: Define a new LDAP domain, utilizing defaults where possible
na_santricity_ldap:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: enabled
bind_username: "CN=MyBindAccount,OU=ServiceAccounts,DC=example,DC=com"
bind_password: "mySecretPass"
server: "ldap://example.com:389"
search_base: "OU=Users,DC=example,DC=com"
role_mappings:
".*dist-dev-storage.*":
- storage.admin
- security.admin
- support.admin
- storage.monitor
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The ldap settings have been updated. |
### Authors
* Michael Price (@lmprice)
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.na_santricity_proxy_firmware_upload – NetApp E-Series manage proxy firmware uploads. netapp\_eseries.santricity.na\_santricity\_proxy\_firmware\_upload – NetApp E-Series manage proxy firmware uploads.
===================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_proxy_firmware_upload`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Ensure specific firmware versions are available on SANtricity Web Services Proxy.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **firmware** list / elements=string | | List of paths and/or directories containing firmware/NVSRAM files. All firmware/NVSRAM files that are not specified will be removed from the proxy if they exist. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Ensure proxy has the expected firmware versions.
na_santricity_proxy_firmware_upload:
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
firmware:
- "path/to/firmware/dlp_files"
- "path/to/nvsram.dlp"
- "path/to/firmware.dlp"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | Status and version of firmware and NVSRAM. |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_global – NetApp E-Series manage global settings configuration netapp\_eseries.santricity.netapp\_e\_global – NetApp E-Series manage global settings configuration
===================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_global`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allow the user to configure several of the global settings associated with an E-Series storage-system
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **log\_path** string | | A local path to a file to be used for debug logging |
| **name** string | | Set the name of the E-Series storage-system This label/name doesn't have to be unique. May be up to 30 characters in length.
aliases: label |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* This module requires Web Services API v1.3 or newer.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Set the storage-system name
netapp_e_global:
name: myArrayName
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
| **name** string | on success | The current name/label of the storage-system. **Sample:** myArrayName |
### Authors
* Michael Price (@lmprice)
ansible netapp_eseries.santricity.na_santricity_mgmt_interface – NetApp E-Series manage management interface configuration netapp\_eseries.santricity.na\_santricity\_mgmt\_interface – NetApp E-Series manage management interface configuration
======================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_mgmt_interface`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure the E-Series management interfaces
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | The IPv4 address to assign to the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **config\_method** string | **Choices:*** dhcp
* static
| The configuration method type to use for network interface ports. dhcp is mutually exclusive with *address*, *subnet\_mask*, and *gateway*. |
| **controller** string / required | **Choices:*** A
* B
| The controller that owns the port you want to configure. Controller names are represented alphabetically, with the first controller as A, the second as B, and so on. Current hardware models have either 1 or 2 available controllers, but that is not a guaranteed hard limitation and could change in the future. |
| **dns\_address** string | | Primary IPv4 or IPv6 DNS server address |
| **dns\_address\_backup** string | | Secondary IPv4 or IPv6 DNS server address |
| **dns\_config\_method** string | **Choices:*** dhcp
* static
| The configuration method type to use for DNS services. dhcp is mutually exclusive with *dns\_address*, and *dns\_address\_backup*. |
| **gateway** string | | The IPv4 gateway address to utilize for the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **ntp\_address** string | | Primary IPv4, IPv6, or FQDN NTP server address |
| **ntp\_address\_backup** string | | Secondary IPv4, IPv6, or FQDN NTP server address |
| **ntp\_config\_method** string | **Choices:*** disabled
* dhcp
* static
| The configuration method type to use for NTP services. disable is mutually exclusive with *ntp\_address* and *ntp\_address\_backup*. dhcp is mutually exclusive with *ntp\_address* and *ntp\_address\_backup*. |
| **port** integer / required | | The ethernet port configuration to modify. The channel represents the port number left to right on the controller, beginning with 1. |
| **ssh** boolean | **Choices:*** no
* yes
| Enable ssh access to the controller for debug purposes. This is a controller-level setting. rlogin/telnet will be enabled for ancient equipment where ssh is not available. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **enabled** ←
* disabled
| Enable or disable IPv4 network interface configuration. Either IPv4 or IPv6 must be enabled otherwise error will occur. |
| **subnet\_mask** string | | The subnet mask to utilize for the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* It is highly recommended to have a minimum of one up management port on each controller.
* When using SANtricity Web Services Proxy, use M(na\_santricity\_storage\_system) to update management paths. This is required because of a known issue and will be addressed in the proxy version 4.1. After the resolution the management ports should automatically be updated.
* The interface settings are applied synchronously, but changes to the interface itself (receiving a new IP address via dhcp, etc), can take seconds or minutes longer to take effect.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Configure the first port on the A controller with a static IPv4 address
na_santricity_mgmt_interface:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
port: "1"
controller: "A"
config_method: static
address: "192.168.1.100"
subnet_mask: "255.255.255.0"
gateway: "192.168.1.1"
- name: Disable ipv4 connectivity for the second port on the B controller
na_santricity_mgmt_interface:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
port: "2"
controller: "B"
enable_interface: no
- name: Enable ssh access for ports one and two on controller A
na_santricity_mgmt_interface:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
port: "1"
controller: "A"
ssh: yes
- name: Configure static DNS settings for the first port on controller A
na_santricity_mgmt_interface:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
port: "1"
controller: "A"
dns_config_method: static
dns_address: "192.168.1.100"
dns_address_backup: "192.168.1.1"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **available\_embedded\_api\_urls** list / elements=string | on success | List containing available web services embedded REST API urls |
| **msg** string | on success | Success message **Sample:** The interface settings have been updated. |
### Authors
* Michael Price (@lmprice)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_amg_role – NetApp E-Series update the role of a storage array within an Asynchronous Mirror Group (AMG). netapp\_eseries.santricity.netapp\_e\_amg\_role – NetApp E-Series update the role of a storage array within an Asynchronous Mirror Group (AMG).
===============================================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_amg_role`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Update a storage array to become the primary or secondary instance in an asynchronous mirror group
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **api\_url** string / required | | The url to the SANtricity WebServices Proxy or embedded REST API. |
| **api\_username** string / required | | The username to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Whether to force the role reversal regardless of the online-state of the primary |
| **name** string / required | | Name of the role |
| **noSync** boolean | **Choices:*** **no** ←
* yes
| Whether to avoid synchronization prior to role reversal |
| **role** string / required | **Choices:*** primary
* secondary
| Whether the array should be the primary or secondary array for the AMG |
| **ssid** string / required | | The ID of the primary storage array for the async mirror action |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Examples
--------
```
- name: Update the role of a storage array
netapp_e_amg_role:
name: updating amg role
role: primary
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | failure | Failure message **Sample:** No Async Mirror Group with the name. |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.na_santricity_alerts_syslog – NetApp E-Series manage syslog servers receiving storage system alerts. netapp\_eseries.santricity.na\_santricity\_alerts\_syslog – NetApp E-Series manage syslog servers receiving storage system alerts.
==================================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_alerts_syslog`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage the list of syslog servers that will notifications on potentially critical events.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **servers** list / elements=string | | List of dictionaries where each dictionary contains a syslog server entry. |
| | **address** string / required | | Syslog server address can be a fully qualified domain name, IPv4 address, or IPv6 address. |
| | **port** string | **Default:**514 | UDP Port must be a numerical value between 0 and 65535. Typically, the UDP Port for syslog is 514. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **test** boolean | **Choices:*** **no** ←
* yes
| This forces a test syslog message to be sent to the stated syslog server. Test will only be issued when a change is made. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* This API is currently only supported with the Embedded Web Services API v2.12 (bundled with SANtricity OS 11.40.2) and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Add two syslog server configurations to NetApp E-Series storage array.
na_santricity_alerts_syslog:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
servers:
- address: "192.168.1.100"
- address: "192.168.2.100"
port: 514
- address: "192.168.3.100"
port: 1000
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
### Authors
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.na_santricity_iscsi_interface – NetApp E-Series manage iSCSI interface configuration netapp\_eseries.santricity.na\_santricity\_iscsi\_interface – NetApp E-Series manage iSCSI interface configuration
==================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_iscsi_interface`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure settings of an E-Series iSCSI interface
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | The IPv4 address to assign to the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **config\_method** string | **Choices:*** **dhcp** ←
* static
| The configuration method type to use for this interface. dhcp is mutually exclusive with *address*, *subnet\_mask*, and *gateway*. |
| **controller** string / required | **Choices:*** A
* B
| The controller that owns the port you want to configure. Controller names are presented alphabetically, with the first controller as A, the second as B, and so on. Current hardware models have either 1 or 2 available controllers, but that is not a guaranteed hard limitation and could change in the future. |
| **gateway** string | | The IPv4 gateway address to utilize for the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **mtu** integer | **Default:**1500 | The maximum transmission units (MTU), in bytes. This allows you to configure a larger value for the MTU, in order to enable jumbo frames (any value > 1500). Generally, it is necessary to have your host, switches, and other components not only support jumbo frames, but also have it configured properly. Therefore, unless you know what you're doing, it's best to leave this at the default.
aliases: max\_frame\_size |
| **port** integer / required | | The controller iSCSI HIC port to modify. You can determine this value by numbering the iSCSI ports left to right on the controller you wish to modify starting with one. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **enabled** ←
* disabled
| When enabled, the provided configuration will be utilized. When disabled, the IPv4 configuration will be cleared and IPv4 connectivity disabled. |
| **subnet\_mask** string | | The subnet mask to utilize for the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* The interface settings are applied synchronously, but changes to the interface itself (receiving a new IP address via dhcp, etc), can take seconds or minutes longer to take effect.
* This module will not be useful/usable on an E-Series system without any iSCSI interfaces.
* This module requires a Web Services API version of >= 1.3.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Configure the first port on the A controller with a static IPv4 address
na_santricity_iscsi_interface:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
port: "1"
controller: "A"
config_method: static
address: "192.168.1.100"
subnet_mask: "255.255.255.0"
gateway: "192.168.1.1"
- name: Disable ipv4 connectivity for the second port on the B controller
na_santricity_iscsi_interface:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
port: "2"
controller: "B"
state: disabled
- name: Enable jumbo frames for the first 4 ports on controller A
na_santricity_iscsi_interface:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
port: "{{ item }}"
controller: "A"
state: enabled
mtu: 9000
config_method: dhcp
loop:
- 1
- 2
- 3
- 4
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The interface settings have been updated. |
### Authors
* Michael Price (@lmprice)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_snapshot_group – NetApp E-Series manage snapshot groups netapp\_eseries.santricity.netapp\_e\_snapshot\_group – NetApp E-Series manage snapshot groups
==============================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_snapshot_group`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, delete snapshot groups for NetApp E-series storage arrays
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **api\_url** string / required | | The url to the SANtricity WebServices Proxy or embedded REST API. |
| **api\_username** string / required | | The username to authenticate with the SANtricity WebServices Proxy or embedded REST API. |
| **base\_volume\_name** string / required | | The name of the base volume or thin volume to use as the base for the new snapshot group. If a snapshot group with an identical `name` already exists but with a different base volume an error will be returned. |
| **delete\_limit** integer | **Default:**30 | The automatic deletion indicator. If non-zero, the oldest snapshot image will be automatically deleted when creating a new snapshot image to keep the total number of snapshot images limited to the number specified. This value is overridden by the consistency group setting if this snapshot group is associated with a consistency group. |
| **full\_policy** string | **Choices:*** unknown
* failbasewrites
* **purgepit** ←
| The behavior on when the data repository becomes full. This value is overridden by consistency group setting if this snapshot group is associated with a consistency group |
| **name** string / required | | The name to give the snapshot group |
| **repo\_pct** integer | **Default:**20 | The size of the repository in relation to the size of the base volume |
| **rollback\_priority** string | **Choices:*** highest
* high
* **medium** ←
* low
* lowest
| The importance of the rollback operation. This value is overridden by consistency group setting if this snapshot group is associated with a consistency group |
| **ssid** string | | Storage system identifier |
| **state** string / required | **Choices:*** present
* absent
| Whether to ensure the group is present or absent. |
| **storage\_pool\_name** string / required | | The name of the storage pool on which to allocate the repository volume. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **warning\_threshold** integer | **Default:**80 | The repository utilization warning threshold, as a percentage of the repository volume capacity. |
Examples
--------
```
- name: Configure Snapshot group
netapp_e_snapshot_group:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
base_volume_name: SSGroup_test
name=: OOSS_Group
repo_pct: 20
warning_threshold: 85
delete_limit: 30
full_policy: purgepit
storage_pool_name: Disk_Pool_1
rollback_priority: medium
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Success message **Sample:** json facts for newly created snapshot group. |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.na_santricity_asup – NetApp E-Series manage auto-support settings netapp\_eseries.santricity.na\_santricity\_asup – NetApp E-Series manage auto-support settings
==============================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_asup`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allow the auto-support settings to be configured for an individual E-Series storage-system
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **active** boolean | **Choices:*** no
* **yes** ←
| Enable active/proactive monitoring for ASUP. When a problem is detected by our monitoring systems, it's possible that the bundle did not contain all of the required information at the time of the event. Enabling this option allows NetApp support personnel to manually request transmission or re-transmission of support data in order ot resolve the problem. Only applicable if *state=enabled*. |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **days** list / elements=string | **Choices:*** monday
* tuesday
* wednesday
* thursday
* friday
* saturday
* sunday
| A list of days of the week that ASUP bundles will be sent. A larger, weekly bundle will be sent on one of the provided days.
aliases: schedule\_days, days\_of\_week |
| **email** dictionary | | Information particular to the e-mail delivery method. Uses the SMTP protocol. Required when M(method==email). |
| | **sender** string | | Sender's email account Required when M(routing\_type==email). |
| | **server** string | | Mail server's IP address or fully qualified domain name. Required when M(routing\_type==email). |
| | **test\_recipient** string | | Test verification email Required when M(routing\_type==email). |
| **end** integer | **Default:**24 | An end hour may be specified in a range from 1 to 24 hours. ASUP bundles will be sent daily between the provided start and end time (UTC).
*start* must be less than *end*. |
| **maintenance\_duration** integer | **Default:**24 | The duration of time the ASUP maintenance mode will be active. Permittable range is between 1 and 72 hours. Required when *state==maintenance\_enabled*. |
| **maintenance\_emails** list / elements=string | | List of email addresses for maintenance notifications. Required when *state==maintenance\_enabled*. |
| **method** string | **Choices:*** **https** ←
* http
* email
| AutoSupport dispatch delivery method. |
| **proxy** dictionary | | Information particular to the proxy delivery method. Required when M((method==https or method==http) and routing\_type==proxy). |
| | **host** string | | Proxy host IP address or fully qualified domain name. Required when M(method==http or method==https) and M(routing\_type==proxy). |
| | **password** string | | Password for the proxy. |
| | **port** integer | | Proxy host port. Required when M(method==http or method==https) and M(routing\_type==proxy). |
| | **script** string | | Path to the AutoSupport routing script file. Required when M(method==http or method==https) and M(routing\_type==script). |
| | **username** string | | Username for the proxy. |
| **routing\_type** string | **Choices:*** **direct** ←
* proxy
* script
| AutoSupport routing Required when M(method==https or method==http). |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **start** integer | **Default:**0 | A start hour may be specified in a range from 0 to 23 hours. ASUP bundles will be sent daily between the provided start and end time (UTC).
*start* must be less than *end*. |
| **state** string | **Choices:*** **enabled** ←
* disabled
* maintenance\_enabled
* maintenance\_disabled
| Enable/disable the E-Series auto-support configuration or maintenance mode. When this option is enabled, configuration, logs, and other support-related information will be relayed to NetApp to help better support your system. No personally identifiable information, passwords, etc, will be collected. The maintenance state enables the maintenance window which allows maintenance activities to be performed on the storage array without generating support cases. Maintenance mode cannot be enabled unless ASUP has previously been enabled. |
| **validate** boolean | **Choices:*** **no** ←
* yes
| Validate ASUP configuration. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* Enabling ASUP will allow our support teams to monitor the logs of the storage-system in order to proactively respond to issues with the system. It is recommended that all ASUP-related options be enabled, but they may be disabled if desired.
* This API is currently only supported with the Embedded Web Services API v2.0 and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Enable ASUP and allow pro-active retrieval of bundles
na_santricity_asup:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: enabled
active: true
days: ["saturday", "sunday"]
start: 17
end: 20
- name: Set the ASUP schedule to only send bundles from 12 AM CST to 3 AM CST.
na_santricity_asup:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: disabled
- name: Set the ASUP schedule to only send bundles from 12 AM CST to 3 AM CST.
na_santricity_asup:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
state: maintenance_enabled
maintenance_duration: 24
maintenance_emails:
- [email protected]
- name: Set the ASUP schedule to only send bundles from 12 AM CST to 3 AM CST.
na_santricity_asup:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: maintenance_disabled
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **active** boolean | on success | True if the active option has been enabled. **Sample:** True |
| **asup** boolean | on success | True if ASUP is enabled. **Sample:** True |
| **cfg** complex | on success | Provide the full ASUP configuration. |
| | **asupEnabled** boolean | success | True if ASUP has been enabled. |
| | **daysOfWeek** list / elements=string | success | The days of the week that ASUP bundles will be sent. |
| | **onDemandEnabled** boolean | success | True if ASUP active monitoring has been enabled. |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
### Authors
* Michael Price (@lmprice)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.santricity_host netapp\_eseries.santricity.santricity\_host
===========================================
The documentation for the lookup plugin, netapp\_eseries.santricity.santricity\_host, was malformed.
The errors were:
* ```
1 validation error for PluginDocSchema
doc -> options -> inventory -> type
string does not match regex "^(bits|bool|bytes|dict|float|int|json|jsonarg|list|path|raw|sid|str|tmppath|pathspec|pathlist)$" (type=value_error.str.regex; pattern=^(bits|bool|bytes|dict|float|int|json|jsonarg|list|path|raw|sid|str|tmppath|pathspec|pathlist)$)
```
File a bug with the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) in order to have it corrected.
ansible netapp_eseries.santricity.netapp_e_volume – NetApp E-Series manage storage volumes (standard and thin) netapp\_eseries.santricity.netapp\_e\_volume – NetApp E-Series manage storage volumes (standard and thin)
=========================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_volume`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create or remove volumes (standard and thin) for NetApp E/EF-series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **cache\_without\_batteries** boolean added in 2.9 of netapp\_eseries.santricity | **Choices:*** **no** ←
* yes
| Indicates whether caching should be used without battery backup. Warning, M(cache\_without\_batteries==true) and the storage system looses power and there is no battery backup, data will be lost! |
| **data\_assurance\_enabled** boolean | **Choices:*** **no** ←
* yes
| Determines whether data assurance (DA) should be enabled for the volume Only available when creating a new volume and on a storage pool with drives supporting the DA capability. |
| **initialization\_timeout** integer added in 2.9 of netapp\_eseries.santricity | | Duration in seconds before the wait\_for\_initialization operation will terminate. M(wait\_for\_initialization==True) to have any effect on module's operations. |
| **metadata** dictionary added in 2.8 of netapp\_eseries.santricity | | Dictionary containing meta data for the use, user, location, etc of the volume (dictionary is arbitrarily defined for whatever the user deems useful) When *workload\_name* exists on the storage array but the metadata is different then the workload definition will be updated. (Changes will update all associated volumes!)
*workload\_name* must be specified when *metadata* are defined. |
| **name** string / required | | The name of the volume to manage. |
| **owning\_controller** string added in 2.9 of netapp\_eseries.santricity | **Choices:*** A
* B
| Specifies which controller will be the primary owner of the volume Not specifying will allow the controller to choose ownership. |
| **read\_ahead\_enable** boolean added in 2.8 of netapp\_eseries.santricity | **Choices:*** no
* **yes** ←
| Indicates whether or not automatic cache read-ahead is enabled. This option has no effect on thinly provisioned volumes since the architecture for thin volumes cannot benefit from read ahead caching. |
| **read\_cache\_enable** boolean added in 2.8 of netapp\_eseries.santricity | **Choices:*** no
* **yes** ←
| Indicates whether read caching should be enabled for the volume. |
| **segment\_size\_kb** integer | **Default:**"128" | Segment size of the volume All values are in kibibytes. Some common choices include '8', '16', '32', '64', '128', '256', and '512' but options are system dependent. Retrieve the definitive system list from M(netapp\_e\_facts) under segment\_sizes. When the storage pool is a raidDiskPool then the segment size must be 128kb. Segment size migrations are not allowed in this module |
| **size** float / required | | Required only when *state=='present'*. Size of the volume in *size\_unit*. Size of the virtual volume in the case of a thin volume in *size\_unit*. Maximum virtual volume size of a thin provisioned volume is 256tb; however other OS-level restrictions may exist. |
| **size\_unit** string | **Choices:*** bytes
* b
* kb
* mb
* **gb** ←
* tb
* pb
* eb
* zb
* yb
| The unit used to interpret the size parameter |
| **ssd\_cache\_enabled** boolean | **Choices:*** **no** ←
* yes
| Whether an existing SSD cache should be enabled on the volume (fails if no SSD cache defined) The default value is to ignore existing SSD cache setting. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string / required | **Choices:*** present
* absent
| Whether the specified volume should exist |
| **storage\_pool\_name** string | | Required only when requested *state=='present'*. Name of the storage pool wherein the volume should reside. |
| **thin\_provision** boolean | **Choices:*** **no** ←
* yes
| Whether the volume should be thin provisioned. Thin volumes can only be created when *raid\_level=="raidDiskPool"*. Generally, use of thin-provisioning is not recommended due to performance impacts. |
| **thin\_volume\_expansion\_policy** string added in 2.8 of netapp\_eseries.santricity | **Choices:*** **automatic** ←
* manual
| This is the thin volume expansion policy. When *thin\_volume\_expansion\_policy=="automatic"* and *thin\_volume\_growth\_alert\_threshold* is exceed the *thin\_volume\_max\_repo\_size* will be automatically expanded. When *thin\_volume\_expansion\_policy=="manual"* and *thin\_volume\_growth\_alert\_threshold* is exceeded the storage system will wait for manual intervention. The thin volume\_expansion policy can not be modified on existing thin volumes in this module. Generally speaking you should almost always use *thin\_volume\_expansion\_policy=="automatic*. |
| **thin\_volume\_growth\_alert\_threshold** integer added in 2.8 of netapp\_eseries.santricity | **Default:**95 | This is the thin provision repository utilization threshold (in percent). When the percentage of used storage of the maximum repository size exceeds this value then a alert will be issued and the *thin\_volume\_expansion\_policy* will be executed. Values must be between or equal to 10 and 99. |
| **thin\_volume\_max\_repo\_size** float | | This is the maximum amount the thin volume repository will be allowed to grow. Only has significance when *thin\_volume\_expansion\_policy=="automatic"*. When the percentage *thin\_volume\_repo\_size* of *thin\_volume\_max\_repo\_size* exceeds *thin\_volume\_growth\_alert\_threshold* then a warning will be issued and the storage array will execute the *thin\_volume\_expansion\_policy* policy. Expansion operations when *thin\_volume\_expansion\_policy=="automatic"* will increase the maximum repository size. The default will be the same as size (in size\_unit) |
| **thin\_volume\_repo\_size** integer | | This value (in size\_unit) sets the allocated space for the thin provisioned repository. Initial value must between or equal to 4gb and 256gb in increments of 4gb. During expansion operations the increase must be between or equal to 4gb and 256gb in increments of 4gb. This option has no effect during expansion if *thin\_volume\_expansion\_policy=="automatic"*. Generally speaking you should almost always use *thin\_volume\_expansion\_policy=="automatic*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **wait\_for\_initialization** boolean added in 2.8 of netapp\_eseries.santricity | **Choices:*** **no** ←
* yes
| Forces the module to wait for expansion operations to complete before continuing. |
| **workload\_name** string added in 2.8 of netapp\_eseries.santricity | | Label for the workload defined by the metadata. When *workload\_name* and *metadata* are specified then the defined workload will be added to the storage array. When *workload\_name* exists on the storage array but the metadata is different then the workload definition will be updated. (Changes will update all associated volumes!) Existing workloads can be retrieved using M(netapp\_e\_facts). |
| **write\_cache\_enable** boolean added in 2.8 of netapp\_eseries.santricity | **Choices:*** no
* **yes** ←
| Indicates whether write-back caching should be enabled for the volume. |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Create simple volume with workload tags (volume meta data)
netapp_e_volume:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
state: present
name: volume
storage_pool_name: storage_pool
size: 300
size_unit: gb
workload_name: volume_tag
metadata:
key1: value1
key2: value2
- name: Create a thin volume
netapp_e_volume:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
state: present
name: volume1
storage_pool_name: storage_pool
size: 131072
size_unit: gb
thin_provision: true
thin_volume_repo_size: 32
thin_volume_max_repo_size: 1024
- name: Expand thin volume's virtual size
netapp_e_volume:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
state: present
name: volume1
storage_pool_name: storage_pool
size: 262144
size_unit: gb
thin_provision: true
thin_volume_repo_size: 32
thin_volume_max_repo_size: 1024
- name: Expand thin volume's maximum repository size
netapp_e_volume:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
state: present
name: volume1
storage_pool_name: storage_pool
size: 262144
size_unit: gb
thin_provision: true
thin_volume_repo_size: 32
thin_volume_max_repo_size: 2048
- name: Delete volume
netapp_e_volume:
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
state: absent
name: volume
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | State of volume **Sample:** Standard volume [workload\_vol\_1] has been created. |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.na_santricity_auth – NetApp E-Series set or update the password for a storage array device or SANtricity Web Services Proxy. netapp\_eseries.santricity.na\_santricity\_auth – NetApp E-Series set or update the password for a storage array device or SANtricity Web Services Proxy.
=========================================================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_auth`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Sets or updates the password for a storage array device or SANtricity Web Services Proxy.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **current\_admin\_password** string | | The current admin password. When making changes to the embedded web services's login passwords, api\_password will be used and current\_admin\_password will be ignored. When making changes to the proxy web services's login passwords, api\_password will be used and current\_admin\_password will be ignored. Only required when the password has been set and will be ignored if not set. |
| **minimum\_password\_length** integer | | This option defines the minimum password length. |
| **password** string | | The password you would like to set. Cannot be more than 30 characters. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **user** string | **Choices:*** **admin** ←
* monitor
* support
* security
* storage
| The local user account password to update For systems prior to E2800, use admin to change the rw (system password). For systems prior to E2800, all choices except admin will be ignored. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Set *ssid==”0”* or *ssid==”proxy”* when attempting to change the password for SANtricity Web Services Proxy.
* SANtricity Web Services Proxy storage password will be updated when changing the password on a managed storage system from the proxy; This is only true when the storage system has been previously contacted.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Set the initial password
na_santricity_auth:
ssid: 1
api_url: https://192.168.1.100:8443/devmgr/v2
api_username: admin
api_password: adminpass
validate_certs: true
current_admin_password: currentadminpass
password: newpassword123
user: admin
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Success message **Sample:** Password Updated Successfully |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_discover – NetApp E-Series discover E-Series storage systems netapp\_eseries.santricity.na\_santricity\_discover – NetApp E-Series discover E-Series storage systems
=======================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_discover`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Module searches a subnet range and returns any available E-Series storage systems.
Requirements
------------
The below requirements are needed on the host that executes this module.
* ipaddress
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **ports** list / elements=string | **Default:**[8443] | This option specifies which ports to be tested during the discovery process. The first usable port will be used in the returned API url. |
| **prefer\_embedded** boolean | **Choices:*** **no** ←
* yes
| Give preference to Web Services Embedded when an option exists for both Web Services Proxy and Embedded. Web Services Proxy will be utilized when available by default. |
| **proxy\_password** string | | Web Service Proxy user password |
| **proxy\_url** string | | Web Services Proxy REST API URL. Example https://192.168.1.100:8443/devmgr/v2/ |
| **proxy\_username** string | | Web Service Proxy username |
| **proxy\_validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether to validate Web Service Proxy SSL certificate |
| **subnet\_mask** string / required | | This is the IPv4 search range for discovering E-Series storage arrays. IPv4 subnet mask specified in CIDR form. Example 192.168.1.0/24 would search the range 192.168.1.0 to 192.168.1.255. Be sure to include all management paths in the search range. |
Notes
-----
Note
* Only available for platforms E2800 or later (SANtricity Web Services Embedded REST API must be available).
* All E-Series storage systems with SANtricity version 11.62 or later will be discovered.
* Only E-Series storage systems without a set admin password running SANtricity versions prior to 11.62 will be discovered.
* Use SANtricity Web Services Proxy to discover all systems regardless of SANricity version or password.
Examples
--------
```
- name: Discover all E-Series storage systems on the network.
na_santricity_discover:
subnet_mask: 192.168.1.0/24
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **systems\_found** dictionary | on success | Success message **Sample:** {"012341234123": { "addresses": ["192.168.1.184", "192.168.1.185"], "api\_urls": ["https://192.168.1.184:8443/devmgr/v2/", "https://192.168.1.185:8443/devmgr/v2/"], "label": "ExampleArray01", "proxy\_ssid: "", "proxy\_required": false}, "012341234567": { "addresses": ["192.168.1.23", "192.168.1.24"], "api\_urls": ["https://192.168.1.100:8443/devmgr/v2/"], "label": "ExampleArray02", "proxy\_ssid": "array\_ssid", "proxy\_required": true}} |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.santricity_storage_pool – Storage pool information netapp\_eseries.santricity.santricity\_storage\_pool – Storage pool information
===============================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.santricity_storage_pool`.
Synopsis
--------
* Retrieves storage pool information from the inventory
### Authors
* Nathan Swartz
ansible netapp_eseries.santricity.netapp_e_mgmt_interface – NetApp E-Series management interface configuration netapp\_eseries.santricity.netapp\_e\_mgmt\_interface – NetApp E-Series management interface configuration
==========================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_mgmt_interface`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure the E-Series management interfaces
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | The IPv4 address to assign to the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **channel** integer | | The port to modify the configuration for. The channel represents the port number (typically from left to right on the controller), beginning with a value of 1. Mutually exclusive with *name*. |
| **config\_method** string | **Choices:*** dhcp
* static
| The configuration method type to use for network interface ports. dhcp is mutually exclusive with *address*, *subnet\_mask*, and *gateway*. |
| **controller** string / required | **Choices:*** A
* B
| The controller that owns the port you want to configure. Controller names are represented alphabetically, with the first controller as A, the second as B, and so on. Current hardware models have either 1 or 2 available controllers, but that is not a guaranteed hard limitation and could change in the future. |
| **dns\_address** string | | Primary IPv4 DNS server address |
| **dns\_address\_backup** string | | Backup IPv4 DNS server address Queried when primary DNS server fails |
| **dns\_config\_method** string | **Choices:*** dhcp
* static
| The configuration method type to use for DNS services. dhcp is mutually exclusive with *dns\_address*, and *dns\_address\_backup*. |
| **gateway** string | | The IPv4 gateway address to utilize for the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **log\_path** string | | A local path to a file to be used for debug logging |
| **name** string | | The port to modify the configuration for. The list of choices is not necessarily comprehensive. It depends on the number of ports that are present in the system. The name represents the port number (typically from left to right on the controller), beginning with a value of 1. Mutually exclusive with *channel*.
aliases: port, iface |
| **ntp\_address** string | | Primary IPv4 NTP server address |
| **ntp\_address\_backup** string | | Backup IPv4 NTP server address Queried when primary NTP server fails |
| **ntp\_config\_method** string | **Choices:*** disable
* dhcp
* static
| The configuration method type to use for NTP services. disable is mutually exclusive with *ntp\_address* and *ntp\_address\_backup*. dhcp is mutually exclusive with *ntp\_address* and *ntp\_address\_backup*. |
| **ssh** boolean | **Choices:*** no
* yes
| Enable ssh access to the controller for debug purposes. This is a controller-level setting. rlogin/telnet will be enabled for ancient equipment where ssh is not available. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** enable
* disable
| Enable or disable IPv4 network interface configuration. Either IPv4 or IPv6 must be enabled otherwise error will occur. Only required when enabling or disabling IPv4 network interface
aliases: enable\_interface |
| **subnet\_mask** string | | The subnet mask to utilize for the interface. Should be specified in xx.xx.xx.xx form. Mutually exclusive with *config\_method=dhcp*
|
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* The interface settings are applied synchronously, but changes to the interface itself (receiving a new IP address via dhcp, etc), can take seconds or minutes longer to take effect.
* Known issue: Changes specifically to down ports will result in a failure. However, this may not be the case in up coming NetApp E-Series firmware releases (released after firmware version 11.40.2).
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Configure the first port on the A controller with a static IPv4 address
netapp_e_mgmt_interface:
channel: 1
controller: "A"
config_method: static
address: "192.168.1.100"
subnet_mask: "255.255.255.0"
gateway: "192.168.1.1"
ssid: "1"
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
- name: Disable ipv4 connectivity for the second port on the B controller
netapp_e_mgmt_interface:
channel: 2
controller: "B"
enable_interface: no
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
- name: Enable ssh access for ports one and two on controller A
netapp_e_mgmt_interface:
channel: "{{ item }}"
controller: "A"
ssh: yes
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
loop:
- 1
- 2
- name: Configure static DNS settings for the first port on controller A
netapp_e_mgmt_interface:
channel: 1
controller: "A"
dns_config_method: static
dns_address: "192.168.1.100"
dns_address_backup: "192.168.1.1"
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
- name: Configure static NTP settings for ports one and two on controller B
netapp_e_mgmt_interface:
channel: "{{ item }}"
controller: "B"
ntp_config_method: static
ntp_address: "129.100.1.100"
ntp_address_backup: "127.100.1.1"
ssid: "{{ ssid }}"
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
loop:
- 1
- 2
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **enabled** boolean | on success | Indicates whether IPv4 connectivity has been enabled or disabled. This does not necessarily indicate connectivity. If dhcp was enabled absent a dhcp server, for instance, it is unlikely that the configuration will actually be valid. **Sample:** True |
| **msg** string | on success | Success message **Sample:** The interface settings have been updated. |
### Authors
* Michael Price (@lmprice)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_proxy_systems – NetApp E-Series manage SANtricity web services proxy storage arrays netapp\_eseries.santricity.na\_santricity\_proxy\_systems – NetApp E-Series manage SANtricity web services proxy storage arrays
===============================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_proxy_systems`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage the arrays accessible via a NetApp Web Services Proxy for NetApp E-series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **accept\_certificate** boolean | **Choices:*** no
* **yes** ←
| Accept the storage system's certificate automatically even when it is self-signed. Use M(na\_santricity\_certificates) to add certificates to SANtricity Web Services Proxy. SANtricity Web Services Proxy will fail to add any untrusted storage system. |
| **add\_discovered\_systems** boolean | **Choices:*** **no** ←
* yes
| This flag will force all discovered storage systems to be added to SANtricity Web Services Proxy. |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **password** string | | Default storage system password which will be used anytime when password has not been provided in the *systems* sub-options. The storage system admin password will be set on the device itself with the provided admin password if it is not set. |
| **subnet\_mask** string | | This is the IPv4 search range for discovering E-Series storage arrays. IPv4 subnet mask specified in CIDR form. Example 192.168.1.0/24 would search the range 192.168.1.0 to 192.168.1.255. Be sure to include all management paths in the search range. |
| **systems** list / elements=string | **Default:**[] | List of storage system information which defines which systems should be added on SANtricity Web Services Proxy. Accepts a simple serial number list or list of dictionary containing at minimum the serial or addresses key from the sub-option list. Note that the serial number will be used as the storage system identifier when an identifier is not specified. When *add\_discovered\_systems == False* and any system serial number not supplied that is discovered will be removed from the proxy. |
| | **addresses** list / elements=string | | List of storage system's IPv4 addresses. Mutually exclusive with the sub-option serial. |
| | **password** string | | This is the storage system admin password. When not provided *default\_password* will be used. The storage system admin password will be set on the device itself with the provided admin password if it is not set. |
| | **serial** string | | Storage system's serial number which can be located on the top of every NetApp E-Series enclosure. Include any leading zeros. Mutually exclusive with the sub-option address. |
| | **ssid** string | | This is the Web Services Proxy's identifier for a storage system. When ssid is not specified then either the serial or first controller IPv4 address will be used instead. |
| | **tags** dictionary | | Optional meta tags to associate to the storage system |
| **tags** dictionary | | Default meta tags to associate with all storage systems if not otherwise specified in *systems* sub-options. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
---
- name: Add storage systems to SANtricity Web Services Proxy
na_santricity_proxy_systems:
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
subnet_mask: 192.168.1.0/24
password: password
tags:
tag: value
accept_certificate: True
systems:
- ssid: "system1"
serial: "056233035640"
password: "asecretpassword"
tags:
use: corporate
location: sunnyvale
- ssid: "system2"
addresses:
- 192.168.1.100
- 192.168.2.100 # Second is not be required. It will be discovered
password: "anothersecretpassword"
- serial: "021324673799"
- "021637323454"
- name: Add storage system to SANtricity Web Services Proxy with serial number list only. The serial numbers will be used to identify each system.
na_santricity_proxy_systems:
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
subnet_mask: 192.168.1.0/24
password: password
accept_certificate: True
systems:
- "1144FG123018"
- "721716500123"
- "123540006043"
- "112123001239"
- name: Add all discovered storage system to SANtricity Web Services Proxy found in the IP address range 192.168.1.0 to 192.168.1.255.
na_santricity_proxy_systems:
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
add_discovered_systems: True
subnet_mask: 192.168.1.0/24
password: password
accept_certificate: True
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | Description of actions performed. **Sample:** Storage systems [system1, system2, 1144FG123018, 721716500123, 123540006043, 112123001239] were added. |
### Authors
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.netapp_e_alerts – NetApp E-Series manage email notification settings netapp\_eseries.santricity.netapp\_e\_alerts – NetApp E-Series manage email notification settings
=================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_alerts`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Certain E-Series systems have the capability to send email notifications on potentially critical events.
* This module will allow the owner of the system to specify email recipients for these messages.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **contact** string | | Allows the owner to specify some free-form contact information to be included in the emails. This is typically utilized to provide a contact phone number. |
| **log\_path** string | | Path to a file on the Ansible control node to be used for debug logging |
| **recipients** list / elements=string | | The email addresses that will receive the email notifications. Required when *state=enabled*. |
| **sender** string | | This is the sender that the recipient will see. It doesn't necessarily need to be a valid email account. Required when *state=enabled*. |
| **server** string | | A fully qualified domain name, IPv4 address, or IPv6 address of a mail server. To use a fully qualified domain name, you must configure a DNS server on both controllers using M(netapp\_e\_mgmt\_interface). - Required when *state=enabled*. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **enabled** ←
* disabled
| Enable/disable the sending of email-based alerts. |
| **test** boolean | **Choices:*** **no** ←
* yes
| When a change is detected in the configuration, a test email will be sent. This may take a few minutes to process. Only applicable if *state=enabled*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* Alertable messages are a subset of messages shown by the Major Event Log (MEL), of the storage-system. Examples of alertable messages include drive failures, failed controllers, loss of redundancy, and other warning/critical events.
* This API is currently only supported with the Embedded Web Services API v2.0 and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Enable email-based alerting
netapp_e_alerts:
state: enabled
sender: [email protected]
server: [email protected]
contact: "Phone: 1-555-555-5555"
recipients:
- [email protected]
- [email protected]
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
- name: Disable alerting
netapp_e_alerts:
state: disabled
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
### Authors
* Michael Price (@lmprice)
ansible netapp_eseries.santricity.netapp_e_drive_firmware – NetApp E-Series manage drive firmware netapp\_eseries.santricity.netapp\_e\_drive\_firmware – NetApp E-Series manage drive firmware
=============================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_drive_firmware`.
New in version 2.9: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Ensure drive firmware version is activated on specified drive model.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **firmware** list / elements=string / required | | list of drive firmware file paths. NetApp E-Series drives require special firmware which can be downloaded from https://mysupport.netapp.com/NOW/download/tools/diskfw\_eseries/ |
| **ignore\_inaccessible\_drives** boolean | **Choices:*** **no** ←
* yes
| This flag will determine whether drive firmware upgrade should fail if any affected drives are inaccessible. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **upgrade\_drives\_online** boolean | **Choices:*** no
* **yes** ←
| This flag will determine whether drive firmware can be upgrade while drives are accepting I/O. When *upgrade\_drives\_online==False* stop all I/O before running task. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **wait\_for\_completion** boolean | **Choices:*** **no** ←
* yes
| This flag will cause module to wait for any upgrade actions to complete. |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Ensure correct firmware versions
nac_santricity_drive_firmware:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
firmware: "path/to/drive_firmware"
wait_for_completion: true
ignore_inaccessible_drives: false
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | Whether any drive firmware was upgraded and whether it is in progress. **Sample:** {'changed': True, 'upgrade\_in\_process': True} |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_storagepool – NetApp E-Series manage volume groups and disk pools netapp\_eseries.santricity.na\_santricity\_storagepool – NetApp E-Series manage volume groups and disk pools
============================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_storagepool`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create or remove volume groups and disk pools for NetApp E-series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **criteria\_drive\_count** integer | | The number of disks to use for building the storage pool. When *state=="present"* then *criteria\_drive\_count* or *criteria\_min\_usable\_capacity* must be specified. The pool will be expanded if this number exceeds the number of disks already in place (See expansion note below) |
| **criteria\_drive\_interface\_type** string | **Choices:*** scsi
* fibre
* sata
* pata
* fibre520b
* sas
* sas4k
* nvme4k
| The interface type to use when selecting drives for the storage pool If not provided then all interface types will be considered. |
| **criteria\_drive\_max\_size** float | | The maximum individual drive size (in size\_unit) to consider when choosing drives for the storage pool. |
| **criteria\_drive\_min\_size** float | | The minimum individual drive size (in size\_unit) to consider when choosing drives for the storage pool. |
| **criteria\_drive\_require\_da** boolean | **Choices:*** **no** ←
* yes
| Ensures the storage pool will be created with only data assurance (DA) capable drives. Only available for new storage pools; existing storage pools cannot be converted. |
| **criteria\_drive\_require\_fde** boolean | **Choices:*** **no** ←
* yes
| Whether full disk encryption ability is required for drives to be added to the storage pool |
| **criteria\_drive\_type** string | **Choices:*** hdd
* ssd
| The type of disk (hdd or ssd) to use when searching for candidates to use. When not specified each drive type will be evaluated until successful drive candidates are found starting with the most prevalent drive type. |
| **criteria\_min\_usable\_capacity** float | | The minimum size of the storage pool (in size\_unit). When *state=="present"* then *criteria\_drive\_count* or *criteria\_min\_usable\_capacity* must be specified. The pool will be expanded if this value exceeds its current size. (See expansion note below) Do not use when the storage system contains mixed drives and *usable\_drives* is specified since usable capacities may not be accurate. |
| **criteria\_size\_unit** string | **Choices:*** bytes
* b
* kb
* mb
* **gb** ←
* tb
* pb
* eb
* zb
* yb
| The unit used to interpret size parameters |
| **ddp\_critical\_threshold\_pct** integer | **Default:**85 | Issues a critical alert when threshold of storage has been allocated. Only applicable when *raid\_level=="raidDiskPool"*. Set *ddp\_critical\_threshold\_pct==0* to disable alert. |
| **ddp\_warning\_threshold\_pct** integer | **Default:**85 | Issues a warning alert when threshold of storage has been allocated. Only applicable when *raid\_level=="raidDiskPool"*. Set *ddp\_warning\_threshold\_pct==0* to disable alert. |
| **erase\_secured\_drives** boolean | **Choices:*** no
* **yes** ←
| If *state=="absent"* then all storage pool drives will be erase If *state=="present"* then delete all available storage array drives that have security enabled. |
| **name** string / required | | The name of the storage pool to manage |
| **raid\_level** string | **Choices:*** raidAll
* raid0
* raid1
* raid3
* raid5
* raid6
* **raidDiskPool** ←
| The RAID level of the storage pool to be created. Required only when *state=="present"*. When *raid\_level=="raidDiskPool"* then *criteria\_drive\_count >= 10 or criteria\_drive\_count >= 11* is required depending on the storage array specifications. When *raid\_level=="raid0"* then *1<=criteria\_drive\_count* is required. When *raid\_level=="raid1"* then *2<=criteria\_drive\_count* is required. When *raid\_level=="raid3"* then *3<=criteria\_drive\_count<=30* is required. When *raid\_level=="raid5"* then *3<=criteria\_drive\_count<=30* is required. When *raid\_level=="raid6"* then *5<=criteria\_drive\_count<=30* is required. Note that raidAll will be treated as raidDiskPool and raid3 as raid5. |
| **remove\_volumes** boolean | **Choices:*** no
* **yes** ←
| Prior to removing a storage pool, delete all volumes in the pool. |
| **reserve\_drive\_count** integer | | Set the number of drives reserved by the storage pool for reconstruction operations. Only valid on raid disk pools. |
| **secure\_pool** boolean | **Choices:*** no
* yes
| Enables security at rest feature on the storage pool. Will only work if all drives in the pool are security capable (FDE, FIPS, or mix) Warning, once security is enabled it is impossible to disable without erasing the drives. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **present** ←
* absent
| Whether the specified storage pool should exist or not. Note that removing a storage pool currently requires the removal of all defined volumes first. |
| **usable\_drives** string | | Ordered comma-separated list of tray/drive slots to be selected for drive candidates (drives that are used will be skipped). Each drive entry is represented as <tray\_number>:<(optional) drawer\_number>:<drive\_slot\_number> (e.g. 99:0 is the base tray's drive slot 0). The base tray's default identifier is 99 and expansion trays are added in the order they are attached but these identifiers can be changed by the user. Be aware that trays with multiple drawers still have a dedicated drive slot for all drives and the slot number does not rely on the drawer; however, if you're planing to have drawer protection you need to order accordingly. When *usable\_drives* are not provided then the drive candidates will be selected by the storage system. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The expansion operations are non-blocking due to the time consuming nature of expanding volume groups
* Traditional volume groups (raid0, raid1, raid5, raid6) are performed in steps dictated by the storage array. Each required step will be attempted until the request fails which is likely because of the required expansion time.
* raidUnsupported will be treated as raid0, raidAll as raidDiskPool and raid3 as raid5.
* Tray loss protection and drawer loss protection will be chosen if at all possible.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: No disk groups
na_santricity_storagepool:
ssid: "{{ ssid }}"
name: "{{ item }}"
state: absent
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Success message **Sample:** Json facts for the pool that was created. |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_auditlog – NetApp E-Series manage audit-log configuration netapp\_eseries.santricity.netapp\_e\_auditlog – NetApp E-Series manage audit-log configuration
===============================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_auditlog`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows an e-series storage system owner to set audit-log configuration parameters.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Forces the audit-log configuration to delete log history when log messages fullness cause immediate warning or full condition. Warning! This will cause any existing audit-log messages to be deleted. This is only applicable for *full\_policy=preventSystemAccess*. |
| **full\_policy** string | **Choices:*** **overWrite** ←
* preventSystemAccess
| Specifies what audit-log should do once the number of entries approach the record limit. |
| **log\_level** string | **Choices:*** all
* **writeOnly** ←
| Filters the log messages according to the specified log level selection. |
| **log\_path** string | | A local path to a file to be used for debug logging. |
| **max\_records** integer | **Default:**50000 | The maximum number log messages audit-log will retain. Max records must be between and including 100 and 50000. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **threshold** integer | **Default:**90 | This is the memory full percent threshold that audit-log will start issuing warning messages. Percent range must be between and including 60 and 90. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* This module is currently only supported with the Embedded Web Services API v3.0 and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Define audit-log to prevent system access if records exceed 50000 with warnings occurring at 60% capacity.
netapp_e_auditlog:
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
api_username: "{{ netapp_e_api_username }}"
api_password: "{{ netapp_e_api_password }}"
ssid: "{{ netapp_e_ssid }}"
validate_certs: no
max_records: 50000
log_level: all
full_policy: preventSystemAccess
threshold: 60
log_path: /path/to/log_file.log
- name: Define audit-log utilize the default values.
netapp_e_auditlog:
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
api_username: "{{ netapp_e_api_username }}"
api_password: "{{ netapp_e_api_password }}"
ssid: "{{ netapp_e_ssid }}"
- name: Force audit-log configuration when full or warning conditions occur while enacting preventSystemAccess policy.
netapp_e_auditlog:
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
api_username: "{{ netapp_e_api_username }}"
api_password: "{{ netapp_e_api_password }}"
ssid: "{{ netapp_e_ssid }}"
max_records: 5000
log_level: all
full_policy: preventSystemAccess
threshold: 60
force: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
### Authors
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.na_santricity_ib_iser_interface – NetApp E-Series manage InfiniBand iSER interface configuration netapp\_eseries.santricity.na\_santricity\_ib\_iser\_interface – NetApp E-Series manage InfiniBand iSER interface configuration
===============================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_ib_iser_interface`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure settings of an E-Series InfiniBand iSER interface IPv4 address configuration.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string / required | | The IPv4 address to assign to the interface. Should be specified in xx.xx.xx.xx form. |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **channel** integer / required | | The InfiniBand HCA port you wish to modify. Ports start left to right and start with 1. |
| **controller** string / required | **Choices:*** A
* B
| The controller that owns the port you want to configure. Controller names are presented alphabetically, with the first controller as A, the second as B, and so on. Current hardware models have either 1 or 2 available controllers, but that is not a guaranteed hard limitation and could change in the future. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Configure the first port on the A controller with a static IPv4 address
na_santricity_ib_iser_interface:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
controller: "A"
channel: "1"
address: "192.168.1.100"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **enabled** boolean | on success | Indicates whether IPv4 connectivity has been enabled or disabled. This does not necessarily indicate connectivity. If dhcp was enabled without a dhcp server, for instance, it is unlikely that the configuration will actually be valid. **Sample:** True |
| **msg** string | on success | Success message **Sample:** The interface settings have been updated. |
### Authors
* Michael Price (@lmprice)
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_auditlog – NetApp E-Series manage audit-log configuration netapp\_eseries.santricity.na\_santricity\_auditlog – NetApp E-Series manage audit-log configuration
====================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_auditlog`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows an e-series storage system owner to set audit-log configuration parameters.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Forces the audit-log configuration to delete log history when log messages fullness cause immediate warning or full condition. Warning! This will cause any existing audit-log messages to be deleted. This is only applicable for *full\_policy=preventSystemAccess*. |
| **full\_policy** string | **Choices:*** **overWrite** ←
* preventSystemAccess
| Specifies what audit-log should do once the number of entries approach the record limit. |
| **log\_level** string | **Choices:*** all
* **writeOnly** ←
| Filters the log messages according to the specified log level selection. |
| **max\_records** integer | **Default:**50000 | The maximum number log messages audit-log will retain. Max records must be between and including 100 and 50000. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **threshold** integer | **Default:**90 | This is the memory full percent threshold that audit-log will start issuing warning messages. Percent range must be between and including 60 and 90. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* Use *ssid==”0”* or *ssid==”proxy”* to configure SANtricity Web Services Proxy auditlog settings otherwise.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Define audit-log to prevent system access if records exceed 50000 with warnings occurring at 60% capacity.
na_santricity_auditlog:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
max_records: 50000
log_level: all
full_policy: preventSystemAccess
threshold: 60
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.na_santricity_drive_firmware – NetApp E-Series manage drive firmware netapp\_eseries.santricity.na\_santricity\_drive\_firmware – NetApp E-Series manage drive firmware
==================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_drive_firmware`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Ensure drive firmware version is activated on specified drive model.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **firmware** list / elements=string / required | | list of drive firmware file paths. NetApp E-Series drives require special firmware which can be downloaded from https://mysupport.netapp.com/NOW/download/tools/diskfw\_eseries/ |
| **ignore\_inaccessible\_drives** boolean | **Choices:*** **no** ←
* yes
| This flag will determine whether drive firmware upgrade should fail if any affected drives are inaccessible. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **upgrade\_drives\_online** boolean | **Choices:*** no
* **yes** ←
| This flag will determine whether drive firmware can be upgrade while drives are accepting I/O. When *upgrade\_drives\_online==False* stop all I/O before running task. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **wait\_for\_completion** boolean | **Choices:*** **no** ←
* yes
| This flag will cause module to wait for any upgrade actions to complete. |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Ensure correct firmware versions
na_santricity_drive_firmware:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
firmware: "path/to/drive_firmware"
wait_for_completion: true
ignore_inaccessible_drives: false
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | Whether any drive firmware was upgraded and whether it is in progress. **Sample:** {'changed': True, 'upgrade\_in\_process': True} |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_asup – NetApp E-Series manage auto-support settings netapp\_eseries.santricity.netapp\_e\_asup – NetApp E-Series manage auto-support settings
=========================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_asup`.
New in version 2.7: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allow the auto-support settings to be configured for an individual E-Series storage-system
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **active** boolean | **Choices:*** no
* **yes** ←
| Enable active/proactive monitoring for ASUP. When a problem is detected by our monitoring systems, it's possible that the bundle did not contain all of the required information at the time of the event. Enabling this option allows NetApp support personnel to manually request transmission or re-transmission of support data in order ot resolve the problem. Only applicable if *state=enabled*. |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **days** list / elements=string | **Choices:*** monday
* tuesday
* wednesday
* thursday
* friday
* saturday
* sunday
| A list of days of the week that ASUP bundles will be sent. A larger, weekly bundle will be sent on one of the provided days.
aliases: days\_of\_week, schedule\_days |
| **end** integer | **Default:**24 | An end hour may be specified in a range from 1 to 24 hours. ASUP bundles will be sent daily between the provided start and end time (UTC).
*start* must be less than *end*.
aliases: end\_time |
| **log\_path** string | | A local path to a file to be used for debug logging |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **start** integer | **Default:**0 | A start hour may be specified in a range from 0 to 23 hours. ASUP bundles will be sent daily between the provided start and end time (UTC).
*start* must be less than *end*.
aliases: start\_time |
| **state** string | **Choices:*** **enabled** ←
* disabled
| Enable/disable the E-Series auto-support configuration. When this option is enabled, configuration, logs, and other support-related information will be relayed to NetApp to help better support your system. No personally identifiable information, passwords, etc, will be collected.
aliases: asup, auto\_support, autosupport |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
| **verbose** boolean | **Choices:*** **no** ←
* yes
| Provide the full ASUP configuration in the return. |
Notes
-----
Note
* Check mode is supported.
* Enabling ASUP will allow our support teams to monitor the logs of the storage-system in order to proactively respond to issues with the system. It is recommended that all ASUP-related options be enabled, but they may be disabled if desired.
* This API is currently only supported with the Embedded Web Services API v2.0 and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Enable ASUP and allow pro-active retrieval of bundles
netapp_e_asup:
state: enabled
active: yes
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
- name: Set the ASUP schedule to only send bundles from 12 AM CST to 3 AM CST.
netapp_e_asup:
start: 17
end: 20
api_url: "10.1.1.1:8443"
api_username: "admin"
api_password: "myPass"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **active** boolean | on success | True if the active option has been enabled. **Sample:** True |
| **asup** boolean | on success | True if ASUP is enabled. **Sample:** True |
| **cfg** complex | on success when *verbose=true*. | Provide the full ASUP configuration. |
| | **asupEnabled** boolean | success | True if ASUP has been enabled. |
| | **daysOfWeek** list / elements=string | success | The days of the week that ASUP bundles will be sent. |
| | **onDemandEnabled** boolean | success | True if ASUP active monitoring has been enabled. |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
### Authors
* Michael Price (@lmprice)
ansible netapp_eseries.santricity.netapp_e_storagepool – NetApp E-Series manage volume groups and disk pools netapp\_eseries.santricity.netapp\_e\_storagepool – NetApp E-Series manage volume groups and disk pools
=======================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_storagepool`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create or remove volume groups and disk pools for NetApp E-series storage arrays.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **criteria\_drive\_count** integer | | The number of disks to use for building the storage pool. When *state=="present"* then *criteria\_drive\_count* or *criteria\_min\_usable\_capacity* must be specified. The pool will be expanded if this number exceeds the number of disks already in place (See expansion note below) |
| **criteria\_drive\_interface\_type** string | **Choices:*** sas
* sas4k
* fibre
* fibre520b
* scsi
* sata
* pata
| The interface type to use when selecting drives for the storage pool If not provided then all interface types will be considered. |
| **criteria\_drive\_min\_size** float | | The minimum individual drive size (in size\_unit) to consider when choosing drives for the storage pool. |
| **criteria\_drive\_require\_da** boolean added in 2.9 of netapp\_eseries.santricity | **Choices:*** **no** ←
* yes
| Ensures the storage pool will be created with only data assurance (DA) capable drives. Only available for new storage pools; existing storage pools cannot be converted. |
| **criteria\_drive\_require\_fde** boolean | **Choices:*** **no** ←
* yes
| Whether full disk encryption ability is required for drives to be added to the storage pool |
| **criteria\_drive\_type** string | **Choices:*** hdd
* ssd
| The type of disk (hdd or ssd) to use when searching for candidates to use. When not specified each drive type will be evaluated until successful drive candidates are found starting with the most prevalent drive type. |
| **criteria\_min\_usable\_capacity** float | | The minimum size of the storage pool (in size\_unit). When *state=="present"* then *criteria\_drive\_count* or *criteria\_min\_usable\_capacity* must be specified. The pool will be expanded if this value exceeds its current size. (See expansion note below) |
| **criteria\_size\_unit** string | **Choices:*** bytes
* b
* kb
* mb
* **gb** ←
* tb
* pb
* eb
* zb
* yb
| The unit used to interpret size parameters |
| **erase\_secured\_drives** boolean | **Choices:*** no
* **yes** ←
| If *state=="absent"* then all storage pool drives will be erase If *state=="present"* then delete all available storage array drives that have security enabled. |
| **name** string / required | | The name of the storage pool to manage |
| **raid\_level** string | **Choices:*** raidAll
* raid0
* raid1
* raid3
* raid5
* raid6
* **raidDiskPool** ←
| The RAID level of the storage pool to be created. Required only when *state=="present"*. When *raid\_level=="raidDiskPool"* then *criteria\_drive\_count >= 10 or criteria\_drive\_count >= 11* is required depending on the storage array specifications. When *raid\_level=="raid0"* then *1<=criteria\_drive\_count* is required. When *raid\_level=="raid1"* then *2<=criteria\_drive\_count* is required. When *raid\_level=="raid3"* then *3<=criteria\_drive\_count<=30* is required. When *raid\_level=="raid5"* then *3<=criteria\_drive\_count<=30* is required. When *raid\_level=="raid6"* then *5<=criteria\_drive\_count<=30* is required. Note that raidAll will be treated as raidDiskPool and raid3 as raid5. |
| **remove\_volumes** boolean | **Choices:*** no
* **yes** ←
| Prior to removing a storage pool, delete all volumes in the pool. |
| **reserve\_drive\_count** integer | | Set the number of drives reserved by the storage pool for reconstruction operations. Only valid on raid disk pools. |
| **secure\_pool** boolean | **Choices:*** no
* yes
| Enables security at rest feature on the storage pool. Will only work if all drives in the pool are security capable (FDE, FIPS, or mix) Warning, once security is enabled it is impossible to disable without erasing the drives. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string / required | **Choices:*** present
* absent
| Whether the specified storage pool should exist or not. Note that removing a storage pool currently requires the removal of all defined volumes first. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The expansion operations are non-blocking due to the time consuming nature of expanding volume groups
* Traditional volume groups (raid0, raid1, raid5, raid6) are performed in steps dictated by the storage array. Each required step will be attempted until the request fails which is likely because of the required expansion time.
* raidUnsupported will be treated as raid0, raidAll as raidDiskPool and raid3 as raid5.
* Tray loss protection and drawer loss protection will be chosen if at all possible.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: No disk groups
netapp_e_storagepool:
ssid: "{{ ssid }}"
name: "{{ item }}"
state: absent
api_url: "{{ netapp_api_url }}"
api_username: "{{ netapp_api_username }}"
api_password: "{{ netapp_api_password }}"
validate_certs: "{{ netapp_api_validate_certs }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Success message **Sample:** Json facts for the pool that was created. |
### Authors
* Kevin Hulquest (@hulquest)
* Nathan Swartz (@ndswartz)
| programming_docs |
ansible netapp_eseries.santricity.na_santricity_iscsi_target – NetApp E-Series manage iSCSI target configuration netapp\_eseries.santricity.na\_santricity\_iscsi\_target – NetApp E-Series manage iSCSI target configuration
============================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_iscsi_target`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure the settings of an E-Series iSCSI target
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **chap\_secret** string | | Enable Challenge-Handshake Authentication Protocol (CHAP), utilizing this value as the password. When this value is specified, we will always trigger an update (changed=True). We have no way of verifying whether or not the password has changed. The chap secret may only use ascii characters with values between 32 and 126 decimal. The chap secret must be no less than 12 characters, but no greater than 57 characters in length. The chap secret is cleared when not specified or an empty string.
aliases: chap, password |
| **name** string | | The name/alias to assign to the iSCSI target. This alias is often used by the initiator software in order to make an iSCSI target easier to identify.
aliases: alias |
| **ping** boolean | **Choices:*** no
* **yes** ←
| Enable ICMP ping responses from the configured iSCSI ports. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **unnamed\_discovery** boolean | **Choices:*** no
* **yes** ←
| When an initiator initiates a discovery session to an initiator port, it is considered an unnamed discovery session if the iSCSI target iqn is not specified in the request. This option may be disabled to increase security if desired. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* Some of the settings are dependent on the settings applied to the iSCSI interfaces. These can be configured using M(na\_santricity\_iscsi\_interface).
* This module requires a Web Services API version of >= 1.3.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Enable ping responses and unnamed discovery sessions for all iSCSI ports
na_santricity_iscsi_target:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
name: myTarget
ping: true
unnamed_discovery: true
- name: Set the target alias and the CHAP secret
na_santricity_iscsi_target:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
name: myTarget
chap: password1234
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **alias** string | on success | The alias assigned to the iSCSI target. **Sample:** myArray |
| **iqn** string | on success | The iqn (iSCSI Qualified Name), assigned to the iSCSI target. **Sample:** iqn.1992-08.com.netapp:2800.000a132000b006d2000000005a0e8f45 |
| **msg** string | on success | Success message **Sample:** The iSCSI target settings have been updated. |
### Authors
* Michael Price (@lmprice)
ansible netapp_eseries.santricity.na_santricity_proxy_drive_firmware_upload – NetApp E-Series manage proxy drive firmware files netapp\_eseries.santricity.na\_santricity\_proxy\_drive\_firmware\_upload – NetApp E-Series manage proxy drive firmware files
=============================================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_proxy_drive_firmware_upload`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Ensure drive firmware files are available on SANtricity Web Service Proxy.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **firmware** list / elements=string | | This option can be a list of file paths and/or directories containing drive firmware. Note that only files with the extension .dlp will be attempted to be added to the proxy; all other files will be ignored. NetApp E-Series drives require special firmware which can be downloaded from https://mysupport.netapp.com/NOW/download/tools/diskfw\_eseries/ |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Ensure correct firmware versions
na_santricity_proxy_drive_firmware_upload:
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
firmware:
- "path/to/drive_firmware_file1.dlp"
- "path/to/drive_firmware_file2.dlp"
- "path/to/drive_firmware_directory"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | Whether any changes have been made to the collection of drive firmware on SANtricity Web Services Proxy. |
### Authors
* Nathan Swartz (@ndswartz)
ansible netapp_eseries.santricity.netapp_e_auth – NetApp E-Series set or update the password for a storage array. netapp\_eseries.santricity.netapp\_e\_auth – NetApp E-Series set or update the password for a storage array.
============================================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.netapp_e_auth`.
New in version 2.2: of netapp\_eseries.santricity
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Sets or updates the password for a storage array. When the password is updated on the storage array, it must be updated on the SANtricity Web Services proxy. Note, all storage arrays do not have a Monitor or RO role.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_password** string | | The password used to authenticate against the API This can optionally be set via an environment variable, API\_PASSWORD |
| **api\_url** string | | The full API url. Example: http://ENDPOINT:8080/devmgr/v2 This can optionally be set via an environment variable, API\_URL |
| **api\_username** string | | The username used to authenticate against the API This can optionally be set via an environment variable, API\_USERNAME |
| **current\_password** string | | The current admin password. This is not required if the password hasn't been set before. |
| **name** string | | The name of the storage array. Note that if more than one storage array with this name is detected, the task will fail and you'll have to use the ID instead. |
| **new\_password** string / required | | The password you would like to set. Cannot be more than 30 characters. |
| **set\_admin** boolean | **Choices:*** **no** ←
* yes
| Boolean value on whether to update the admin password. If set to false then the RO account is updated. |
| **ssid** string | | the identifier of the storage array in the Web Services Proxy. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Examples
--------
```
- name: Test module
netapp_e_auth:
name: trex
current_password: OldPasswd
new_password: NewPasswd
set_admin: yes
api_url: '{{ netapp_api_url }}'
api_username: '{{ netapp_api_username }}'
api_password: '{{ netapp_api_password }}'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | Success message **Sample:** Password Updated Successfully |
### Authors
* Kevin Hulquest (@hulquest)
ansible netapp_eseries.santricity.na_santricity_syslog – NetApp E-Series manage syslog settings netapp\_eseries.santricity.na\_santricity\_syslog – NetApp E-Series manage syslog settings
==========================================================================================
Note
This plugin is part of the [netapp\_eseries.santricity collection](https://galaxy.ansible.com/netapp_eseries/santricity) (version 1.2.13).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install netapp_eseries.santricity`.
To use it in a playbook, specify: `netapp_eseries.santricity.na_santricity_syslog`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allow the syslog settings to be configured for an individual E-Series storage-system
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | The syslog server's IPv4 address or a fully qualified hostname. All existing syslog configurations will be removed when *state=absent* and *address=None*. |
| **api\_password** string / required | | The password to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **api\_url** string / required | | The url to the SANtricity Web Services Proxy or Embedded Web Services API. Example https://prod-1.wahoo.acme.com:8443/devmgr/v2 |
| **api\_username** string / required | | The username to authenticate with the SANtricity Web Services Proxy or Embedded Web Services API. |
| **components** list / elements=string | **Default:**["auditLog"] | The e-series logging components define the specific logs to transfer to the syslog server. At the time of writing, 'auditLog' is the only logging component but more may become available. |
| **port** integer | **Default:**514 | This is the port the syslog server is using. |
| **protocol** string | **Choices:*** **udp** ←
* tcp
* tls
| This is the transmission protocol the syslog server's using to receive syslog messages. |
| **ssid** string | **Default:**1 | The ID of the array to manage. This value must be unique for each array. |
| **state** string | **Choices:*** **present** ←
* absent
| Add or remove the syslog server configuration for E-Series storage array. Existing syslog server configuration will be removed or updated when its address matches *address*. Fully qualified hostname that resolve to an IPv4 address that matches *address* will not be treated as a match. |
| **test** boolean | **Choices:*** **no** ←
* yes
| This forces a test syslog message to be sent to the stated syslog server. Only attempts transmission when *state=present*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Should https certificates be validated? |
Notes
-----
Note
* Check mode is supported.
* This API is currently only supported with the Embedded Web Services API v2.12 (bundled with SANtricity OS 11.40.2) and higher.
* The E-Series Ansible modules require either an instance of the Web Services Proxy (WSP), to be available to manage the storage-system, or an E-Series storage-system that supports the Embedded Web Services API.
* Embedded Web Services is currently available on the E2800, E5700, EF570, and newer hardware models.
* M(netapp\_e\_storage\_system) may be utilized for configuring the systems managed by a WSP instance.
Examples
--------
```
- name: Add two syslog server configurations to NetApp E-Series storage array.
na_santricity_syslog:
ssid: "1"
api_url: "https://192.168.1.100:8443/devmgr/v2"
api_username: "admin"
api_password: "adminpass"
validate_certs: true
state: present
address: "{{ item }}"
port: 514
protocol: tcp
component: "auditLog"
loop:
- "192.168.1.1"
- "192.168.1.100"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on success | Success message **Sample:** The settings have been updated. |
| **syslog** boolean | on success | True if syslog server configuration has been added to e-series storage array. **Sample:** True |
### Authors
* Nathan Swartz (@ndswartz)
ansible Collections in the Dellemc Namespace Collections in the Dellemc Namespace
====================================
These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **dellemc** namespace.
* [dellemc.enterprise\_sonic](enterprise_sonic/index#plugins-in-dellemc-enterprise-sonic)
* [dellemc.openmanage](openmanage/index#plugins-in-dellemc-openmanage)
* [dellemc.os10](os10/index#plugins-in-dellemc-os10)
* [dellemc.os6](os6/index#plugins-in-dellemc-os6)
* [dellemc.os9](os9/index#plugins-in-dellemc-os9)
ansible dellemc.os10.os10_config – Manage Dell EMC SmartFabric OS10 configuration sections dellemc.os10.os10\_config – Manage Dell EMC SmartFabric OS10 configuration sections
===================================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.os10_config`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* OS10 configurations use a simple block indent file syntax for segmenting configuration into sections. This module provides an implementation for working with OS10 configuration sections in a deterministic way.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **after** list / elements=string | | The ordered set of commands to append to the end of the command stack if a change needs to be made. Just like with *before* this allows the playbook designer to append a set of commands to be executed after the command set. |
| **backup** boolean | **Choices:*** **no** ←
* yes
| This argument will cause the module to create a full backup of the current `running-config` from the remote device before any changes are made. If the `backup_options` value is not given, the backup file is written to the `backup` folder in the playbook root directory. If the directory does not exist, it is created. |
| **backup\_options** dictionary | | This is a dict object containing configurable options related to backup file path. The value of this option is read only when `backup` is set to *yes*, if `backup` is set to *no* this option will be silently ignored. |
| | **dir\_path** path | | This option provides the path ending with directory name in which the backup configuration file will be stored. If the directory does not exist it will be first created and the filename is either the value of `filename` or default filename as described in `filename` options description. If the path value is not given in that case a *backup* directory will be created in the current working directory and backup configuration will be copied in `filename` within *backup* directory. |
| | **filename** string | | The filename to be used to store the backup configuration. If the the filename is not given it will be generated based on the hostname, current time and date in format defined by <hostname>\_config.<current-date>@<current-time> |
| **before** list / elements=string | | The ordered set of commands to push on to the command stack if a change needs to be made. This allows the playbook designer the opportunity to perform configuration commands prior to pushing any changes without affecting how the set of commands are matched against the system. |
| **config** string | | The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The *config* argument allows the implementer to pass in the configuration to use as the base config for comparison. |
| **lines** list / elements=string | | The ordered set of commands that should be configured in the section. The commands must be the exact same commands as found in the device running-config. Be sure to note the configuration command syntax as some commands are automatically modified by the device config parser. This argument is mutually exclusive with *src*.
aliases: commands |
| **match** string | **Choices:*** **line** ←
* strict
* exact
* none
| Instructs the module on the way to perform the matching of the set of commands against the current device config. If match is set to *line*, commands are matched line by line. If match is set to *strict*, command lines are matched with respect to position. If match is set to *exact*, command lines must be an equal match. Finally, if match is set to *none*, the module will not attempt to compare the source configuration with the running configuration on the remote device. |
| **parents** list / elements=string | | The ordered set of parents that uniquely identify the section or hierarchy the commands should be checked against. If the parents argument is omitted, the commands are checked against the set of top level or global commands. |
| **provider** dictionary | | A dict object containing connection details. |
| | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. |
| | **authorize** boolean | **Choices:*** **no** ←
* yes
| Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. |
| | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **replace** string | **Choices:*** **line** ←
* block
| Instructs the module on the way to perform the configuration on the device. If the replace argument is set to *line* then the modified lines are pushed to the device in configuration mode. If the replace argument is set to *block* then the entire command block is pushed to the device in configuration mode if any line is not correct. |
| **save** boolean | **Choices:*** **no** ←
* yes
| The `save` argument instructs the module to save the running- config to the startup-config at the conclusion of the module running. If check mode is specified, this argument is ignored. |
| **src** path | | Specifies the source path to the file that contains the configuration or configuration template to load. The path to the source file can either be the full path on the Ansible control host or a relative path from the playbook or role root directory. This argument is mutually exclusive with *lines*. |
| **update** string | **Choices:*** **merge** ←
* check
| The *update* argument controls how the configuration statements are processed on the remote device. Valid choices for the *update* argument are *merge* and *check*. When you set this argument to *merge*, the configuration changes merge with the current device running configuration. When you set this argument to *check* the configuration updates are determined but not actually configured on the remote device. |
Notes
-----
Note
* For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>.
Examples
--------
```
- os10_config:
lines: ['hostname {{ inventory_hostname }}']
- os10_config:
lines:
- 10 permit ip host 1.1.1.1 any log
- 20 permit ip host 2.2.2.2 any log
- 30 permit ip host 3.3.3.3 any log
- 40 permit ip host 4.4.4.4 any log
- 50 permit ip host 5.5.5.5 any log
parents: ['ip access-list test']
before: ['no ip access-list test']
match: exact
- os10_config:
lines:
- 10 permit ip host 1.1.1.1 any log
- 20 permit ip host 2.2.2.2 any log
- 30 permit ip host 3.3.3.3 any log
- 40 permit ip host 4.4.4.4 any log
parents: ['ip access-list test']
before: ['no ip access-list test']
replace: block
- os10_config:
lines: ['hostname {{ inventory_hostname }}']
backup: yes
backup_options:
filename: backup.cfg
dir_path: /home/user
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **backup\_path** string | when backup is yes | The full path to the backup file **Sample:** /playbooks/ansible/backup/os10\_config.2016-07-16@22:28:34 |
| **commands** list / elements=string | always | The set of commands that will be pushed to the remote device **Sample:** ['hostname foo', 'router bgp 1', 'router-id 1.1.1.1'] |
| **saved** boolean | When not check\_mode. | Returns whether the configuration is saved to the startup configuration or not. **Sample:** True |
| **updates** list / elements=string | always | The set of commands that will be pushed to the remote device. **Sample:** ['hostname foo', 'router bgp 1', 'router-id 1.1.1.1'] |
### Authors
* Senthil Kumar Ganesan (@skg-net)
| programming_docs |
ansible dellemc.os10.os10_command – Run commands on devices running Dell EMC SmartFabric OS10 dellemc.os10.os10\_command – Run commands on devices running Dell EMC SmartFabric OS10
======================================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.os10_command`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Sends arbitrary commands to a OS10 device and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met.
* This module does not support running commands in configuration mode. Please use [dellemc.os10.os10\_config](os10_config_module#ansible-collections-dellemc-os10-os10-config-module) to configure OS10 devices.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **commands** list / elements=string / required | | List of commands to send to the remote OS10 device over the configured provider. The resulting output from the command is returned. If the *wait\_for* argument is provided, the module is not returned until the condition is satisfied or the number of retries has expired. |
| **interval** integer | **Default:**1 | Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again. |
| **match** string | **Choices:*** **all** ←
* any
| The *match* argument is used in conjunction with the *wait\_for* argument to specify the match policy. Valid values are `all` or `any`. If the value is set to `all` then all conditionals in the wait\_for must be satisfied. If the value is set to `any` then only one of the values must be satisfied. |
| **provider** dictionary | | A dict object containing connection details. |
| | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. |
| | **authorize** boolean | **Choices:*** **no** ←
* yes
| Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. |
| | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
| **retries** integer | **Default:**10 | Specifies the number of retries a command should be tried before it is considered failed. The command is run on the target device every retry and evaluated against the *wait\_for* conditions. |
| **wait\_for** list / elements=string | | List of conditions to evaluate against the output of the command. The task will wait for each condition to be true before moving forward. If the conditional is not true within the configured number of *retries*, the task fails. See examples. |
Notes
-----
Note
* For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>.
Examples
--------
```
tasks:
- name: run show version on remote devices
os10_command:
commands: show version
- name: run show version and check to see if output contains OS10
os10_command:
commands: show version
wait_for: result[0] contains OS10
- name: run multiple commands on remote nodes
os10_command:
commands:
- show version
- show interface
- name: run multiple commands and evaluate the output
os10_command:
commands:
- show version
- show interface
wait_for:
- result[0] contains OS10
- result[1] contains Ethernet
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **failed\_conditions** list / elements=string | failed | The list of conditionals that have failed **Sample:** ['...', '...'] |
| **stdout** list / elements=string | always apart from low level errors (such as action plugin) | The set of responses from the commands **Sample:** ['...', '...'] |
| **stdout\_lines** list / elements=string | always apart from low level errors (such as action plugin) | The value of stdout split into a list **Sample:** [['...', '...'], ['...'], ['...']] |
| **warnings** list / elements=string | always | The list of warnings (if any) generated by module based on arguments **Sample:** ['...', '...'] |
### Authors
* Senthil Kumar Ganesan (@skg-net)
ansible Dellemc.Os10 Dellemc.Os10
============
Collection version 1.1.1
Plugin Index
------------
These are the plugins in the dellemc.os10 collection
### Cliconf Plugins
* [os10](os10_cliconf#ansible-collections-dellemc-os10-os10-cliconf) – Use os10 cliconf to run command on Dell OS10 platform
### Modules
* [base\_xml\_to\_dict](base_xml_to_dict_module#ansible-collections-dellemc-os10-base-xml-to-dict-module) – Operations for show command output convertion from xml to json format.
* [bgp\_validate](bgp_validate_module#ansible-collections-dellemc-os10-bgp-validate-module) – Validate the bgp neighbor state,raise error if it is not in established state
* [mtu\_validate](mtu_validate_module#ansible-collections-dellemc-os10-mtu-validate-module) – Validate the MTU value for lldp neighbors
* [os10\_command](os10_command_module#ansible-collections-dellemc-os10-os10-command-module) – Run commands on devices running Dell EMC SmartFabric OS10
* [os10\_config](os10_config_module#ansible-collections-dellemc-os10-os10-config-module) – Manage Dell EMC SmartFabric OS10 configuration sections
* [os10\_facts](os10_facts_module#ansible-collections-dellemc-os10-os10-facts-module) – Collect facts from devices running Dell EMC SmartFabric OS10
* [show\_system\_network\_summary](show_system_network_summary_module#ansible-collections-dellemc-os10-show-system-network-summary-module) – Operations for show\_system\_network output in json/yaml format.
* [vlt\_validate](vlt_validate_module#ansible-collections-dellemc-os10-vlt-validate-module) – Validate the vlt info, raise an error if peer is not in up state
* [wiring\_validate](wiring_validate_module#ansible-collections-dellemc-os10-wiring-validate-module) – Validate the wiring based on the planned wiring details
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible dellemc.os10.base_xml_to_dict – Operations for show command output convertion from xml to json format. dellemc.os10.base\_xml\_to\_dict – Operations for show command output convertion from xml to json format.
=========================================================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.base_xml_to_dict`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Get the show system inforamtion of a Leaf-Spine.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cli\_responses** string / required | | show command xml output |
Examples
--------
```
Copy below YAML into a playbook (e.g. play.yml) and run as follows:
#$ ansible-playbook -i inv play.yml
name: setup the plabook to get show command output in dict format
hosts: localhost
connection: local
gather_facts: False
vars:
cli:
username: admin
password: admin
tasks:
- name: "Get Dell EMC OS10 Show output in dict format"
os10_command:
commands: "{{ command_list }}"
register: show
- debug: var=show
- name: call to lib to get output in dict
base_xml_to_dict:
cli_responses: "{{ item }}"
loop: "{{ show.stdout }}"
```
### Authors
* Senthil Kumar Ganesan (@skg-net)
ansible dellemc.os10.os10_facts – Collect facts from devices running Dell EMC SmartFabric OS10 dellemc.os10.os10\_facts – Collect facts from devices running Dell EMC SmartFabric OS10
=======================================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.os10_facts`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Collects a base set of device facts from a remote device that is running OS10. This module prepends all of the base network fact keys with `ansible_net_<fact>`. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **gather\_subset** list / elements=string | **Default:**["!config"] | When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, hardware, config, and interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial `M(!`) to specify that a specific subset should not be collected. |
| **provider** dictionary | | A dict object containing connection details. |
| | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. |
| | **authorize** boolean | **Choices:*** **no** ←
* yes
| Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. |
| | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. |
| | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. |
| | **port** integer | | Specifies the port to use when building the connection to the remote device. |
| | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. |
| | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. |
| | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. |
Notes
-----
Note
* For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>.
Examples
--------
```
# Collect all facts from the device
- os10_facts:
gather_subset: all
# Collect only the config and default facts
- os10_facts:
gather_subset:
- config
# Do not collect hardware facts
- os10_facts:
gather_subset:
- "!hardware"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **ansible\_net\_all\_ipv4\_addresses** list / elements=string | when interfaces is configured | All IPv4 addresses configured on the device |
| **ansible\_net\_all\_ipv6\_addresses** list / elements=string | when interfaces is configured | All IPv6 addresses configured on the device |
| **ansible\_net\_config** string | when config is configured | The current active config from the device |
| **ansible\_net\_cpu\_arch** string | when hardware is configured | CPU Architecture of the remote device. |
| **ansible\_net\_gather\_subset** list / elements=string | always | The list of fact subsets collected from the device |
| **ansible\_net\_hostname** string | always | The configured hostname of the device |
| **ansible\_net\_interfaces** dictionary | when interfaces is configured | A hash of all interfaces running on the system |
| **ansible\_net\_memfree\_mb** integer | when hardware is configured | The available free memory on the remote device in Mb |
| **ansible\_net\_memtotal\_mb** integer | when hardware is configured | The total memory on the remote device in Mb |
| **ansible\_net\_model** string | always | The model name returned from the device. |
| **ansible\_net\_name** string | Always. | The name of the OS that is running. |
| **ansible\_net\_neighbors** dictionary | when interfaces is configured | The list of LLDP neighbors from the remote device |
| **ansible\_net\_servicetag** string | always | The service tag number of the remote device. |
| **ansible\_net\_version** string | always | The operating system version running on the remote device |
### Authors
* Senthil Kumar Ganesan (@skg-net)
ansible dellemc.os10.bgp_validate – Validate the bgp neighbor state,raise error if it is not in established state dellemc.os10.bgp\_validate – Validate the bgp neighbor state,raise error if it is not in established state
==========================================================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.bgp_validate`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Troubleshoot the bgp neighor state info using show ip bgp summary and show ip interface brief.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **bgp\_neighbors** list / elements=string / required | | planned neighbours input from group\_var to compare actual |
| **show\_ip\_bgp** list / elements=string / required | | show ip bgp summary output |
| **show\_ip\_intf\_brief** list / elements=string / required | | show ip interface brief output |
Examples
--------
```
Copy below YAML into a playbook (e.g. play.yml) and run as follows:
#$ ansible-playbook -i inv play.yml
name: Validate BGP configuration
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: "Get Dell EMC OS10 Show ip bgp summary"
os10_command:
commands:
- command: "show ip bgp summary | display-xml"
- command: "show ip interface brief | display-xml"
provider: "{{ hostvars[item].cli }}"
with_items: "{{ groups['all'] }}"
register: show_bgp
- set_fact:
output_bgp: "{{ output_bgp|default([])+ [{'host': item.invocation.module_args.provider.host, 'inv_name': item.item,
'stdout_show_bgp': item.stdout.0, 'stdout_show_ip': item.stdout.1}] }}"
loop: "{{ show_bgp.results }}"
- debug: var=output_bgp
- local_action: copy content={{ output_bgp }} dest=show
- name: call lib to convert bgp info from xml to dict format
base_xml_to_dict:
cli_responses: "{{ item.stdout_show_bgp }}"
with_items:
- "{{ output_bgp }}"
register: show_bgp_list
- name: call lib to convert ip interface info from xml to dict format
base_xml_to_dict:
cli_responses: "{{ item.stdout_show_ip }}"
with_items:
- "{{ output_bgp }}"
register: show_ip_intf_list
- name: call lib for bgp validation
bgp_validate:
show_ip_bgp: "{{ show_bgp_list.results }}"
show_ip_intf_brief: "{{ show_ip_intf_list.results }}"
bgp_neighbors: "{{ intended_bgp_neighbors }}"
```
### Authors
* Senthil Kumar Ganesan (@skg-net)
ansible dellemc.os10.mtu_validate – Validate the MTU value for lldp neighbors dellemc.os10.mtu\_validate – Validate the MTU value for lldp neighbors
======================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.mtu_validate`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Get the wiring info using lldp output and show system network summary.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **show\_ip\_intf\_brief** list / elements=string / required | | show ip intf brief |
| **show\_lldp\_neighbors\_list** list / elements=string / required | | show lldp neighbor output |
| **show\_system\_network\_summary** list / elements=string / required | | show system network summary output |
Examples
--------
```
Copy below YAML into a playbook (e.g. play.yml) and run follows:
#$ ansible-playbook -i inv play.yml
name: show mtu mismatch info
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: "Get Dell EMC OS10 MTU mismatch info"
os10_command:
commands:
- command: "show lldp neighbors"
- command: "show ip interface brief | display-xml"
provider: "{{ hostvars[item].cli }}"
with_items: "{{ groups['all'] }}"
register: show_lldp
- set_fact:
output: "{{ output|default([])+ [{'host': item.invocation.module_args.provider.host, 'inv_name': item.item,
'stdout_show_lldp': item.stdout.0, 'stdout_show_ip': item.stdout.1 }] }}"
loop: "{{ show_lldp.results }}"
- debug: var=output
- local_action: copy content={{ output }} dest=show1
- name: call lib to convert ip interface info from xml to dict format
base_xml_to_dict:
cli_responses: "{{ item.stdout_show_ip }}"
with_items: "{{ output }}"
register: show_ip_intf_list
- local_action: copy content={{ show_ip_intf_list }} dest=show_ip
- name: "Get Dell EMC OS10 Show system"
import_role:
name: os10_fabric_summary
register: show_system_network_summary
- debug: var=show_system_network_summary
- name: call lib to process
mtu_validate:
show_lldp_neighbors_list: "{{ output }}"
show_system_network_summary: "{{ show_system_network_summary.msg.results }}"
show_ip_intf_brief: "{{ show_ip_intf_list.results }}"
```
### Authors
* Senthil Kumar Ganesan (@skg-net)
| programming_docs |
ansible dellemc.os10.vlt_validate – Validate the vlt info, raise an error if peer is not in up state dellemc.os10.vlt\_validate – Validate the vlt info, raise an error if peer is not in up state
=============================================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.vlt_validate`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Troubleshoot the show vlt info and raise an error if peer is not up.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **intended\_vlt\_pairs** list / elements=string / required | | intended vlt pair intput to verify with actual |
| **show\_system\_network\_summary** list / elements=string / required | | show system summary output |
| **show\_vlt** list / elements=string / required | | show vlt output |
Examples
--------
```
Copy below YAML into a playbook (e.g. play.yml) and run as follows:
#$ ansible-playbook -i inv play.yml
name: show system Configuration
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: "Get Dell EMC OS10 Show run vlt"
os10_command:
commands:
- command: "show running-configuration vlt | grep vlt-domain"
provider: "{{ hostvars[item].cli }}"
with_items: "{{ groups['all'] }}"
register: show_run_vlt
- set_fact:
output_vlt: "{{ output_vlt|default([])+ [{'host': item.invocation.module_args.provider.host, 'inv_name': item.item,
'stdout_show_vlt': item.stdout.0}] }}"
loop: "{{ show_run_vlt.results }}"
- debug: var=output_vlt
- name: "Get Dell EMC OS10 Show vlt info"
os10_command:
commands:
- command: "show vlt {{ item.stdout_show_vlt.split()[1] }} | display-xml"
provider: "{{ hostvars[item.inv_name].cli }}"
with_items: "{{ output_vlt }}"
register: show_vlt
- set_fact:
vlt_out: "{{ vlt_out|default([])+ [{'host': item.invocation.module_args.provider.host, 'inv_name': item.item, 'show_vlt_stdout': item.stdout.0}] }}"
loop: "{{ show_vlt.results }}"
register: vlt_output
- name: call lib to convert vlt info from xml to dict format
base_xml_to_dict:
cli_responses: "{{ item.show_vlt_stdout }}"
with_items:
- "{{ vlt_out }}"
register: vlt_dict_output
- name: "Get Dell EMC OS10 Show system"
import_role:
name: os10_fabric_summary
register: show_system_network_summary
- name: call lib to process
vlt_validate:
show_vlt : "{{ vlt_dict_output.results }}"
show_system_network_summary: "{{ show_system_network_summary.msg.results }}"
intended_vlt_pairs: "{{ intended_vlt_pairs }}"
register: show_vlt_info
```
### Authors
* Senthil Kumar Ganesan (@skg-net)
ansible dellemc.os10.show_system_network_summary – Operations for show_system_network output in json/yaml format. dellemc.os10.show\_system\_network\_summary – Operations for show\_system\_network output in json/yaml format.
==============================================================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.show_system_network_summary`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Get the show system inforamtion of a Leaf-Spine.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cli\_responses** list / elements=string / required | | show system command xml output |
| **output\_type** string | **Default:**"json" | json or yaml Default value is json |
Examples
--------
```
Copy below YAML into a playbook (e.g. play.yml) and run as follows:
#$ ansible-playbook -i inv show.yml
name: show system Configuration
hosts: localhost
connection: local
gather_facts: False
vars:
cli:
username: admin
password: admin
tasks:
- name: "Get Dell EMC OS10 Show system summary"
os10_command:
commands: ['show system | display-xml']
provider: "{{ hostvars[item].cli }}"
with_items: "{{ groups['all'] }}"
register: show_system
- set_fact:
output: "{{ output|default([])+ [{'inv_name': item.item, 'host': item.invocation.module_args.provider.host, 'stdout_show_system': item.stdout}] }}"
loop: "{{ show_system.results }}"
- debug: var=output
- name: "show system network call to lib "
show_system_network_summary:
cli_responses: "{{ output}} "
output_type: "{{ output_method if output_method is defined else 'json' }}"
register: show_system_network_summary
- debug: var=show_system_network_summary
```
### Authors
* Senthil Kumar Ganesan (@skg-net)
ansible dellemc.os10.wiring_validate – Validate the wiring based on the planned wiring details dellemc.os10.wiring\_validate – Validate the wiring based on the planned wiring details
=======================================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.wiring_validate`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Get the wiring info using lldp output and show system network summary.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **planned\_neighbors** list / elements=string / required | | planned neighbours input from group\_var to compare actual |
| **show\_lldp\_neighbors\_list** list / elements=string / required | | show lldp neighbor output |
| **show\_system\_network\_summary** list / elements=string / required | | show system network summary output |
Examples
--------
```
Copy below YAML into a playbook (e.g. play.yml) and run as follows:
#$ ansible-playbook -i inv play.yml
name: show system Configuration
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: "Get Dell EMC OS10 Show lldp"
os10_command:
commands:
- command: "show lldp neighbors"
provider: "{{ hostvars[item].cli }}"
with_items: "{{ groups['all'] }}"
register: show_lldp
- local_action: copy content={{ show_lldp }} dest=show
- set_fact:
output_lldp: "{{ output_lldp|default([])+ [{'host': item.invocation.module_args.provider.host, 'inv_name': item.item,
'stdout_show_lldp': item.stdout}] }}"
loop: "{{ show_lldp.results }}"
- debug: var=output_lldp
- name: "Get Dell EMC OS10 Show system"
import_role:
name: os10_fabric_summary
register: show_system_network_summary
- debug: var=show_system_network_summary
- name: call lib to process
wiring_validate:
show_lldp_neighbors_list: "{{ output_lldp }}"
show_system_network_summary: "{{ show_system_network_summary.msg.results }}"
planned_neighbors: "{{ intended_neighbors }}"
```
### Authors
* Senthil Kumar Ganesan (@skg-net)
ansible dellemc.os10.os10 – Use os10 cliconf to run command on Dell OS10 platform dellemc.os10.os10 – Use os10 cliconf to run command on Dell OS10 platform
=========================================================================
Note
This plugin is part of the [dellemc.os10 collection](https://galaxy.ansible.com/dellemc/os10) (version 1.1.1).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.os10`.
To use it in a playbook, specify: `dellemc.os10.os10`.
Synopsis
--------
* This os10 plugin provides low level abstraction apis for sending and receiving CLI commands from Dell OS10 network devices.
ansible dellemc.enterprise_sonic.sonic_bgp_as_paths – Manage BGP autonomous system path (or as-path-list) and its parameters dellemc.enterprise\_sonic.sonic\_bgp\_as\_paths – Manage BGP autonomous system path (or as-path-list) and its parameters
========================================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_bgp_as_paths`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of BGP bgp\_as\_paths for devices running Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of 'bgp\_as\_paths' configurations. |
| | **members** list / elements=string | | Members of this BGP as-path; regular expression string can be provided. |
| | **name** string / required | | Name of as-path-list. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
# Before state:
# -------------
#
# show bgp as-path-access-list
# AS path list test:
# members: 808.*,909.*
- name: Delete BGP as path list
dellemc.enterprise_sonic.sonic_bgp_as_paths:
config:
- name: test
members:
- 909.*
state: deleted
# After state:
# ------------
#
# show bgp as-path-access-list
# AS path list test:
# members: 808.*
# Using deleted
# Before state:
# -------------
#
# show bgp as-path-access-list
# AS path list test:
# members: 808.*,909.*
# AS path list test1:
# members: 608.*,709.*
- name: Deletes BGP as-path list
dellemc.enterprise_sonic.sonic_bgp_as_paths:
config:
- name: test
members:
state: deleted
# After state:
# ------------
#
# show bgp as-path-access-list
# AS path list test1:
# members: 608.*,709.*
# Using deleted
# Before state:
# -------------
#
# show bgp as-path-access-list
# AS path list test:
# members: 808.*,909.*
- name: Deletes BGP as-path list
dellemc.enterprise_sonic.sonic_bgp_as_paths:
config:
state: deleted
# After state:
# ------------
#
# show bgp as-path-access-list
#
# Using merged
# Before state:
# -------------
#
# show bgp as-path-access-list
# AS path list test:
- name: Adds 909.* to test as-path list
dellemc.enterprise_sonic.sonic_bgp_as_paths:
config:
- name: test
members:
- 909.*
state: merged
# After state:
# ------------
#
# show bgp as-path-access-list
# AS path list test:
# members: 909.*
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Kumaraguru Narayanan (@nkumaraguru)
ansible dellemc.enterprise_sonic.sonic_vrfs – Manage VRFs and associate VRFs to interfaces such as, Eth, LAG, VLAN, and loopback dellemc.enterprise\_sonic.sonic\_vrfs – Manage VRFs and associate VRFs to interfaces such as, Eth, LAG, VLAN, and loopback
==========================================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_vrfs`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages VRF and VRF interface attributes in Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of VRF configurations. |
| | **members** dictionary | | Holds a dictionary mapping of list of interfaces linked to a VRF interface. |
| | | **interfaces** list / elements=dictionary | | List of interface names that are linked to a specific VRF interface. |
| | | | **name** string | | The name of the physical interface. |
| | **name** string / required | | The name of the VRF interface. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#show ip vrf
#VRF-NAME INTERFACES
#----------------------------------------------------------------
#Vrfcheck1
#Vrfcheck2
#Vrfcheck3 Eth1/3
# Eth1/14
# Eth1/16
# Eth1/17
#Vrfcheck4 Eth1/5
# Eth1/6
#
- name: Configuring vrf deleted state
dellemc.enterprise_sonic.sonic_vrfs:
config:
- name: Vrfcheck4
members:
interfaces:
- name: Eth1/6
- name: Vrfcheck3
members:
interfaces:
- name: Eth1/3
- name: Eth1/14
state: deleted
#
# After state:
# ------------
#
#show ip vrf
#VRF-NAME INTERFACES
#----------------------------------------------------------------
#Vrfcheck1
#Vrfcheck2
#Vrfcheck3 Eth1/16
# Eth1/17
#Vrfcheck4 Eth1/5
#
#
# Using merged
#
# Before state:
# -------------
#
#show ip vrf
#VRF-NAME INTERFACES
#----------------------------------------------------------------
#Vrfcheck1
#Vrfcheck2
#Vrfcheck3 Eth1/16
# Eth1/17
#Vrfcheck4
#
- name: Configuring vrf merged state
dellemc.enterprise_sonic.sonic_vrfs:
config:
- name: Vrfcheck4
members:
interfaces:
- name: Eth1/5
- name: Eth1/6
- name: Vrfcheck3
members:
interfaces:
- name: Eth1/3
- name: Eth1/14
state: merged
#
# After state:
# ------------
#
#show ip vrf
#VRF-NAME INTERFACES
#----------------------------------------------------------------
#Vrfcheck1
#Vrfcheck2
#Vrfcheck3 Eth1/3
# Eth1/14
# Eth1/16
# Eth1/17
#Vrfcheck4 Eth1/5
# Eth1/6
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Abirami N (@abirami-n)
ansible Dellemc.Enterprise_Sonic Dellemc.Enterprise\_Sonic
=========================
Collection version 1.1.0
Plugin Index
------------
These are the plugins in the dellemc.enterprise\_sonic collection
### Cliconf Plugins
* [sonic](sonic_cliconf#ansible-collections-dellemc-enterprise-sonic-sonic-cliconf) – Use sonic cliconf to run command on Dell OS10 platform
### Httpapi Plugins
* [sonic](sonic_httpapi#ansible-collections-dellemc-enterprise-sonic-sonic-httpapi) – HttpApi Plugin for devices supporting Restconf SONIC API
### Modules
* [sonic\_aaa](sonic_aaa_module#ansible-collections-dellemc-enterprise-sonic-sonic-aaa-module) – Manage AAA and its parameters
* [sonic\_api](sonic_api_module#ansible-collections-dellemc-enterprise-sonic-sonic-api-module) – Manages REST operations on devices running Enterprise SONiC
* [sonic\_bgp](sonic_bgp_module#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-module) – Manage global BGP and its parameters
* [sonic\_bgp\_af](sonic_bgp_af_module#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-af-module) – Manage global BGP address-family and its parameters
* [sonic\_bgp\_as\_paths](sonic_bgp_as_paths_module#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-as-paths-module) – Manage BGP autonomous system path (or as-path-list) and its parameters
* [sonic\_bgp\_communities](sonic_bgp_communities_module#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-communities-module) – Manage BGP community and its parameters
* [sonic\_bgp\_ext\_communities](sonic_bgp_ext_communities_module#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-ext-communities-module) – Manage BGP extended community-list and its parameters
* [sonic\_bgp\_neighbors](sonic_bgp_neighbors_module#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-neighbors-module) – Manage a BGP neighbor and its parameters
* [sonic\_bgp\_neighbors\_af](sonic_bgp_neighbors_af_module#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-neighbors-af-module) – Manage the BGP neighbor address-family and its parameters
* [sonic\_command](sonic_command_module#ansible-collections-dellemc-enterprise-sonic-sonic-command-module) – Runs commands on devices running Enterprise SONiC
* [sonic\_config](sonic_config_module#ansible-collections-dellemc-enterprise-sonic-sonic-config-module) – Manages configuration sections on devices running Enterprise SONiC
* [sonic\_facts](sonic_facts_module#ansible-collections-dellemc-enterprise-sonic-sonic-facts-module) – Collects facts on devices running Enterprise SONiC
* [sonic\_interfaces](sonic_interfaces_module#ansible-collections-dellemc-enterprise-sonic-sonic-interfaces-module) – Configure Interface attributes on interfaces such as, Eth, LAG, VLAN, and loopback. (create a loopback interface if it does not exist.)
* [sonic\_l2\_interfaces](sonic_l2_interfaces_module#ansible-collections-dellemc-enterprise-sonic-sonic-l2-interfaces-module) – Configure interface-to-VLAN association that is based on access or trunk mode
* [sonic\_l3\_interfaces](sonic_l3_interfaces_module#ansible-collections-dellemc-enterprise-sonic-sonic-l3-interfaces-module) – Configure the IPv4 and IPv6 parameters on Interfaces such as, Eth, LAG, VLAN, and loopback
* [sonic\_lag\_interfaces](sonic_lag_interfaces_module#ansible-collections-dellemc-enterprise-sonic-sonic-lag-interfaces-module) – Manage link aggregation group (LAG) interface parameters
* [sonic\_mclag](sonic_mclag_module#ansible-collections-dellemc-enterprise-sonic-sonic-mclag-module) – Manage multi chassis link aggregation groups domain (MCLAG) and its parameters
* [sonic\_port\_breakout](sonic_port_breakout_module#ansible-collections-dellemc-enterprise-sonic-sonic-port-breakout-module) – Configure port breakout settings on physical interfaces
* [sonic\_radius\_server](sonic_radius_server_module#ansible-collections-dellemc-enterprise-sonic-sonic-radius-server-module) – Manage RADIUS server and its parameters
* [sonic\_system](sonic_system_module#ansible-collections-dellemc-enterprise-sonic-sonic-system-module) – Configure system parameters
* [sonic\_tacacs\_server](sonic_tacacs_server_module#ansible-collections-dellemc-enterprise-sonic-sonic-tacacs-server-module) – Manage TACACS server and its parameters
* [sonic\_users](sonic_users_module#ansible-collections-dellemc-enterprise-sonic-sonic-users-module) – Manage users and its parameters
* [sonic\_vlans](sonic_vlans_module#ansible-collections-dellemc-enterprise-sonic-sonic-vlans-module) – Manage VLAN and its parameters
* [sonic\_vrfs](sonic_vrfs_module#ansible-collections-dellemc-enterprise-sonic-sonic-vrfs-module) – Manage VRFs and associate VRFs to interfaces such as, Eth, LAG, VLAN, and loopback
* [sonic\_vxlans](sonic_vxlans_module#ansible-collections-dellemc-enterprise-sonic-sonic-vxlans-module) – Manage VxLAN EVPN and its parameters
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
| programming_docs |
ansible dellemc.enterprise_sonic.sonic_bgp_ext_communities – Manage BGP extended community-list and its parameters dellemc.enterprise\_sonic.sonic\_bgp\_ext\_communities – Manage BGP extended community-list and its parameters
==============================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_bgp_ext_communities`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of BGP extcommunity-list for devices running Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of 'bgp\_extcommunity\_list' configurations. |
| | **match** string | **Choices:*** all
* **any** ←
| Matches any/all of the the members. |
| | **members** dictionary | | Members of this BGP ext community list. |
| | | **regex** list / elements=string | | Members of this BGP ext community list. Regular expression string can be given here. Applicable for expanded ext BGP community type. |
| | | **route\_origin** list / elements=string | | Members of this BGP ext community list. The format of route\_origin is in either 0..65535:0..65535 or A.B.C.D:[1..65535] format. |
| | | **route\_target** list / elements=string | | Members of this BGP ext community list. The format of route\_target is in either 0..65535:0..65535 or A.B.C.D:[1..65535] format. |
| | **name** string / required | | Name of the BGP ext communitylist. |
| | **permit** boolean | **Choices:*** no
* yes
| Permits or denies this community. |
| | **type** string | **Choices:*** **standard** ←
* expanded
| Whether it is a standard or expanded ext community\_list entry. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test: match: ANY
# rt:101:101
# rt:201:201
- name: Deletes a BGP ext community member
dellemc.enterprise_sonic.sonic_bgp_ext_communities:
config:
- name: test
members:
regex:
- 201:201
state: deleted
# After state:
# ------------
#
# show bgp ext-community-list
# Standard extended community list test: match: ANY
# rt:101:101
#
# Using deleted
# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test: match: ANY
# 101
# Expanded extended community list test1: match: ANY
# 201
- name: Deletes a single BGP extended community
dellemc.enterprise_sonic.sonic_bgp_ext_communities:
config:
- name: test1
members:
state: deleted
# After state:
# ------------
#
# show bgp ext-community-list
# Standard extended community list test: match: ANY
# 101
#
# Using deleted
# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test: match: ANY
# 101
# Expanded extended community list test1: match: ANY
# 201
- name: Deletes all BGP extended communities
dellemc.enterprise_sonic.sonic_bgp_ext_communities:
config:
state: deleted
# After state:
# ------------
#
# show bgp ext-community-list
#
# Using deleted
# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test: match: ANY
# 101
# Expanded extended community list test1: match: ANY
# 201
- name: Deletes all members in a single BGP extended community
dellemc.enterprise_sonic.sonic_bgp_ext_communities:
config:
- name: test1
members:
regex:
state: deleted
# After state:
# ------------
#
# show bgp ext-community-list
# Standard extended community list test: match: ANY
# 101
# Expanded extended community list test1: match: ANY
#
# Using merged
# Before state:
# -------------
#
# show bgp as-path-access-list
# AS path list test:
- name: Adds 909.* to test as-path list
dellemc.enterprise_sonic.sonic_bgp_as_paths:
config:
- name: test
members:
- 909.*
state: merged
# After state:
# ------------
#
# show bgp as-path-access-list
# AS path list test:
# members: 909.*
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Kumaraguru Narayanan (@nkumaraguru)
ansible dellemc.enterprise_sonic.sonic_mclag – Manage multi chassis link aggregation groups domain (MCLAG) and its parameters dellemc.enterprise\_sonic.sonic\_mclag – Manage multi chassis link aggregation groups domain (MCLAG) and its parameters
=======================================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_mclag`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage multi chassis link aggregation groups domain (MCLAG) and its parameters
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | Dict of mclag domain configurations. |
| | **domain\_id** integer / required | | ID of the mclag domain (MCLAG domain). |
| | **keepalive** integer | | MCLAG session keepalive-interval in secs. |
| | **members** dictionary | | Holds portchannels dictionary for an MCLAG domain. |
| | | **portchannels** list / elements=dictionary | | Holds a list of portchannels for configuring as an MCLAG interface. |
| | | | **lag** string | | Holds a PortChannel ID. |
| | **peer\_address** string | | The IPV4 peer-ip for corresponding MCLAG. |
| | **peer\_link** string | | Peer-link for corresponding MCLAG. |
| | **session\_timeout** integer | | MCLAG session timeout value in secs. |
| | **source\_address** string | | The IPV4 source-ip for corresponding MCLAG. |
| | **system\_mac** string | | Mac address of MCLAG. |
| | **unique\_ip** dictionary | | Holds Vlan dictionary for mclag unique ip. |
| | | **vlans** list / elements=dictionary | | Holds list of VLANs for which a separate IP addresses is enabled for Layer 3 protocol support over MCLAG. |
| | | | **vlan** string | | Holds a VLAN ID. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state that the configuration should be left in. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# sonic# show mclag brief
# MCLAG Not Configured
#
- name: Merge provided configuration with device configuration
dellemc.enterprise_sonic.sonic_mclag:
config:
domain_id: 1
peer_address: 1.1.1.1
source_address: 2.2.2.2
peer_link: 'Portchannel1'
keepalive: 1
session_timeout: 3
unique_ip:
vlans:
- vlan: Vlan4
members:
portchannles:
- lag: PortChannel10
state: merged
#
# After state:
# ------------
#
# sonic# show mclag brief
#
# Domain ID : 1
# Role : standby
# Session Status : down
# Peer Link Status : down
# Source Address : 2.2.2.2
# Peer Address : 1.1.1.1
# Peer Link : PortChannel1
# Keepalive Interval : 1 secs
# Session Timeout : 3 secs
# System Mac : 20:04:0f:37:bd:c9
#
#
# Number of MLAG Interfaces:1
#-----------------------------------------------------------
# MLAG Interface Local/Remote Status
#-----------------------------------------------------------
# PortChannel10 down/down
#
# admin@sonic:~$ show runningconfiguration all
# {
# ...
# "MCLAG_UNIQUE_IP": {
# "Vlan4": {
# "unique_ip": "enable"
# }
# },
# ...
# }
#
#
# Using merged
#
# Before state:
# ------------
#
# sonic# show mclag brief
#
# Domain ID : 1
# Role : standby
# Session Status : down
# Peer Link Status : down
# Source Address : 2.2.2.2
# Peer Address : 1.1.1.1
# Peer Link : PortChannel1
# Keepalive Interval : 1 secs
# Session Timeout : 3 secs
# System Mac : 20:04:0f:37:bd:c9
#
#
# Number of MLAG Interfaces:1
#-----------------------------------------------------------
# MLAG Interface Local/Remote Status
#-----------------------------------------------------------
# PortChannel10 down/down
#
# admin@sonic:~$ show runningconfiguration all
# {
# ...
# "MCLAG_UNIQUE_IP": {
# "Vlan4": {
# "unique_ip": "enable"
# }
# },
# ...
# }
#
#
- name: Merge device configuration with the provided configuration
dellemc.enterprise_sonic.sonic_mclag:
config:
domain_id: 1
source_address: 3.3.3.3
keepalive: 10
session_timeout: 30
unique_ip:
vlans:
- vlan: Vlan5
members:
portchannels:
- lag: PortChannel12
state: merged
#
# After state:
# ------------
#
# sonic# show mclag brief
#
# Domain ID : 1
# Role : standby
# Session Status : down
# Peer Link Status : down
# Source Address : 3.3.3.3
# Peer Address : 1.1.1.1
# Peer Link : PortChannel1
# Keepalive Interval : 10 secs
# Session Timeout : 30 secs
# System Mac : 20:04:0f:37:bd:c9
#
#
# Number of MLAG Interfaces:2
#-----------------------------------------------------------
# MLAG Interface Local/Remote Status
#-----------------------------------------------------------
# PortChannel10 down/down
# PortChannel12 down/down
#
# admin@sonic:~$ show runningconfiguration all
# {
# ...
# "MCLAG_UNIQUE_IP": {
# "Vlan4": {
# "unique_ip": "enable"
# },
# "Vlan5": {
# "unique_ip": "enable"
# }
# },
# ...
# }
#
#
# Using deleted
#
# Before state:
# ------------
#
# sonic# show mclag brief
#
# Domain ID : 1
# Role : standby
# Session Status : down
# Peer Link Status : down
# Source Address : 3.3.3.3
# Peer Address : 1.1.1.1
# Peer Link : PortChannel1
# Keepalive Interval : 10 secs
# Session Timeout : 30 secs
# System Mac : 20:04:0f:37:bd:c9
#
#
# Number of MLAG Interfaces:1
#-----------------------------------------------------------
# MLAG Interface Local/Remote Status
#-----------------------------------------------------------
# PortChannel10 down/down
#
# admin@sonic:~$ show runningconfiguration all
# {
# ...
# "MCLAG_UNIQUE_IP": {
# "Vlan4": {
# "unique_ip": "enable"
# }
# },
# ...
# }
#
- name: Delete device configuration based on the provided configuration
dellemc.enterprise_sonic.sonic_mclag:
config:
domain_id: 1
source_address: 3.3.3.3
keepalive: 10
members:
portchannels:
- lag: PortChannel10
state: deleted
#
# After state:
# ------------
#
# sonic# show mclag brief
#
# Domain ID : 1
# Role : standby
# Session Status : down
# Peer Link Status : down
# Source Address :
# Peer Address : 1.1.1.1
# Peer Link : PortChannel1
# Keepalive Interval : 1 secs
# Session Timeout : 15 secs
# System Mac : 20:04:0f:37:bd:c9
#
#
# Number of MLAG Interfaces:0
#
# admin@sonic:~$ show runningconfiguration all
# {
# ...
# "MCLAG_UNIQUE_IP": {
# "Vlan4": {
# "unique_ip": "enable"
# }
# },
# ...
# }
#
#
#
# Using deleted
#
# Before state:
# ------------
#
# sonic# show mclag brief
#
# Domain ID : 1
# Role : standby
# Session Status : down
# Peer Link Status : down
# Source Address : 3.3.3.3
# Peer Address : 1.1.1.1
# Peer Link : PortChannel1
# Keepalive Interval : 10 secs
# Session Timeout : 30 secs
# System Mac : 20:04:0f:37:bd:c9
#
#
# Number of MLAG Interfaces:1
#-----------------------------------------------------------
# MLAG Interface Local/Remote Status
#-----------------------------------------------------------
# PortChannel10 down/down
#
# admin@sonic:~$ show runningconfiguration all
# {
# ...
# "MCLAG_UNIQUE_IP": {
# "Vlan4": {
# "unique_ip": "enable"
# }
# },
# ...
# }
#
- name: Delete all device configuration
dellemc.enterprise_sonic.sonic_mclag:
config:
state: deleted
#
# After state:
# ------------
#
# sonic# show mclag brief
# MCLAG Not Configured
#
# admin@sonic:~$ show runningconfiguration all | grep MCLAG_UNIQUE_IP
# admin@sonic:~$
#
#
# Using deleted
#
# Before state:
# ------------
#
# sonic# show mclag brief
#
# Domain ID : 1
# Role : standby
# Session Status : down
# Peer Link Status : down
# Source Address : 3.3.3.3
# Peer Address : 1.1.1.1
# Peer Link : PortChannel1
# Keepalive Interval : 10 secs
# Session Timeout : 30 secs
# System Mac : 20:04:0f:37:bd:c9
#
#
# Number of MLAG Interfaces:2
#-----------------------------------------------------------
# MLAG Interface Local/Remote Status
#-----------------------------------------------------------
# PortChannel10 down/down
# PortChannel12 down/sown
#
# admin@sonic:~$ show runningconfiguration all
# {
# ...
# "MCLAG_UNIQUE_IP": {
# "Vlan4": {
# "unique_ip": "enable"
# }
# },
# ...
# }
- name: Delete device configuration based on the provided configuration
dellemc.enterprise_sonic.sonic_mclag:
config:
domain_id: 1
source_address: 3.3.3.3
keepalive: 10
members:
portchannels:
- lag: PortChannel10
state: deleted
#
# After state:
# ------------
#
# sonic# show mclag brief
#
# Domain ID : 1
# Role : standby
# Session Status : down
# Peer Link Status : down
# Source Address :
# Peer Address : 1.1.1.1
# Peer Link : PortChannel1
# Keepalive Interval : 1 secs
# Session Timeout : 15 secs
# System Mac : 20:04:0f:37:bd:c9
#
#
# Number of MLAG Interfaces:0
#
# admin@sonic:~$ show runningconfiguration all
# {
# ...
# "MCLAG_UNIQUE_IP": {
# "Vlan4": {
# "unique_ip": "enable"
# }
# },
# ...
# }
#
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Abirami N (@abirami-n)
ansible dellemc.enterprise_sonic.sonic_command – Runs commands on devices running Enterprise SONiC dellemc.enterprise\_sonic.sonic\_command – Runs commands on devices running Enterprise SONiC
============================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_command`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Runs commands on remote devices running Enterprise SONiC Distribution by Dell Technologies. Sends arbitrary commands to an Enterprise SONiC node and returns the results that are read from the device. This module includes an argument that causes the module to wait for a specific condition before returning or time out if the condition is not met.
* This module does not support running commands in configuration mode. To configure SONiC devices, use M(sonic\_config).
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **commands** list / elements=string / required | | List of commands to send to the remote Enterprise SONiC devices over the configured provider. The resulting output from the command is returned. If the *wait\_for* argument is provided, the module is not returned until the condition is satisfied or the number of retries has expired. If a command sent to the device requires answering a prompt, it is possible to pass a dict containing *command*, *answer* and *prompt*. Common answers are 'yes' or "\r" (carriage return, must be double quotes). See examples. |
| **interval** integer | **Default:**1 | Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again. |
| **match** string | **Choices:*** **all** ←
* any
| The *match* argument is used in conjunction with the *wait\_for* argument to specify the match policy. Valid values are `all` or `any`. If the value is set to `all` then all conditionals in the wait\_for must be satisfied. If the value is set to `any` then only one of the values must be satisfied. |
| **retries** integer | **Default:**10 | Specifies the number of retries a command should be run before it is considered failed. The command is run on the target device every retry and evaluated against the *wait\_for* conditions. |
| **wait\_for** list / elements=string | | List of conditions to evaluate against the output of the command. The task waits for each condition to be true before moving forward. If the conditional is not true within the configured number of retries, the task fails. See examples. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
- name: Runs show version on remote devices
dellemc.enterprise_sonic.sonic_command:
commands: show version
- name: Runs show version and checks to see if output contains 'Dell'
dellemc.enterprise_sonic.sonic_command:
commands: show version
wait_for: result[0] contains Dell
- name: Runs multiple commands on remote nodes
dellemc.enterprise_sonic.sonic_command:
commands:
- show version
- show interface
- name: Runs multiple commands and evaluate the output
dellemc.enterprise_sonic.sonic_command:
commands:
- 'show version'
- 'show system'
wait_for:
- result[0] contains Dell
- result[1] contains Hostname
- name: Runs commands that require answering a prompt
dellemc.enterprise_sonic.sonic_command:
commands:
- command: 'reload'
prompt: '[confirm yes/no]: ?$'
answer: 'no'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **failed\_conditions** list / elements=string | failed | The list of conditionals that have failed. **Sample:** ['...', '...'] |
| **stdout** list / elements=string | always apart from low level errors (such as action plugin) | The set of responses from the commands. **Sample:** ['...', '...'] |
| **stdout\_lines** list / elements=string | always apart from low level errors (such as action plugin) | The value of stdout split into a list. **Sample:** [['...', '...'], ['...'], ['...']] |
| **warnings** list / elements=string | always | The list of warnings (if any) generated by module based on arguments. **Sample:** ['...', '...'] |
### Authors
* Dhivya P (@dhivayp)
| programming_docs |
ansible dellemc.enterprise_sonic.sonic_vlans – Manage VLAN and its parameters dellemc.enterprise\_sonic.sonic\_vlans – Manage VLAN and its parameters
=======================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_vlans`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of VLANs parameters on devices running Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A dictionary of VLAN options. |
| | **vlan\_id** integer / required | | ID of the VLAN Range is 1 to 4094 |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state that the configuration should be left in. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using merged
# Before state:
# -------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#30 Inactive
#
#sonic#
#
- name: Merges given VLAN attributes with the device configuration
dellemc.enterprise_sonic.sonic_vlans:
config:
- vlan_id: 10
state: merged
# After state:
# ------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#30 Inactive
#
#sonic#
#
#sonic# show interface Vlan 10
#Vlan10 is up
#Mode of IPV4 address assignment: not-set
#Mode of IPV6 address assignment: not-set
#IP MTU 6000 bytes
#sonic#
#
# Using deleted
# Before state:
# -------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#20 Inactive
#
#sonic#
- name: Deletes attributes of the given VLANs
dellemc.enterprise_sonic.sonic_vlans:
config:
- vlan_id: 20
state: deleted
# After state:
# ------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#
#sonic#
# Using deleted
# Before state:
# -------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#20 Inactive
#30 Inactive
#
#sonic#
- name: Deletes all the VLANs on the switch
dellemc.enterprise_sonic.sonic_vlans:
config:
state: deleted
# After state:
# ------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#
#sonic#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration that is returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Mohamed Javeed (@javeedf)
ansible dellemc.enterprise_sonic.sonic_bgp_communities – Manage BGP community and its parameters dellemc.enterprise\_sonic.sonic\_bgp\_communities – Manage BGP community and its parameters
===========================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_bgp_communities`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of BGP bgp\_communities for device running Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of 'bgp\_communities' configurations. |
| | **aann** string | | Community number aa:nn format 0..65535:0..65535; applicable for standard BGP community type. |
| | **local\_as** boolean | **Choices:*** no
* yes
| Do not send outside local AS (well-known community); applicable for standard BGP community type. |
| | **match** string | **Choices:*** ALL
* **ANY** ←
| Matches any/all of the members. |
| | **members** dictionary | | Members of this BGP community list. |
| | | **regex** list / elements=string | | Members of this BGP community list. Regular expression string can be given here. Applicable for expanded BGP community type. |
| | **name** string / required | | Name of the BGP communitylist. |
| | **no\_advertise** boolean | **Choices:*** no
* yes
| Do not advertise to any peer (well-known community); applicable for standard BGP community type. |
| | **no\_export** boolean | **Choices:*** no
* yes
| Do not export to next AS (well-known community); applicable for standard BGP community type. |
| | **no\_peer** boolean | **Choices:*** no
* yes
| Do not export to next AS (well-known community); applicable for standard BGP community type. |
| | **permit** boolean | **Choices:*** no
* yes
| Permits or denies this community. |
| | **type** string | **Choices:*** **standard** ←
* expanded
| Whether it is a standard or expanded community-list entry. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
# Before state:
# -------------
#
# show bgp community-list
# Standard community list test: match: ANY
# 101
# 201
# Standard community list test1: match: ANY
# 301
- name: Deletes BGP community member
dellemc.enterprise_sonic.sonic_bgp_communities:
config:
- name: test
members:
regex:
- 201
state: deleted
# After state:
# ------------
#
# show bgp community-list
# Standard community list test: match: ANY
# 101
# Standard community list test1: match: ANY
# 301
# Using deleted
# Before state:
# -------------
#
# show bgp community-list
# Standard community list test: match: ANY
# 101
# Expanded community list test1: match: ANY
# 201
- name: Deletes a single BGP community
dellemc.enterprise_sonic.sonic_bgp_communities:
config:
- name: test
members:
state: deleted
# After state:
# ------------
#
# show bgp community-list
# Expanded community list test1: match: ANY
# 201
# Using deleted
# Before state:
# -------------
#
# show bgp community-list
# Standard community list test: match: ANY
# 101
# Expanded community list test1: match: ANY
# 201
- name: Delete All BGP communities
dellemc.enterprise_sonic.sonic_bgp_communities:
config:
state: deleted
# After state:
# ------------
#
# show bgp community-list
#
# Using deleted
# Before state:
# -------------
#
# show bgp community-list
# Standard community list test: match: ANY
# 101
# Expanded community list test1: match: ANY
# 201
- name: Deletes all members in a single BGP community
dellemc.enterprise_sonic.sonic_bgp_communities:
config:
- name: test
members:
regex:
state: deleted
# After state:
# ------------
#
# show bgp community-list
# Expanded community list test: match: ANY
# Expanded community list test1: match: ANY
# 201
# Using merged
# Before state:
# -------------
#
# show bgp as-path-access-list
# AS path list test:
- name: Adds 909.* to test as-path list
dellemc.enterprise_sonic.sonic_bgp_as_paths:
config:
- name: test
members:
- 909.*
state: merged
# After state:
# ------------
#
# show bgp as-path-access-list
# AS path list test:
# members: 909.*
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration that is returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration that is returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands that are pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Kumaraguru Narayanan (@nkumaraguru)
ansible dellemc.enterprise_sonic.sonic_bgp_af – Manage global BGP address-family and its parameters dellemc.enterprise\_sonic.sonic\_bgp\_af – Manage global BGP address-family and its parameters
==============================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_bgp_af`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of global BGP\_AF parameters on devices running Enterprise SONiC.
* bgp\_as and vrf\_name must be created in advance on the device.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | Specifies the BGP\_AF related configuration. |
| | **address\_family** dictionary | | Specifies BGP address family related configurations. |
| | | **afis** list / elements=dictionary | | List of address families, such as ipv4, ipv6, and l2vpn. afi and safi are required together. |
| | | | **advertise\_all\_vni** boolean | **Choices:*** no
* yes
| Specifies the advertise all vni flag. |
| | | | **advertise\_default\_gw** boolean | **Choices:*** no
* yes
| Specifies the advertise default gateway flag. |
| | | | **advertise\_prefix** list / elements=dictionary | | Specifies the prefix of the advertise. afi and safi are required together. |
| | | | | **afi** string | **Choices:*** ipv4
* ipv6
* l2vpn
| Specifies afi of the advertise. |
| | | | | **safi** string | **Choices:*** **unicast** ←
* evpn
| Specifies safi of the advertise. |
| | | | **afi** string / required | **Choices:*** ipv4
* ipv6
* l2vpn
| Type of address family to configure. |
| | | | **dampening** boolean | **Choices:*** no
* yes
| Enable route flap dampening if set to true |
| | | | **max\_path** dictionary | | Specifies the maximum paths of ibgp and ebgp count. |
| | | | | **ebgp** integer | | Specifies the count of the ebgp multipaths count. |
| | | | | **ibgp** integer | | Specifies the count of the ibgp multipaths count. |
| | | | **network** list / elements=string | | Enable routing on an IP network for each prefix provided in the network |
| | | | **redistribute** list / elements=dictionary | | Specifies the redistribute information from another routing protocol. |
| | | | | **metric** string | | Specifies the metric for redistributed routes. |
| | | | | **protocol** string / required | **Choices:*** ospf
* static
* connected
| Specifies the protocol for configuring redistribute information. |
| | | | | **route\_map** string | | Specifies the route map reference. |
| | | | **safi** string | **Choices:*** **unicast** ←
* evpn
| Specifies the type of communication for the address family. |
| | **bgp\_as** string / required | | Specifies the BGP autonomous system (AS) number which is already configured on the device. |
| | **vrf\_name** string | **Default:**"default" | Specifies the VRF name which is already configured on the device. |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the BGP\_AF process configured on the device. In case of merged, the input configuration is merged with the existing BGP\_AF configuration on the device. In case of deleted, the existing BGP\_AF configuration is removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#do show running-configuration bgp
#!
#router bgp 51
# router-id 111.2.2.41
# timers 60 180
# !
# address-family ipv4 unicast
# maximum-paths 1
# maximum-paths ibgp 1
# dampening
# !
# address-family ipv6 unicast
# redistribute connected route-map bb metric 21
# redistribute ospf route-map aa metric 27
# redistribute static route-map bb metric 26
# maximum-paths 4
# maximum-paths ibgp 5
# !
# address-family l2vpn evpn
#!
#
- name: Delete BGP Address family configuration from the device
dellemc.enterprise_sonic.sonic_bgp_af:
config:
- bgp_as: 51
address_family:
afis:
- afi: l2vpn
safi: evpn
advertise_all_vni: False
advertise_default_gw: False
advertise_prefix:
- afi: ipv4
safi: unicast
- afi: ipv6
safi: unicast
max_path:
ebgp: 2
ibgp: 5
redistribute:
- metric: "21"
protocol: connected
route_map: bb
- metric: "27"
protocol: ospf
route_map: aa
- metric: "26"
protocol: static
route_map: bb
state: deleted
# After state:
# ------------
#
#do show running-configuration bgp
#!
#router bgp 51
# router-id 111.2.2.41
# timers 60 180
# !
# address-family ipv6 unicast
# !
# address-family l2vpn evpn
#
# Using deleted
#
# Before state:
# -------------
#
#do show running-configuration bgp
#!
#router bgp 51
# router-id 111.2.2.41
# timers 60 180
# !
# address-family ipv6 unicast
# !
# address-family l2vpn evpn
#
- name: Delete All BGP address family configurations
dellemc.enterprise_sonic.sonic_bgp_af:
config:
state: deleted
# After state:
# ------------
#
#do show running-configuration bgp
#!
#router bgp 51
# router-id 111.2.2.41
# timers 60 180
#
# Using merged
#
# Before state:
# -------------
#
#do show running-configuration bgp
#!
#router bgp 51
# router-id 111.2.2.41
# timers 60 180
# !
# address-family l2vpn evpn
#
- name: Merge provided BGP address family configuration on the device.
dellemc.enterprise_sonic.sonic_bgp_af:
config:
- bgp_as: 51
address_family:
afis:
- afi: l2vpn
safi: evpn
advertise_all_vni: False
advertise_default_gw: False
advertise_prefix:
- afi: ipv4
safi: unicast
network:
- 2.2.2.2/16
- 192.168.10.1/32
dampening: True
- afi: ipv6
safi: unicast
max_path:
ebgp: 4
ibgp: 5
redistribute:
- metric: "21"
protocol: connected
route_map: bb
- metric: "27"
protocol: ospf
route_map: aa
- metric: "26"
protocol: static
route_map: bb
state: merged
# After state:
# ------------
#
#do show running-configuration bgp
#!
#router bgp 51
# router-id 111.2.2.41
# timers 60 180
# !
# address-family ipv4 unicast
# network 2.2.2.2/16
# network 192.168.10.1/32
# dampening
# !
# address-family ipv6 unicast
# redistribute connected route-map bb metric 21
# redistribute ospf route-map aa metric 27
# redistribute static route-map bb metric 26
# maximum-paths 4
# maximum-paths ibgp 5
# !
# address-family l2vpn evpn
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M (@niraimadaiselvamm)
ansible dellemc.enterprise_sonic.sonic_aaa – Manage AAA and its parameters dellemc.enterprise\_sonic.sonic\_aaa – Manage AAA and its parameters
====================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_aaa`.
New in version 1.1.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module is used for configuration management of aaa parameters on devices running Enterprise SONiC.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | Specifies the aaa related configurations |
| | **authentication** dictionary | | Specifies the configurations required for aaa authentication |
| | | **data** dictionary | | Specifies the data required for aaa authentication |
| | | | **fail\_through** boolean | **Choices:*** no
* yes
| Specifies the state of failthrough |
| | | | **group** string | **Choices:*** ldap
* radius
* tacacs+
| Specifies the method of aaa authentication |
| | | | **local** boolean | **Choices:*** no
* yes
| Enable or Disable local authentication |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the aaa parameters configured on the device. In case of merged, the input configuration will be merged with the existing aaa configuration on the device. In case of deleted the existing aaa configuration will be removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
# do show aaa
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough : True
# login-method : local
- name: Delete aaa configurations
dellemc.enterprise_sonic.sonic_aaa:
config:
authentication:
data:
local: True
state: deleted
# After state:
# ------------
#
# do show aaa
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough : True
# login-method :
# Using deleted
#
# Before state:
# -------------
#
# do show aaa
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough : True
# login-method : local
- name: Delete aaa configurations
dellemc.enterprise_sonic.sonic_aaa:
config:
state: deleted
# After state:
# ------------
#
# do show aaa
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough :
# login-method :
# Using merged
#
# Before state:
# -------------
#
# do show aaa
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough : False
# login-method :
- name: Merge aaa configurations
dellemc.enterprise_sonic.sonic_aaa:
config:
authentication:
data:
local: true
fail_through: true
state: merged
# After state:
# ------------
#
# do show aaa
# AAA Authentication Information
# ---------------------------------------------------------
# failthrough : True
# login-method : local
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Abirami N (@abirami-n)
| programming_docs |
ansible dellemc.enterprise_sonic.sonic_lag_interfaces – Manage link aggregation group (LAG) interface parameters dellemc.enterprise\_sonic.sonic\_lag\_interfaces – Manage link aggregation group (LAG) interface parameters
===========================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_lag_interfaces`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module manages attributes of link aggregation group (LAG) interfaces of devices running Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of LAG configurations. |
| | **members** dictionary | | The list of interfaces that are part of the group. |
| | | **interfaces** list / elements=dictionary | | The list of interfaces that are part of the group. |
| | | | **member** string | | The interface name. |
| | **mode** string | **Choices:*** static
* lacp
| Specifies mode of the port-channel while creation. |
| | **name** string / required | | ID of the LAG. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state that the configuration should be left in. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using merged
#
# Before state:
# -------------
#
# interface Eth1/10
# mtu 9100
# speed 100000
# no shutdown
# !
# interface Eth1/15
# channel-group 12
# mtu 9100
# speed 100000
# no shutdown
#
- name: Merges provided configuration with device configuration
dellemc.enterprise_sonic.sonic_lag_interfaces:
config:
- name: PortChannel10
members:
interfaces:
- member: Eth1/10
state: merged
#
# After state:
# ------------
#
# interface Eth1/10
# channel-group 10
# mtu 9100
# speed 100000
# no shutdown
# !
# interface Eth1/15
# channel-group 12
# mtu 9100
# speed 100000
# no shutdown
#
# Using deleted
#
# Before state:
# -------------
# interface PortChannel10
# !
# interface Eth1/10
# channel-group 10
# mtu 9100
# speed 100000
# no shutdown
#
- name: Deletes LAG attributes of a given interface, This does not delete the port-channel itself
dellemc.enterprise_sonic.sonic_lag_interfaces:
config:
- name: PortChannel10
members:
interfaces:
state: deleted
#
# After state:
# ------------
# interface PortChannel10
# !
# interface Eth1/10
# mtu 9100
# speed 100000
# no shutdown
#
# Using deleted
#
# Before state:
# -------------
# interface PortChannel 10
# !
# interface PortChannel 12
# !
# interface Eth1/10
# channel-group 10
# mtu 9100
# speed 100000
# no shutdown
# !
# interface Eth1/15
# channel-group 12
# mtu 9100
# speed 100000
# no shutdown
#
- name: Deletes all LAGs and LAG attributes of all interfaces
dellemc.enterprise_sonic.sonic_lag_interfaces:
config:
state: deleted
#
# After state:
# -------------
#
# interface Eth1/10
# mtu 9100
# speed 100000
# no shutdown
# !
# interface Eth1/15
# mtu 9100
# speed 100000
# no shutdown
#
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration that is returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Abirami N (@abirami-n)
ansible dellemc.enterprise_sonic.sonic_interfaces – Configure Interface attributes on interfaces such as, Eth, LAG, VLAN, and loopback. (create a loopback interface if it does not exist.) dellemc.enterprise\_sonic.sonic\_interfaces – Configure Interface attributes on interfaces such as, Eth, LAG, VLAN, and loopback. (create a loopback interface if it does not exist.)
=====================================================================================================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_interfaces`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure Interface attributes such as, MTU, admin statu, and so on, on interfaces such as, Eth, LAG, VLAN, and loopback. (create a loopback interface if it does not exist.)
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of interface configurations. |
| | **description** string | | Description about the interface. |
| | **enabled** boolean | **Choices:*** no
* yes
| Administrative state of the interface. |
| | **mtu** integer | | MTU of the interface. |
| | **name** string / required | | The name of the interface, for example, 'Eth1/15'. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state the configuration should be left in. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name Description Admin Oper Speed MTU
#------------------------------------------------------------------------------------------
#Eth1/1 - up 100000 9100
#Eth1/2 - up 100000 9100
#Eth1/3 - down 100000 9100
#Eth1/3 - down 1000 5000
#Eth1/5 - down 100000 9100
#
- name: Configures interfaces
dellemc.enterprise_sonic.sonic_interfaces:
config:
name: Eth1/3
state: deleted
#
# After state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name Description Admin Oper Speed MTU
#------------------------------------------------------------------------------------------
#Eth1/1 - up 100000 9100
#Eth1/2 - up 100000 9100
#Eth1/3 - down 100000 9100
#Eth1/3 - up 100000 9100
#Eth1/5 - down 100000 9100
#
#
# Using deleted
#
# Before state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name Description Admin Oper Speed MTU
#------------------------------------------------------------------------------------------
#Eth1/1 - up 100000 9100
#Eth1/2 - up 100000 9100
#Eth1/3 - down 100000 9100
#Eth1/3 - down 1000 9100
#Eth1/5 - down 100000 9100
#
- name: Configures interfaces
dellemc.enterprise_sonic.sonic_interfaces:
config:
state: deleted
#
# After state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name Description Admin Oper Speed MTU
#------------------------------------------------------------------------------------------
#Eth1/1 - up 100000 9100
#Eth1/2 - up 100000 9100
#Eth1/3 - up 100000 9100
#Eth1/3 - up 100000 9100
#Eth1/5 - up 100000 9100
#
#
# Using merged
#
# Before state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name Description Admin Oper Speed MTU
#------------------------------------------------------------------------------------------
#Eth1/1 - up 100000 9100
#Eth1/2 - up 100000 9100
#Eth1/3 - down 100000 9100
#Eth1/3 - down 1000 9100
#
- name: Configures interfaces
dellemc.enterprise_sonic.sonic_interfaces:
config:
- name: Eth1/3
description: 'Ethernet Twelve'
- name: Eth1/5
description: 'Ethernet Sixteen'
enable: True
mtu: 3500
state: merged
#
#
# After state:
# ------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name Description Admin Oper Speed MTU
#------------------------------------------------------------------------------------------
#Eth1/1 - up 100000 9100
#Eth1/2 - up 100000 9100
#Eth1/3 - down 100000 9100
#Eth1/4 - down 1000 9100
#Eth1/5 - down 100000 3500
#
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M(@niraimadaiselvamm)
ansible dellemc.enterprise_sonic.sonic_api – Manages REST operations on devices running Enterprise SONiC dellemc.enterprise\_sonic.sonic\_api – Manages REST operations on devices running Enterprise SONiC
==================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_api`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages REST operations on devices running Enterprise SONiC Distribution by Dell Technologies. This module provides an implementation for working with SONiC REST operations in a deterministic way.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **body** raw | | The body of the HTTP request/response to the web service which contains the payload. |
| **method** string / required | **Choices:*** GET
* PUT
* POST
* PATCH
* DELETE
| The HTTP method of the request or response. Must be a valid method accepted by the service that handles the request. |
| **status\_code** list / elements=integer / required | | A list of valid, numeric, HTTP status codes that signifies the success of a request. |
| **url** path / required | | The HTTP path of the request after 'restconf/'. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
- name: Checks that you can connect (GET) to a page and it returns a status 200
dellemc.enterprise_sonic.sonic_api:
url: data/openconfig-interfaces:interfaces/interface=Ethernet60
method: "GET"
status_code: 200
- name: Appends data to an existing interface using PATCH and verifies if it returns status 204
dellemc.enterprise_sonic.sonic_api:
url: data/openconfig-interfaces:interfaces/interface=Ethernet60/config/description
method: "PATCH"
body: {"openconfig-interfaces:description": "Eth-60"}
status_code: 204
- name: Deletes an associated IP address using DELETE and verifies if it returns status 204
dellemc.enterprise_sonic.sonic_api:
url: >
data/openconfig-interfaces:interfaces/interface=Ethernet64/subinterfaces/subinterface=0/
openconfig-if-ip:ipv4/addresses/address=1.1.1.1/config/prefix-length
method: "DELETE"
status_code: 204
- name: Adds a VLAN network instance using PUT and verifies if it returns status 204
dellemc.enterprise_sonic.sonic_api:
url: data/openconfig-network-instance:network-instances/network-instance=Vlan100/
method: "PUT"
body: {"openconfig-network-instance:network-instance": [{"name": "Vlan100","config": {"name": "Vlan100"}}]}
status_code: 204
- name: Adds a prefix-set to a routing policy using POST and verifies if it returns 201
dellemc.enterprise_sonic.sonic_api:
url: data/openconfig-routing-policy:routing-policy/defined-sets/prefix-sets/prefix-set=p1
method: "POST"
body: {"openconfig-routing-policy:config": {"name": "p1","mode": "IPV4" }}
status_code: 201
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | HTTP Error | The HTTP error message from the request. |
| **response** list / elements=string | always | The response at the network device end for the REST call which contains the status code. **Sample:** {'response': [204, {'': None}]} |
### Authors
* Abirami N (@abirami-n)
ansible dellemc.enterprise_sonic.sonic_radius_server – Manage RADIUS server and its parameters dellemc.enterprise\_sonic.sonic\_radius\_server – Manage RADIUS server and its parameters
=========================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_radius_server`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of radius server parameters on devices running Enterprise SONiC.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | Specifies the radius server related configuration. |
| | **auth\_type** string | **Choices:*** **pap** ←
* chap
* mschapv2
| Specifies the authentication type of the radius server. |
| | **key** string | | Specifies the key of the radius server. |
| | **nas\_ip** string | | Specifies the network access server of the radius server. |
| | **retransmit** integer | | Specifies the re-transmit value of the radius server. |
| | **servers** dictionary | | Specifies the servers list of the radius server. |
| | | **host** list / elements=dictionary | | Specifies the host details of the radius servers list. |
| | | | **auth\_type** string | **Choices:*** pap
* chap
* mschapv2
| Specifies the authentication type of the radius server host. |
| | | | **key** string | | Specifies the key of the radius server host. |
| | | | **name** string | | Specifies the name of the radius server host. |
| | | | **port** integer | | Specifies the port of the radius server host. |
| | | | **priority** integer | | Specifies the priority of the radius server host. |
| | | | **retransmit** integer | | Specifies the retransmit of the radius server host. |
| | | | **source\_interface** string | | Specifies the source interface of the radius server host. |
| | | | **timeout** integer | | Specifies the timeout of the radius server host. |
| | | | **vrf** string | | Specifies the vrf of the radius server host. |
| | **statistics** boolean | **Choices:*** no
* yes
| Specifies the statistics flag of the radius server. |
| | **timeout** integer | | Specifies the timeout of the radius server. |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the radius server configured on the device. In case of merged, the input mode configuration will be merged with the existing radius server configuration on the device. In case of deleted the existing radius server mode configuration will be removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#sonic(config)# do show radius-server
#---------------------------------------------------------
#RADIUS Global Configuration
#---------------------------------------------------------
#nas-ip-addr: 1.2.3.4
#statistics : True
#timeout : 10
#auth-type : chap
#key : chap
#retransmit : 3
#--------------------------------------------------------------------------------
#HOST AUTH-TYPE KEY AUTH-PORT PRIORITY TIMEOUT RTSMT VRF SI
#--------------------------------------------------------------------------------
#localhost mschapv2 local 52 2 20 2 mgmt Ethernet12
#myhost chap local 53 3 23 3 mgmt Ethernet24
#---------------------------------------------------------
#RADIUS Statistics
#---------------------------------------------------------
#
- name: Merge radius configurations
dellemc.enterprise_sonic.sonic_radius_server:
config:
auth_type: chap
nas_ip: 1.2.3.4
statistics: true
timeout: 10
servers:
host:
- name: localhost
state: deleted
# After state:
# ------------
#sonic(config)# do show radius-server
#---------------------------------------------------------
#RADIUS Global Configuration
#---------------------------------------------------------
#timeout : 5
#auth-type : pap
#key : chap
#retransmit : 3
#--------------------------------------------------------------------------------
#HOST AUTH-TYPE KEY AUTH-PORT PRIORITY TIMEOUT RTSMT VRF SI
#--------------------------------------------------------------------------------
#myhost chap local 53 3 23 3 mgmt Ethernet24
# Using deleted
#
# Before state:
# -------------
#
#sonic(config)# do show radius-server
#---------------------------------------------------------
#RADIUS Global Configuration
#---------------------------------------------------------
#nas-ip-addr: 1.2.3.4
#statistics : True
#timeout : 10
#auth-type : chap
#key : chap
#retransmit : 3
#--------------------------------------------------------------------------------
#HOST AUTH-TYPE KEY AUTH-PORT PRIORITY TIMEOUT RTSMT VRF SI
#--------------------------------------------------------------------------------
#localhost mschapv2 local 52 2 20 2 mgmt Ethernet12
#myhost chap local 53 3 23 3 mgmt Ethernet24
#---------------------------------------------------------
#RADIUS Statistics
#---------------------------------------------------------
#
- name: Merge radius configurations
dellemc.enterprise_sonic.sonic_radius_server:
config:
state: deleted
# After state:
# ------------
#sonic(config)# do show radius-server
#---------------------------------------------------------
#RADIUS Global Configuration
#---------------------------------------------------------
#timeout : 5
#auth-type : pap
# Using merged
#
# Before state:
# -------------
#
#sonic(config)# do show radius-server
#---------------------------------------------------------
#RADIUS Global Configuration
#---------------------------------------------------------
#
- name: Merge radius configurations
dellemc.enterprise_sonic.sonic_radius_server:
config:
auth_type: chap
key: chap
nas_ip: 1.2.3.4
statistics: true
timeout: 10
retransmit: 3
servers:
host:
- name: localhost
auth_type: mschapv2
key: local
priority: 2
port: 52
retransmit: 2
timeout: 20
source_interface: Eth 12
vrf: mgmt
state: merged
# After state:
# ------------
#
#sonic(config)# do show radius-server
#---------------------------------------------------------
#RADIUS Global Configuration
#---------------------------------------------------------
#nas-ip-addr: 1.2.3.4
#statistics : True
#timeout : 10
#auth-type : chap
#key : chap
#retransmit : 3
#--------------------------------------------------------------------------------
#HOST AUTH-TYPE KEY AUTH-PORT PRIORITY TIMEOUT RTSMT VRF SI
#--------------------------------------------------------------------------------
#localhost mschapv2 local 52 2 20 2 mgmt Ethernet12
#---------------------------------------------------------
#RADIUS Statistics
#---------------------------------------------------------
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M (@niraimadaiselvamm)
| programming_docs |
ansible dellemc.enterprise_sonic.sonic_bgp_neighbors – Manage a BGP neighbor and its parameters dellemc.enterprise\_sonic.sonic\_bgp\_neighbors – Manage a BGP neighbor and its parameters
==========================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_bgp_neighbors`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of global BGP\_NEIGHBORS parameters on devices running Enterprise SONiC.
* bgp\_as and vrf\_name must be created on the device in advance.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | Specifies the BGP neighbors related configuration. |
| | **bgp\_as** string / required | | Specifies the BGP autonomous system (AS) number which is already configured on the device. |
| | **neighbors** list / elements=dictionary | | Specifies BGP neighbor-related configurations. |
| | | **advertisement\_interval** integer | | Specifies the minimum interval between sending BGP routing updates. The range is from 0 to 600. |
| | | **bfd** boolean | **Choices:*** no
* yes
| Enables or disables BFD. |
| | | **capability** dictionary | | Specifies capability attributes to this neighbor. |
| | | | **dynamic** boolean | **Choices:*** no
* yes
| Enables or disables dynamic capability to this neighbor. |
| | | | **extended\_nexthop** boolean | **Choices:*** no
* yes
| Enables or disables advertise extended next-hop capability to the peer. |
| | | **neighbor** string / required | | Neighbor router address. |
| | | **peer\_group** string | | The name of the peer group that the neighbor is a member of. |
| | | **remote\_as** dictionary | | Remote AS of the BGP neighbor to configure. peer\_as and peer\_type are mutually exclusive. |
| | | | **peer\_as** integer | | Specifies remote AS number. The range is from 1 to 4294967295. |
| | | | **peer\_type** string | **Choices:*** internal
* external
| Specifies the type of BGP peer. |
| | | **timers** dictionary | | Specifies BGP neighbor timer-related configurations. |
| | | | **holdtime** integer | | Interval after not receiving a keepalive message that SONiC declares a peer dead, in seconds. The range is from 0 to 65535. |
| | | | **keepalive** integer | | Frequency with which the device sends keepalive messages to its peer, in seconds. The range is from 0 to 65535. |
| | **peer\_group** list / elements=dictionary | | Specifies the list of peer groups. |
| | | **address\_family** dictionary | | Holds of list of address families associated to the peergroup. |
| | | | **afis** list / elements=dictionary | | List of address families with afi, safi, activate and allowas-in parameters. afi and safi are required together. |
| | | | | **activate** boolean | **Choices:*** no
* yes
| Enable or disable activate. |
| | | | | **afi** string | **Choices:*** ipv4
* ipv6
* l2vpn
| Holds afi mode. |
| | | | | **allowas\_in** dictionary | | Holds AS value. The origin and value are mutually exclusive. |
| | | | | | **origin** boolean | **Choices:*** no
* yes
| Set AS as the origin. |
| | | | | | **value** integer | | Holds AS number in the range 1-10. |
| | | | | **safi** string | **Choices:*** unicast
* evpn
| Holds safi mode. |
| | | **advertisement\_interval** integer | | Specifies the minimum interval between sending BGP routing updates. The range is from 0 to 600. |
| | | **bfd** boolean | **Choices:*** no
* yes
| Enables or disables BFD. |
| | | **capability** dictionary | | Specifies capability attributes to this peer group. |
| | | | **dynamic** boolean | **Choices:*** no
* yes
| Enables or disables dynamic capability to this peer group. |
| | | | **extended\_nexthop** boolean | **Choices:*** no
* yes
| Enables or disables advertise extended next-hop capability to the peer. |
| | | **name** string / required | | Name of the peer group. |
| | | **remote\_as** dictionary | | Remote AS of the BGP peer group to configure. peer\_as and peer\_type are mutually exclusive. |
| | | | **peer\_as** integer | | Specifies remote AS number. The range is from 1 to 4294967295. |
| | | | **peer\_type** string | **Choices:*** internal
* external
| Specifies the type of BGP peer. |
| | | **timers** dictionary | | Specifies BGP peer group timer related configurations. |
| | | | **holdtime** integer | | Interval after not receiving a keepalive message that Enterprise SONiC declares a peer dead, in seconds. The range is from 0 to 65535. |
| | | | **keepalive** integer | | Frequency with which the device sends keepalive messages to its peer, in seconds. The range is from 0 to 65535. |
| | **vrf\_name** string | **Default:**"default" | Specifies the VRF name which is already configured on the device. |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the BGP process that is configured on the device. In case of merged, the input configuration is merged with the existing BGP configuration on the device. In case of deleted, the existing BGP configuration is removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# neighbor interface Eth1/3
#!
#router bgp 11
# network import-check
# timers 60 180
# !
# neighbor 192.168.1.4
# !
# peer-group SP1
# bfd
# capability dynamic
# !
# peer-group SP2
# !
#
- name: Deletes all BGP neighbors
dellemc.enterprise_sonic.sonic_bgp_neighbors:
config:
state: deleted
#
# After state:
# -------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
#!
#router bgp 11
# network import-check
# timers 60 180
# !
#
# Using merged
#
# Before state:
# ------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
#!
#router bgp 11
# network import-check
# timers 60 180
# !
- name: "Adds sonic_bgp_neighbors"
dellemc.enterprise_sonic.sonic_bgp_neighbors:
config:
- bgp_as: 51
vrf_name: VrfReg1
peer_group:
- name: SPINE
bfd: true
capability:
dynamic: true
extended_nexthop: true
remote_as:
peer_as: 4
address_family:
afis:
- afi: ipv4
safi: unicast
activate: true
allowas_in:
origin: true
- afi: ipv6
safi: unicast
activate: true
allowas_in:
value: 5
neighbors:
- neighbor: Eth1/3
remote_as:
peer_as: 10
peer_group: SPINE
advertisement_interval: 15
timers:
keepalive: 30
holdtime: 15
bfd: true
capability:
dynamic: true
extended_nexthop: true
- neighbor: 192.168.1.4
state: merged
#
# After state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
# remote-as 4
# bfd
# capability dynamic
# capability extended-nexthop
# address-family ipv4 unicast
# activate
# allowas-in origin
# send-community both
# !
# address-family ipv6 unicast
# activate
# allowas-in 5
# send-community both
# !
# neighbor interface Eth1/3
# peer-group SPINE
# remote-as 10
# timers 15 30
# advertisement-interval 15
# bfd
# capability extended-nexthop
# capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 11
# network import-check
# timers 60 180
#
# Using deleted
#
# Before state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
# bfd
# remote-as 4
# !
# neighbor interface Eth1/3
# peer-group SPINE
# remote-as 10
# timers 15 30
# advertisement-interval 15
# bfd
# capability extended-nexthop
# capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 11
# network import-check
# timers 60 18
# !
# peer-group SP
# !
# neighbor interface Eth1/3
#
- name: "Deletes sonic_bgp_neighbors and peer-groups specific to vrfname"
dellemc.enterprise_sonic.sonic_bgp_neighbors:
config:
- bgp_as: 51
vrf_name: VrfReg1
state: deleted
# After state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
#router bgp 11
# network import-check
# timers 60 18
# !
# peer-group SP
# !
# neighbor interface Eth1/3
#
# Using deleted
#
# Before state:
# -------------
#
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
# bfd
# remote-as 4
# !
# neighbor interface Eth1/3
# peer-group SPINE
# remote-as 10
# timers 15 30
# advertisement-interval 15
# bfd
# capability extended-nexthop
# capability dynamic
# !
# neighbor 192.168.1.4
# !
- name: "Deletes specific sonic_bgp_neighbors"
dellemc.enterprise_sonic.sonic_bgp_neighbors:
config:
- bgp_as: 51
vrf_name: VrfReg1
peer_group:
- name: SPINE
bfd: true
remote_as:
peer_as: 4
neighbors:
- neighbor: Eth1/3
remote_as:
peer_as: 10
peer_group: SPINE
advertisement_interval: 15
timers:
keepalive: 30
holdtime: 15
bfd: true
capability:
dynamic: true
extended_nexthop: true
- neighbor: 192.168.1.4
state: deleted
#
# After state:
# -------------
#
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
# !
# neighbor interface Eth1/3
# !
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Abirami N (@abirami-n)
ansible dellemc.enterprise_sonic.sonic – Use sonic cliconf to run command on Dell OS10 platform dellemc.enterprise\_sonic.sonic – Use sonic cliconf to run command on Dell OS10 platform
========================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic`.
Synopsis
--------
* This sonic plugin provides low level abstraction apis for sending and receiving CLI commands from Dell OS10 network devices.
ansible dellemc.enterprise_sonic.sonic_users – Manage users and its parameters dellemc.enterprise\_sonic.sonic\_users – Manage users and its parameters
========================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_users`.
New in version 1.1.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of users parameters on devices running Enterprise SONiC.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | Specifies the users related configuration. |
| | **name** string / required | | Specifies the name of the user. |
| | **password** string | | Specifies the password of the user. |
| | **role** string | **Choices:*** admin
* operator
| Specifies the role of the user. |
| | **update\_password** string | **Choices:*** **always** ←
* on\_create
| Specifies the update password flag. In case of always, password will be updated every time. In case of on\_create, password will be updated only when user is created. |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the users configured on the device. In case of merged, the input configuration will be merged with the existing users configuration on the device. In case of deleted the existing users configuration will be removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#do show running-configuration
#!
#username admin password $6$sdZt2C7F$3oPSRkkJyLZtsKlFNGWdwssblQWBj5dXM6qAJAQl7dgOfqLSpZJ/n6xf8zPRcqPUFCu5ZKpEtynJ9sZ/S8Mgj. role admin
#username sysadmin password $6$3QNqJzpFAPL9JqHA$417xFKw6SRn.CiqMFJkDfQJXKJGjeYwi2A8BIyfuWjGimvunOOjTRunVluudey/W9l8jhzN1oewBW5iLxmq2Q1 role admin
#username sysoperator password $6$s1eTVjcX4Udi69gY$zlYgqwoKRGC6hGL5iKDImN/4BL7LXKNsx9e5PoSsBLs6C80ShYj2LoJAUZ58ia2WNjcHXhTD1p8eU9wyRTCiE0 role operator
#
- name: Merge users configurations
dellemc.enterprise_sonic.sonic_users:
config:
- name: sysoperator
state: deleted
# After state:
# ------------
#
#do show running-configuration
#!
#username admin password $6$sdZt2C7F$3oPSRkkJyLZtsKlFNGWdwssblQWBj5dXM6qAJAQl7dgOfqLSpZJ/n6xf8zPRcqPUFCu5ZKpEtynJ9sZ/S8Mgj. role admin
#username sysadmin password $6$3QNqJzpFAPL9JqHA$417xFKw6SRn.CiqMFJkDfQJXKJGjeYwi2A8BIyfuWjGimvunOOjTRunVluudey/W9l8jhzN1oewBW5iLxmq2Q1 role admin
# Using deleted
#
# Before state:
# -------------
#
#do show running-configuration
#!
#username admin password $6$sdZt2C7F$3oPSRkkJyLZtsKlFNGWdwssblQWBj5dXM6qAJAQl7dgOfqLSpZJ/n6xf8zPRcqPUFCu5ZKpEtynJ9sZ/S8Mgj. role admin
#username sysadmin password $6$3QNqJzpFAPL9JqHA$417xFKw6SRn.CiqMFJkDfQJXKJGjeYwi2A8BIyfuWjGimvunOOjTRunVluudey/W9l8jhzN1oewBW5iLxmq2Q1 role admin
#username sysoperator password $6$s1eTVjcX4Udi69gY$zlYgqwoKRGC6hGL5iKDImN/4BL7LXKNsx9e5PoSsBLs6C80ShYj2LoJAUZ58ia2WNjcHXhTD1p8eU9wyRTCiE0 role operator
#
- name: Merge users configurations
dellemc.enterprise_sonic.sonic_users:
config:
state: deleted
# After state:
# ------------
#
#do show running-configuration
#!
#username admin password $6$sdZt2C7F$3oPSRkkJyLZtsKlFNGWdwssblQWBj5dXM6qAJAQl7dgOfqLSpZJ/n6xf8zPRcqPUFCu5ZKpEtynJ9sZ/S8Mgj. role admin
# Using merged
#
# Before state:
# -------------
#
#do show running-configuration
#!
#username admin password $6$sdZt2C7F$3oPSRkkJyLZtsKlFNGWdwssblQWBj5dXM6qAJAQl7dgOfqLSpZJ/n6xf8zPRcqPUFCu5ZKpEtynJ9sZ/S8Mgj. role admin
#
- name: Merge users configurations
dellemc.enterprise_sonic.sonic_users:
config:
- name: sysadmin
role: admin
password: admin
update_password: always
- name: sysoperator
role: operator
password: operator
update_password: always
state: merged
# After state:
# ------------
#!
#do show running-configuration
#!
#username admin password $6$sdZt2C7F$3oPSRkkJyLZtsKlFNGWdwssblQWBj5dXM6qAJAQl7dgOfqLSpZJ/n6xf8zPRcqPUFCu5ZKpEtynJ9sZ/S8Mgj. role admin
#username sysadmin password $6$3QNqJzpFAPL9JqHA$417xFKw6SRn.CiqMFJkDfQJXKJGjeYwi2A8BIyfuWjGimvunOOjTRunVluudey/W9l8jhzN1oewBW5iLxmq2Q1 role admin
#username sysoperator password $6$s1eTVjcX4Udi69gY$zlYgqwoKRGC6hGL5iKDImN/4BL7LXKNsx9e5PoSsBLs6C80ShYj2LoJAUZ58ia2WNjcHXhTD1p8eU9wyRTCiE0 role operator
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M (@niraimadaiselvamm)
ansible dellemc.enterprise_sonic.sonic_bgp – Manage global BGP and its parameters dellemc.enterprise\_sonic.sonic\_bgp – Manage global BGP and its parameters
===========================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_bgp`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of global BGP parameters on devices running Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | Specifies the BGP-related configuration. |
| | **bestpath** dictionary | | Configures the BGP best-path. |
| | | **as\_path** dictionary | | Configures the as-path values. |
| | | | **confed** boolean | **Choices:*** no
* yes
| Configures the confed values of as-path. |
| | | | **ignore** boolean | **Choices:*** no
* yes
| Configures the ignore values of as-path. |
| | | | **multipath\_relax** boolean | **Choices:*** no
* yes
| Configures the multipath\_relax values of as-path. |
| | | | **multipath\_relax\_as\_set** boolean | **Choices:*** no
* yes
| Configures the multipath\_relax\_as\_set values of as-path. |
| | | **compare\_routerid** boolean | **Choices:*** no
* yes
| Configures the compare\_routerid. |
| | | **med** dictionary | | Configures the med values. |
| | | | **always\_compare\_med** boolean | **Choices:*** no
* yes
| Allows comparing meds from different neighbors if set to true |
| | | | **confed** boolean | **Choices:*** no
* yes
| Configures the confed values of med. |
| | | | **missing\_as\_worst** boolean | **Choices:*** no
* yes
| Configures the missing\_as\_worst values of as-path. |
| | **bgp\_as** string / required | | Specifies the BGP autonomous system (AS) number to configure on the device. |
| | **log\_neighbor\_changes** boolean | **Choices:*** no
* yes
| Enables/disables logging neighbor up/down and reset reason. |
| | **max\_med** dictionary | | Configure max med and its parameters |
| | | **on\_startup** dictionary | | On startup time and max-med value |
| | | | **med\_val** integer | | on startup med value |
| | | | **timer** integer | | Configures on startup time |
| | **router\_id** string | | Configures the BGP routing process router-id value. |
| | **timers** dictionary | | Adjust routing timers |
| | | **holdtime** integer | | Configures hold-time |
| | | **keepalive\_interval** integer | | Configures keepalive-interval |
| | **vrf\_name** string | **Default:**"default" | Specifies the VRF name. |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the BGP process that is configured on the device. In case of merged, the input configuration is merged with the existing BGP configuration on the device. In case of deleted, the existing BGP configuration is removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#!
#router bgp 10 vrf VrfCheck1
# router-id 10.2.2.32
# log-neighbor-changes
#!
#router bgp 11 vrf VrfCheck2
# log-neighbor-changes
# bestpath as-path ignore
# bestpath med missing-as-worst confed
# bestpath compare-routerid
#!
#router bgp 4
# router-id 10.2.2.4
# bestpath as-path ignore
# bestpath as-path confed
# bestpath med missing-as-worst confed
# bestpath compare-routerid
#!
#
- name: Delete BGP Global attributes
dellemc.enterprise_sonic.sonic_bgp:
config:
- bgp_as: 4
router_id: 10.2.2.4
log_neighbor_changes: False
bestpath:
as_path:
confed: True
ignore: True
multipath_relax: False
multipath_relax_as_set: True
compare_routerid: True
med:
confed: True
missing_as_worst: True
- bgp_as: 10
router_id: 10.2.2.32
log_neighbor_changes: True
vrf_name: 'VrfCheck1'
- bgp_as: 11
log_neighbor_changes: True
vrf_name: 'VrfCheck2'
bestpath:
as_path:
confed: False
ignore: True
multipath_relax_as_set: True
compare_routerid: True
med:
confed: True
missing_as_worst: True
state: deleted
# After state:
# ------------
#
#!
#router bgp 10 vrf VrfCheck1
# log-neighbor-changes
#!
#router bgp 11 vrf VrfCheck2
# log-neighbor-changes
# bestpath compare-routerid
#!
#router bgp 4
# log-neighbor-changes
# bestpath compare-routerid
#!
# Using deleted
#
# Before state:
# -------------
#
#!
#router bgp 10 vrf VrfCheck1
# router-id 10.2.2.32
# log-neighbor-changes
#!
#router bgp 11 vrf VrfCheck2
# log-neighbor-changes
# bestpath as-path ignore
# bestpath med missing-as-worst confed
# bestpath compare-routerid
#!
#router bgp 4
# router-id 10.2.2.4
# bestpath as-path ignore
# bestpath as-path confed
# bestpath med missing-as-worst confed
# bestpath compare-routerid
#!
- name: Deletes all the bgp global configurations
dellemc.enterprise_sonic.sonic_bgp:
config:
state: deleted
# After state:
# ------------
#
#!
#!
# Using merged
#
# Before state:
# -------------
#
#!
#router bgp 4
# router-id 10.1.1.4
#!
#
- name: Merges provided configuration with device configuration
dellemc.enterprise_sonic.sonic_bgp:
config:
- bgp_as: 4
router_id: 10.2.2.4
log_neighbor_changes: False
timers:
holdtime: 20
keepalive_interval: 30
bestpath:
as_path:
confed: True
ignore: True
multipath_relax: False
multipath_relax_as_set: True
compare_routerid: True
med:
confed: True
missing_as_worst: True
always_compare_med: True
max_med:
on_startup:
timer: 667
med_val: 7878
- bgp_as: 10
router_id: 10.2.2.32
log_neighbor_changes: True
vrf_name: 'VrfCheck1'
- bgp_as: 11
log_neighbor_changes: True
vrf_name: 'VrfCheck2'
bestpath:
as_path:
confed: False
ignore: True
multipath_relax_as_set: True
compare_routerid: True
med:
confed: True
missing_as_worst: True
state: merged
#
# After state:
# ------------
#
#!
#router bgp 10 vrf VrfCheck1
# router-id 10.2.2.32
# log-neighbor-changes
#!
#router bgp 11 vrf VrfCheck2
# log-neighbor-changes
# bestpath as-path ignore
# bestpath med missing-as-worst confed
# bestpath compare-routerid
#!
#router bgp 4
# router-id 10.2.2.4
# bestpath as-path ignore
# bestpath as-path confed
# bestpath med missing-as-worst confed
# bestpath compare-routerid
# always-compare-med
# max-med on-startup 667 7878
# timers 20 30
#
#!
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Dhivya P (@dhivayp)
| programming_docs |
ansible dellemc.enterprise_sonic.sonic_system – Configure system parameters dellemc.enterprise\_sonic.sonic\_system – Configure system parameters
=====================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_system`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module is used for configuration management of global system parameters on devices running Enterprise SONiC.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | Specifies the system related configurations |
| | **anycast\_address** dictionary | | Specifies different types of anycast address that can be configured on the device |
| | | **ipv4** boolean | **Choices:*** no
* yes
| Enable or disable ipv4 anycast-address |
| | | **ipv6** boolean | **Choices:*** no
* yes
| Enable or disable ipv6 anycast-address |
| | | **mac\_address** string | | Specifies the mac anycast-address |
| | **hostname** string | | Specifies the hostname of the SONiC device |
| | **interface\_naming** string | **Choices:*** standard
* native
| Specifies the type of interface-naming in device |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the system parameters configured on the device. In case of merged, the input configuration will be merged with the existing system configuration on the device. In case of deleted the existing system configuration will be removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#!
#SONIC(config)#do show running-configuration
#!
#ip anycast-mac-address aa:bb:cc:dd:ee:ff
#ip anycast-address enable
#ipv6 anycast-address enable
#interface-naming standard
- name: Merge provided configuration with device configuration
dellemc.enterprise_sonic.sonic_system:
config:
hostname: SONIC
interface_naming: standard
anycast_address:
ipv6: true
state: deleted
# After state:
# ------------
#!
#sonic(config)#do show running-configuration
#!
#ip anycast-mac-address aa:bb:cc:dd:ee:ff
#ip anycast-address enable
# Using deleted
#
# Before state:
# -------------
#!
#SONIC(config)#do show running-configuration
#!
#ip anycast-mac-address aa:bb:cc:dd:ee:ff
#ip anycast-address enable
#ipv6 anycast-address enable
#interface-naming standard
- name: Delete all system related configs in device configuration
dellemc.enterprise_sonic.sonic_system:
config:
state: deleted
# After state:
# ------------
#!
#sonic(config)#do show running-configuration
#!
# Using merged
#
# Before state:
# -------------
#!
#sonic(config)#do show running-configuration
#!
- name: Merge provided configuration with device configuration
dellemc.enterprise_sonic.sonic_system:
config:
hostname: SONIC
interface_naming: standard
anycast_address:
ipv6: true
ipv4: true
mac_address: aa:bb:cc:dd:ee:ff
state: merged
# After state:
# ------------
#!
#SONIC(config)#do show running-configuration
#!
#ip anycast-mac-address aa:bb:cc:dd:ee:ff
#ip anycast-address enable
#ipv6 anycast-address enable
#interface-naming standard
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Abirami N (@abirami-n)
ansible dellemc.enterprise_sonic.sonic_l2_interfaces – Configure interface-to-VLAN association that is based on access or trunk mode dellemc.enterprise\_sonic.sonic\_l2\_interfaces – Configure interface-to-VLAN association that is based on access or trunk mode
===============================================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_l2_interfaces`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages Layer 2 interface attributes of Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of Layer 2 interface configurations. |
| | **access** dictionary | | Configures access mode characteristics of the interface. |
| | | **vlan** integer | | Configures the specified VLAN in access mode. |
| | **name** string / required | | Full name of the interface, for example, 'Eth1/26'. |
| | **trunk** dictionary | | Configures trunking parameters on an interface. |
| | | **allowed\_vlans** list / elements=dictionary | | Specifies list of allowed VLANs of trunk mode on the interface. |
| | | | **vlan** integer | | Configures the specified VLAN in trunk mode. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state that the configuration should be left in. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/3
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
- name: Eth1/4
state: deleted
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive
#13 Inactive
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
#
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/3
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
state: deleted
#
# After state:
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive
#13 Inactive
#14 Inactive
#15 Inactive
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#11 Inactive T Eth1/7
#12 Inactive T Eth1/7
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
access:
vlan: 10
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/7
#12 Inactive T Eth1/7
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
trunk:
allowed_vlans:
- vlan: 11
- vlan: 12
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/7
#12 Inactive T Eth1/7
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
access:
vlan: 12
trunk:
allowed_vlans:
- vlan: 13
- vlan: 14
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive A Eth1/3
# A Eth1/4
#13 Inactive T Eth1/3
# T Eth1/4
#14 Inactive A Eth1/3
# A Eth1/5
#15 Inactive T Eth1/5
#
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M(@niraimadaiselvamm)
ansible dellemc.enterprise_sonic.sonic_vxlans – Manage VxLAN EVPN and its parameters dellemc.enterprise\_sonic.sonic\_vxlans – Manage VxLAN EVPN and its parameters
==============================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_vxlans`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages interface attributes of Enterprise SONiC interfaces.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of VxLAN configurations. source\_ip and evpn\_nvo are required together. |
| | **evpn\_nvo** string | | EVPN nvo name |
| | **name** string / required | | The name of the VxLAN. |
| | **source\_ip** string | | The source IP address of the VTEP. |
| | **vlan\_map** list / elements=dictionary | | The list of VNI map of VLAN. |
| | | **vlan** integer | | VLAN ID for VNI VLAN map. |
| | | **vni** integer / required | | Specifies the VNI ID. |
| | **vrf\_map** list / elements=dictionary | | list of VNI map of VRF. |
| | | **vni** integer / required | | Specifies the VNI ID. |
| | | **vrf** string | | VRF name for VNI VRF map. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state of the configuration after module completion. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
# do show running-configuration
#
#interface vxlan vteptest1
# source-ip 1.1.1.1
# map vni 101 vlan 11
# map vni 102 vlan 12
# map vni 101 vrf Vrfcheck1
# map vni 102 vrf Vrfcheck2
#!
#
- name: "Test vxlans deleted state 01"
dellemc.enterprise_sonic.sonic_vxlans:
config:
- name: vteptest1
source_ip: 1.1.1.1
vlan_map:
- vni: 101
vlan: 11
vrf_map:
- vni: 101
vrf: Vrfcheck1
state: deleted
#
# After state:
# ------------
#
# do show running-configuration
#
#interface vxlan vteptest1
# source-ip 1.1.1.1
# map vni 102 vlan 12
# map vni 102 vrf Vrfcheck2
#!
#
# Using deleted
#
# Before state:
# -------------
#
# do show running-configuration
#
#interface vxlan vteptest1
# source-ip 1.1.1.1
# map vni 102 vlan 12
# map vni 102 vrf Vrfcheck2
#!
#
- name: "Test vxlans deleted state 02"
dellemc.enterprise_sonic.sonic_vxlans:
config:
state: deleted
#
# After state:
# ------------
#
# do show running-configuration
#
#!
#
# Using merged
#
# Before state:
# -------------
#
# do show running-configuration
#
#!
#
- name: "Test vxlans merged state 01"
dellemc.enterprise_sonic.sonic_vxlans:
config:
- name: vteptest1
source_ip: 1.1.1.1
evpn_nvo_name: nvo1
vlan_map:
- vni: 101
vlan: 11
- vni: 102
vlan: 12
vrf_map:
- vni: 101
vrf: Vrfcheck1
- vni: 102
vrf: Vrfcheck2
state: merged
#
# After state:
# ------------
#
# do show running-configuration
#
#interface vxlan vteptest1
# source-ip 1.1.1.1
# map vni 101 vlan 11
# map vni 102 vlan 12
# map vni 101 vrf Vrfcheck1
# map vni 102 vrf Vrfcheck2
#!
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands that are pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M (@niraimadaiselvamm)
ansible dellemc.enterprise_sonic.sonic_l3_interfaces – Configure the IPv4 and IPv6 parameters on Interfaces such as, Eth, LAG, VLAN, and loopback dellemc.enterprise\_sonic.sonic\_l3\_interfaces – Configure the IPv4 and IPv6 parameters on Interfaces such as, Eth, LAG, VLAN, and loopback
============================================================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_l3_interfaces`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configures Layer 3 interface settings on devices running Enterprise SONiC Distribution by Dell Technologies. This module provides configuration management of IPv4 and IPv6 parameters on Ethernet interfaces of devices running Enterprise SONiC.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | A list of l3\_interfaces configurations. |
| | **ipv4** dictionary | | ipv4 configurations to be set for the Layer 3 interface mentioned in name option. |
| | | **addresses** list / elements=dictionary | | List of IPv4 addresses to be set. |
| | | | **address** string | | IPv4 address to be set in the format <ipv4 address>/<mask> for example, 192.0.2.1/24. |
| | | | **secondary** boolean | **Choices:*** no
* yes
**Default:**"False" | secondary flag of the ip address. |
| | | **anycast\_addresses** list / elements=string | | List of IPv4 addresses to be set for anycast. |
| | **ipv6** dictionary | | ipv6 configurations to be set for the Layer 3 interface mentioned in name option. |
| | | **addresses** list / elements=dictionary | | List of IPv6 addresses to be set. |
| | | | **address** string | | IPv6 address to be set in the address format is <ipv6 address>/<mask> for example, 2001:db8:2201:1::1/64. |
| | | **enabled** boolean | **Choices:*** no
* yes
| enabled flag of the ipv6. |
| | **name** string / required | | Full name of the interface, for example, Eth1/3. |
| **state** string | **Choices:*** **merged** ←
* deleted
| The state that the configuration should be left in. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
# ip address 83.1.1.1/16
# ip address 84.1.1.1/16 secondary
# ipv6 address 83::1/16
# ipv6 address 84::1/16
# ipv6 enable
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
# ip address 91.1.1.1/16
# ip address 92.1.1.1/16 secondary
# ipv6 address 90::1/16
# ipv6 address 91::1/16
# ipv6 address 92::1/16
# ipv6 address 93::1/16
#!
#interface Vlan501
# ip anycast-address 11.12.13.14/12
# ip anycast-address 1.2.3.4/22
#!
#
#
- name: delete one l3 interface.
dellemc.enterprise_sonic.sonic_l3_interfaces:
config:
- name: Ethernet20
ipv4:
addresses:
- address: 83.1.1.1/16
- address: 84.1.1.1/16
- name: Ethernet24
ipv6:
enabled: true
addresses:
- address: 91::1/16
- name: Vlan501
ipv4:
anycast_addresses:
- 11.12.13.14/12
state: deleted
# After state:
# ------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
# ipv6 address 83::1/16
# ipv6 address 84::1/16
# ipv6 enable
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
# ip address 91.1.1.1/16
# ip address 92.1.1.1/16 secondary
# ipv6 address 90::1/16
# ipv6 address 92::1/16
# ipv6 address 93::1/16
#!
#interface Vlan501
# ip anycast-address 1.2.3.4/22
#!
#
# Using deleted
#
# Before state:
# -------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
# ip address 83.1.1.1/16
# ip address 84.1.1.1/16 secondary
# ipv6 address 83::1/16
# ipv6 address 84::1/16
# ipv6 enable
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
# ip address 91.1.1.1/16
# ipv6 address 90::1/16
# ipv6 address 91::1/16
# ipv6 address 92::1/16
# ipv6 address 93::1/16
#!
#interface Vlan501
# ip anycast-address 11.12.13.14/12
# ip anycast-address 1.2.3.4/22
#!
#
#
- name: delete all l3 interface
dellemc.enterprise_sonic.sonic_l3_interfaces:
config:
state: deleted
#
# After state:
# ------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
#!
#interface Vlan501
#!
#
# Using merged
#
# Before state:
# -------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
#!
#interface Vlan501
# ip anycast-address 1.2.3.4/22
#!
#
- name: Add l3 interface configurations
dellemc.enterprise_sonic.sonic_l3_interfaces:
config:
- name: Ethernet20
ipv4:
addresses:
- address: 83.1.1.1/16
- address: 84.1.1.1/16
secondary: True
ipv6:
enabled: true
addresses:
- address: 83::1/16
- address: 84::1/16
secondary: True
- name: Ethernet24
ipv4:
addresses:
- address: 91.1.1.1/16
ipv6:
addresses:
- address: 90::1/16
- address: 91::1/16
- address: 92::1/16
- address: 93::1/16
- name: Vlan501
ipv4:
anycast_addresses:
- 11.12.13.14/12
state: merged
#
# After state:
# ------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
# ip address 83.1.1.1/16
# ip address 84.1.1.1/16 secondary
# ipv6 address 83::1/16
# ipv6 address 84::1/16
# ipv6 enable
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
# ip address 91.1.1.1/16
# ipv6 address 90::1/16
# ipv6 address 91::1/16
# ipv6 address 92::1/16
# ipv6 address 93::1/16
#!
#interface Vlan501
# ip anycast-address 1.2.3.4/22
# ip anycast-address 11.12.13.14/12
#!
#
#
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Kumaraguru Narayanan (@nkumaraguru)
| programming_docs |
ansible dellemc.enterprise_sonic.sonic – HttpApi Plugin for devices supporting Restconf SONIC API dellemc.enterprise\_sonic.sonic – HttpApi Plugin for devices supporting Restconf SONIC API
==========================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* This HttpApi plugin provides methods to connect to Restconf SONIC API endpoints.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **root\_path** string | **Default:**"/restconf" | var: ansible\_httpapi\_restconf\_root | Specifies the location of the Restconf root. |
### Authors
* Ansible Networking Team
ansible dellemc.enterprise_sonic.sonic_config – Manages configuration sections on devices running Enterprise SONiC dellemc.enterprise\_sonic.sonic\_config – Manages configuration sections on devices running Enterprise SONiC
============================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_config`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages configuration sections of Enterprise SONiC Distribution by Dell Technologies. SONiC configurations use a simple block indent file syntax for segmenting configuration into sections. This module provides an implementation for working with SONiC configuration sections in a deterministic way.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **after** list / elements=string | | The ordered set of commands to append to the end of the command stack if a change needs to be made. Just like with *before*, this allows the playbook designer to append a set of commands to be executed after the command set. |
| **backup** boolean | **Choices:*** **no** ←
* yes
| This argument causes the module to create a full backup of the current `running-configuration` from the remote device before any changes are made. If the `backup_options` value is not given, the backup file is written to the `backup` folder in the playbook root directory. If the directory does not exist, it is created. |
| **backup\_options** dictionary | | This is a dictionary object containing configurable options related to backup file path. The value of this option is read only when `backup` is set to *yes*, if `backup` is set to *no* this option is ignored. |
| | **dir\_path** path | | This option provides the path ending with directory name in which the backup configuration file is stored. If the directory does not exist it is first created, and the filename is either the value of `filename` or default filename as described in `filename` options description. If the path value is not given, an *backup* directory is created in the current working directory and backup configuration is copied in `filename` within the *backup* directory. |
| | **filename** string | | The filename to be used to store the backup configuration. If the filename is not given, it is generated based on the hostname, current time, and date in the format defined by <hostname>\_config.<current-date>@<current-time>. |
| **before** list / elements=string | | The ordered set of commands to push on to the command stack if a change needs to be made. This allows the playbook designer the opportunity to perform configuration commands prior to pushing any changes without affecting how the set of commands are matched against the system. |
| **config** string | | The module, by default, connects to the remote device and retrieves the current running-configuration to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-configuration for every task in a playbook. The *config* argument allows the implementer to pass in the configuration to use as the base configuration for comparison. |
| **lines** list / elements=string | | The ordered set of commands that should be configured in the section. The commands must be the exact same commands as found in the device running-configuration. Be sure to note the configuration command syntax as some commands are automatically modified by the device configuration parser. This argument is mutually exclusive with *src*.
aliases: commands |
| **match** string | **Choices:*** **line** ←
* strict
* exact
* none
| Instructs the module on the way to perform the matching of the set of commands against the current device configuration. If match is set to *line*, commands are matched line by line. If match is set to *strict*, command lines are matched with respect to position. If match is set to *exact*, command lines must be an equal match. If match is set to *none*, the module does not attempt to compare the source configuration with the running-configuration on the remote device. |
| **parents** list / elements=string | | The ordered set of parents that uniquely identify the section or hierarchy the commands should be checked against. If the parents argument is omitted, the commands are checked against the set of top level or global commands. |
| **replace** string | **Choices:*** **line** ←
* block
| Instructs the module how to perform a configuration on the device. If the replace argument is set to *line*, then the modified lines are pushed to the device in configuration mode. If the replace argument is set to *block*, then the entire command block is pushed to the device in configuration mode if any line is not correct. |
| **save** boolean | **Choices:*** **no** ←
* yes
| The `save` argument instructs the module to save the running- configuration to the startup-configuration at the conclusion of the module running. If check mode is specified, this argument is ignored. |
| **src** path | | Specifies the source path to the file that contains the configuration or configuration template to load. The path to the source file can either be the full path on the Ansible control host, or a relative path from the playbook or role root directory. This argument is mutually exclusive with *lines*. |
| **update** string | **Choices:*** **merge** ←
* check
| The *update* argument controls how the configuration statements are processed on the remote device. Valid choices for the *update* argument are *merge* and *check*. When you set this argument to *merge*, the configuration changes merge with the current device running-configuration. When you set this argument to *check*, the configuration updates are determined but not configured on the remote device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
- dellemc.enterprise_sonic.sonic_config:
lines: ['username {{ user_name }} password {{ user_password }} role {{ user_role }}']
- dellemc.enterprise_sonic.sonic_config:
lines:
- description 'SONiC'
parents: ['interface Eth1/10']
- dellemc.enterprise_sonic.sonic_config:
lines:
- seq 2 permit udp any any
- seq 3 deny icmp any any
parents: ['ip access-list test']
before: ['no ip access-list test']
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **commands** list / elements=string | always | The set of commands that is pushed to the remote device. **Sample:** ['username foo password foo role admin', 'router bgp 1', 'router-id 1.1.1.1'] |
| **saved** boolean | When not check\_mode. | Returns whether the configuration is saved to the startup configuration or not. **Sample:** True |
| **updates** list / elements=string | always | The set of commands that is pushed to the remote device. **Sample:** ['username foo password foo role admin', 'router bgp 1', 'router-id 1.1.1.1'] |
### Authors
* Abirami N (@abirami-n)
ansible dellemc.enterprise_sonic.sonic_bgp_neighbors_af – Manage the BGP neighbor address-family and its parameters dellemc.enterprise\_sonic.sonic\_bgp\_neighbors\_af – Manage the BGP neighbor address-family and its parameters
===============================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_bgp_neighbors_af`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of BGP neighbors address-family parameters on devices running Enterprise SONiC.
* bgp\_as, vrf\_name and neighbors need be created in advance on the device.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | Specifies the BGP neighbors address-family related configuration. |
| | **bgp\_as** string / required | | Specifies the BGP autonomous system (AS) number which is already configured on the device. |
| | **neighbors** list / elements=dictionary | | Specifies BGP neighbor related configurations in address-family configuration mode. |
| | | **address\_family** list / elements=dictionary | | Specifies BGP address-family related configurations. afi and safi are required together. |
| | | | **activate** boolean | **Choices:*** no
* yes
| Enables the address-family for this neighbor. |
| | | | **afi** string / required | **Choices:*** ipv4
* ipv6
* l2vpn
| Type of address-family to configure. |
| | | | **allowas\_in** dictionary | | Specifies the allowas in values. |
| | | | | **origin** boolean | **Choices:*** no
* yes
| Specifies the origin value. |
| | | | | **value** integer | | Specifies the value of the allowas in. |
| | | | **route\_map** list / elements=dictionary | | Specifies the route-map. |
| | | | | **direction** string | | Specifies the direction of the route-map. |
| | | | | **name** string | | Specifies the name of the route-map. |
| | | | **route\_reflector\_client** boolean | **Choices:*** no
* yes
| Specifies a neighbor as a route-reflector client. |
| | | | **route\_server\_client** boolean | **Choices:*** no
* yes
| Specifies a neighbor as a route-server client. |
| | | | **safi** string | **Choices:*** **unicast** ←
* evpn
| Specifies the type of cast for the address-family. |
| | | **neighbor** string / required | | Neighbor router address which is already configured on the device. |
| | **vrf\_name** string | **Default:**"default" | Specifies the VRF name which is already configured on the device. |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the BGP process that is configured on the device. In case of merged, the input configuration is merged with the existing BGP configuration on the device. In case of deleted, the existing BGP configuration is removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#!
#router bgp 4
# !
# neighbor interface Eth1/3
# !
# address-family ipv4 unicast
# activate
# allowas-in 4
# route-map aa in
# route-map aa out
# route-reflector-client
# route-server-client
# send-community both
#!
#
- name: Deletes neighbors address-family with specific values
dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
config:
- bgp_as: 4
neighbors:
- neighbor: Eth1/3
address_family:
- afi: ipv4
safi: unicast
allowas_in:
value: 4
route_map:
- name: aa
direction: in
- name: aa
direction: out
route_reflector_client: true
route_server_client: true
state: deleted
# After state:
# ------------
#!
#router bgp 4
# !
# neighbor interface Eth1/3
# !
# address-family ipv4 unicast
# send-community both
#!
# Using deleted
#
# Before state:
# -------------
#
#!
#router bgp 4
# !
# neighbor interface Eth1/3
# !
# address-family ipv4 unicast
# activate
# allowas-in 4
# route-map aa in
# route-map aa out
# route-reflector-client
# route-server-client
# send-community both
#!
# neighbor interface Eth1/5
# !
# address-family ipv4 unicast
# activate
# allowas-in origin
# send-community both
#!
#
- name: Deletes neighbors address-family with specific values
dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
config:
state: deleted
# After state:
# ------------
#!
#router bgp 4
#!
# Using deleted
#
# Before state:
# -------------
#
#!
#router bgp 4
# !
# neighbor interface Eth1/3
#!
#
- name: Merges neighbors address-family with specific values
dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
config:
- bgp_as: 4
neighbors:
- neighbor: Eth1/3
address_family:
- afi: ipv4
safi: unicast
allowas_in:
value: 4
route_map:
- name: aa
direction: in
- name: aa
direction: out
route_reflector_client: true
route_server_client: true
state: merged
# After state:
# ------------
#!
#router bgp 4
# !
# neighbor interface Eth1/3
# !
# address-family ipv4 unicast
# activate
# allowas-in 4
# route-map aa in
# route-map aa out
# route-reflector-client
# route-server-client
# send-community both
#!
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned is always in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M (@niraimadaiselvamm)
ansible dellemc.enterprise_sonic.sonic_facts – Collects facts on devices running Enterprise SONiC dellemc.enterprise\_sonic.sonic\_facts – Collects facts on devices running Enterprise SONiC
===========================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_facts`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Collects facts from devices running Enterprise SONiC Distribution by Dell Technologies. This module places the facts gathered in the fact tree keyed by the respective resource name. The facts module always collects a base set of facts from the device and can enable or disable collection of additional facts.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **gather\_network\_resources** list / elements=string | **Choices:*** all
* vlans
* interfaces
* l2\_interfaces
* l3\_interfaces
* lag\_interfaces
* bgp
* bgp\_af
* bgp\_neighbors
* bgp\_neighbors\_af
* bgp\_as\_paths
* bgp\_communities
* bgp\_ext\_communities
* mclag
* vrfs
* vxlans
* users
* system
* port\_breakout
* aaa
* tacacs\_server
* radius\_server
| When supplied, this argument restricts the facts collected to a given subset. Possible values for this argument include all and the resources like 'all', 'interfaces', 'vlans', 'lag\_interfaces', 'l2\_interfaces', 'l3\_interfaces'. Can specify a list of values to include a larger subset. Values can also be used with an initial `M(!`) to specify that a specific subset should not be collected. |
| **gather\_subset** list / elements=string | **Default:**"!config" | When supplied, this argument restricts the facts collected to a given subset. Possible values for this argument include all, min, hardware, config, legacy, and interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial `M(!`) to specify that a specific subset should not be collected. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
- name: Gather all facts
dellemc.enterprise_sonic.sonic_facts:
gather_subset: all
gather_network_resources: all
- name: Collects VLAN and interfaces facts
dellemc.enterprise_sonic.sonic_facts:
gather_subset:
- min
gather_network_resources:
- vlans
- interfaces
- name: Do not collects VLAN and interfaces facts
dellemc.enterprise_sonic.sonic_facts:
gather_network_resources:
- "!vlans"
- "!interfaces"
- name: Collects VLAN and minimal default facts
dellemc.enterprise_sonic.sonic_facts:
gather_subset: min
gather_network_resources: vlans
- name: Collect lag_interfaces and minimal default facts
dellemc.enterprise_sonic.sonic_facts:
gather_subset: min
gather_network_resources: lag_interfaces
```
### Authors
* Mohamed Javeed (@javeedf)
* Abirami N (@abirami-n)
| programming_docs |
ansible dellemc.enterprise_sonic.sonic_port_breakout – Configure port breakout settings on physical interfaces dellemc.enterprise\_sonic.sonic\_port\_breakout – Configure port breakout settings on physical interfaces
=========================================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_port_breakout`.
New in version 1.0.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of port breakout parameters on devices running Enterprise SONiC.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** list / elements=dictionary | | Specifies the port breakout related configuration. |
| | **mode** string | **Choices:*** 1x100G
* 1x400G
* 1x40G
* 2x100G
* 2x200G
* 2x50G
* 4x100G
* 4x10G
* 4x25G
* 4x50G
| Specifies the mode of the port breakout. |
| | **name** string / required | | Specifies the name of the port breakout. |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the port breakout configured on the device. In case of merged, the input mode configuration will be merged with the existing port breakout configuration on the device. In case of deleted the existing port breakout mode configuration will be removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
#do show interface breakout
#-----------------------------------------------
#Port Breakout Mode Status Interfaces
#-----------------------------------------------
#1/1 4x10G Completed Eth1/1/1
# Eth1/1/2
# Eth1/1/3
# Eth1/1/4
#1/11 1x100G Completed Eth1/11
#
- name: Merge users configurations
dellemc.enterprise_sonic.sonic_port_breakout:
config:
- name: 1/11
mode: 1x100G
state: deleted
# After state:
# ------------
#
#do show interface breakout
#-----------------------------------------------
#Port Breakout Mode Status Interfaces
#-----------------------------------------------
#1/1 4x10G Completed Eth1/1/1
# Eth1/1/2
# Eth1/1/3
# Eth1/1/4
#1/11 Default Completed Ethernet40
# Using deleted
#
# Before state:
# -------------
#
#do show interface breakout
#-----------------------------------------------
#Port Breakout Mode Status Interfaces
#-----------------------------------------------
#1/1 4x10G Completed Eth1/1/1
# Eth1/1/2
# Eth1/1/3
# Eth1/1/4
#1/11 1x100G Completed Eth1/11
#
- name: Merge users configurations
dellemc.enterprise_sonic.sonic_port_breakout:
config:
state: deleted
# After state:
# ------------
#
#do show interface breakout
#-----------------------------------------------
#Port Breakout Mode Status Interfaces
#-----------------------------------------------
#1/1 Default Completed Ethernet0
#1/11 Default Completed Ethernet40
# Using merged
#
# Before state:
# -------------
#
#do show interface breakout
#-----------------------------------------------
#Port Breakout Mode Status Interfaces
#-----------------------------------------------
#1/1 4x10G Completed Eth1/1/1
# Eth1/1/2
# Eth1/1/3
# Eth1/1/4
#
- name: Merge users configurations
dellemc.enterprise_sonic.sonic_port_breakout:
config:
- name: 1/11
mode: 1x100G
state: merged
# After state:
# ------------
#
#do show interface breakout
#-----------------------------------------------
#Port Breakout Mode Status Interfaces
#-----------------------------------------------
#1/1 4x10G Completed Eth1/1/1
# Eth1/1/2
# Eth1/1/3
# Eth1/1/4
#1/11 1x100G Completed Eth1/11
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M (@niraimadaiselvamm)
ansible dellemc.enterprise_sonic.sonic_tacacs_server – Manage TACACS server and its parameters dellemc.enterprise\_sonic.sonic\_tacacs\_server – Manage TACACS server and its parameters
=========================================================================================
Note
This plugin is part of the [dellemc.enterprise\_sonic collection](https://galaxy.ansible.com/dellemc/enterprise_sonic) (version 1.1.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.enterprise_sonic`.
To use it in a playbook, specify: `dellemc.enterprise_sonic.sonic_tacacs_server`.
New in version 1.1.0: of dellemc.enterprise\_sonic
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides configuration management of tacacs server parameters on devices running Enterprise SONiC.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config** dictionary | | Specifies the tacacs server related configuration. |
| | **auth\_type** string | **Choices:*** **pap** ←
* chap
* mschap
* login
| Specifies the authentication type of the tacacs server. |
| | **key** string | | Specifies the key of the tacacs server. |
| | **servers** dictionary | | Specifies the servers list of the tacacs server. |
| | | **host** list / elements=dictionary | | Specifies the host details of the tacacs servers list. |
| | | | **auth\_type** string | **Choices:*** **pap** ←
* chap
* mschap
* login
| Specifies the authentication type of the tacacs server host. |
| | | | **key** string | | Specifies the key of the tacacs server host. |
| | | | **name** string | | Specifies the name of the tacacs server host. |
| | | | **port** integer | **Default:**49 | Specifies the port of the tacacs server host. |
| | | | **priority** integer | **Default:**1 | Specifies the priority of the tacacs server host. |
| | | | **timeout** integer | **Default:**5 | Specifies the timeout of the tacacs server host. |
| | | | **vrf** string | **Default:**"default" | Specifies the vrf of the tacacs server host. |
| | **source\_interface** string | | Specifies the source interface of the tacacs server. |
| | **timeout** integer | | Specifies the timeout of the tacacs server. |
| **state** string | **Choices:*** **merged** ←
* deleted
| Specifies the operation to be performed on the tacacs server configured on the device. In case of merged, the input mode configuration will be merged with the existing tacacs server configuration on the device. In case of deleted the existing tacacs server mode configuration will be removed from the device. |
Notes
-----
Note
* Tested against Enterprise SONiC Distribution by Dell Technologies.
* Supports `check_mode`.
Examples
--------
```
# Using deleted
#
# Before state:
# -------------
#
# do show tacacs-server
#---------------------------------------------------------
#TACACS Global Configuration
#---------------------------------------------------------
#source-interface : Ethernet12
#timeout : 10
#auth-type : login
#key : login
#------------------------------------------------------------------------------------------------
#HOST AUTH-TYPE KEY PORT PRIORITY TIMEOUT VRF
#------------------------------------------------------------------------------------------------
#1.2.3.4 pap ***** 50 2 10 mgmt
#localhost pap 49 1 5 default
#
- name: Merge tacacs configurations
dellemc.enterprise_sonic.sonic_tacacs_server:
config:
auth_type: login
key: login
source_interface: Ethernet 12
timeout: 10
servers:
host:
- name: 1.2.3.4
state: deleted
# After state:
# ------------
#
#do show tacacs-server
#---------------------------------------------------------
#TACACS Global Configuration
#---------------------------------------------------------
#timeout : 5
#auth-type : pap
#------------------------------------------------------------------------------------------------
#HOST AUTH-TYPE KEY PORT PRIORITY TIMEOUT VRF
#------------------------------------------------------------------------------------------------
#localhost pap 49 1 5 default
# Using deleted
#
# Before state:
# -------------
#
# do show tacacs-server
#---------------------------------------------------------
#TACACS Global Configuration
#---------------------------------------------------------
#source-interface : Ethernet12
#timeout : 10
#auth-type : login
#key : login
#------------------------------------------------------------------------------------------------
#HOST AUTH-TYPE KEY PORT PRIORITY TIMEOUT VRF
#------------------------------------------------------------------------------------------------
#1.2.3.4 pap ***** 50 2 10 mgmt
#localhost pap 49 1 5 default
#
- name: Merge tacacs configurations
dellemc.enterprise_sonic.sonic_tacacs_server:
config:
state: deleted
# After state:
# ------------
#
#do show tacacs-server
#---------------------------------------------------------
#TACACS Global Configuration
#---------------------------------------------------------
#timeout : 5
#auth-type : pap
# Using merged
#
# Before state:
# -------------
#
#sonic(config)# do show tacacs-server
#---------------------------------------------------------
#TACACS Global Configuration
#---------------------------------------------------------
#
- name: Merge tacacs configurations
dellemc.enterprise_sonic.sonic_tacacs_server:
config:
auth_type: pap
key: pap
source_interface: Ethernet 12
timeout: 10
servers:
host:
- name: 1.2.3.4
auth_type: pap
key: 1234
state: merged
# After state:
# ------------
#
#sonic(config)# do show tacacs-server
#---------------------------------------------------------
#TACACS Global Configuration
#---------------------------------------------------------
#source-interface : Ethernet12
#timeout : 10
#auth-type : pap
#key : pap
#------------------------------------------------------------------------------------------------
#HOST AUTH-TYPE KEY PORT PRIORITY TIMEOUT VRF
#------------------------------------------------------------------------------------------------
#1.2.3.4 pap 1234 49 1 5 default
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. |
| **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] |
### Authors
* Niraimadaiselvam M (@niraimadaiselvamm)
ansible dellemc.openmanage.redfish_powerstate – Manage device power state dellemc.openmanage.redfish\_powerstate – Manage device power state
==================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.redfish_powerstate`.
New in version 2.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to manage the different power states of the specified device.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **baseuri** string / required | | IP address of the target out-of-band controller. For example- <ipaddress>:<port>. |
| **password** string / required | | Password of the target out-of-band controller. |
| **reset\_type** string / required | **Choices:*** ForceOff
* ForceOn
* ForceRestart
* GracefulRestart
* GracefulShutdown
* Nmi
* On
* PowerCycle
* PushPowerButton
| This option resets the device. If `ForceOff`, Turns off the device immediately. If `ForceOn`, Turns on the device immediately. If `ForceRestart`, Turns off the device immediately, and then restarts the device. If `GracefulRestart`, Performs graceful shutdown of the device, and then restarts the device. If `GracefulShutdown`, Performs a graceful shutdown of the device, and the turns off the device. If `Nmi`, Sends a diagnostic interrupt to the device. This is usually a non-maskable interrupt (NMI) on x86 device. If `On`, Turns on the device. If `PowerCycle`, Performs power cycle on the device. If `PushPowerButton`, Simulates the pressing of a physical power button on the device. When a power control operation is performed, which is not supported on the device, an error message is displayed with the list of operations that can be performed. |
| **resource\_id** string | | The unique identifier of the device being managed. For example- [https://<baseuri>/redfish/v1/Systems/<resource\_id>](#). This option is mandatory for *base\_uri* with multiple devices. To get the device details, use the API [https://<baseuri>/redfish/v1/Systems](#). |
| **username** string / required | | Username of the target out-of-band controller. |
Notes
-----
Note
* Run this module from a system that has direct access to Redfish APIs.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Manage power state of the first device
dellemc.openmanage.redfish_powerstate:
baseuri: "192.168.0.1"
username: "username"
password: "password"
reset_type: "On"
- name: Manage power state of a specified device
dellemc.openmanage.redfish_powerstate:
baseuri: "192.168.0.1"
username: "username"
password: "password"
reset_type: "ForceOff"
resource_id: "System.Embedded.1"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on http error | Details of the HTTP error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the operation because the resource /redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset entered in not found.', 'MessageArgs': ['/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset'], '[email protected]': 1, 'MessageId': 'IDRAC.2.1.SYS403', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'Enter the correct resource and retry the operation. For information about valid resource, see the Redfish Users Guide available on the support site.', 'Severity': 'Critical'}], 'code': 'Base.1.5.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information'}} |
| **msg** string | always | Overall status of the reset operation. **Sample:** Successfully performed the reset type operation 'On'. |
### Authors
* Sajna Shetty(@Sajna-Shetty)
ansible dellemc.openmanage.ome_firmware_baseline – Create, modify, or delete a firmware baseline on OpenManage Enterprise or OpenManage Enterprise Modular dellemc.openmanage.ome\_firmware\_baseline – Create, modify, or delete a firmware baseline on OpenManage Enterprise or OpenManage Enterprise Modular
====================================================================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.ome_firmware_baseline`.
New in version 2.0.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to create, modify, or delete a firmware baseline on OpenManage Enterprise or OpenManage Enterprise Modular.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **baseline\_description** string | | Description for the baseline being created. |
| **baseline\_id** integer added in 3.4.0 of dellemc.openmanage | | ID of the existing baseline. This option is mutually exclusive with *baseline\_name*. |
| **baseline\_name** string | | Name of the the baseline. This option is mutually exclusive with *baseline\_id*. |
| **catalog\_name** string | | Name of the catalog to be associated with the baseline. |
| **device\_group\_names** list / elements=string | | List of group names. This option is mutually exclusive with *device\_ids* and *device\_service\_tags*. |
| **device\_ids** list / elements=integer | | List of device IDs. This option is mutually exclusive with *device\_service\_tags* and *device\_group\_names*. |
| **device\_service\_tags** list / elements=string | | List of device service tags. This option is mutually exclusive with *device\_ids* and *device\_group\_names*. |
| **downgrade\_enabled** boolean | **Choices:*** no
* yes
| Indicates whether firmware downgrade is allowed for the devices in the baseline. This value will be set to `True` by default, if not provided during baseline creation. |
| **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. |
| **is\_64\_bit** boolean | **Choices:*** no
* yes
| Indicates if the repository contains 64-bit DUPs. This value will be set to `True` by default, if not provided during baseline creation. |
| **job\_wait** boolean added in 3.4.0 of dellemc.openmanage | **Choices:*** no
* **yes** ←
| Provides the option to wait for job completion. This option is applicable when *state* is `present`. |
| **job\_wait\_timeout** integer added in 3.4.0 of dellemc.openmanage | **Default:**600 | The maximum wait time of *job\_wait* in seconds. The job is tracked only for this duration. This option is applicable when *job\_wait* is `True`. |
| **new\_baseline\_name** string added in 3.4.0 of dellemc.openmanage | | New name of the baseline. |
| **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. |
| **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. |
| **state** string added in 3.4.0 of dellemc.openmanage | **Choices:*** **present** ←
* absent
|
`present` creates or modifies a baseline.
`absent` deletes an existing baseline. |
| **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC OpenManage Enterprise or OpenManage Enterprise Modular.
* *device\_group\_names* option is not applicable for OpenManage Enterprise Modular.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Create baseline for device IDs
dellemc.openmanage.ome_firmware_baseline:
hostname: "192.168.0.1"
username: "username"
password: "password"
baseline_name: "baseline_name"
baseline_description: "baseline_description"
catalog_name: "catalog_name"
device_ids:
- 1010
- 2020
- name: Create baseline for servicetags
dellemc.openmanage.ome_firmware_baseline:
hostname: "192.168.0.1"
username: "username"
password: "password"
baseline_name: "baseline_name"
baseline_description: "baseline_description"
catalog_name: "catalog_name"
device_service_tags:
- "SVCTAG1"
- "SVCTAG2"
- name: Create baseline for device groups without job tracking
dellemc.openmanage.ome_firmware_baseline:
hostname: "192.168.0.1"
username: "username"
password: "password"
baseline_name: "baseline_name"
baseline_description: "baseline_description"
catalog_name: "catalog_name"
device_group_names:
- "Group1"
- "Group2"
job_wait: no
- name: Modify an existing baseline
dellemc.openmanage.ome_firmware_baseline:
hostname: "192.168.0.1"
username: "username"
password: "password"
baseline_name: "existing_baseline_name"
new_baseline_name: "new_baseline_name"
baseline_description: "new baseline_description"
catalog_name: "catalog_other"
device_group_names:
- "Group3"
- "Group4"
- "Group5"
downgrade_enabled: no
is_64_bit: yes
- name: Delete a baseline
dellemc.openmanage.ome_firmware_baseline:
hostname: "192.168.0.1"
username: "username"
password: "password"
state: absent
baseline_name: "baseline_name"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **baseline\_id** integer | When *state* is `absent` | ID of the deleted baseline. **Sample:** 10123 |
| **baseline\_status** dictionary | success | Details of the baseline status. **Sample:** {'CatalogId': 123, 'Description': 'BASELINE DESCRIPTION', 'DeviceComplianceReports': [], 'DowngradeEnabled': True, 'Id': 23, 'Is64Bit': True, 'Name': 'my\_baseline', 'RepositoryId': 123, 'RepositoryName': 'catalog123', 'RepositoryType': 'HTTP', 'Targets': [{'Id': 10083, 'Type': {'Id': 1000, 'Name': 'DEVICE'}}, {'Id': 10076, 'Type': {'Id': 1000, 'Name': 'DEVICE'}}], 'TaskId': 11235, 'TaskStatusId': 2060} |
| **error\_info** dictionary | on http error | Details of http error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to retrieve baseline list either because the device ID(s) entered are invalid', 'Resolution': 'Make sure the entered device ID(s) are valid and retry the operation.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **job\_id** integer | When baseline job is in running state | Job ID of the baseline task. **Sample:** 10123 |
| **msg** string | always | Overall status of the firmware baseline operation. **Sample:** Successfully created the firmware baseline. |
### Authors
* Jagadeesh N V(@jagadeeshnv)
| programming_docs |
ansible dellemc.openmanage.idrac_lifecycle_controller_status_info – Get the status of the Lifecycle Controller dellemc.openmanage.idrac\_lifecycle\_controller\_status\_info – Get the status of the Lifecycle Controller
==========================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.idrac_lifecycle_controller_status_info`.
New in version 2.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module shows the status of the Lifecycle Controller on a Dell EMC PowerEdge server.
Requirements
------------
The below requirements are needed on the host that executes this module.
* omsdk
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **idrac\_ip** string / required | | iDRAC IP Address. |
| **idrac\_password** string / required | | iDRAC user password.
aliases: idrac\_pwd |
| **idrac\_port** integer | **Default:**443 | iDRAC port. |
| **idrac\_user** string / required | | iDRAC username. |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC iDRAC.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Show status of the Lifecycle Controller
dellemc.openmanage.idrac_lifecycle_controller_status_info:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **lc\_status\_info** dictionary | success | Displays the status of the Lifecycle Controller on a Dell EMC PowerEdge server. **Sample:** {'msg': {'LCReady': True, 'LCStatus': 'Ready'}} |
| **msg** string | always | Overall status of fetching lifecycle controller status. **Sample:** Successfully fetched the lifecycle controller status. |
### Authors
* Rajeev Arakkal (@rajeevarakkal)
* Anooja Vardhineni (@anooja-vardhineni)
ansible dellemc.openmanage.dellemc_get_firmware_inventory – Get Firmware Inventory dellemc.openmanage.dellemc\_get\_firmware\_inventory – Get Firmware Inventory
=============================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.dellemc_get_firmware_inventory`.
New in version 1.0.0: of dellemc.openmanage
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2023-01-15
Why
Replaced with [dellemc.openmanage.idrac\_firmware\_info](idrac_firmware_info_module#ansible-collections-dellemc-openmanage-idrac-firmware-info-module).
Alternative
Use [dellemc.openmanage.idrac\_firmware\_info](idrac_firmware_info_module#ansible-collections-dellemc-openmanage-idrac-firmware-info-module) instead.
Synopsis
--------
* Get Firmware Inventory.
Requirements
------------
The below requirements are needed on the host that executes this module.
* omsdk
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **idrac\_ip** string / required | | iDRAC IP Address. |
| **idrac\_password** string / required | | iDRAC user password.
aliases: idrac\_pwd |
| **idrac\_port** integer | **Default:**443 | iDRAC port. |
| **idrac\_user** string / required | | iDRAC username. |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC iDRAC.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Get Installed Firmware Inventory
dellemc.openmanage.dellemc_get_firmware_inventory:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
```
Status
------
* This module will be removed in a major release after 2023-01-15. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Rajeev Arakkal (@rajeevarakkal)
ansible dellemc.openmanage.idrac_network – Configures the iDRAC network attributes dellemc.openmanage.idrac\_network – Configures the iDRAC network attributes
===========================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.idrac_network`.
New in version 2.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to configure iDRAC network settings.
Requirements
------------
The below requirements are needed on the host that executes this module.
* omsdk
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **auto\_config** string | **Choices:*** Enabled
* Disabled
| Allows to enable or disable auto-provisioning to automatically acquire domain name from DHCP. |
| **auto\_detect** string | **Choices:*** Enabled
* Disabled
| Allows to auto detect the available NIC types used by iDRAC. |
| **auto\_negotiation** string | **Choices:*** Enabled
* Disabled
| Allows iDRAC to automatically set the duplex mode and network speed. |
| **dns\_from\_dhcp** string | **Choices:*** Enabled
* Disabled
| Allows to enable DHCP to obtain DNS server address. |
| **dns\_idrac\_name** string | | Name of the DNS to register iDRAC. |
| **duplex\_mode** string | **Choices:*** Full
* Half
| Select the type of data transmission for the NIC. |
| **enable\_dhcp** string | **Choices:*** Enabled
* Disabled
| Allows to enable or disable Dynamic Host Configuration Protocol (DHCP) in iDRAC. |
| **enable\_ipv4** string | **Choices:*** Enabled
* Disabled
| Allows to enable or disable IPv4 configuration. |
| **enable\_nic** string | **Choices:*** Enabled
* Disabled
| Allows to enable or disable the Network Interface Controller (NIC) used by iDRAC. |
| **failover\_network** string | **Choices:*** ALL
* LOM1
* LOM2
* LOM3
* LOM4
* T\_None
| Select one of the remaining LOMs. If a network fails, the traffic is routed through the failover network. |
| **idrac\_ip** string / required | | iDRAC IP Address. |
| **idrac\_password** string / required | | iDRAC user password.
aliases: idrac\_pwd |
| **idrac\_port** integer | **Default:**443 | iDRAC port. |
| **idrac\_user** string / required | | iDRAC username. |
| **ip\_address** string | | Enter a valid iDRAC static IPv4 address. |
| **network\_speed** string | **Choices:*** T\_10
* T\_100
* T\_1000
| Select the network speed for the selected NIC. |
| **nic\_mtu** integer | | Maximum Transmission Unit of the NIC. |
| **nic\_selection** string | **Choices:*** Dedicated
* LOM1
* LOM2
* LOM3
* LOM4
| Select one of the available NICs. |
| **register\_idrac\_on\_dns** string | **Choices:*** Enabled
* Disabled
| Registers iDRAC on a Domain Name System (DNS). |
| **setup\_idrac\_nic\_vlan** string | **Choices:*** Enabled
* Disabled
| Allows to configure VLAN on iDRAC. |
| **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is mandatory for network shares. |
| **share\_name** string / required | | Network share or a local path. |
| **share\_password** string | | Network share user password. This option is mandatory for CIFS share.
aliases: share\_pwd |
| **share\_user** string | | Network share user name. Use the format 'user@domain' or 'domain\\user' if user is part of a domain. This option is mandatory for CIFS share. |
| **static\_dns** string | | Enter the static DNS domain name. |
| **static\_dns\_1** string | | Enter the preferred static DNS server IPv4 address. |
| **static\_dns\_2** string | | Enter the preferred static DNS server IPv4 address. |
| **static\_gateway** string | | Enter the static IPv4 gateway address to iDRAC. |
| **static\_net\_mask** string | | Enter the static IP subnet mask to iDRAC. |
| **vlan\_id** integer | | Enter the VLAN ID. The VLAN ID must be a number from 1 through 4094. |
| **vlan\_priority** integer | | Enter the priority for the VLAN ID. The priority value must be a number from 0 through 7. |
Notes
-----
Note
* This module requires ‘Administrator’ privilege for *idrac\_user*.
* Run this module from a system that has direct access to Dell EMC iDRAC.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Configure iDRAC network settings
dellemc.openmanage.idrac_network:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
share_name: "192.168.0.1:/share"
share_password: "share_pwd"
share_user: "share_user"
share_mnt: "/mnt/share"
register_idrac_on_dns: Enabled
dns_idrac_name: None
auto_config: None
static_dns: None
setup_idrac_nic_vlan: Enabled
vlan_id: 0
vlan_priority: 1
enable_nic: Enabled
nic_selection: Dedicated
failover_network: T_None
auto_detect: Disabled
auto_negotiation: Enabled
network_speed: T_1000
duplex_mode: Full
nic_mtu: 1500
ip_address: "192.168.0.1"
enable_dhcp: Enabled
enable_ipv4: Enabled
static_dns_1: "192.168.0.1"
static_dns_2: "192.168.0.1"
dns_from_dhcp: Enabled
static_gateway: None
static_net_mask: None
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **msg** string | always | Successfully configured the idrac network settings. **Sample:** Successfully configured the idrac network settings. |
| **network\_status** dictionary | success | Status of the Network settings operation job. **Sample:** {'@odata.context': '/redfish/v1/$metadata#DellJob.DellJob', '@odata.id': '/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID\_856418531008', '@odata.type': '#DellJob.v1\_0\_2.DellJob', 'CompletionTime': '2020-03-31T03:04:15', 'Description': 'Job Instance', 'EndTime': None, 'Id': 'JID\_856418531008', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'SYS053', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} |
### Authors
* Felix Stephen (@felixs88)
* Anooja Vardhineni (@anooja-vardhineni)
ansible dellemc.openmanage.idrac_lifecycle_controller_job_status_info – Get the status of a Lifecycle Controller job dellemc.openmanage.idrac\_lifecycle\_controller\_job\_status\_info – Get the status of a Lifecycle Controller job
=================================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.idrac_lifecycle_controller_job_status_info`.
New in version 2.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module shows the status of a specific Lifecycle Controller job using its job ID.
Requirements
------------
The below requirements are needed on the host that executes this module.
* omsdk
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **idrac\_ip** string / required | | iDRAC IP Address. |
| **idrac\_password** string / required | | iDRAC user password.
aliases: idrac\_pwd |
| **idrac\_port** integer | **Default:**443 | iDRAC port. |
| **idrac\_user** string / required | | iDRAC username. |
| **job\_id** string / required | | JOB ID in the format "JID\_123456789012". |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC iDRAC.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Show status of a Lifecycle Control job
dellemc.openmanage.idrac_lifecycle_controller_job_status_info:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
job_id: "JID_1234567890"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **job\_info** dictionary | success | Displays the status of a Lifecycle Controller job. **Sample:** {'ElapsedTimeSinceCompletion': '8742', 'InstanceID': 'JID\_844222910040', 'JobStartTime': 'NA', 'JobStatus': 'Completed', 'JobUntilTime': 'NA', 'Message': 'Job completed successfully.', 'MessageArguments': 'NA', 'MessageID': 'RED001', 'Name': 'update:DCIM:INSTALLED#iDRAC.Embedded.1-1#IDRACinfo', 'PercentComplete': '100', 'Status': 'Success'} |
| **msg** string | always | Overall status of the job facts operation. **Sample:** Successfully fetched the job info. |
### Authors
* Rajeev Arakkal (@rajeevarakkal)
* Anooja Vardhineni (@anooja-vardhineni)
ansible dellemc.openmanage.ome_smart_fabric_uplink – Create, modify or delete a uplink for a fabric on OpenManage Enterprise Modular dellemc.openmanage.ome\_smart\_fabric\_uplink – Create, modify or delete a uplink for a fabric on OpenManage Enterprise Modular
===============================================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.ome_smart_fabric_uplink`.
New in version 2.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to create, modify or delete an uplink for a fabric.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.17
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Provide a short description for the uplink to be created or modified. |
| **fabric\_name** string / required | | Provide the *fabric\_name* of the fabric for which the uplink is to be configured. |
| **hostname** string / required | | OpenManage Enterprise Modular IP address or hostname. |
| **name** string / required | | Provide the *name* of the uplink to be created, modified or deleted. |
| **new\_name** string | | Provide the new *new\_name* for the uplink. |
| **password** string / required | | OpenManage Enterprise Modular password. |
| **port** integer | **Default:**443 | OpenManage Enterprise Modular HTTPS port. |
| **primary\_switch\_ports** list / elements=string | | The IOM slots to be connected to the primary switch.
*primary\_switch\_service\_tag* is mandatory for this option. |
| **primary\_switch\_service\_tag** string | | Service tag of the primary switch. |
| **secondary\_switch\_ports** list / elements=string | | The IOM slots to be connected to the secondary switch.
*secondary\_switch\_service\_tag* is mandatory for this option. |
| **secondary\_switch\_service\_tag** string | | Service tag of the secondary switch. |
| **state** string | **Choices:*** **present** ←
* absent
|
`present` - Creates a new uplink with the provided *name*. - Modifies an existing uplink with the provided *name*.
`absent` – Deletes the uplink with the provided *name*.
*WARNING* Delete operation can impact the network infrastructure. |
| **tagged\_networks** list / elements=string | | VLANs to be associated with the uplink *name*. |
| **ufd\_enable** string | **Choices:*** Enabled
* Disabled
| Add or Remove the uplink to the Uplink Failure Detection (UFD) group. The UFD group identifies the loss of connectivity to the upstream switch and notifies the servers that are connected to the switch. During an uplink failure, the switch disables the corresponding downstream server ports. The downstream servers can then select alternate connectivity routes, if available.
*WARNING* The firmware version of the I/O Module running the Fabric Manager must support this configuration feature. If not, uplink creation will be successful with an appropriate error message in response. |
| **untagged\_network** string | | Specify the name of the VLAN to be added as untagged to the uplink. |
| **uplink\_type** string | **Choices:*** Ethernet
* FCoE
* FC Gateway
* FC Direct Attach
* Ethernet - No Spanning Tree
| Specify the uplink type.
*NOTE* The uplink type cannot be changed for an existing uplink. |
| **username** string / required | | OpenManage Enterprise Modular username. |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC OpenManage Enterprise Modular.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Create an Uplink
dellemc.openmanage.ome_smart_fabric_uplink:
hostname: "192.168.0.1"
username: "username"
password: "password"
state: "present"
fabric_name: "fabric1"
name: "uplink1"
description: "CREATED from OMAM"
uplink_type: "Ethernet"
ufd_enable: "Enabled"
primary_switch_service_tag: "ABC1234"
primary_switch_ports:
- ethernet1/1/13
- ethernet1/1/14
secondary_switch_service_tag: "XYZ1234"
secondary_switch_ports:
- ethernet1/1/13
- ethernet1/1/14
tagged_networks:
- vlan1
- vlan3
untagged_network: vlan2
tags: create_uplink
- name: Modify an existing uplink
dellemc.openmanage.ome_smart_fabric_uplink:
hostname: "192.168.0.1"
username: "username"
password: "password"
state: "present"
fabric_name: "fabric1"
name: "uplink1"
new_name: "uplink2"
description: "Modified from OMAM"
uplink_type: "Ethernet"
ufd_enable: "Disabled"
primary_switch_service_tag: "DEF1234"
primary_switch_ports:
- ethernet1/2/13
- ethernet1/2/14
secondary_switch_service_tag: "TUV1234"
secondary_switch_ports:
- ethernet1/2/13
- ethernet1/2/14
tagged_networks:
- vlan11
- vlan33
untagged_network: vlan22
tags: modify_uplink
- name: Delete an Uplink
dellemc.openmanage.ome_smart_fabric_uplink:
hostname: "192.168.0.1"
username: "username"
password: "password"
state: "absent"
fabric_name: "fabric1"
name: "uplink1"
tags: delete_uplink
- name: Modify an Uplink name
dellemc.openmanage.ome_smart_fabric_uplink:
hostname: "192.168.0.1"
username: "username"
password: "password"
state: "present"
fabric_name: "fabric1"
name: "uplink1"
new_name: "uplink2"
tags: modify_uplink_name
- name: Modify Uplink ports
dellemc.openmanage.ome_smart_fabric_uplink:
hostname: "192.168.0.1"
username: "username"
password: "password"
state: "present"
fabric_name: "fabric1"
name: "uplink1"
description: "uplink ports modified"
primary_switch_service_tag: "ABC1234"
primary_switch_ports:
- ethernet1/1/6
- ethernet1/1/7
secondary_switch_service_tag: "XYZ1234"
secondary_switch_ports:
- ethernet1/1/9
- ethernet1/1/10
tags: modify_ports
- name: Modify Uplink networks
dellemc.openmanage.ome_smart_fabric_uplink:
hostname: "192.168.0.1"
username: "username"
password: "password"
state: "present"
fabric_name: "fabric1"
name: "create1"
description: "uplink networks modified"
tagged_networks:
- vlan4
tags: modify_networks
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **additional\_info** dictionary | when *state=present* and additional information present in response. | Additional details of the fabric operation. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to configure the Uplink Failure Detection mode on the uplink because the firmware version of the I/O Module running the Fabric Manager does not support the configuration feature.', 'MessageArgs': [], 'MessageId': 'CDEV7151', 'RelatedProperties': [], 'Resolution': "Update the firmware version of the I/O Module running the Fabric Manager and retry the operation. For information about the recommended I/O Module firmware versions, see the OpenManage Enterprise-Modular User's Guide available on the support site.", 'Severity': 'Informational'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the request because the resource URI does not exist or is not implemented.', 'MessageArgs': [], 'MessageId': 'CGEN1006', 'RelatedProperties': [], 'Resolution': "Check the request resource URI. Refer to the OpenManage Enterprise-Modular User's Guide for more information about resource URI and its properties.", 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **msg** string | always | Overall status of the uplink operation. **Sample:** Successfully modified the uplink. |
| **uplink\_id** string | when *state=present* | Returns the ID when an uplink is created or modified. **Sample:** ddc3d260-fd71-46a1-97f9-708e12345678 |
### Authors
* Jagadeesh N V(@jagadeeshnv)
| programming_docs |
ansible dellemc.openmanage.ome_firmware_baseline_info – Retrieves baseline details from OpenManage Enterprise dellemc.openmanage.ome\_firmware\_baseline\_info – Retrieves baseline details from OpenManage Enterprise
========================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.ome_firmware_baseline_info`.
New in version 2.0.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module retrieves the list and details of all the baselines on OpenManage Enterprise.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **baseline\_name** string | | Name of the baseline.If *baseline\_name* is not provided, all the available firmware baselines are returned. |
| **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. |
| **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. |
| **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. |
| **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC OpenManage Enterprise.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Retrieve details of all the available firmware baselines
dellemc.openmanage.ome_firmware_baseline_info:
hostname: "192.168.0.1"
username: "username"
password: "password"
- name: Retrieve details of a specific firmware baseline identified by its baseline name
dellemc.openmanage.ome_firmware_baseline_info:
hostname: "192.168.0.1"
username: "username"
password: "password"
baseline_name: "baseline_name"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **baseline\_info** dictionary | success | Details of the baselines. **Sample:** {'@odata.id': '/api/UpdateService/Baselines(239)', '@odata.type': '#UpdateService.Baselines', 'CatalogId': 22, 'ComplianceSummary': {'ComplianceStatus': 'CRITICAL', 'NumberOfCritical': 1, 'NumberOfDowngrade': 0, 'NumberOfNormal': 0, 'NumberOfWarning': 0}, 'Description': 'baseline\_description', '[email protected]': '/api/UpdateService/Baselines(239)/DeviceComplianceReports', 'DowngradeEnabled': True, 'Id': 239, 'Is64Bit': True, 'LastRun': '2020-05-22 16:42:40.307', 'Name': 'baseline\_name', 'RepositoryId': 12, 'RepositoryName': 'HTTP DELL', 'RepositoryType': 'DELL\_ONLINE', 'Targets': [{'Id': 10342, 'Type': {'Id': 1000, 'Name': 'DEVICE'}}], 'TaskId': 41415, 'TaskStatusId': 2060} |
| **msg** string | on error | Overall baseline information. **Sample:** Successfully fetched firmware baseline information. |
### Authors
* Sajna Shetty(@Sajna-Shetty)
ansible Dellemc.Openmanage Dellemc.Openmanage
==================
Collection version 3.6.0
Plugin Index
------------
These are the plugins in the dellemc.openmanage collection
### Modules
* [dellemc\_configure\_idrac\_eventing](dellemc_configure_idrac_eventing_module#ansible-collections-dellemc-openmanage-dellemc-configure-idrac-eventing-module) – Configures the iDRAC eventing related attributes
* [dellemc\_configure\_idrac\_services](dellemc_configure_idrac_services_module#ansible-collections-dellemc-openmanage-dellemc-configure-idrac-services-module) – Configures the iDRAC services related attributes
* [dellemc\_get\_firmware\_inventory](dellemc_get_firmware_inventory_module#ansible-collections-dellemc-openmanage-dellemc-get-firmware-inventory-module) – Get Firmware Inventory
* [dellemc\_get\_system\_inventory](dellemc_get_system_inventory_module#ansible-collections-dellemc-openmanage-dellemc-get-system-inventory-module) – Get the PowerEdge Server System Inventory
* [dellemc\_idrac\_lc\_attributes](dellemc_idrac_lc_attributes_module#ansible-collections-dellemc-openmanage-dellemc-idrac-lc-attributes-module) – Enable or disable Collect System Inventory on Restart (CSIOR) property for all iDRAC/LC jobs
* [dellemc\_idrac\_storage\_volume](dellemc_idrac_storage_volume_module#ansible-collections-dellemc-openmanage-dellemc-idrac-storage-volume-module) – Configures the RAID configuration attributes
* [dellemc\_system\_lockdown\_mode](dellemc_system_lockdown_mode_module#ansible-collections-dellemc-openmanage-dellemc-system-lockdown-mode-module) – Configures system lockdown mode for iDRAC
* [idrac\_bios](idrac_bios_module#ansible-collections-dellemc-openmanage-idrac-bios-module) – Configure the BIOS attributes
* [idrac\_firmware](idrac_firmware_module#ansible-collections-dellemc-openmanage-idrac-firmware-module) – Firmware update from a repository on a network share (CIFS, NFS, HTTP, HTTPS, FTP)
* [idrac\_firmware\_info](idrac_firmware_info_module#ansible-collections-dellemc-openmanage-idrac-firmware-info-module) – Get Firmware Inventory
* [idrac\_lifecycle\_controller\_job\_status\_info](idrac_lifecycle_controller_job_status_info_module#ansible-collections-dellemc-openmanage-idrac-lifecycle-controller-job-status-info-module) – Get the status of a Lifecycle Controller job
* [idrac\_lifecycle\_controller\_jobs](idrac_lifecycle_controller_jobs_module#ansible-collections-dellemc-openmanage-idrac-lifecycle-controller-jobs-module) – Delete the Lifecycle Controller Jobs
* [idrac\_lifecycle\_controller\_logs](idrac_lifecycle_controller_logs_module#ansible-collections-dellemc-openmanage-idrac-lifecycle-controller-logs-module) – Export Lifecycle Controller logs to a network share or local path.
* [idrac\_lifecycle\_controller\_status\_info](idrac_lifecycle_controller_status_info_module#ansible-collections-dellemc-openmanage-idrac-lifecycle-controller-status-info-module) – Get the status of the Lifecycle Controller
* [idrac\_network](idrac_network_module#ansible-collections-dellemc-openmanage-idrac-network-module) – Configures the iDRAC network attributes
* [idrac\_os\_deployment](idrac_os_deployment_module#ansible-collections-dellemc-openmanage-idrac-os-deployment-module) – Boot to a network ISO image
* [idrac\_redfish\_storage\_controller](idrac_redfish_storage_controller_module#ansible-collections-dellemc-openmanage-idrac-redfish-storage-controller-module) – Configures the storage controller settings
* [idrac\_reset](idrac_reset_module#ansible-collections-dellemc-openmanage-idrac-reset-module) – Reset iDRAC
* [idrac\_server\_config\_profile](idrac_server_config_profile_module#ansible-collections-dellemc-openmanage-idrac-server-config-profile-module) – Export or Import iDRAC Server Configuration Profile (SCP)
* [idrac\_syslog](idrac_syslog_module#ansible-collections-dellemc-openmanage-idrac-syslog-module) – Enable or disable the syslog on iDRAC
* [idrac\_system\_info](idrac_system_info_module#ansible-collections-dellemc-openmanage-idrac-system-info-module) – Get the PowerEdge Server System Inventory
* [idrac\_timezone\_ntp](idrac_timezone_ntp_module#ansible-collections-dellemc-openmanage-idrac-timezone-ntp-module) – Configures time zone and NTP on iDRAC
* [idrac\_user](idrac_user_module#ansible-collections-dellemc-openmanage-idrac-user-module) – Configure settings for user accounts
* [ome\_application\_certificate](ome_application_certificate_module#ansible-collections-dellemc-openmanage-ome-application-certificate-module) – This module allows to generate a CSR and upload the certificate
* [ome\_application\_network\_address](ome_application_network_address_module#ansible-collections-dellemc-openmanage-ome-application-network-address-module) – Updates the network configuration on OpenManage Enterprise
* [ome\_application\_network\_proxy](ome_application_network_proxy_module#ansible-collections-dellemc-openmanage-ome-application-network-proxy-module) – Updates the proxy configuration on OpenManage Enterprise
* [ome\_application\_network\_time](ome_application_network_time_module#ansible-collections-dellemc-openmanage-ome-application-network-time-module) – Updates the network time on OpenManage Enterprise
* [ome\_application\_network\_webserver](ome_application_network_webserver_module#ansible-collections-dellemc-openmanage-ome-application-network-webserver-module) – Updates the Web server configuration on OpenManage Enterprise
* [ome\_chassis\_slots](ome_chassis_slots_module#ansible-collections-dellemc-openmanage-ome-chassis-slots-module) – Rename sled slots on OpenManage Enterprise Modular
* [ome\_configuration\_compliance\_baseline](ome_configuration_compliance_baseline_module#ansible-collections-dellemc-openmanage-ome-configuration-compliance-baseline-module) – Create, modify, and delete a configuration compliance baseline and remediate non-compliant devices on OpenManage Enterprise
* [ome\_configuration\_compliance\_info](ome_configuration_compliance_info_module#ansible-collections-dellemc-openmanage-ome-configuration-compliance-info-module) – Device compliance report for devices managed in OpenManage Enterprise
* [ome\_device\_group](ome_device_group_module#ansible-collections-dellemc-openmanage-ome-device-group-module) – Add devices to a static device group on OpenManage Enterprise
* [ome\_device\_info](ome_device_info_module#ansible-collections-dellemc-openmanage-ome-device-info-module) – Retrieves the information of devices inventoried by OpenManage Enterprise
* [ome\_diagnostics](ome_diagnostics_module#ansible-collections-dellemc-openmanage-ome-diagnostics-module) – Export technical support logs(TSR) to network share location
* [ome\_discovery](ome_discovery_module#ansible-collections-dellemc-openmanage-ome-discovery-module) – Create, modify, or delete a discovery job on OpenManage Enterprise
* [ome\_firmware](ome_firmware_module#ansible-collections-dellemc-openmanage-ome-firmware-module) – Firmware update of PowerEdge devices and its components through OpenManage Enterprise
* [ome\_firmware\_baseline](ome_firmware_baseline_module#ansible-collections-dellemc-openmanage-ome-firmware-baseline-module) – Create, modify, or delete a firmware baseline on OpenManage Enterprise or OpenManage Enterprise Modular
* [ome\_firmware\_baseline\_compliance\_info](ome_firmware_baseline_compliance_info_module#ansible-collections-dellemc-openmanage-ome-firmware-baseline-compliance-info-module) – Retrieves baseline compliance details on OpenManage Enterprise
* [ome\_firmware\_baseline\_info](ome_firmware_baseline_info_module#ansible-collections-dellemc-openmanage-ome-firmware-baseline-info-module) – Retrieves baseline details from OpenManage Enterprise
* [ome\_firmware\_catalog](ome_firmware_catalog_module#ansible-collections-dellemc-openmanage-ome-firmware-catalog-module) – Create, modify, or delete a firmware catalog on OpenManage Enterprise or OpenManage Enterprise Modular
* [ome\_groups](ome_groups_module#ansible-collections-dellemc-openmanage-ome-groups-module) – Manages static device groups on OpenManage Enterprise
* [ome\_identity\_pool](ome_identity_pool_module#ansible-collections-dellemc-openmanage-ome-identity-pool-module) – Manages identity pool settings on OpenManage Enterprise
* [ome\_job\_info](ome_job_info_module#ansible-collections-dellemc-openmanage-ome-job-info-module) – Get job details for a given job ID or an entire job queue on OpenMange Enterprise
* [ome\_network\_port\_breakout](ome_network_port_breakout_module#ansible-collections-dellemc-openmanage-ome-network-port-breakout-module) – This module allows to automate the port portioning or port breakout to logical sub ports
* [ome\_network\_vlan](ome_network_vlan_module#ansible-collections-dellemc-openmanage-ome-network-vlan-module) – Create, modify & delete a VLAN
* [ome\_network\_vlan\_info](ome_network_vlan_info_module#ansible-collections-dellemc-openmanage-ome-network-vlan-info-module) – Retrieves the information about networks VLAN(s) present in OpenManage Enterprise
* [ome\_powerstate](ome_powerstate_module#ansible-collections-dellemc-openmanage-ome-powerstate-module) – Performs the power management operations on OpenManage Enterprise
* [ome\_profile](ome_profile_module#ansible-collections-dellemc-openmanage-ome-profile-module) – Create, modify, delete, assign, unassign and migrate a profile on OpenManage Enterprise
* [ome\_smart\_fabric](ome_smart_fabric_module#ansible-collections-dellemc-openmanage-ome-smart-fabric-module) – Create, modify or delete a fabric on OpenManage Enterprise Modular
* [ome\_smart\_fabric\_uplink](ome_smart_fabric_uplink_module#ansible-collections-dellemc-openmanage-ome-smart-fabric-uplink-module) – Create, modify or delete a uplink for a fabric on OpenManage Enterprise Modular
* [ome\_template](ome_template_module#ansible-collections-dellemc-openmanage-ome-template-module) – Create, modify, deploy, delete, export, import and clone a template on OpenManage Enterprise
* [ome\_template\_identity\_pool](ome_template_identity_pool_module#ansible-collections-dellemc-openmanage-ome-template-identity-pool-module) – Attach or detach an identity pool to a requested template on OpenManage Enterprise
* [ome\_template\_info](ome_template_info_module#ansible-collections-dellemc-openmanage-ome-template-info-module) – Retrieves template details from OpenManage Enterprise
* [ome\_template\_network\_vlan](ome_template_network_vlan_module#ansible-collections-dellemc-openmanage-ome-template-network-vlan-module) – Set tagged and untagged vlans to native network card supported by a template on OpenManage Enterprise
* [ome\_user](ome_user_module#ansible-collections-dellemc-openmanage-ome-user-module) – Create, modify or delete a user on OpenManage Enterprise
* [ome\_user\_info](ome_user_info_module#ansible-collections-dellemc-openmanage-ome-user-info-module) – Retrieves details of all accounts or a specific account on OpenManage Enterprise
* [redfish\_firmware](redfish_firmware_module#ansible-collections-dellemc-openmanage-redfish-firmware-module) – To perform a component firmware update using the image file available on the local or remote system
* [redfish\_powerstate](redfish_powerstate_module#ansible-collections-dellemc-openmanage-redfish-powerstate-module) – Manage device power state
* [redfish\_storage\_volume](redfish_storage_volume_module#ansible-collections-dellemc-openmanage-redfish-storage-volume-module) – Manages the storage volume configuration
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible dellemc.openmanage.dellemc_configure_idrac_services – Configures the iDRAC services related attributes dellemc.openmanage.dellemc\_configure\_idrac\_services – Configures the iDRAC services related attributes
=========================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.dellemc_configure_idrac_services`.
New in version 1.0.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to configure the iDRAC services related attributes.
Requirements
------------
The below requirements are needed on the host that executes this module.
* omsdk
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **alert\_port** integer | **Default:**162 | The iDRAC port number that must be used for SNMP traps. The default value is 162, and the acceptable range is between 1 to 65535. |
| **community\_name** string | | SNMP community name for iDRAC. It is used by iDRAC to validate SNMP queries received from remote systems requesting SNMP data access. |
| **discovery\_port** integer | **Default:**161 | The SNMP agent port on the iDRAC. The default value is 161, and the acceptable range is between 1 to 65535. |
| **enable\_web\_server** string | **Choices:*** Enabled
* Disabled
| Whether to Enable or Disable webserver configuration for iDRAC. |
| **http\_port** integer | | HTTP access port. |
| **https\_port** integer | | HTTPS access port. |
| **idrac\_ip** string / required | | iDRAC IP Address. |
| **idrac\_password** string / required | | iDRAC user password.
aliases: idrac\_pwd |
| **idrac\_port** integer | **Default:**443 | iDRAC port. |
| **idrac\_user** string / required | | iDRAC username. |
| **ipmi\_lan** dictionary | | Community name set on iDRAC for SNMP settings. |
| | **community\_name** string | | This option is used by iDRAC when it sends out SNMP and IPMI traps. The community name is checked by the remote system to which the traps are sent. |
| **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is mandatory for Network Share. |
| **share\_name** string / required | | Network share or a local path. |
| **share\_password** string | | Network share user password. This option is mandatory for CIFS Network Share.
aliases: share\_pwd |
| **share\_user** string | | Network share user in the format 'user@domain' or 'domain\user' if user is part of a domain else 'user'. This option is mandatory for CIFS Network Share. |
| **snmp\_enable** string | **Choices:*** Enabled
* Disabled
| Whether to Enable or Disable SNMP protocol for iDRAC. |
| **snmp\_protocol** string | **Choices:*** All
* SNMPv3
| Type of the SNMP protocol. |
| **ssl\_encryption** string | **Choices:*** Auto\_Negotiate
* T\_128\_Bit\_or\_higher
* T\_168\_Bit\_or\_higher
* T\_256\_Bit\_or\_higher
| Secure Socket Layer encryption for webserver. |
| **timeout** string | | Timeout value. |
| **tls\_protocol** string | **Choices:*** TLS\_1\_0\_and\_Higher
* TLS\_1\_1\_and\_Higher
* TLS\_1\_2\_Only
| Transport Layer Security for webserver. |
| **trap\_format** string | **Choices:*** SNMPv1
* SNMPv2
* SNMPv3
| SNMP trap format for iDRAC. |
Notes
-----
Note
* This module requires ‘Administrator’ privilege for *idrac\_user*.
* Run this module from a system that has direct access to Dell EMC iDRAC.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Configure the iDRAC services attributes
dellemc.openmanage.dellemc_configure_idrac_services:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
share_name: "192.168.0.1:/share"
share_mnt: "/mnt/share"
enable_web_server: "Enabled"
http_port: 80
https_port: 443
ssl_encryption: "Auto_Negotiate"
tls_protocol: "TLS_1_2_Only"
timeout: "1800"
snmp_enable: "Enabled"
snmp_protocol: "SNMPv3"
community_name: "public"
alert_port: 162
discovery_port: 161
trap_format: "SNMPv3"
ipmi_lan:
community_name: "public"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **msg** string | always | Overall status of iDRAC service attributes configuration. **Sample:** Successfully configured the iDRAC services settings. |
| **service\_status** dictionary | success | Details of iDRAC services attributes configuration. **Sample:** {'CompletionTime': '2020-04-02T02:43:28', 'Description': 'Job Instance', 'EndTime': None, 'Id': 'JID\_12345123456', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageArgs': [], 'MessageId': 'SYS053', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} |
### Authors
* Felix Stephen (@felixs88)
| programming_docs |
ansible dellemc.openmanage.ome_application_certificate – This module allows to generate a CSR and upload the certificate dellemc.openmanage.ome\_application\_certificate – This module allows to generate a CSR and upload the certificate
==================================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.ome_application_certificate`.
New in version 2.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows the generation a new certificate signing request (CSR) and to upload the certificate on OpenManage Enterprise.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **business\_name** string | | Name of the business that issued the certificate. This option is applicable for `generate_csr`. |
| **command** string | **Choices:*** **generate\_csr** ←
* upload
|
`generate_csr` allows the generation of a CSR and `upload` uploads the certificate. |
| **country** string | | Country in which the issuer resides. This option is applicable for `generate_csr`. |
| **country\_state** string | | State in which the issuer resides. This option is applicable for `generate_csr`. |
| **department\_name** string | | Name of the department that issued the certificate. This option is applicable for `generate_csr`. |
| **distinguished\_name** string | | Name of the certificate issuer. This option is applicable for `generate_csr`. |
| **email** string | | Email associated with the issuer. This option is applicable for `generate_csr`. |
| **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. |
| **locality** string | | Local address of the issuer of the certificate. This option is applicable for `generate_csr`. |
| **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. |
| **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. |
| **upload\_file** string | | Local path of the certificate file to be uploaded. This option is applicable for `upload`. Once the certificate is uploaded, OpenManage Enterprise cannot be accessed for a few seconds. |
| **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. |
Notes
-----
Note
* If a certificate is uploaded, which is identical to an already existing certificate, it is accepted by the module.
* This module does not support `check_mode`.
Examples
--------
```
---
- name: Generate a certificate signing request
dellemc.openmanage.ome_application_certificate:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "generate_csr"
distinguished_name: "hostname.com"
department_name: "Remote Access Group"
business_name: "Dell Inc."
locality: "Round Rock"
country_state: "Texas"
country: "US"
email: "[email protected]"
- name: Upload the certificate
dellemc.openmanage.ome_application_certificate:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "upload"
upload_file: "/path/certificate.cer"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **csr\_status** dictionary | on success | Details of the generated certificate. **Sample:** {'CertificateData': '-----BEGIN CERTIFICATE REQUEST-----GHFSUEKLELE af3u4h2rkdkfjasczjfefhkrr/frjrfrjfrxnvzklf/nbcvxmzvndlskmcvbmzkdk kafhaksksvklhfdjtrhhffgeth/tashdrfstkm@kdjFGD/sdlefrujjfvvsfeikdf yeufghdkatbavfdomehtdnske/tahndfavdtdfgeikjlagmdfbandfvfcrfgdtwxc qwgfrteyupojmnsbajdkdbfs/ujdfgthedsygtamnsuhakmanfuarweyuiwruefjr etwuwurefefgfgurkjkdmbvfmvfvfk==-----END CERTIFICATE REQUEST-----'} |
| **error\_info** dictionary | on HTTP error | Details of the HTTP error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to upload the certificate because the certificate file provided is invalid.', 'MessageArgs': [], 'MessageId': 'CSEC9002', 'RelatedProperties': [], 'Resolution': 'Make sure the CA certificate and private key are correct and retry the operation.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **msg** string | always | Overall status of the certificate signing request. **Sample:** Successfully generated certificate signing request. |
### Authors
* Felix Stephen (@felixs88)
ansible dellemc.openmanage.ome_application_network_time – Updates the network time on OpenManage Enterprise dellemc.openmanage.ome\_application\_network\_time – Updates the network time on OpenManage Enterprise
======================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.ome_application_network_time`.
New in version 2.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows the configuration of network time on OpenManage Enterprise.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **enable\_ntp** boolean / required | **Choices:*** no
* yes
| Enables or disables Network Time Protocol(NTP). If *enable\_ntp* is false, then the NTP addresses reset to their default values. |
| **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. |
| **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. |
| **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. |
| **primary\_ntp\_address** string | | The primary NTP address. This option is applicable when *enable\_ntp* is true. |
| **secondary\_ntp\_address1** string | | The first secondary NTP address. This option is applicable when *enable\_ntp* is true. |
| **secondary\_ntp\_address2** string | | The second secondary NTP address. This option is applicable when *enable\_ntp* is true. |
| **system\_time** string | | Time in the current system. This option is only applicable when *enable\_ntp* is false. This option must be provided in following format 'yyyy-mm-dd hh:mm:ss'. |
| **time\_zone** string | | The valid timezone ID to be used. This option is applicable for both system time and NTP time synchronization. |
| **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC OpenManage Enterprise.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Configure system time
dellemc.openmanage.ome_application_network_time:
hostname: "192.168.0.1"
username: "username"
password: "password"
enable_ntp: false
system_time: "2020-03-31 21:35:18"
time_zone: "TZ_ID_11"
- name: Configure NTP server for time synchronization
dellemc.openmanage.ome_application_network_time:
hostname: "192.168.0.1"
username: "username"
password: "password"
enable_ntp: true
time_zone: "TZ_ID_66"
primary_ntp_address: "192.168.0.2"
secondary_ntp_address1: "192.168.0.2"
secondary_ntp_address2: "192.168.0.4"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the request because the input value for SystemTime is missing or an invalid value is entered.', 'MessageArgs': ['SystemTime'], 'MessageId': 'CGEN6002', 'RelatedProperties': [], 'Resolution': 'Enter a valid value and retry the operation.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **msg** string | always | Overall status of the network time configuration change. **Sample:** Successfully configured network time. |
| **proxy\_configuration** dictionary | success | Updated application network time configuration. **Sample:** {'EnableNTP': False, 'JobId': None, 'PrimaryNTPAddress': None, 'SecondaryNTPAddress1': None, 'SecondaryNTPAddress2': None, 'SystemTime': None, 'TimeSource': 'Local Clock', 'TimeZone': 'TZ\_ID\_1', 'TimeZoneIdLinux': None, 'TimeZoneIdWindows': None, 'UtcTime': None} |
### Authors
* Sajna Shetty(@Sajna-Shetty)
ansible dellemc.openmanage.idrac_syslog – Enable or disable the syslog on iDRAC dellemc.openmanage.idrac\_syslog – Enable or disable the syslog on iDRAC
========================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.idrac_syslog`.
New in version 2.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to enable or disable the iDRAC syslog.
Requirements
------------
The below requirements are needed on the host that executes this module.
* omsdk
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **idrac\_ip** string / required | | iDRAC IP Address. |
| **idrac\_password** string / required | | iDRAC user password.
aliases: idrac\_pwd |
| **idrac\_port** integer | **Default:**443 | iDRAC port. |
| **idrac\_user** string / required | | iDRAC username. |
| **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is mandatory for network shares. |
| **share\_name** string / required | | Network share or a local path. |
| **share\_password** string | | Network share user password. This option is mandatory for CIFS share.
aliases: share\_pwd |
| **share\_user** string | | Network share user name. Use the format 'user@domain' or 'domain\\user' if user is part of a domain. This option is mandatory for CIFS share. |
| **syslog** string | **Choices:*** **Enabled** ←
* Disabled
| Enables or disables an iDRAC syslog. |
Notes
-----
Note
* This module requires ‘Administrator’ privilege for *idrac\_user*.
* Run this module from a system that has direct access to Dell EMC iDRAC.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Enable iDRAC syslog
dellemc.openmanage.idrac_syslog:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
share_name: "192.168.0.2:/share"
share_password: "share_user_pwd"
share_user: "share_user_name"
share_mnt: "/mnt/share"
syslog: "Enabled"
- name: Disable iDRAC syslog
dellemc.openmanage.idrac_syslog:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
share_name: "192.168.0.2:/share"
share_password: "share_user_pwd"
share_user: "share_user_name"
share_mnt: "/mnt/share"
syslog: "Disabled"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **msg** string | always | Overall status of the syslog export operation. **Sample:** Successfully fetch the syslogs. |
| **syslog\_status** dictionary | success | Job details of the syslog operation. **Sample:** {'@odata.context': '/redfish/v1/$metadata#DellJob.DellJob', '@odata.id': '/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID\_852940632485', '@odata.type': '#DellJob.v1\_0\_2.DellJob', 'CompletionTime': '2020-03-27T02:27:45', 'Description': 'Job Instance', 'EndTime': None, 'Id': 'JID\_852940632485', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'SYS053', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} |
### Authors
* Felix Stephen (@felixs88)
* Anooja Vardhineni (@anooja-vardhineni)
ansible dellemc.openmanage.ome_profile – Create, modify, delete, assign, unassign and migrate a profile on OpenManage Enterprise dellemc.openmanage.ome\_profile – Create, modify, delete, assign, unassign and migrate a profile on OpenManage Enterprise
=========================================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.ome_profile`.
New in version 3.1.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to create, modify, delete, assign, unassign, and migrate a profile on OpenManage Enterprise.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** dictionary | | Attributes for `modify` and `assign`. |
| | **Attributes** list / elements=dictionary | | List of attributes to be modified, when *command* is `modify`. List of attributes to be overridden when *command* is `assign`. |
| | **Options** dictionary | | Provides the different shut down options. This is applicable when *command* is `assign`. |
| | **Schedule** dictionary | | Schedule for profile deployment. This is applicable when *command* is `assign`. |
| **boot\_to\_network\_iso** dictionary | | Details of the Share iso. Applicable when *command* is `create`, `assign`, and `modify`. |
| | **boot\_to\_network** boolean / required | **Choices:*** no
* yes
| Enable or disable a network share. |
| | **iso\_path** string | | Specify the full ISO path including the share name. |
| | **iso\_timeout** integer | **Choices:*** 1
* 2
* 4
* 8
* 16
**Default:**4 | Set the number of hours that the network ISO file will remain mapped to the target device(s). |
| | **share\_ip** string | | IP address of the network share. |
| | **share\_password** string | | User password when *share\_type* is `CIFS`. |
| | **share\_type** string | **Choices:*** NFS
* CIFS
| Type of network share. |
| | **share\_user** string | | User name when *share\_type* is `CIFS`. |
| | **workgroup** string | | User workgroup when *share\_type* is `CIFS`. |
| **command** string | **Choices:*** **create** ←
* modify
* delete
* assign
* unassign
* migrate
|
`create` creates new profiles.
`modify` modifies an existing profile. Only *name*, *description*, *boot\_to\_network\_iso*, and *attributes* can be modified.
`delete` deletes an existing profile.
`assign` Deploys an existing profile on a target device and returns a task ID.
`unassign` unassigns a profile from a specified target and returns a task ID.
`migrate` migrates an existing profile and returns a task ID. |
| **description** string | | Description of the profile. |
| **device\_id** integer | | ID of the target device. This is applicable when *command* is `assign` and `migrate`. This option is mutually exclusive with *device\_service\_tag*. |
| **device\_service\_tag** string | | Identifier of the target device. This is typically 7 to 8 characters in length. Applicable when *command* is `assign`, and `migrate`. This option is mutually exclusive with *device\_id*. If the device does not exist when *command* is `assign` then the profile is auto-deployed. |
| **filters** dictionary | | Filters the profiles based on selected criteria. This is applicable when *command* is `delete` or `unassign`. This supports suboption *ProfileIds* which takes a list of profile IDs. This also supports OData filter expressions with the suboption *Filters*. See OpenManage Enterprise REST API guide for the filtering options available.
*WARNING* When this option is used in case of `unassign`, task ID is not returned for any of the profiles affected. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Provides the option to force the migration of a profile even if the source device cannot be contacted. This option is applicable when *command* is `migrate`. |
| **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. |
| **name** string | | Name of the profile. This is applicable for modify, delete, assign, unassign, and migrate operations. This option is mutually exclusive with *name\_prefix* and *number\_of\_profiles*. |
| **name\_prefix** string | **Default:**"Profile" | The name provided when creating a profile is used a prefix followed by the number assigned to it by OpenManage Enterprise. This is applicable only for a create operation. This option is mutually exclusive with *name*. |
| **new\_name** string | | New name of the profile. Applicable when *command* is `modify`. |
| **number\_of\_profiles** integer | **Default:**1 | Provide the number of profiles to be created. This is applicable when *name\_prefix* is used with `create`. This option is mutually exclusive with *name*. Openmanage Enterprise can create a maximum of 100 profiles. |
| **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. |
| **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. |
| **template\_id** integer | | ID of the template. This is applicable when *command* is `create`. This option is mutually exclusive with *template\_name*. |
| **template\_name** string | | Name of the template for creating the profile(s). This is applicable when *command* is `create`. This option is mutually exclusive with *template\_id*. |
| **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC OpenManage Enterprise.
* This module does not support `check_mode`.
* `assign` operation on a already assigned profile will not redeploy.
Examples
--------
```
---
- name: Create two profiles from a template
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
template_name: "template 1"
name_prefix: "omam_profile"
number_of_profiles: 2
- name: Create profile with NFS share
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: create
template_name: "template 1"
name_prefix: "omam_profile"
number_of_profiles: 1
boot_to_network_iso:
boot_to_network: True
share_type: NFS
share_ip: "192.168.0.1"
iso_path: "path/to/my_iso.iso"
iso_timeout: 8
- name: Create profile with CIFS share
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: create
template_name: "template 1"
name_prefix: "omam_profile"
number_of_profiles: 1
boot_to_network_iso:
boot_to_network: True
share_type: CIFS
share_ip: "192.168.0.2"
share_user: "username"
share_password: "password"
workgroup: "workgroup"
iso_path: "\\path\\to\\my_iso.iso"
iso_timeout: 8
- name: Modify profile name with NFS share and attributes
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: modify
name: "Profile 00001"
new_name: "modified profile"
description: "new description"
boot_to_network_iso:
boot_to_network: True
share_type: NFS
share_ip: "192.168.0.3"
iso_path: "path/to/my_iso.iso"
iso_timeout: 8
attributes:
Attributes:
- Id: 4506
Value: "server attr 1"
IsIgnored: true
- Id: 4507
Value: "server attr 2"
IsIgnored: true
- name: Delete a profile using profile name
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "delete"
name: "Profile 00001"
- name: Delete profiles using filters
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "delete"
filters:
SelectAll: True
Filters: =contains(ProfileName,'Profile 00002')
- name: Delete profiles using profile list filter
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "delete"
filters:
ProfileIds:
- 17123
- 16124
- name: Assign a profile to target along with network share
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: assign
name: "Profile 00001"
device_id: 12456
boot_to_network_iso:
boot_to_network: True
share_type: NFS
share_ip: "192.168.0.1"
iso_path: "path/to/my_iso.iso"
iso_timeout: 8
attributes:
Attributes:
- Id: 4506
Value: "server attr 1"
IsIgnored: true
Options:
ShutdownType: 0
TimeToWaitBeforeShutdown: 300
EndHostPowerState: 1
StrictCheckingVlan: True
Schedule:
RunNow: True
RunLater: False
- name: Unassign a profile using profile name
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "unassign"
name: "Profile 00003"
- name: Unassign profiles using filters
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "unassign"
filters:
SelectAll: True
Filters: =contains(ProfileName,'Profile 00003')
- name: Unassign profiles using profile list filter
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "unassign"
filters:
ProfileIds:
- 17123
- 16123
- name: Migrate a profile
dellemc.openmanage.ome_profile:
hostname: "192.168.0.1"
username: "username"
password: "password"
command: "migrate"
name: "Profile 00001"
device_id: 12456
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **job\_id** integer | when *command* is `assign`, `migrate` or `unassign` | Task ID created when *command* is `assign`, `migrate` or `unassign`.
`assign` and `unassign` operations do not trigger a task if a profile is auto-deployed. **Sample:** 14123 |
| **msg** string | always | Overall status of the profile operation. **Sample:** Successfully created 2 profile(s). |
| **profile\_ids** list / elements=string | when *command* is `create` | IDs of the profiles created. **Sample:** [1234, 5678] |
### Authors
* Jagadeesh N V (@jagadeeshnv)
| programming_docs |
ansible dellemc.openmanage.dellemc_idrac_lc_attributes – Enable or disable Collect System Inventory on Restart (CSIOR) property for all iDRAC/LC jobs dellemc.openmanage.dellemc\_idrac\_lc\_attributes – Enable or disable Collect System Inventory on Restart (CSIOR) property for all iDRAC/LC jobs
================================================================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.dellemc_idrac_lc_attributes`.
New in version 1.0.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module is responsible for enabling or disabling of Collect System Inventory on Restart (CSIOR) property for all iDRAC/LC jobs.
Requirements
------------
The below requirements are needed on the host that executes this module.
* omsdk
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **csior** string | **Choices:*** **Enabled** ←
* Disabled
| Whether to Enable or Disable Collect System Inventory on Restart (CSIOR) property for all iDRAC/LC jobs. |
| **idrac\_ip** string / required | | iDRAC IP Address. |
| **idrac\_password** string / required | | iDRAC user password.
aliases: idrac\_pwd |
| **idrac\_port** integer | **Default:**443 | iDRAC port. |
| **idrac\_user** string / required | | iDRAC username. |
| **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is mandatory for Network Share. |
| **share\_name** string / required | | Network share or a local path. |
| **share\_password** string | | Network share user password. This option is mandatory for CIFS Network Share.
aliases: share\_pwd |
| **share\_user** string | | Network share user in the format 'user@domain' or 'domain\user' if user is part of a domain else 'user'. This option is mandatory for CIFS Network Share. |
Notes
-----
Note
* This module requires ‘Administrator’ privilege for *idrac\_user*.
* Run this module from a system that has direct access to Dell EMC iDRAC.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Set up iDRAC LC Attributes
dellemc.openmanage.dellemc_idrac_lc_attributes:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
share_name: "192.168.0.1:/share"
share_mnt: "/mnt/share"
csior: "Enabled"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **lc\_attribute\_status** dictionary | success | Collect System Inventory on Restart (CSIOR) property for all iDRAC/LC jobs is configured. **Sample:** {'CompletionTime': '2020-03-30T00:06:53', 'Description': 'Job Instance', 'EndTime': None, 'Id': 'JID\_1234512345', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'SYS053', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} |
| **msg** string | always | Overall status of iDRAC LC attributes configuration. **Sample:** Successfully configured the iDRAC LC attributes. |
### Authors
* Felix Stephen (@felixs88)
ansible dellemc.openmanage.ome_user_info – Retrieves details of all accounts or a specific account on OpenManage Enterprise dellemc.openmanage.ome\_user\_info – Retrieves details of all accounts or a specific account on OpenManage Enterprise
=====================================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.ome_user_info`.
New in version 2.0.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module retrieves the list and basic details of all accounts or details of a specific account on OpenManage Enterprise.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **account\_id** integer | | Unique Id of the account. |
| **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. |
| **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. |
| **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. |
| **system\_query\_options** dictionary | | Options for filtering the output. |
| | **filter** string | | Filter records for the supported values. |
| **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. |
Notes
-----
Note
* Run this module from a system that has direct access to DellEMC OpenManage Enterprise.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Retrieve basic details of all accounts
dellemc.openmanage.ome_user_info:
hostname: "192.168.0.1"
username: "username"
password: "password"
- name: Retrieve details of a specific account identified by its account ID
dellemc.openmanage.ome_user_info:
hostname: "192.168.0.1"
username: "username"
password: "password"
account_id: 1
- name: Get filtered user info based on user name
dellemc.openmanage.ome_user_info:
hostname: "192.168.0.1"
username: "username"
password: "password"
system_query_options:
filter: "UserName eq 'test'"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | on error | Over all status of fetching user facts. **Sample:** Unable to retrieve the account details. |
| **user\_info** dictionary | success | Details of the user. **Sample:** {'192.168.0.1': {'Description': 'user name description', 'DirectoryServiceId': 0, 'Enabled': True, 'Id': '1814', 'IsBuiltin': True, 'Locked': False, 'Name': 'user\_name', 'Password': None, 'RoleId': '10', 'UserName': 'user\_name', 'UserTypeId': 1}} |
### Authors
* Jagadeesh N V(@jagadeeshnv)
ansible dellemc.openmanage.dellemc_configure_idrac_eventing – Configures the iDRAC eventing related attributes dellemc.openmanage.dellemc\_configure\_idrac\_eventing – Configures the iDRAC eventing related attributes
=========================================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.dellemc_configure_idrac_eventing`.
New in version 1.0.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to configure the iDRAC eventing related attributes.
Requirements
------------
The below requirements are needed on the host that executes this module.
* omsdk
* python >= 2.7.5
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **address** string | | Email address for SNMP Trap. |
| **alert\_number** integer | | Alert number for Email configuration. |
| **authentication** string | **Choices:*** Enabled
* Disabled
| Simple Mail Transfer Protocol Authentication. |
| **custom\_message** string | | Custom message for SNMP Trap reference. |
| **destination** string | | Destination for SNMP Trap. |
| **destination\_number** integer | | Destination number for SNMP Trap. |
| **email\_alert\_state** string | **Choices:*** Enabled
* Disabled
| Whether to Enable or Disable Email alert. |
| **enable\_alerts** string | **Choices:*** Enabled
* Disabled
| Whether to Enable or Disable iDRAC alerts. |
| **idrac\_ip** string / required | | iDRAC IP Address. |
| **idrac\_password** string / required | | iDRAC user password.
aliases: idrac\_pwd |
| **idrac\_port** integer | **Default:**443 | iDRAC port. |
| **idrac\_user** string / required | | iDRAC username. |
| **password** string | | Password for SMTP authentication. |
| **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is mandatory for Network Share. |
| **share\_name** string / required | | Network share or a local path. |
| **share\_password** string | | Network share user password. This option is mandatory for CIFS Network Share.
aliases: share\_pwd |
| **share\_user** string | | Network share user in the format 'user@domain' or 'domain\user' if user is part of a domain else 'user'. This option is mandatory for CIFS Network Share. |
| **smtp\_ip\_address** string | | SMTP IP address for communication. |
| **smtp\_port** string | | SMTP Port number for access. |
| **snmp\_trap\_state** string | **Choices:*** Enabled
* Disabled
| Whether to Enable or Disable SNMP alert. |
| **snmp\_v3\_username** string | | SNMP v3 username for SNMP Trap. |
| **username** string | | Username for SMTP authentication. |
Notes
-----
Note
* This module requires ‘Administrator’ privilege for *idrac\_user*.
* Run this module from a system that has direct access to Dell EMC iDRAC.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Configure the iDRAC eventing attributes
dellemc.openmanage.dellemc_configure_idrac_eventing:
idrac_ip: "192.168.0.1"
idrac_user: "user_name"
idrac_password: "user_password"
share_name: "192.168.0.1:/share"
share_password: "share_user"
share_user: "share_password"
share_mnt: "/mnt/share"
destination_number: "2"
destination: "1.1.1.1"
snmp_v3_username: "None"
snmp_trap_state: "Enabled"
email_alert_state: "Disabled"
alert_number: "1"
address: "[email protected]"
custom_message: "Custom Message"
enable_alerts: "Disabled"
authentication: "Enabled"
smtp_ip_address: "192.168.0.1"
smtp_port: "25"
username: "username"
password: "password"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **eventing\_status** dictionary | success | Configures the iDRAC eventing attributes. **Sample:** {'CompletionTime': '2020-04-02T02:43:28', 'Description': 'Job Instance', 'EndTime': None, 'Id': 'JID\_12345123456', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageArgs': [], 'MessageId': 'SYS053', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} |
| **msg** string | always | Successfully configured the iDRAC eventing settings. **Sample:** Successfully configured the iDRAC eventing settings. |
### Authors
* Felix Stephen (@felixs88)
ansible dellemc.openmanage.ome_chassis_slots – Rename sled slots on OpenManage Enterprise Modular dellemc.openmanage.ome\_chassis\_slots – Rename sled slots on OpenManage Enterprise Modular
===========================================================================================
Note
This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0).
You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`.
To install it, use: `ansible-galaxy collection install dellemc.openmanage`.
To use it in a playbook, specify: `dellemc.openmanage.ome_chassis_slots`.
New in version 3.6.0: of dellemc.openmanage
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows to rename sled slots on OpenManage Enterprise Modular either using device id or device service tag or using chassis service tag and slot number.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7.17
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **device\_options** list / elements=dictionary | | The ID or service tag of the sled in the slot and the new name for the slot.
*device\_options* is mutually exclusive with *slot\_options*. |
| | **device\_id** integer | | Device ID of the sled in the slot. This is mutually exclusive with *device\_service\_tag*. |
| | **device\_service\_tag** string | | Service tag of the sled in the slot. This is mutually exclusive with *device\_id*. |
| | **slot\_name** string / required | | Provide name for the slot. |
| **hostname** string / required | | OpenManage Enterprise Modular IP address or hostname. |
| **password** string / required | | OpenManage Enterprise Modular password. |
| **port** integer | **Default:**443 | OpenManage Enterprise Modular HTTPS port. |
| **slot\_options** list / elements=dictionary | | The service tag of the chassis, slot number of the slot to be renamed, and the new name for the slot.
*slot\_options* is mutually exclusive with *device\_options*. |
| | **chassis\_service\_tag** string / required | | Service tag of the chassis. |
| | **slots** list / elements=dictionary / required | | The slot number and the new name for the slot. |
| | | **slot\_name** string / required | | Provide name for the slot. |
| | | **slot\_number** integer / required | | The slot number of the slot to be renamed. |
| **username** string / required | | OpenManage Enterprise Modular username. |
Notes
-----
Note
* This module initiates the refresh inventory task. It may take a minute for new names to be reflected. If the task exceeds 300 seconds to refresh, the task times out.
* Run this module from a system that has direct access to Dell EMC OpenManage Enterprise Modular.
* This module supports `check_mode`.
Examples
--------
```
---
- name: Rename the slots in multiple chassis using slot number and chassis service tag
ome_chassis_slots:
hostname: "192.168.0.1"
username: "username"
password: "password"
slot_options:
- chassis_service_tag: ABC1234
slots:
- slot_number: 1
slot_name: sled_name_1
- slot_number: 2
slot_name: sled_name_2
- chassis_service_tag: ABC1235
slots:
- slot_number: 1
slot_name: sled_name_1
- slot_number: 2
slot_name: sled_name_2
- name: Rename single slot name of the sled using sled ID
dellemc.openmanage.ome_chassis_slots:
hostname: "192.168.0.1"
username: "username"
password: "password"
device_options:
- device_id: 10054
slot_name: slot_device_name_1
- name: Rename single slot name of the sled using sled service tag
dellemc.openmanage.ome_chassis_slots:
hostname: "192.168.0.1"
username: "username"
password: "password"
device_options:
- device_service_tag: ABC1234
slot_name: service_tag_slot
- name: Rename multiple slot names of the devices
dellemc.openmanage.ome_chassis_slots:
hostname: "192.168.0.1"
username: "username"
password: "password"
device_options:
- device_id: 10054
slot_name: sled_name_1
- device_service_tag: ABC1234
slot_name: sled_name_2
- device_id: 10055
slot_name: sled_name_3
- device_service_tag: PQR1234
slot_name: sled_name_4
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the operation because an invalid value is entered for the property Invalid json type: STRING for Edm.Int64 property: Id .', 'MessageArgs': ['Invalid json type: STRING for Edm.Int64 property: Id'], 'MessageId': 'CGEN1014', 'RelatedProperties': [], 'Resolution': "Enter a valid value for the property and retry the operation. For more information about valid values, see the OpenManage Enterprise-Modular User's Guide available on the support site.", 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} |
| **msg** string | always | Overall status of the slot rename operation. **Sample:** Successfully renamed the slot(s). |
| **rename\_failed\_slots** list / elements=dictionary | if at least one slot renaming fails | Information of the valid slots that are not renamed.
`JobStatus` is shown if rename job fails.
`NOTE` Only slots which were not renamed are listed. **Sample:** [{'ChassisId': '12345', 'ChassisName': 'MX-ABCD123', 'ChassisServiceTag': 'ABCD123', 'DeviceType': '4000', 'JobId': 1234, 'JobStatus': 'Aborted', 'SlotId': '10061', 'SlotName': 'c2', 'SlotNumber': '1', 'SlotType': '4000'}, {'ChassisId': '10053', 'ChassisName': 'MX-PQRS123', 'ChassisServiceTag': 'PQRS123', 'DeviceType': '1000', 'JobId': 0, 'JobStatus': 'HTTP Error 400: Bad Request', 'SlotId': '10069', 'SlotName': 'b2', 'SlotNumber': '3', 'SlotType': '2000'}] |
| **slot\_info** list / elements=dictionary | if at least one slot renamed | Information of the slots that are renamed successfully. The `DeviceServiceTag` and `DeviceId` options are available only if *device\_options* is used.
`NOTE` Only the slots which were renamed are listed. **Sample:** [{'ChassisId': 10053, 'ChassisServiceTag': 'ABCD123', 'DeviceName': '', 'DeviceType': 1000, 'JobId': 15746, 'SlotId': '10072', 'SlotName': 'slot\_op2', 'SlotNumber': '6', 'SlotType': 2000}, {'ChassisId': 10053, 'ChassisName': 'MX-ABCD123', 'ChassisServiceTag': 'ABCD123', 'DeviceType': '3000', 'JobId': 15747, 'SlotId': '10070', 'SlotName': 'slot\_op2', 'SlotNumber': '4', 'SlotType': '2000'}, {'ChassisId': '10053', 'ChassisName': 'MX-PQRS123', 'ChassisServiceTag': 'PQRS123', 'DeviceId': '10054', 'DeviceServiceTag': 'XYZ5678', 'DeviceType': '1000', 'JobId': 15761, 'SlotId': '10067', 'SlotName': 'a1', 'SlotNumber': '1', 'SlotType': '2000'}] |
### Authors
* Jagadeesh N V(@jagadeeshnv)
| programming_docs |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.