netapp_eseries / netapp_eseries.host / 1.3.1 / module / update_conf Update configuration file Authors: Nathan Swartz (@ndswartz)netapp_eseries.host.update_conf (1.3.1) — module
Install with ansible-galaxy collection install netapp_eseries.host:==1.3.1
collections: - name: netapp_eseries.host version: 1.3.1
Update an existing configuration file with specified options.
- name: Update iscsid.conf. netapp_eseries.host.update_conf: path: /etc/iscsi/iscsid.conf options: node.session.timeo.replacement_timeout: 20 node.session.queue_depth: 128 node.session.nr_sessions: 2 become: true
src: description: - Path to the source configuration file. - Use I(path) if I(src) and I(dest) are the same. - I(src) is mutually exclusive with I(path) required: false type: str dest: description: - Destination path for the updated configuration file. - I(dest) is mutually exclusive with I(path) required: false type: str mode: description: - The permissions the destination and backup configuration files should have. - The permissions must be in octal number form ("0644", "644"). Be sure to place these in quotes to avoid unintended integer conversion. - When not specified, the file permissions will be determined by the operating system defaults. required: false type: str path: description: - Path to configuration file to be updated. - Hidden backup of the original configuration file will be made when I(backup_original==True) - I(path) is mutually exclusive with I(src) and I(dest). required: false type: str insert: choices: - beginning - end - before - after - skip default: end description: - Where to insert options that were not found in the source configuration file. - I(insert=="before") and I(insert=="after") requires I(insert_pattern) to be defined. - If I(insert=="skip") then any options that were not found in the source configuration file will not be added. - A warning will be issued for options that are not found in the source configuration file. type: str options: default: {} description: - Dictionary containing the options to be update in the destination configuration file. - Any options that are not found in the source configuration file will be added with a warning. required: false type: dict padding: choices: - left - right - both - none default: none description: - Where padding should be added around the I(equivalence_character) for any option not found in the source configuration file. - A space will be added to the left of the I(equivalence_character) when I(padding=='left') - A space will be added to the right of the I(equivalence_character) when I(padding=='right') - A space will be added to both sides of the I(equivalence_character) when I(padding=='both') required: false type: str pattern: default: ()([A-Za-z0-9._-]+)()(.*) description: - Regular expression pattern to capture and update configuration file options. - Must return four regular expression groups in the order comment, option, equivalence, and then value. - The equivalence group can be left empty to be generated based on I(equivalence_character). - The comment group can be left empty to be generated based on I(comment_character). required: false type: str backup_path: description: - Path where the backup configuration file should be placed. - When I(backup_path) is specified then the original configuration file, I(path), will be used as part of the name to avoid conflicts with slashes replaced with underscores. - This is useful when all configuration files are read within the directory resulting in duplicate configuration files. required: false type: str block_message: default: ANSIBLE NETAPP_ESERIES.HOST.UPDATE_CONF MANAGED BLOCK description: - Message inserted between the begin and end comment lines surrounding options that were not found in the source configuration file. required: false type: str insert_pattern: description: - String or regular expression that is used to determine the line to insert before or after. - If the pattern fails to locate a line matching the expression I(insert_pattern) in the configuration file then any options not found will be placed at the end of the file. required: false type: str backup_original: default: true description: - Whether to create a backup of the original configuration file when I(path) is provided. - When I(backup_original==False) and I(path) is specified then there will be no source for the original configuration defaults; so when an option is removed from I(options), it will remain unchanged. - No backup will be made when I(src) is provided. required: false type: bool backup_extension: default: .~ansible-original description: String that will be postpended to the I(path) file name. required: false type: str timestamp_backup: default: false description: - Create a timestamped backup of the file when changes are made in case it is needed later. - Do not conflate this option with M(backup_original) that will be overridden when new changes are made. required: false type: str comment_character: default: '#' description: Character that is used to indicate a line should be skipped or ignored. required: false type: str equivalence_character: default: '=' description: The equivalence character used in the configuration file. required: false type: str insert_block_comments: default: true description: - Whether to add begin and end comment lines around options added that were not found in the source configuration file. - True is recommended when I(path) is defined and I(backup_original==False) to delineate between options that existed in the original I(path) file. required: false type: bool
backup: description: The original configuration file's backup that is used to maintain the original configuration. returned: on success sample: /etc/iscsi/.iscsid.conf.~original type: str destination: description: Destination of the configuration file. returned: on success sample: /etc/iscsi/iscsid.conf type: str msg: description: Message describing what was changed. returned: on success sample: Configuration file changed. type: str source: description: Source of the configuration file. returned: on success sample: /etc/iscsi/iscsid.conf type: str timestamp_backup: description: Whether a timestamp backup was created of the source configuration file. returned: on success sample: true type: bool