git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/distrib.yml
blob: a8fb3ef7830a6db9d375c08e62d5ee8334b3cac2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
- 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"