From: Gustavo Martin Morcuende Date: Mon, 30 Jan 2017 22:13:52 +0000 (+0100) Subject: Ansible scripts. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=cd366b3d3f67c43fb3bef86ad2f26a4faa5af154;p=CForFun.git Ansible scripts. --- diff --git a/ansible/loopfiles.yml b/ansible/loopfiles.yml new file mode 100644 index 0000000..1bf923a --- /dev/null +++ b/ansible/loopfiles.yml @@ -0,0 +1,15 @@ +# Returns files in $HOME and fills result in fileoutput +# +# ansible-playbook loopfiles.yml -e 'filename=fileoutput' +# +--- +- hosts: localhost + connection: local + tasks: + - name: List files in directory + find: + paths: "{{ ansible_env.HOME }}" + register: result + - name: Fill file + shell: echo "{{ item.path }}" >> "{{ filename }}" + with_items: "{{ result.files }}"