aboutsummaryrefslogtreecommitdiffstats
path: root/roles/fedora/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/fedora/tasks')
-rw-r--r--roles/fedora/tasks/hosts.yml10
-rw-r--r--roles/fedora/tasks/locale.yml2
-rw-r--r--roles/fedora/tasks/main.yml10
-rw-r--r--roles/fedora/tasks/networkd.yml15
-rw-r--r--roles/fedora/tasks/resolved.yml39
-rw-r--r--roles/fedora/tasks/systemd.yml32
-rw-r--r--roles/fedora/tasks/timesyncd.yml25
-rw-r--r--roles/fedora/tasks/timezone.yml7
8 files changed, 138 insertions, 2 deletions
diff --git a/roles/fedora/tasks/hosts.yml b/roles/fedora/tasks/hosts.yml
new file mode 100644
index 0000000..46299d6
--- /dev/null
+++ b/roles/fedora/tasks/hosts.yml
@@ -0,0 +1,10 @@
+---
+- name: Configure /etc/hosts
+ template:
+ dest: '/etc/hosts'
+ src: hosts.j2
+ owner: root
+ group: root
+ mode: 0644
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/fedora/tasks/locale.yml b/roles/fedora/tasks/locale.yml
index a96d6ba..813abe7 100644
--- a/roles/fedora/tasks/locale.yml
+++ b/roles/fedora/tasks/locale.yml
@@ -1,5 +1,5 @@
---
-- name: Setting default locales
+- name: Setting default locale
template:
dest: '/etc/locale.conf'
src: locale.conf.j2
diff --git a/roles/fedora/tasks/main.yml b/roles/fedora/tasks/main.yml
index 2e163a4..4492df5 100644
--- a/roles/fedora/tasks/main.yml
+++ b/roles/fedora/tasks/main.yml
@@ -1,6 +1,8 @@
---
- import_tasks: dnf.yml
tags: dnf
+- import_tasks: hosts.yml
+ tags: hosts
- import_tasks: timezone.yml
when: timezone is defined
tags: timezone
@@ -10,5 +12,13 @@
- import_tasks: hostname.yml
when: hostname is defined
tags: hostname
+- import_tasks: systemd.yml
+ tags: systemd
+- import_tasks: resolved.yml
+ tags: resolved
+- import_tasks: networkd.yml
+ tags: networkd
+- import_tasks: timesyncd.yml
+ tags: timesyncd
# vim: set ts=2 sw=2 et:
diff --git a/roles/fedora/tasks/networkd.yml b/roles/fedora/tasks/networkd.yml
new file mode 100644
index 0000000..de38fa4
--- /dev/null
+++ b/roles/fedora/tasks/networkd.yml
@@ -0,0 +1,15 @@
+---
+- name: Enable/disable systemd-networkd
+ systemd:
+ name: systemd-networkd.service
+ enabled: "{{ use_networkd|ternary('yes','no') }}"
+ masked: "{{ use_networkd|ternary('no',omit) }}"
+ # let the current network daemons run undisturbed until reboot
+ # aka. don't cut the pipe we're connected through
+ #state: "{{ use_networkd|ternary('started','stopped') }}"
+ when: not chroot
+- name: '- when in chroot'
+ command: "systemctl {{ use_networkd|ternary('enable','disable') }} systemd-networkd.service"
+ when: chroot
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/fedora/tasks/resolved.yml b/roles/fedora/tasks/resolved.yml
new file mode 100644
index 0000000..263f93d
--- /dev/null
+++ b/roles/fedora/tasks/resolved.yml
@@ -0,0 +1,39 @@
+---
+- name: Configure systemd-resolved
+ ini_file:
+ path: '/etc/systemd/resolved.conf'
+ no_extra_spaces: yes
+ section: "{{ item.key.split('.',1)[0] }}"
+ option: "{{ item.key.split('.',1)[1] }}"
+ value: "{{ item.value|ternary(item.value,omit) }}"
+ state: "{{ item.value|ternary('present','absent') }}"
+ with_dict: '{{ resolved_conf }}'
+ when: use_resolved
+ notify: restart resolved
+
+- name: Enable/disable systemd-resolved
+ systemd:
+ name: systemd-resolved.service
+ enabled: "{{ use_resolved|ternary('yes','no') }}"
+ masked: no
+ state: "{{ use_resolved|ternary('started','stopped') }}"
+ when: not chroot
+- name: '- when in chroot'
+ command: 'systemctl {{ use_resolved|ternary("enable","disable") }} systemd-resolved.service'
+ when: chroot
+
+- name: Symlink /etc/resolv.conf
+ file:
+ path: '/etc/resolv.conf'
+ src: '/run/systemd/resolve/resolv.conf'
+ state: link
+ force: yes
+ when: use_resolved
+- name: Use myhostname and possibly resolved nss plugins
+ lineinfile:
+ path: /etc/nsswitch.conf
+ regexp: '^hosts:'
+ line: 'hosts: files resolve [!UNAVAIL=return] dns myhostname'
+ when: use_resolved
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/fedora/tasks/systemd.yml b/roles/fedora/tasks/systemd.yml
new file mode 100644
index 0000000..56a5898
--- /dev/null
+++ b/roles/fedora/tasks/systemd.yml
@@ -0,0 +1,32 @@
+---
+- name: Configure systemd system.conf
+ ini_file:
+ path: '/etc/systemd/system.conf'
+ no_extra_spaces: yes
+ section: "{{ item.key.split('.',1)[0] }}"
+ option: "{{ item.key.split('.',1)[1] }}"
+ value: "{{ item.value|ternary(item.value,omit) }}"
+ state: "{{ item.value|ternary('present','absent') }}"
+ with_dict: '{{ systemd_conf }}'
+
+- name: Configure journald.conf
+ ini_file:
+ path: '/etc/systemd/journald.conf'
+ no_extra_spaces: yes
+ section: "{{ item.key.split('.',1)[0] }}"
+ option: "{{ item.key.split('.',1)[1] }}"
+ value: "{{ item.value|ternary(item.value,omit) }}"
+ state: "{{ item.value|ternary('present','absent') }}"
+ with_dict: '{{ journald_conf }}'
+
+- name: Configure logind.conf
+ ini_file:
+ path: '/etc/systemd/logind.conf'
+ no_extra_spaces: yes
+ section: "{{ item.key.split('.',1)[0] }}"
+ option: "{{ item.key.split('.',1)[1] }}"
+ value: "{{ item.value|ternary(item.value,omit) }}"
+ state: "{{ item.value|ternary('present','absent') }}"
+ with_dict: '{{ logind_conf }}'
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/fedora/tasks/timesyncd.yml b/roles/fedora/tasks/timesyncd.yml
new file mode 100644
index 0000000..63949fc
--- /dev/null
+++ b/roles/fedora/tasks/timesyncd.yml
@@ -0,0 +1,25 @@
+---
+- name: Configure systemd-timesyncd
+ ini_file:
+ path: '/etc/systemd/timesyncd.conf'
+ no_extra_spaces: yes
+ section: "{{ item.key.split('.',1)[0] }}"
+ option: "{{ item.key.split('.',1)[1] }}"
+ value: "{{ item.value|ternary(item.value,omit) }}"
+ state: "{{ item.value|ternary('present','absent') }}"
+ with_dict: '{{ timesyncd_conf }}'
+ when: use_timesyncd
+ notify: restart timesyncd
+
+- name: Enable systemd-timesyncd
+ systemd:
+ name: systemd-timesyncd.service
+ enabled: "{{ use_timesyncd|ternary('yes','no') }}"
+ masked: no
+ state: "{{ use_timesyncd|ternary('started','stopped') }}"
+ when: not chroot
+- name: '- when in chroot'
+ command: systemctl enable systemd-timesyncd.service
+ when: chroot
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/fedora/tasks/timezone.yml b/roles/fedora/tasks/timezone.yml
index 90c2344..a917dd4 100644
--- a/roles/fedora/tasks/timezone.yml
+++ b/roles/fedora/tasks/timezone.yml
@@ -1,9 +1,14 @@
---
-- name: Create /etc/localtime
+- name: Configure timezone
+ timezone:
+ name: '{{ timezone }}'
+ when: not chroot
+- name: '- when in chroot'
file:
path: '/etc/localtime'
src: '../usr/share/zoneinfo/{{ timezone }}'
state: link
force: yes
+ when: chroot
# vim: set ts=2 sw=2 et: