--- /dev/null
+# Updates apt cache.
+#
+# ansible-vault --vault-password-file=vault.txt create sudopass
+# ansible-playbook aptsudo.yml -vvvvv --vault-password-file=vault.txt
+#
+---
+- hosts: localhost
+ vars_files:
+ - sudopass
+
+ tasks:
+ - name: apt update cache
+ become: yes
+ become_user: root
+ become_method: sudo
+ apt:
+ update_cache: yes
--- /dev/null
+$ANSIBLE_VAULT;1.1;AES256
+31366363623239353561623031653563343536636263396362386461616262313539643930666636
+6631613661306463356434663765313033643439373361300a373431363062643838356261343936
+34343263663933656635393735343265303832343964376336323965623637323433316265363065
+3436363864333265340a316335326463376332316531376635333837353532663632386534323730
+31346462376365303232363836343965646561663934323935376265633937383339626662303931
+3737653631633338386162623766323062393363376538336365
--- /dev/null
+mysillypassword
--- /dev/null
+# Returns files in $HOME and fills result in fileoutput
+#
+# ansible-vault --vault-password-file=vault.txt create sudopass
+# ansible-playbook aptsudo.yml -vvvvv --vault-password-file=vault.txt -e 'filename=fileoutput'
+#
+---
+- hosts: localhost
+ vars_files:
+ - sudopass
+
+ tasks:
+ - name: List files in directory
+ become: yes
+ become_user: root
+ become_method: sudo -i
+ find:
+ paths: "{{ ansible_env.HOME }}"
+ register: result
+ - name: Fill file
+ shell: echo "{{ item.path }}" >> "{{ filename }}"
+ with_items: "{{ result.files }}"
+
--- /dev/null
+$ANSIBLE_VAULT;1.1;AES256
+31366363623239353561623031653563343536636263396362386461616262313539643930666636
+6631613661306463356434663765313033643439373361300a373431363062643838356261343936
+34343263663933656635393735343265303832343964376336323965623637323433316265363065
+3436363864333265340a316335326463376332316531376635333837353532663632386534323730
+31346462376365303232363836343965646561663934323935376265633937383339626662303931
+3737653631633338386162623766323062393363376538336365
--- /dev/null
+mysillypassword