diff options
Diffstat (limited to 'ansible/roles/trygvis-base')
-rw-r--r-- | ansible/roles/trygvis-base/defaults/main.yml | 7 | ||||
-rw-r--r-- | ansible/roles/trygvis-base/handlers/main.yml | 7 | ||||
-rw-r--r-- | ansible/roles/trygvis-base/tasks/main.yml | 57 |
3 files changed, 71 insertions, 0 deletions
diff --git a/ansible/roles/trygvis-base/defaults/main.yml b/ansible/roles/trygvis-base/defaults/main.yml new file mode 100644 index 0000000..f469304 --- /dev/null +++ b/ansible/roles/trygvis-base/defaults/main.yml @@ -0,0 +1,7 @@ +bitraf_base__etc_localtime: yes +bitraf_base__remove_root_authorized_keys: yes +bitraf_base__fix_aliases: yes + +# These mostly applies to LXC hosts +bitraf_base__fix_hosts: no +bitraf_base__syslog: no diff --git a/ansible/roles/trygvis-base/handlers/main.yml b/ansible/roles/trygvis-base/handlers/main.yml new file mode 100644 index 0000000..c0b601c --- /dev/null +++ b/ansible/roles/trygvis-base/handlers/main.yml @@ -0,0 +1,7 @@ +- name: reconfigure tzdata + become: yes + shell: dpkg-reconfigure -f noninteractive tzdata + +- name: postalias /etc/aliases + become: yes + shell: "[ -x /usr/sbin/postalias ] && /usr/sbin/postalias /etc/aliases" diff --git a/ansible/roles/trygvis-base/tasks/main.yml b/ansible/roles/trygvis-base/tasks/main.yml new file mode 100644 index 0000000..d753056 --- /dev/null +++ b/ansible/roles/trygvis-base/tasks/main.yml @@ -0,0 +1,57 @@ +- become: true + tags: + - trygvis-base + - trygvis-base-misc + block: + - name: /etc/localtime + when: trygvis_base__etc_localtime + file: + src: /usr/share/zoneinfo/Europe/Oslo + dest: /etc/localtime + state: link + force: yes + notify: reconfigure tzdata + + - name: remove ~root/.ssh/authorized_keys + when: trygvis_base__remove_root_authorized_keys + file: + path: ~root/.ssh/authorized_keys + state: absent + + - name: /etc/hosts + when: trygvis_base__fix_hosts + copy: + dest: /etc/hosts + content: | + 127.0.0.1 localhost + 127.0.1.1 {{ ansible_hostname }}.trygvis.io {{ ansible_hostname }} + ::1 localhost ip6-localhost ip6-loopback + ff02::1 ip6-allnodes + ff02::2 ip6-allrouters + + - name: stat /etc/aliases + register: etc_aliases + stat: + path: /etc/aliases + - name: /etc/aliases + when: trygvis_base__fix_aliases and etc_aliases.stat.exists + notify: postalias /etc/aliases + lineinfile: + path: /etc/aliases + regexp: "^root:" + line: "root: root@trygvis.no" + +- become: true + tags: + - trygvis-base + - trygvis-base-syslog + when: trygvis_base__syslog + block: + - name: + vars: + items: + - rsyslog + apt: + name: "{{ items }}" + state: present + install_recommends: no |