Ansible - Template module


The template module is an Action Plugin module.



  • constructs a file in a temporary location on the controller using variables from the playbook environment or from the user
  • transfers the temporary file to a temporary file on the remote system
  • invokes the copy module which operates on the remote system to move the file into its final location, sets file permissions, and so on.


Template action

  - name: " User - Create the conf variable file"
    become: yes
    become_user: '{{ user_login_user }}'
      src: './user/user/'
      dest: '/home/{{ user_login_user }}/{{ user_login_user }}'
      owner: '{{ user_login_user }}'
      group: '{{ user_login_user }}'
      mode: 0770
    when: "'dev' in group_names or 'tst' in group_names" # only for the dev/test environment

Template language

{% if not registry_enabled %}
    enabled = no
{% elif registry_enabled %}
    enabled = yes
{% endif %}

Powered by ComboStrap