aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/trygvis-base
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-11-26 22:33:54 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2018-11-26 22:33:54 +0100
commitb7bccaf7ff75fd2234b9232f595cbc8e226b80e9 (patch)
tree3e2822166b9be455f7589e56ca28a685bbccd2d8 /ansible/roles/trygvis-base
parent6fe44ad6366232314d45502d387ccbc671e84d9f (diff)
downloadinfra-b7bccaf7ff75fd2234b9232f595cbc8e226b80e9.tar.gz
infra-b7bccaf7ff75fd2234b9232f595cbc8e226b80e9.tar.bz2
infra-b7bccaf7ff75fd2234b9232f595cbc8e226b80e9.tar.xz
infra-b7bccaf7ff75fd2234b9232f595cbc8e226b80e9.zip
o Importing bitraf-base, packages and postfix-satellite from Bitraf.
o Configuring nextcloud.
Diffstat (limited to 'ansible/roles/trygvis-base')
-rw-r--r--ansible/roles/trygvis-base/defaults/main.yml7
-rw-r--r--ansible/roles/trygvis-base/handlers/main.yml7
-rw-r--r--ansible/roles/trygvis-base/tasks/main.yml57
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