CSIT-1070 Update Ansible structure
[csit.git] / resources / tools / testbed-setup / ansible / roles / common / tasks / main.yaml
1 ---\r
2 # file: roles/common/tasks/main.yaml\r
3 \r
4 - name: Ubuntu specific\r
5   import_tasks: ubuntu_x86_64.yaml\r
6   when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'\r
7 \r
8 - name: Set hostname\r
9   hostname:\r
10       name: '{{ hostname }}'\r
11   tags: set-hostname\r
12 \r
13 - name: Ensure hostname is in /etc/hosts\r
14   lineinfile:\r
15     path: '/etc/hosts'\r
16     regexp: '^{{ ansible_default_ipv4.address }}.+$'\r
17     line: '{{ ansible_default_ipv4.address }} {{ hostname }}.linuxfoundation.org'\r
18   tags: set-hostname\r
19 \r
20 - name: Set sudoers\r
21   lineinfile:\r
22     path: '/etc/sudoers'\r
23     state: 'present'\r
24     regexp: '^%admin ALL='\r
25     line: '%admin ALL=(ALL) ALL'\r
26     validate: '/usr/sbin/visudo -cf %s'\r
27   tags: set-sudoers\r
28 \r
29 - name: Set sudoers\r
30   lineinfile:\r
31     path: '/etc/sudoers'\r
32     state: 'present'\r
33     regexp: '^%sudo'\r
34     line: '%sudo ALL=(ALL:ALL) NOPASSWD: ALL'\r
35     validate: '/usr/sbin/visudo -cf %s'\r
36   tags: set-sudoers\r
37 \r
38 - name: Copy grub file\r
39   template:\r
40    src: 'files/grub'\r
41    dest: '/etc/default/grub'\r
42    owner: 'root'\r
43    group: 'root'\r
44    mode: '644'\r
45   notify: ['Update GRUB']\r
46   tags: copy-grub\r