bd31e7c59f1fa7ff92ac8c3c1c2f874ba1fe832b — Louis Solofrizzo 20 days ago d4e6240
deploy: Update deployment playbooks with node-exporter and ipmi

Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>
M .gitignore => .gitignore +2 -0
@@ 1,2 1,4 @@ build/
  sdk/version.go
+ deploy/lxd/intel
+ deploy/lxd/arm

M deploy/conf/bashrc => deploy/conf/bashrc +1 -1
@@ 1,5 1,5 @@ # Prompt
- export PS1="\[\e[90m\][ \[\e[94m\]{{ product_name }}\[\e[90m\] ] [ \[\e[92m\]\u\[\e[90m\] ] [ \[\e[93m\]\h\[\e[90m\] ] (\[\e[37m\]\W\[\e[90m\]) \[\e[0m\]\$> "
+ export PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "
  
  # Aliases
  alias l='ls --color'

M deploy/conf/motd => deploy/conf/motd +1 -2
@@ 5,8 5,7 @@ | |  _|_____| (__| \__ \ (_| (_) |
  |_|_|        \___|_|___/\___\___/
  
- Host     : {{ ansible_ssh_host }}
- Physical : {{ physical_node_name.stdout }}
+ Host     : {{ hostname }}
  IP       : {{ net.adm.ipv4 }}
  Arch     : {{ vars['ansible_architecture'] }}
  Distro   : {{ vars['ansible_distribution'] }}

A deploy/ipmi/ipmi.yml => deploy/ipmi/ipmi.yml +25 -0
@@ 0,0 1,25 @@
+ - name: IPMI configuration
+   hosts: all
+   tasks:
+   - name: Install ipmitool
+     apt:
+       name: ipmitool
+ 
+   - name: Enable ipmi over lan
+     shell: ipmitool lan set 1 access on
+ 
+   - name: Set root user
+     shell: ipmitool user set name 2 root
+     when: '"ipmi" in net and "ipv4" in net["ipmi"]'
+ 
+   - name: Set root password
+     shell: ipmitool user set password 2 ''
+     when: '"ipmi" in net and "ipv4" in net["ipmi"]'
+ 
+   - name: Enable admin rights for root
+     shell: ipmitool channel setaccess 1 2 link=on ipmi=on callin=on privilege=4
+     when: '"ipmi" in net and "ipv4" in net["ipmi"]'
+ 
+   - name: Enable the user
+     shell: ipmitool user enable 2
+     when: '"ipmi" in net and "ipv4" in net["ipmi"]'

M deploy/lxd/fast-install.yml => deploy/lxd/fast-install.yml +0 -2
@@ 38,5 38,3 @@ name: lxd
        state: restarted
        daemon_reload: yes
- 
- 

M deploy/lxd/install-arm.yml => deploy/lxd/install-arm.yml +10 -58
@@ 69,69 69,21 @@ 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:
+   - name: Get artifacts
+     fetch:
        src: "{{ item.src }}"
-       dest: "{{ item.dest }}"
-       state: link
+       dest: "arm/{{ item.dest }}"
+       flat: yes
      with_items:
        - src: /usr/local/src/bin/lxd
-         dest: /usr/bin/lxd
+         dest: lxd
        - src: /usr/local/src/bin/lxc
-         dest: /usr/bin/lxc
+         dest: lxc
        - src: /usr/local/src/deps/libco/libco.so.0.1.0
-         dest: /usr/lib/libco.so
+         dest: libco.so.0.1.0
        - src: /usr/local/src/deps/raft/.libs/libraft.so
-         dest: /usr/lib/libraft.so.0
+         dest: libraft.so
        - src: /usr/local/src/deps/dqlite/.libs/libdqlite.so
-         dest: /usr/lib/libdqlite.so.0
+         dest: libdqlite.so
        - 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/arm-linux-gnueabihf/libsqlite3.so.0.8.6
-       - /usr/lib/arm-linux-gnueabihf/libsqlite3.so.0
- 
-   - name: Install subuid
-     copy: 
-       src: subuid
-       dest: /etc/subuid
- 
-   - name: Install subgid
-     copy: 
-       src: subgid
-       dest: /etc/subgid
- 
-   - 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: "arm/{{ 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
+         dest: libsqlite3.so

M deploy/lxd/install.yml => deploy/lxd/install.yml +11 -49
@@ 52,7 52,7 @@ - /usr/local/src/deps
  
    - name: Get LXD
-     shell: go get -d -v github.com/lxc/lxd/lxd
+     shell: go get -d -v github.com/Ne02ptzero/lxd/lxd
  
    - name: Get dependencies of LXD
      shell: make deps


@@ 68,59 68,21 @@ 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:
+   - name: Get artifacts
+     fetch:
        src: "{{ item.src }}"
-       dest: "{{ item.dest }}"
-       state: link
+       dest: "intel/{{ item.dest }}"
+       flat: yes
      with_items:
        - src: /usr/local/src/bin/lxd
-         dest: /usr/bin/lxd
+         dest: lxd
        - src: /usr/local/src/bin/lxc
-         dest: /usr/bin/lxc
+         dest: lxc
        - src: /usr/local/src/deps/libco/libco.so.0.1.0
-         dest: /usr/lib/libco.so
+         dest: libco.so.0.1.0
        - src: /usr/local/src/deps/raft/.libs/libraft.so
-         dest: /usr/lib/libraft.so.0
+         dest: libraft.so
        - src: /usr/local/src/deps/dqlite/.libs/libdqlite.so
-         dest: /usr/lib/libdqlite.so.0
+         dest: libdqlite.so
        - 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
+         dest: libsqlite3.so

M deploy/lxd/lxd.service => deploy/lxd/lxd.service +1 -1
@@ 6,7 6,7 @@ Type=simple
  User=root
  LimitNOFILE=64000
- ExecStart=/usr/bin/lxd
+ ExecStart=/usr/bin/lxd --debug
  Restart=always
  
  [Install]

A deploy/monitoring/node-exporter.service => deploy/monitoring/node-exporter.service +10 -0
@@ 0,0 1,10 @@
+ [Unit]
+ Description=Node Exporter
+ Wants=network-online.target
+ After=network-online.target
+ 
+ [Service]
+ ExecStart=/usr/local/bin/node_exporter
+ 
+ [Install]
+ WantedBy=default.target

A deploy/monitoring/node_exporter.yml => deploy/monitoring/node_exporter.yml +48 -0
@@ 0,0 1,48 @@
+ - name: Node Exporter installation
+   hosts: all
+   tasks:
+   - name: Get intel node exporter archive
+     get_url:
+       url: https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
+       dest: /tmp/node-exporter.tar.gz
+     when: 'vars["ansible_architecture"] != "armv7l"'
+ 
+   - name: Get ARM node exporter archive
+     get_url:
+       url: https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-armv7.tar.gz
+       dest: /tmp/node-exporter.tar.gz
+     when: 'vars["ansible_architecture"] == "armv7l"'
+ 
+   - name: Unarchive
+     unarchive:
+       src: /tmp/node-exporter.tar.gz
+       dest: /tmp/
+       remote_src: yes
+ 
+   - name: Copy binary intel
+     copy:
+       src: /tmp/node_exporter-0.18.1.linux-amd64/node_exporter
+       dest: /usr/local/bin/
+       remote_src: yes
+       mode: +x
+     when: 'vars["ansible_architecture"] != "armv7l"'
+ 
+   - name: Copy binary arm
+     copy:
+       src: /tmp/node_exporter-0.18.1.linux-armv7/node_exporter
+       dest: /usr/local/bin/
+       remote_src: yes
+       mode: +x
+     when: 'vars["ansible_architecture"] == "armv7l"'
+ 
+   - name: Install system file
+     copy:
+       src: node-exporter.service
+       dest: /etc/systemd/system/
+ 
+   - name: Enable & Start node exporter
+     systemd:
+       name: node-exporter
+       enabled: yes
+       state: restarted
+       daemon_reload: yes

M deploy/network/network_up.sh.j2 => deploy/network/network_up.sh.j2 +2 -2
@@ 11,7 11,7 @@ # Add interface {{ slave }} to the bond
  ip link set {{ slave }} down
  ip addr flush {{ slave }}
- ip link set dev {{ slave }} mtu 9000
+ ip link set dev {{ slave }} mtu 1500
  ip link set {{ slave }} master {{ net.cluster.name }}
  
  {% endfor %}


@@ 24,7 24,7 @@ echo 1 > /sys/class/net/{{ net.cluster.name }}/bonding/xmit_hash_policy
  
  # Bring the bond up
- ip link set dev {{ net.cluster.name }} up mtu 9000
+ ip link set dev {{ net.cluster.name }} up mtu 1500
  
  # Bring the bridge up
  ip link set dev {{ net.bridge.name }} up

A deploy/network/network_up_pi.sh => deploy/network/network_up_pi.sh +11 -0
@@ 0,0 1,11 @@
+ #!/usr/bin/env bash
+ 
+ # Create bridge interface
+ ip link add br0 type bridge
+ 
+ ip link set eth0 down
+ ip addr flush eth0
+ ip link set eth0 master br0
+ 
+ ip link set dev br0 up
+ dhclient br0

M deploy/prd/inventory.yml => deploy/prd/inventory.yml +5 -0
@@ 153,3 153,8 @@ net:
                  adm:
                    ipv4: 10.32.0.3
+           grafana:
+             01:
+               net:
+                 adm:
+                   ipv4: 10.32.0.6