2 # file: roles/common/tasks/main.yaml
4 - name: Ensure the system exists in Cobbler
6 host: '{{ cobbler_hostname }}'
10 ipaddress: '{{ ansible_default_ipv4.address }}'
11 macaddress: '{{ ansible_default_ipv4.macaddress }}'
12 name: '{{ hostname }}'
13 password: '{{ cobbler_password }}'
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 }}"'
23 username: '{{ cobbler_username }}'
26 when: provision_enabled
27 delegate_to: localhost
30 - name: Commit Cobbler changes
32 host: '{{ cobbler_hostname }}'
34 password: '{{ cobbler_password }}'
35 username: '{{ cobbler_username }}'
39 when: provision_enabled
40 delegate_to: localhost
41 register: __included_in_cobbler
47 - meta: flush_handlers
49 - name: Add permanent proxy settings
51 path: '/etc/environment'
53 line: '{{ item.key }}={{ item.value }}'
54 with_dict: '{{ proxy_env }}'
55 when: proxy_env is defined
57 - name: Install distribution - release - machine prerequisites
58 include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml'
60 - name: Set sudoers admin
64 regexp: '^%admin ALL='
65 line: '%admin ALL=(ALL) ALL'
66 validate: '/usr/sbin/visudo -cf %s'
69 - name: Set sudoers sudo
74 line: '%sudo ALL=(ALL:ALL) NOPASSWD: ALL'
75 validate: '/usr/sbin/visudo -cf %s'
78 - name: Copy grub file
80 src: 'files/grub_{{ ansible_machine }}'
81 dest: '/etc/default/grub'
90 - meta: flush_handlers