ref: d4e6240f0f0bebb9bff5cec37d1c8706a23615c1 cisco/deploy/lxd/install.yml -rw-r--r-- 3.4 KiB View raw
                                                                                
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
117
118
119
120
121
122
123
124
125
126
127
- name: LXD Installation
  hosts: "*intel*"
  environment:
    GOPATH: "/usr/local/src/"
  tasks:
  - name: Install dependencies
    apt:
      name:
        - acl
        - autoconf
        - dnsmasq-base
        - git
        - libacl1-dev
        - libcap-dev
        - liblxc1
        - lxc-dev
        - libtool
        - libuv1-dev
        - make
        - pkg-config
        - rsync
        - squashfs-tools 
        - tar
        - tcl
        - xz-utils
        - ebtables
      state: present

  - name: Get latest golang
    get_url:
      url: https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
      dest: /tmp

  - name: Unarchive golang
    unarchive:
      src: /tmp/go1.12.5.linux-amd64.tar.gz
      dest: /usr/local
      remote_src: yes

  - name: Create symbolic link
    file:
      src: /usr/local/go/bin/go
      dest: /usr/bin/go
      state: link

  - name: Cleanup previous installs
    file:
      path: "{{ item }}"
      state: absent
    with_items:
      - /usr/local/src/src
      - /usr/local/src/deps

  - name: Get LXD
    shell: go get -d -v github.com/lxc/lxd/lxd

  - name: Get dependencies of LXD
    shell: make deps
    args:
      chdir: /usr/local/src/src/github.com/lxc/lxd

  - name: Make LXD
    shell: git pull && make
    args:
      chdir: /usr/local/src/src/github.com/lxc/lxd
    environment:
      CGO_CFLAGS: "-I/usr/local/src/deps/sqlite/ -I/usr/local/src/deps/dqlite/include/ -I/usr/local/src/deps/raft/include/ -I/usr/local/src/deps/libco/"
      CGO_LDFLAGS: "-L/usr/local/src/deps/sqlite/.libs/ -L/usr/local/src/deps/dqlite/.libs/ -L/usr/local/src/deps/raft/.libs -L/usr/local/src/deps/libco/"
      LD_LIBRARY_PATH: "/usr/local/src/deps/sqlite/.libs/:/usr/local/src/deps/dqlite/.libs/:/usr/local/src/deps/raft/.libs:/usr/local/src/deps/libco/"

  - name: Create symlinks
    file:
      src: "{{ item.src }}"
      dest: "{{ item.dest }}"
      state: link
    with_items:
      - src: /usr/local/src/bin/lxd
        dest: /usr/bin/lxd
      - src: /usr/local/src/bin/lxc
        dest: /usr/bin/lxc
      - src: /usr/local/src/deps/libco/libco.so.0.1.0
        dest: /usr/lib/libco.so
      - src: /usr/local/src/deps/raft/.libs/libraft.so
        dest: /usr/lib/libraft.so.0
      - src: /usr/local/src/deps/dqlite/.libs/libdqlite.so
        dest: /usr/lib/libdqlite.so.0
      - src: /usr/local/src/deps/sqlite/.libs/libsqlite3.so
        dest: /usr/lib/libsqlite3.so.0

  - name: Remove system sqlite
    file:
      path: "{{ item }}"
      state: absent
    with_items:
      - /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
      - /usr/lib/x86_64-linux-gnu/libsqlite3.so.0

  - name: Install system service
    copy:
      src: lxd.service
      dest: /etc/systemd/system/

  - name: Enable system service
    systemd:
      name: lxd
      state: restarted
      daemon_reload: yes

   - name: Get artifacts
     fetch:
       src: "{{ item.src }}"
       dest: "intel/{{ item.dest }}"
       flat: yes
     with_items:
       - src: /usr/local/src/bin/lxd
         dest: lxd
       - src: /usr/local/src/bin/lxc
         dest: lxc
       - src: /usr/local/src/deps/libco/libco.so.0.1.0
         dest: libco.so.0.1.0
       - src: /usr/local/src/deps/raft/.libs/libraft.so
         dest: libraft.so
       - src: /usr/local/src/deps/dqlite/.libs/libdqlite.so
         dest: libdqlite.so
       - src: /usr/local/src/deps/sqlite/.libs/libsqlite3.so
         dest: libsqlite3.so