diff --git a/README.md b/README.md index 4c3ad9a..85024b5 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ root: `packer/ansible` -`ansible-playbook -u root -i inventories/qemu playbook.yml -t windowmanager` +`ansible-playbook -u root -i inventories/qemu playbook.yml [-t TAG]` diff --git a/packer/ansible/playbook.yml b/packer/ansible/playbook.yml index e29c87a..c6f6b8b 100644 --- a/packer/ansible/playbook.yml +++ b/packer/ansible/playbook.yml @@ -20,3 +20,27 @@ - role: windowmanager tags: - windowmanager + - role: localisation + tags: + - localisation + vars: + auth: + sudo: + sudoers: + - root + + localisation: + keyboard: + layout: de + variant: + model: pc105 + options: "" + locale: + generate: + - en_US.UTF-8 UTF-8 + - de_DE.UTF-8 UTF-8 + - C.UTF-8 UTF-8 + default: de_DE.UTF-8 + tasksel: + - english + - german diff --git a/packer/ansible/roles/auth/tasks/main.yml b/packer/ansible/roles/auth/tasks/main.yml index 06ece31..e13fe8d 100644 --- a/packer/ansible/roles/auth/tasks/main.yml +++ b/packer/ansible/roles/auth/tasks/main.yml @@ -1,2 +1,3 @@ --- - import_tasks: debug.yml +- import_tasks: sudo.yml diff --git a/packer/ansible/roles/auth/tasks/sudo.yml b/packer/ansible/roles/auth/tasks/sudo.yml new file mode 100644 index 0000000..819d217 --- /dev/null +++ b/packer/ansible/roles/auth/tasks/sudo.yml @@ -0,0 +1,13 @@ +--- +- name: install sudo + package: + name: sudo + state: present + +- name: configure sudoers + template: + src: sudoers.j2 + dest: "/etc/sudoers" + owner: root + group: root + mode: '0440' diff --git a/packer/ansible/roles/auth/templates/sudoers.j2 b/packer/ansible/roles/auth/templates/sudoers.j2 new file mode 100644 index 0000000..0780f69 --- /dev/null +++ b/packer/ansible/roles/auth/templates/sudoers.j2 @@ -0,0 +1,11 @@ +# generated by ansible +Defaults env_reset +Defaults mail_badpass +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +root ALL=(ALL:ALL) ALL + +%sudo ALL=(ALL:ALL) ALL +{% for user in auth.sudo.sudoers %} +{{ user }} ALL=(ALL:ALL) ALL +{% endfor %} diff --git a/packer/ansible/roles/localisation/handlers/main.yml b/packer/ansible/roles/localisation/handlers/main.yml new file mode 100644 index 0000000..a199b5a --- /dev/null +++ b/packer/ansible/roles/localisation/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: reconfigure locales + command: dpkg-reconfigure locales -f noninteractive diff --git a/packer/ansible/roles/localisation/tasks/keyboard-configuration.yml b/packer/ansible/roles/localisation/tasks/keyboard-configuration.yml new file mode 100644 index 0000000..baed682 --- /dev/null +++ b/packer/ansible/roles/localisation/tasks/keyboard-configuration.yml @@ -0,0 +1,5 @@ +--- +- name: configure keyboard + template: + src: keyboard.j2 + dest: /etc/default/keyboard diff --git a/packer/ansible/roles/localisation/tasks/locale.yml b/packer/ansible/roles/localisation/tasks/locale.yml new file mode 100644 index 0000000..89f9395 --- /dev/null +++ b/packer/ansible/roles/localisation/tasks/locale.yml @@ -0,0 +1,18 @@ +--- +- name: install locales + apt: + name: locales + state: present + +- name: install localisation tasks + apt: + name: "task-{{ item }}" + state: present + with_items: "{{ localisation.locale.tasksel }}" + +- name: configure locales + command: "{{ item }}" + with_items: + - "echo locales locales/locales_to_be_generated multiselect {% for locale in localisation.locale.generate %}{{ locale }}{% if not loop.last %}, {% endif %}{% endfor %} | debconf-set-selections" + - "echo locales locales/default_environment_locale select {{ localisation.locale.default }} | debconf-set-selections" + notify: reconfigure locales diff --git a/packer/ansible/roles/localisation/tasks/main.yml b/packer/ansible/roles/localisation/tasks/main.yml new file mode 100644 index 0000000..00a1d55 --- /dev/null +++ b/packer/ansible/roles/localisation/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- import_tasks: keyboard-configuration.yml +- import_tasks: locale.yml diff --git a/packer/ansible/roles/localisation/templates/keyboard.j2 b/packer/ansible/roles/localisation/templates/keyboard.j2 new file mode 100644 index 0000000..ed1f65b --- /dev/null +++ b/packer/ansible/roles/localisation/templates/keyboard.j2 @@ -0,0 +1,6 @@ +XKBMODEL="{{ localisation.keyboard.model }}" +XKBLAYOUT="{{ localisation.keyboard.layout }}" +XKBVARIANT="{{ localisation.keyboard.variant }}" +XKBOPTIONS="{{ localisation.keyboard.options }}" + +BACKSPACE="guess" diff --git a/packer/ansible/roles/localisation/templates/locale.gen.j2 b/packer/ansible/roles/localisation/templates/locale.gen.j2 new file mode 100644 index 0000000..ae07994 --- /dev/null +++ b/packer/ansible/roles/localisation/templates/locale.gen.j2 @@ -0,0 +1,3 @@ +{% for locale in localisation.locale.generate %} +{{ locale }} +{% endfor %} diff --git a/packer/ansible/roles/readme_roles.md b/packer/ansible/roles/readme_roles.md new file mode 100644 index 0000000..51348af --- /dev/null +++ b/packer/ansible/roles/readme_roles.md @@ -0,0 +1,3 @@ + * alle „maker-tools“ in fablab + * großer Kram in eigene role + + inkscape