summaryrefslogtreecommitdiff
path: root/worker-vmdb2.yml
blob: a202e152f6d8462d3f492eec3f777425746114c6 (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
- hosts: image
  tasks:
    - shell: |
        echo "{{ host }}" > /etc/hostname
        sed -i '/^127\.0\.0.*localhost.*/s/.*/127.0.0.1 localhost {{ host }}/' \
          /etc/hosts
        sed -i '/^root:[^:]:/s//root::/' /etc/passwd
    - copy:
        content: |
          auto lo
          iface lo inet loopback

          auto eth0
          iface eth0 inet dhcp
        dest: /etc/network/interfaces
    - apt:
        name:
          - ansible
          - build-essential
          - cmdtest
          - debootstrap
          - dosfstools
          - git
          - kpartx
          - locales-all
          - moreutils
          - pandoc
          - parted
          - python3-all
          - python3-cliapp
          - python3-coverage-test-runner
          - python3-jinja2
          - python3-yaml
          - qemu-utils
    - user:
        comment: "Worker"
        name: worker
        shell: /bin/bash
    - file:
        state: directory
        path: /home/worker/.ssh
        owner: worker
        group: worker
        mode: 0700
    - copy:
        src: manager.key.pub
        dest: /home/worker/.ssh/authorized_keys
        owner: worker
        group: worker
        mode: 0600
    - copy:
        content: |
          worker ALL=(ALL:ALL) NOPASSWD: ALL
        dest: /etc/sudoers.d/worker
        owner: root
        group: root
        mode: 0600
  vars:
    host: worker
    ansible_python_interpreter: /usr/bin/python3