Example on adding a few common files to host with ansible

– hosts: all
vars:
user: maca
tasks:
– template:
src: ./templates/settings.xml
dest: /home/{{user}}/.m2/settings.xml
owner: “{{user}}”
group: “{{user}}”
mode: 0644

– template:
src: ./templates/.bash_aliases
dest: /home/{{user}}/.bash_aliases
owner: “{{user}}”
group: “{{user}}”
mode: 0644

– template:
src: ./templates/client.ovpn
dest: /etc/openvpn/client.opvn
owner: “{{user}}”
group: “{{user}}”
mode: 0644

– template:
src: ./templates/hosts
dest: /etc/hosts
owner: “{{user}}”
group: “{{user}}”
mode: 0644

– name: autoremove unused packages
apt:
autoremove: true

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.