Class: Ansible::Ruby::Modules::Template
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Template
- Includes:
- Helpers::FileAttributes
- Defined in:
- lib/ansible/ruby/modules/generated/files/template.rb,
lib/ansible/ruby/modules/custom/files/template.rb
Overview
Templates are processed by the Jinja2 templating language (U(jinja.pocoo.org/docs/)) - documentation on the template formatting can be found in the Template Designer Documentation (U(jinja.pocoo.org/docs/templates/)). Six additional variables can be used in templates: C(ansible_managed) (configurable via the C(defaults) section of C(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. C(template_host) contains the node name of the template’s machine. C(template_uid) is the numeric user id of the owner. C(template_path) is the path of the template. C(template_fullpath) is the absolute path of the template. C(template_run_date) is the date that the template was rendered.
Instance Method Summary collapse
-
#backup ⇒ :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?
The string marking the end of a block.
-
#block_start_string ⇒ String?
The string marking the beginning of a block.
-
#dest ⇒ String
Location to render the template to on the remote machine.
-
#follow ⇒ :yes, ...
This flag indicates that filesystem links in the destination, if they exist, should be followed.,Previous to Ansible 2.4, this was hardcoded as C(yes).
-
#force ⇒ :yes, ...
The default is C(yes), which will replace the remote file when contents are different than the source.
-
#lstrip_blocks ⇒ :yes, ...
If this is set to True leading spaces and tabs are stripped from the start of a line to a block.
-
#mode ⇒ Integer, ...
Mode the file or directory should be.
-
#newline_sequence ⇒ :"\\n", ...
Specify the newline sequence to use for templating files.
-
#output_encoding ⇒ String?
Overrides the encoding used to write the template file defined by C(dest).,It defaults to C(‘utf-8’), but any encoding supported by python can be used.,The source template file must always be encoded using C(‘utf-8’), for homogeneity.
-
#src ⇒ String
Path of a Jinja2 formatted template on the Ansible controller.
-
#trim_blocks ⇒ :yes, ...
If this is set to True the first newline after a block is removed (block, not variable tag!).
-
#variable_end_string ⇒ String?
The string marking the end of a print statement.
-
#variable_start_string ⇒ String?
The string marking the beginning of a print statement.
Methods included from Helpers::FileAttributes
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, fix_inclusion, #initialize, remove_existing_validations, #to_h, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#backup ⇒ :yes, ...
21 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 21 attribute :backup |
#block_end_string ⇒ String?
33 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 33 attribute :block_end_string |
#block_start_string ⇒ String?
29 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 29 attribute :block_start_string |
#dest ⇒ String
17 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 17 attribute :dest |
#follow ⇒ :yes, ...
57 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 57 attribute :follow |
#force ⇒ :yes, ...
53 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 53 attribute :force |
#lstrip_blocks ⇒ :yes, ...
49 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 49 attribute :lstrip_blocks |
#mode ⇒ Integer, ...
61 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 61 attribute :mode |
#newline_sequence ⇒ :"\\n", ...
25 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 25 attribute :newline_sequence |
#output_encoding ⇒ String?
65 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 65 attribute :output_encoding |
#src ⇒ String
13 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 13 attribute :src |
#trim_blocks ⇒ :yes, ...
45 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 45 attribute :trim_blocks |
#variable_end_string ⇒ String?
41 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 41 attribute :variable_end_string |
#variable_start_string ⇒ String?
37 |
# File 'lib/ansible/ruby/modules/generated/files/template.rb', line 37 attribute :variable_start_string |