You need to add a "marker" in order NOT to overwrite current content. For example usage, see github.com/promet/pstools.git and head over to promet-ansible branch & ansible-promet-apacheconfig/tasks/main.yml Syntax guide https://docs.ansible.com/ansible/latest/modules/blockinfile_module.html Some tutorial …
Read More1ansible all -m setup -a "filter=ansible_distribution*" more in https://raymii.org/s/tutorials/Ansible_-_Only_if_on_specific_distribution_or_distribution_version.html
Read More1- name: Move foo to bar 2command: mv /path/to/foo /path/to/bar or check first and do a copy if it exist 1- name: stat foo 2stat: path=/path/to/foo 3register: foo_stat 45- name: Move foo to bar 6command: mv /path/to/foo /path/to/bar 7when: foo_stat.stat.exists and, for ansible 2.0+, you can do: 1- name: Copy files from …
Read More1--- 2- hosts: localhost 3become: true 45tasks: 6- name: Create directory 7file: 8path: /tmp/yallo_dir 9state: directory Ref http://docs.ansible.com/ansible/latest/file_module.html
Read More1--- 2- hosts: localhost 3become: true 45tasks: 6- name: Create file 7file: 8path: /tmp/yallo 9state: touch Ref http://docs.ansible.com/ansible/latest/file_module.html An alternative is to use 'lineinfile' module. In my example below, Ubuntu 18.x no longer has the /etc/rc.local but it still works. See below 1## NOTE : …
Read More12[dev_server] 3... 4... 5... 67[devtools_internal] 8... 9... 10... 1112[dev_needed:children] 13dev_server 14devtools_internal
Read More