--- - hosts: all become: true tasks: # write hello world to a file in the home directory - name: write hello copy: content: "hello ansible from ansible-manager!" dest: /home/vagrant/hello2.txt mode: 0644 become: true - name: Echo hello shell: echo 'hello ansible!' args: chdir: $HOME # Echo the contents of the hello.txt file - name: Echo hello shell: cat /home/vagrant/hello.txt args: chdir: $HOME # Echo the contents of the hello2.txt file - name: Echo hello2 shell: cat /home/vagrant/hello2.txt args: chdir: $HOME # - name: Initialize the cluster # shell: docker swarm init --advertise-addr 192.168.56.10 >> cluster_initialized.txt # args: # chdir: $HOME # creates: cluster_initialized.txt