a8aa57323b595035947f3260b8a9bb3f4e6419c9
[csit.git] / resources / tools / testbed-setup / ansible / roles / vexx_hosts / tasks / main.yaml
1 ---
2 # file: roles/vexx_hosts/tasks/main.yaml
3
4 - name: Ensure the system exists in Cobbler
5   cobbler_system:
6     host: "{{ cobbler_hostname }}"
7     port: 60080
8     interfaces:
9       br1:
10         ipaddress: "{{ ansible_default_ipv4.address }}"
11         macaddress: "{{ ansible_default_ipv4.macaddress }}"
12     name: "{{ hostname }}"
13     password: "{{ cobbler_password }}"
14     properties:
15       hostname: "{{ hostname }}"
16       gateway: "{{ ansible_default_ipv4.gateway }}"
17       profile: "{{ cobbler_profile }}"
18       name_servers: "{{ name_servers }}"
19       name_servers_search: "{{ name_servers_search }}"
20       kickstart: "/var/lib/cobbler/kickstarts/{{ cobbler_profile }}.seed"
21       kernel_options: '"interface={{ ansible_default_ipv4.interface }}"'
22       netboot_enabled: yes
23     username: "{{ cobbler_username }}"
24     use_ssl: no
25     validate_certs: no
26   when: provision_enabled
27   delegate_to: localhost
28   tags:
29     - cobbler-include
30
31 - name: Commit Cobbler changes
32   cobbler_sync:
33     host: "{{ cobbler_hostname }}"
34     port: 60080
35     password: "{{ cobbler_password }}"
36     username: "{{ cobbler_username }}"
37     use_ssl: no
38     validate_certs: no
39   run_once: yes
40   when: provision_enabled
41   delegate_to: localhost
42   register: __included_in_cobbler
43   notify:
44     - "Boot from network"
45     - "Reboot server"
46   tags:
47     - cobbler-include
48
49 - meta: flush_handlers
50
51 - name: Copy netplan network config file
52   template:
53     src: "files/netplan_config"
54     dest: "/etc/netplan/01-netcfg.yaml"
55     owner: "root"
56     group: "root"
57     mode: "0644"
58   tags:
59     - copy-interface-file
60
61 - meta: flush_handlers