--- # file: roles/common/tasks/main.yaml - name: Add permanent proxy settings lineinfile: path: "/etc/environment" state: "present" line: "{{ item.key }}={{ item.value }}" with_dict: "{{ proxy_env }}" when: proxy_env is defined - name: Install distribution - release - machine prerequisites include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml' - name: Set hostname hostname: name: '{{ hostname }}' tags: set-hostname - name: Ensure hostname is in /etc/hosts lineinfile: path: '/etc/hosts' regexp: '^{{ ansible_default_ipv4.address }}.+$' line: '{{ ansible_default_ipv4.address }} {{ hostname }}.{{ name_servers_search }}' tags: set-hostname - name: Set sudoers admin lineinfile: path: '/etc/sudoers' state: 'present' regexp: '^%admin ALL=' line: '%admin ALL=(ALL) ALL' validate: '/usr/sbin/visudo -cf %s' tags: set-sudoers - name: Set sudoers sudo lineinfile: path: '/etc/sudoers' state: 'present' regexp: '^%sudo' line: '%sudo ALL=(ALL:ALL) NOPASSWD: ALL' validate: '/usr/sbin/visudo -cf %s' tags: set-sudoers - name: Copy grub file template: src: 'files/grub' dest: '/etc/default/grub' owner: 'root' group: 'root' mode: '644' notify: ['Update GRUB'] tags: copy-grub - name: Add permanent proxy settings lineinfile: path: "/etc/environment" state: "present" line: "{{ item.key }}={{ item.value }}" with_dict: "{{ proxy_env }}" when: proxy_env is defined