--- - hosts: "localhost" connection: "local" gather_facts: false vars: ansible_python_interpreter: "auto_silent" tasks: - setup: gather_subset: - '!all' - '!min' - 'platform' - name: "Check that DFDISTRIB is not empty" assert: that: - "lookup('env', 'DFDISTRIB') is defined and lookup('env', 'DFDISTRIB') != ''" fail_msg: - "Please set the environment variable DFDISTRIB to an existing inventory entry" - "where you wish to place the dotfiles" - name: "Create dotfiles.tar.xz" delegate_to: "localhost" connection: "local" archive: path: - ".bash_profile" - ".bashrc" - ".flake8" - ".gitconfig" - ".perlcriticrc" - ".profile" - ".pylintrc" - ".tmux.conf" - ".tmux.conf.local" - ".vimrc" - ".bash/aliases.bash" - ".bash/aliases.bash.local" - ".bash/exec.bash" - ".bash/exec.bash.local" - ".bash/postexec.bash" - ".bash/postexec.bash.local" - ".bash/prompt.bash" - ".bash/prompt.bash.local" - ".bash/vars.bash" - ".bash/vars.bash.local" - "bin/ssh-agent-launcher" - "bin/ssh-with-gpg" - ".gnupgdirmngr.conf" - ".gnupggpg-agent.conf" - ".gnupggpg.conf" - "tmux-gpakosz/.gitignore" - "tmux-gpakosz/LICENSE.MIT" - "tmux-gpakosz/LICENSE.WTFPLv2" - "tmux-gpakosz/README.md" - "tmux-gpakosz/.tmux.conf" - "tmux-gpakosz/.tmux.conf.local" - "tmux-yank/CHANGELOG.md" - "tmux-yank/citest" - "tmux-yank/_config.yml" - "tmux-yank/.editorconfig" - "tmux-yank/.gitignore" - "tmux-yank/LICENSE.md" - "tmux-yank/README.md" - "tmux-yank/scripts" - "tmux-yank/.travis.yml" - "tmux-yank/Vagrantfile" - "tmux-yank/vagrant_provisioning.sh" - "tmux-yank/video" - "tmux-yank/yank.tmux" format: "xz" dest: "~/dotfiles.tar.xz" - hosts: "{{ lookup('env', 'DFDISTRIB') }}" gather_facts: false vars: ansible_python_interpreter: "auto_silent" tasks: - block: - name: "Copy dotfiles.tar.xz to remote" copy: src: "~/dotfiles.tar.xz" dest: "~/dotfiles.tar.xz" mode: "0640" tags: - "remote" - "all" - name: "Unpack dotfiles.tar.xz" unarchive: dest: "~/" src: "~/dotfiles.tar.xz" remote_src: "yes" list_files: "yes" tags: - "unpack" - "all" - name: "Remove tarball on remote" file: path: "~/dotfiles.tar.xz" state: "absent" tags: - "removal" - "all" when: inventory_hostname != hostvars['localhost']['ansible_fqdn'] and inventory_hostname != hostvars['localhost']['ansible_hostname'] and inventory_hostname != hostvars['localhost']['ansible_hostname'] | lower - hosts: "localhost" connection: "local" gather_facts: false vars: ansible_python_interpreter: "auto_silent" tasks: - name: "Remove source tarball" file: path: "~/dotfiles.tar.xz" state: "absent" tags: - "removal" - "all"