aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/cobbler/tasks/main.yaml
blob: f48a976ea1cfea6c24879a54a282c86146eb2e74 (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
---
# file: roles/cobbler/tasks/main.yaml

- name: Sync the cobbler docker directory
  synchronize:
    src: 'files'
    dest: '/home/{{ ansible_user }}/cobbler_docker'
  register: __cobbler_image_built
  tags: cobbler-build-image

- name: Build the cobbler docker image
  docker_image:
     path: '/home/{{ ansible_user }}/cobbler_docker/files'
     name: 'csit/cobbler'
     buildargs:
       cobbler_pass: '{{ cobbler_pass }}'
       cobbler_web_pass: '{{ cobbler_password }}'
       cobbler_ip_addr: '{{ inventory_hostname }}'
  when: __cobbler_image_built
  tags: cobbler-build-image

- name: Run Cobbler image
  docker_container:
    name: 'cobbler'
    image: 'csit/cobbler'
    network_mode: 'host'
    volumes:
      - '/mnt:/mnt:ro'
  register: __cobbler_image_running
  tags: cobbler-run-image

- name: Run cobbler setup get-loaders
  command: 'docker exec -i cobbler cobbler get-loaders'
  when: __cobbler_image_running
  tags: cobbler-run-image

- name: Run cobbler setup sync
  command: 'docker exec -i cobbler cobbler sync'
  when: __cobbler_image_running
  tags: cobbler-run-image

- name: Add Ubuntu 18.04.2 Server x86_64 to cobbler
  include_tasks: 'ubuntu-18.04.2-server-x86_64.yaml'
  when: __cobbler_image_running
  tags: cobbler-run-image