]> git.phdru.name Git - ansible.git/commitdiff
Feat: Combine Debian/RedHat playbooks and roles
authorOleg Broytman <phd@phdru.name>
Mon, 2 Sep 2019 16:44:50 +0000 (19:44 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 2 Sep 2019 17:25:41 +0000 (20:25 +0300)
93 files changed:
playbooks/debian/init-system.sh
playbooks/debian/roles/init-system/README.txt [deleted file]
playbooks/debian/roles/init-system/tasks/main.yml [deleted file]
playbooks/debian/roles/init-system2/README.txt [deleted file]
playbooks/debian/roles/packages/README.txt [deleted file]
playbooks/debian/roles/phd/defaults/main.yml [deleted file]
playbooks/init-system.yml
playbooks/init-system2.yml [moved from playbooks/debian/init-system2.yml with 70% similarity]
playbooks/redhat/init-system.sh
playbooks/redhat/init-system.yml [deleted file]
playbooks/redhat/init-system2.yml [deleted file]
playbooks/redhat/roles/dev-packages/README.txt [deleted file]
playbooks/redhat/roles/dev-packages/tasks/main.yml [deleted file]
playbooks/redhat/roles/init-system/README.txt [deleted file]
playbooks/redhat/roles/init-system/tasks/main.yml [deleted file]
playbooks/redhat/roles/init-system2/README.txt [deleted file]
playbooks/redhat/roles/init-system2/tasks/main.yml [deleted file]
playbooks/redhat/roles/logcheck/README.txt [deleted file]
playbooks/redhat/roles/logcheck/files/.gitignore [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-bluetooth [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-console-kit-daemon [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-dbus [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-firefox [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-kernel [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-minidsspd [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-named [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-pa [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-postgres [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-rsyslog [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-runuser [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-samba [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-spamassassin [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-ssh [deleted file]
playbooks/redhat/roles/logcheck/files/ignore.d/local-transmission [deleted file]
playbooks/redhat/roles/logcheck/tasks/main.yml [deleted file]
playbooks/redhat/roles/packages/README.txt [deleted file]
playbooks/redhat/roles/packages/tasks/main.yml [deleted file]
playbooks/redhat/roles/phd/README.txt [deleted file]
playbooks/redhat/roles/phd/defaults/main.yml [deleted file]
playbooks/redhat/roles/phd/meta/main.yml [deleted file]
playbooks/redhat/roles/phd/tasks/main.yml [deleted file]
playbooks/redhat/roles/python-dev-packages/README.txt [deleted file]
playbooks/redhat/roles/python-dev-packages/meta/main.yml [deleted file]
playbooks/redhat/roles/python-dev-packages/tasks/main.yml [deleted file]
playbooks/redhat/roles/python-packages/README.txt [deleted file]
playbooks/redhat/roles/python-packages/tasks/main.yml [deleted file]
playbooks/redhat/roles/remove-systemd/README.txt [new file with mode: 0644]
playbooks/redhat/roles/sudo/README.txt [deleted file]
playbooks/redhat/roles/sudo/meta/main.yml [deleted file]
playbooks/redhat/roles/sudo/tasks/main.yml [deleted file]
playbooks/redhat/update-root.yml [deleted file]
playbooks/roles/dev-packages/README.txt [moved from playbooks/debian/roles/dev-packages/README.txt with 100% similarity]
playbooks/roles/dev-packages/tasks/main.yml [moved from playbooks/debian/roles/dev-packages/tasks/main.yml with 58% similarity]
playbooks/roles/init-system/README.txt [new file with mode: 0644]
playbooks/roles/init-system/tasks/apt.yml [moved from playbooks/debian/roles/init-system/tasks/apt.yml with 100% similarity]
playbooks/roles/init-system/tasks/dnf.yml [moved from playbooks/redhat/roles/init-system/tasks/dnf.yml with 100% similarity]
playbooks/roles/init-system/tasks/locales.yml [moved from playbooks/debian/roles/init-system/tasks/locales.yml with 100% similarity]
playbooks/roles/init-system/tasks/main.yml [new file with mode: 0644]
playbooks/roles/init-system/templates/sources.list [moved from playbooks/debian/roles/init-system/templates/sources.list with 100% similarity]
playbooks/roles/init-system2/README.txt [new file with mode: 0644]
playbooks/roles/init-system2/tasks/main.yml [moved from playbooks/debian/roles/init-system2/tasks/main.yml with 57% similarity]
playbooks/roles/logcheck/README.txt [moved from playbooks/debian/roles/logcheck/README.txt with 100% similarity]
playbooks/roles/logcheck/files/.gitignore [moved from playbooks/debian/roles/logcheck/files/.gitignore with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-bluetooth [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-bluetooth with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-console-kit-daemon [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-console-kit-daemon with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-dbus [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-dbus with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-firefox [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-firefox with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-kernel [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-kernel with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-minidsspd [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-minidsspd with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-named [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-named with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-pa [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-pa with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-postgres [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-postgres with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-rsyslog [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-rsyslog with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-runuser [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-runuser with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-samba [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-samba with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-spamassassin [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-spamassassin with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-ssh [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-ssh with 100% similarity]
playbooks/roles/logcheck/files/ignore.d/local-transmission [moved from playbooks/debian/roles/logcheck/files/ignore.d/local-transmission with 100% similarity]
playbooks/roles/logcheck/tasks/main.yml [moved from playbooks/debian/roles/logcheck/tasks/main.yml with 75% similarity]
playbooks/roles/packages/README.txt [new file with mode: 0644]
playbooks/roles/packages/tasks/main.yml [moved from playbooks/debian/roles/packages/tasks/main.yml with 51% similarity]
playbooks/roles/phd/README.txt [moved from playbooks/debian/roles/phd/README.txt with 100% similarity]
playbooks/roles/phd/defaults/main.yml [new file with mode: 0644]
playbooks/roles/phd/meta/main.yml [moved from playbooks/debian/roles/phd/meta/main.yml with 100% similarity]
playbooks/roles/phd/tasks/main.yml [moved from playbooks/debian/roles/phd/tasks/main.yml with 85% similarity]
playbooks/roles/python-dev-packages/README.txt [moved from playbooks/debian/roles/python-dev-packages/README.txt with 100% similarity]
playbooks/roles/python-dev-packages/meta/main.yml [moved from playbooks/debian/roles/python-dev-packages/meta/main.yml with 100% similarity]
playbooks/roles/python-dev-packages/tasks/main.yml [moved from playbooks/debian/roles/python-dev-packages/tasks/main.yml with 61% similarity]
playbooks/roles/python-packages/README.txt [moved from playbooks/debian/roles/python-packages/README.txt with 100% similarity]
playbooks/roles/python-packages/tasks/main.yml [moved from playbooks/debian/roles/python-packages/tasks/main.yml with 63% similarity]
playbooks/roles/sudo/README.txt [moved from playbooks/debian/roles/sudo/README.txt with 100% similarity]
playbooks/roles/sudo/meta/main.yml [moved from playbooks/debian/roles/sudo/meta/main.yml with 100% similarity]
playbooks/roles/sudo/tasks/main.yml [moved from playbooks/debian/roles/sudo/tasks/main.yml with 67% similarity]

index c44eb832ea86036bfd22778fb1c458634db122b4..512ce025745b729aaa7258b0ab2524662feb4aad 100755 (executable)
@@ -16,4 +16,4 @@ export ANSIBLE_ROLES_PATH &&
 # `sudo` isn't configured yet too; use `su` and ask for root password.
 ansible-playbook ../init-system.yml "$@" -e hosts="$host" \
    --become-method=su -K &&
-exec ansible-playbook init-system2.yml "$@" -e hosts="$host"
+exec ansible-playbook ../init-system2.yml "$@" -e hosts="$host"
diff --git a/playbooks/debian/roles/init-system/README.txt b/playbooks/debian/roles/init-system/README.txt
deleted file mode 100644 (file)
index 1f7eced..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Init new Debian system: configure apt, install minimal list of packages.
diff --git a/playbooks/debian/roles/init-system/tasks/main.yml b/playbooks/debian/roles/init-system/tasks/main.yml
deleted file mode 100644 (file)
index 83104c7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-- name: apt
-  import_tasks: apt.yml
-
-- name: locales
-  import_tasks: locales.yml
diff --git a/playbooks/debian/roles/init-system2/README.txt b/playbooks/debian/roles/init-system2/README.txt
deleted file mode 100644 (file)
index cf6c45b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Init Debian system: phase2 - setup /usr/local.
diff --git a/playbooks/debian/roles/packages/README.txt b/playbooks/debian/roles/packages/README.txt
deleted file mode 100644 (file)
index ef692c4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Install Debian packages.
diff --git a/playbooks/debian/roles/phd/defaults/main.yml b/playbooks/debian/roles/phd/defaults/main.yml
deleted file mode 100644 (file)
index b9fc971..0000000
+++ /dev/null
@@ -1 +0,0 @@
-system_groups: root,adm,disk,cdrom,floppy,sudo,audio,www-data,video,plugdev,staff,users,Debian-exim,fuse,sambashare,input
index e5722c8f369edc964c4502ac64e25d5763df3881..1cd61891fbf47320fa58f0f69bbffb83b37be8ee 100644 (file)
@@ -1,6 +1,6 @@
 - name: Setup Linux system
   hosts: "{{ hosts | default('all') }}"
-  gather_facts: false
+  gather_facts: true
   roles:
     - sudo
     - phd
similarity index 70%
rename from playbooks/debian/init-system2.yml
rename to playbooks/init-system2.yml
index 0a02e3123f83a01d33ac1c4102d04bd2867ed303..a574db17d02b3fe817d1bb16d649aaceed6b08c6 100644 (file)
@@ -3,7 +3,8 @@
   gather_facts: true
   roles:
     - init-system2
-    - remove-systemd
+    - role: remove-systemd
+      when: ansible_facts.os_family == 'Debian'
     - root
     - firewall
     - logcheck
index 085eb3a55ed70f0065930a2a0877b410ada3f753..92361652468f18cfde661ee86fc487298e688f42 100755 (executable)
@@ -14,5 +14,5 @@ export ANSIBLE_ROLES_PATH &&
 
 # Passwordless access isn't configured yet; use `ssh` connection sharing.
 # `sudo` isn't configured yet too; ask for phd password.
-ansible-playbook init-system.yml "$@" -e hosts="$host" -K &&
-exec ansible-playbook init-system2.yml "$@" -e hosts="$host"
+ansible-playbook ../init-system.yml "$@" -e hosts="$host" -K &&
+exec ansible-playbook ../init-system2.yml "$@" -e hosts="$host"
diff --git a/playbooks/redhat/init-system.yml b/playbooks/redhat/init-system.yml
deleted file mode 100644 (file)
index b1dbd68..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-- name: Setup Debain system
-  hosts: "{{ hosts | default('all') }}"
-  gather_facts: false
-  roles:
-    - sudo
-    - phd
diff --git a/playbooks/redhat/init-system2.yml b/playbooks/redhat/init-system2.yml
deleted file mode 100644 (file)
index 75dd28a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-- name: Setup Debain system - part 2
-  hosts: "{{ hosts | default('all') }}"
-  gather_facts: true
-  roles:
-    - init-system2
-    - root
-    - firewall
-    - logcheck
-    - sshd
diff --git a/playbooks/redhat/roles/dev-packages/README.txt b/playbooks/redhat/roles/dev-packages/README.txt
deleted file mode 100644 (file)
index 13d6c5f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Install development packages.
diff --git a/playbooks/redhat/roles/dev-packages/tasks/main.yml b/playbooks/redhat/roles/dev-packages/tasks/main.yml
deleted file mode 100644 (file)
index 22fd224..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-- name: Install development packages
-  become: true
-  dnf:
-    name: ['expat', 'gcc', 'gcc-c++',
-           'gdbm', 'gdbm-libs', 'git', 'gmp',
-           'libffi', 'lzma-sdk', 'make', 'mpdecimal',
-           'openssl', 'patch', 'readline', 'sqlite', 'zlib',
-          ]
-    state: latest
-    update_cache: yes
diff --git a/playbooks/redhat/roles/init-system/README.txt b/playbooks/redhat/roles/init-system/README.txt
deleted file mode 100644 (file)
index 60e0fd1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Init new RPM system: configure yum/dnf, install minimal list of packages.
diff --git a/playbooks/redhat/roles/init-system/tasks/main.yml b/playbooks/redhat/roles/init-system/tasks/main.yml
deleted file mode 100644 (file)
index edfcd82..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-- name: packages
-  import_tasks: dnf.yml
diff --git a/playbooks/redhat/roles/init-system2/README.txt b/playbooks/redhat/roles/init-system2/README.txt
deleted file mode 100644 (file)
index 2b60b3c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Init RPM system: phase2 - setup /usr/local.
diff --git a/playbooks/redhat/roles/init-system2/tasks/main.yml b/playbooks/redhat/roles/init-system2/tasks/main.yml
deleted file mode 100644 (file)
index 991cf55..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-- name: Setup /usr/local
-  become: true
-  file:
-    path: /usr/local
-    state: directory
-    owner: root
-    group: wheel
-    recurse: yes
-
-- name: Setup directories under /usr/local
-  become: true
-  command: find /usr/local -type d -exec chown root.wheel {} + -exec chmod ug+rwx,o+rx,g+s {} +
-
-- name: Setup files under /usr/local
-  become: true
-  command: find /usr/local -type f -exec chmod ug+rwX,o+rX {} +
-
-- name: Setup /usr/local/src
-  become: true
-  file:
-    path: /usr/local/src
-    state: directory
-    owner: phd
-    group: wheel
-    recurse: yes
diff --git a/playbooks/redhat/roles/logcheck/README.txt b/playbooks/redhat/roles/logcheck/README.txt
deleted file mode 100644 (file)
index 670499d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Update logcheck ignore patterns.
diff --git a/playbooks/redhat/roles/logcheck/files/.gitignore b/playbooks/redhat/roles/logcheck/files/.gitignore
deleted file mode 100644 (file)
index f8a9fd0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ignore.d/local-dhcpd
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-bluetooth b/playbooks/redhat/roles/logcheck/files/ignore.d/local-bluetooth
deleted file mode 100644 (file)
index 119a65e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ bluetoothd\[[0-9]+\]: Endpoint (un)?registered: sender=:[0-9.]+ path=/MediaEndpoint/
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-console-kit-daemon b/playbooks/redhat/roles/logcheck/files/ignore.d/local-console-kit-daemon
deleted file mode 100644 (file)
index 1169ef9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ console-kit-daemon\[[0-9]+\]: GLib-CRITICAL: Source ID [0-9]+ was not found when attempting to remove it$
-
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-dbus b/playbooks/redhat/roles/logcheck/files/ignore.d/local-dbus
deleted file mode 100644 (file)
index 7661db8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ dbus\[[0-9]+\]: \[system\] Activating service name='org\.freedesktop\.UDisks' \(using servicehelper\)$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ dbus\[[0-9]+\]: \[system\] Successfully activated service 'org\.freedesktop\.UDisks'$
-
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-firefox b/playbooks/redhat/roles/logcheck/files/ignore.d/local-firefox
deleted file mode 100644 (file)
index 620f89a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ firefox: getaddrinfo\*\.gaih_getanswer: got type "DNAME"$
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-kernel b/playbooks/redhat/roles/logcheck/files/ignore.d/local-kernel
deleted file mode 100644 (file)
index d200924..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel: \[[ 0-9.]+\] CIFS VFS: Server [0-9.]+ has not responded in 120 seconds\. Reconnecting\.\.\.
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel: \[[ 0-9.]+\] Peer [0-9.:/]+ unexpectedly shrunk window [0-9]+:[0-9]+ \(repaired\)$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel: \[[ 0-9.]+\] TCP: request_sock_TCP: Possible SYN flooding on port [0-9]+\. Sending cookies\.  Check SNMP counters\.
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel: \[[ 0-9.]+\] ncpfs: ncp_evict_inode: could not close
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel: \[[ 0-9.]+\] net_ratelimit: [0-9]+ callbacks suppressed$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel: \[[ 0-9.]+\] perf: interrupt took too long
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-minidsspd b/playbooks/redhat/roles/logcheck/files/ignore.d/local-minidsspd
deleted file mode 100644 (file)
index 7d22d5d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ minissdpd\[[0-9]+\]: method , don't know what to do
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-named b/playbooks/redhat/roles/logcheck/files/ignore.d/local-named
deleted file mode 100644 (file)
index 634a8cb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ named\[[0-9]+\]: DNS format error from ([0-9]{1,3}\.){3}[0-9]{1,3}#[0-9]{1,5} resolving
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ named\[[0-9]+\]: client ([0-9]{1,3}\.){3}[0-9]{1,3}#[0-9]{1,5}: message parsing failed
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ named\[[0-9]+\]: client ([0-9]{1,3}\.){3}[0-9]{1,3}#[0-9]{1,5} \([._[:alnum:]-]+\): query (\(cache\) )?'.+' denied
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ named\[[0-9]+\]: client 192\.168\.3\.20#[0-9]+ \([._[:alnum:]-]+\): error sending response: host unreachable$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ named\[[0-9]+\]: clients-per-query (de|in)creased to
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ named\[[0-9]+\]: skipping nameserver '[A-Za-z0-9._-]+' because it is a CNAME, while resolving
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-pa b/playbooks/redhat/roles/logcheck/files/ignore.d/local-pa
deleted file mode 100644 (file)
index 679db46..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ pulseaudio\[[[:digit:]]+\]: \[alsa-(sink|source)-ALC269VC Analog\] alsa-(sink|source)\.c: ALSA woke us up to (read|write) new data (from|to) the device, but there was actually nothing to (read|write)!$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ pulseaudio\[[[:digit:]]+\]: \[alsa-(sink|source)-ALC269VC Analog\] alsa-(sink|source)\.c: Most likely this is a bug in the ALSA driver 'snd_hda_intel'\. Please report this issue to the ALSA developers\.$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ pulseaudio\[[[:digit:]]+\]: \[alsa-(sink|source)-ALC269VC Analog\] alsa-(sink|source)\.c: We were woken up with POLL(IN|OUT) set -- however a subsequent snd_pcm_avail\(\) returned 0 or another value < min_avail.$
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-postgres b/playbooks/redhat/roles/logcheck/files/ignore.d/local-postgres
deleted file mode 100644 (file)
index 2fbc57d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel: \[[ .0-9]{11,13}\] postgres \([0-9]+\): /proc/[0-9]+/oom_adj is deprecated, please use /proc/[0-9]+/oom_score_adj instead\.
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-rsyslog b/playbooks/redhat/roles/logcheck/files/ignore.d/local-rsyslog
deleted file mode 100644 (file)
index f7be8aa..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (liblogging-stdlog|rsyslogd): {1,2}\[origin software="rsyslogd" swVersion="[0-9.]+" x-pid="[0-9]+" x-info="http://www.rsyslog.com"\] rsyslogd was HUPed$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ rsyslogd[0-9-]+: action 'action 17' (suspended|resumed)
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-runuser b/playbooks/redhat/roles/logcheck/files/ignore.d/local-runuser
deleted file mode 100644 (file)
index b0bb7ad..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ runuser: pam_unix\(runuser:session\): session (opened|closed) for user nobody
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-samba b/playbooks/redhat/roles/logcheck/files/ignore.d/local-samba
deleted file mode 100644 (file)
index 8c6c053..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ smbd: pam_unix\(samba:session\): session opened for user
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ smbd: pam_unix\(samba:session\): session closed for user
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-spamassassin b/playbooks/redhat/roles/logcheck/files/ignore.d/local-spamassassin
deleted file mode 100644 (file)
index 7101aa0..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ spamd\[[0-9]+\]: dns: new_dns_packet: domain is utf8 flagged:
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ spamd\[[0-9]+\]: prefork: adjust:
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ spamd\[[0-9]+\]: spamd: handled cleanup of child
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ spamd\[[0-9]+\]: spamd: result:
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-ssh b/playbooks/redhat/roles/logcheck/files/ignore.d/local-ssh
deleted file mode 100644 (file)
index ae96ad6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: (error: )?Received disconnect from
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: (packet_write_wait|ssh_dispatch_run_fatal): Connection from ([0-9]{1,3}\.){3}[0-9]{1,3} port [0-9]+: Broken pipe \[preauth\]
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Bad protocol version identification
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Connection (closed|reset) by ([0-9]{1,3}\.){3}[0-9]{1,3} port [0-9]+ \[preauth\]
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Did not receive identification string from ([0-9]{1,3}\.){3}[0-9]{1,3} port [0-9]+
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Disconnected from ([0-9]{1,3}\.){3}[0-9]{1,3} port [0-9]+ \[preauth\]
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Disconnecting: Change of username or service not allowed:
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Disconnecting: Too many authentication failures
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Failed password for invalid user.+from ([0-9]{1,3}\.){3}[0-9]{1,3} port [0-9]+
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Invalid user.+from ([0-9]{1,3}\.){3}[0-9]{1,3}
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: PAM service\(sshd\) ignoring max retries
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: Unable to negotiate with ([0-9]{1,3}\.){3}[0-9]{1,3} port [0-9]+: no matching (host key type|key exchange method) found\.
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: fatal: (Read from socket|Write) failed: Connection reset by peer
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: fatal: Unable to negotiate a key exchange method \[preauth\]$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: fatal: no hostkey alg \[preauth\]
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: input_userauth_request: invalid user.+\[preauth\]$
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sshd\[[0-9]+\]: pam_unix(sshd:auth): bad username
-
diff --git a/playbooks/redhat/roles/logcheck/files/ignore.d/local-transmission b/playbooks/redhat/roles/logcheck/files/ignore.d/local-transmission
deleted file mode 100644 (file)
index c75af02..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ transmission-daemon\[[0-9]+\]: UDP Failed to set (send|receive) buffer:
diff --git a/playbooks/redhat/roles/logcheck/tasks/main.yml b/playbooks/redhat/roles/logcheck/tasks/main.yml
deleted file mode 100644 (file)
index 727d4ff..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-- name: Install logcheck
-  become: true
-  dnf:
-    name: logcheck
-    state: latest
-    update_cache: yes
-
-- name: Configure logcheck
-  become: true
-  lineinfile:
-    path: /etc/logcheck/logcheck.conf
-    regexp: "^INTRO=0$"
-    line: "INTRO=0"
-    insertafter: "^#INTRO=1$"
-
-- name: Update logcheck ignore patterns
-  become: true
-  copy:
-    src: ignore.d/
-    dest: "/etc/logcheck/ignore.d.{{ item }}"
-    owner: root
-    group: logcheck
-    directory_mode: '0750'
-    mode: 0640
-  loop: ['server', 'workstation']
diff --git a/playbooks/redhat/roles/packages/README.txt b/playbooks/redhat/roles/packages/README.txt
deleted file mode 100644 (file)
index f68b96d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Install RPM packages.
diff --git a/playbooks/redhat/roles/packages/tasks/main.yml b/playbooks/redhat/roles/packages/tasks/main.yml
deleted file mode 100644 (file)
index af8cc80..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-- name: Install software packages
-  become: true
-  dnf:
-    name: ['adjtimex', 'arj', 'mailx', 'elinks', 'fetchmail', 'links',
-           'lzip', 'lzma', 'lzop', 'p7zip', 'xz',
-          ]
-    state: latest
-    update_cache: yes
diff --git a/playbooks/redhat/roles/phd/README.txt b/playbooks/redhat/roles/phd/README.txt
deleted file mode 100644 (file)
index 84c7fa3..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Init remote user phd: create system and user groups, create the user,
-upload SSH public key.
diff --git a/playbooks/redhat/roles/phd/defaults/main.yml b/playbooks/redhat/roles/phd/defaults/main.yml
deleted file mode 100644 (file)
index 1e4d321..0000000
+++ /dev/null
@@ -1 +0,0 @@
-system_groups: root,wheel,adm,disk,cdrom,floppy,audio,video,users,mail,input
diff --git a/playbooks/redhat/roles/phd/meta/main.yml b/playbooks/redhat/roles/phd/meta/main.yml
deleted file mode 100644 (file)
index 8f82bb2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dependencies: ['init-system']
diff --git a/playbooks/redhat/roles/phd/tasks/main.yml b/playbooks/redhat/roles/phd/tasks/main.yml
deleted file mode 100644 (file)
index 8ed988b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-- name: Test if user phd already exists
-  stat:
-    path: "{{ item }}"
-  register: phd_exists
-  changed_when: not phd_exists.stat.exists
-  loop: ['~/.profile', '~/.shellrc']
-
-- debug:
-    msg: "User phd has already been created"
-  when: phd_exists.results|selectattr('stat.exists')|list|length == 2
-
-- name: Create and setup user phd
-  block:
-    - name: Create system groups
-      become: true
-      group:
-        name: "{{ item }}"
-        system: true
-      loop: "{{ system_groups.split(',') }}"
-
-    - name: Create group phd
-      become: true
-      group:
-        name: phd
-
-    - name: Add user phd
-      become: true
-      user:
-        name: phd
-        group: phd
-        groups: "{{ system_groups }}"
-
-    - name: Remove mc directories
-      file:
-        path: "{{ item }}"
-        state: absent
-      loop: ['~/.cache/mc', '~/.config/mc', '~/.local/share/mc']
-
-    - name: Upload and extract home archive
-      unarchive:
-        src: ~/archive/STORE/phd/Home/phd.tar.bz2
-        dest: /home
-  when: phd_exists.results|selectattr('stat.exists')|list|length != 2
-
-- name: Add alias
-  become: true
-  lineinfile:
-    path: /etc/aliases
-    regexp: "^root:            phd$"
-    line: "root:               phd"
diff --git a/playbooks/redhat/roles/python-dev-packages/README.txt b/playbooks/redhat/roles/python-dev-packages/README.txt
deleted file mode 100644 (file)
index 13d6c5f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Install development packages.
diff --git a/playbooks/redhat/roles/python-dev-packages/meta/main.yml b/playbooks/redhat/roles/python-dev-packages/meta/main.yml
deleted file mode 100644 (file)
index 4f10846..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dependencies: ['dev-packages', 'python-packages']
diff --git a/playbooks/redhat/roles/python-dev-packages/tasks/main.yml b/playbooks/redhat/roles/python-dev-packages/tasks/main.yml
deleted file mode 100644 (file)
index f5e04e9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-- name: Install development packages
-  become: true
-  dnf:
-    name: ['bzip2-devel', 'expat-devel', 'gdbm-devel', 'gmp-devel',
-           'libffi-devel', 'lzma-sdk-devel', 'mpdecimal-devel',
-           'ncurses-devel', 'ncurses-libs', 'openssl-devel', 'openssl-libs',
-           'python2-devel', 'python3-devel', 'readline-devel', 'sqlite-devel',
-           'xz-devel', 'xz-libs', 'zlib-devel',
-          ]
-    state: latest
-    update_cache: yes
diff --git a/playbooks/redhat/roles/python-packages/README.txt b/playbooks/redhat/roles/python-packages/README.txt
deleted file mode 100644 (file)
index f766e45..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Install Python packages.
diff --git a/playbooks/redhat/roles/python-packages/tasks/main.yml b/playbooks/redhat/roles/python-packages/tasks/main.yml
deleted file mode 100644 (file)
index ef81490..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-- name: Install Python and packages
-  become: true
-  dnf:
-    name: ['python2', 'python3', 'python2-pip', 'python3-pip',
-           'python2-setuptools', 'python3-setuptools',
-           'python2-pyOpenSSL', 'python3-pyOpenSSL',
-          ]
-    state: latest
-    update_cache: yes
-  register: python
-
-- name: Upgrade Python packages
-  become: true
-  shell: 'umask 022; {{ item }} -m pip install --upgrade
-      "pip < 19.1" setuptools tox virtualenv virtualenvwrapper "wheel < 0.31.1"
-      flake8 sphinx twine'
-  when: python.changed
-  loop: ['python3', 'python2']
diff --git a/playbooks/redhat/roles/remove-systemd/README.txt b/playbooks/redhat/roles/remove-systemd/README.txt
new file mode 100644 (file)
index 0000000..601fea6
--- /dev/null
@@ -0,0 +1 @@
+Empty "role" to satisfy `init-system2`.
diff --git a/playbooks/redhat/roles/sudo/README.txt b/playbooks/redhat/roles/sudo/README.txt
deleted file mode 100644 (file)
index 9d2929b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Init sudo: install sudo, add user phd, allow passwordless operations.
diff --git a/playbooks/redhat/roles/sudo/meta/main.yml b/playbooks/redhat/roles/sudo/meta/main.yml
deleted file mode 100644 (file)
index 8f82bb2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dependencies: ['init-system']
diff --git a/playbooks/redhat/roles/sudo/tasks/main.yml b/playbooks/redhat/roles/sudo/tasks/main.yml
deleted file mode 100644 (file)
index 469b9ae..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-- name: Allow passwordless operations for phd
-  become: true
-  copy:
-    content: 'phd      ALL=(ALL:ALL) NOPASSWD: ALL'
-    dest: /etc/sudoers.d/phd
-    owner: root
-    group: root
-    mode: 0640
diff --git a/playbooks/redhat/update-root.yml b/playbooks/redhat/update-root.yml
deleted file mode 100644 (file)
index 1deda04..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-- name: "Update ~root from ~phd"
-  hosts: "{{ hosts | default('all') }}"
-  become: yes
-  gather_facts: false
-  tasks:
-    - name: "Update ~root - sync directories from ~phd"
-      synchronize:
-        src: "~phd/{{ item }}"
-        dest: ~root
-        archive: no  # avoid setting owner/group
-        recursive: yes
-        links: yes
-        times: yes
-      delegate_to: "{{ inventory_hostname }}"
-      loop: ['.vim', 'bin', 'lib']
-
-    - name: "Update ~root - sync files from ~phd"
-      copy:
-        src: "~phd/{{ item }}"
-        remote_src: yes
-        dest: ~root
-        owner: root
-        group: root
-        mode: "0600"
-        force: no
-      loop: ['.bashrc', 'admin/home/root/.profile',
-             '.bash_logout', '.inputrc', '.less', '.lesskey',
-             '.screenrc', '.shellrc', '.tmux.conf', '.vimrc',
-            ]
-
-    - name: "Update root mc - overwrite files from ~phd/admin"
-      become: true
-      copy:
-        src: "~phd/admin/home/root/.mc/{{ item }}"
-        remote_src: yes
-        dest: ~root/.mc
-        owner: root
-        group: root
-        mode: "0600"
-        force: no
-      loop: ['hotlist', 'ini', 'panels.ini']
-
similarity index 58%
rename from playbooks/debian/roles/dev-packages/tasks/main.yml
rename to playbooks/roles/dev-packages/tasks/main.yml
index 5d733bcaae415ac4569d3f61b9e607584b7684c1..076a1c44c1366fb1d140cccd038d3300e6a2ae32 100644 (file)
           ]
     state: latest
     update_cache: yes
+  when: ansible_facts.os_family == 'Debian'
+
+- name: Install development packages
+  become: true
+  dnf:
+    name: ['expat', 'gcc', 'gcc-c++',
+           'gdbm', 'gdbm-libs', 'git', 'gmp',
+           'libffi', 'lzma-sdk', 'make', 'mpdecimal',
+           'openssl', 'patch', 'readline', 'sqlite', 'zlib',
+          ]
+    state: latest
+    update_cache: yes
+  when: ansible_facts.os_family == 'RedHat'
diff --git a/playbooks/roles/init-system/README.txt b/playbooks/roles/init-system/README.txt
new file mode 100644 (file)
index 0000000..6f90ed9
--- /dev/null
@@ -0,0 +1,2 @@
+Init new Linux system: configure package manager,
+install minimal list of packages.
diff --git a/playbooks/roles/init-system/tasks/main.yml b/playbooks/roles/init-system/tasks/main.yml
new file mode 100644 (file)
index 0000000..dccb754
--- /dev/null
@@ -0,0 +1,11 @@
+- name: apt
+  import_tasks: apt.yml
+  when: ansible_facts.os_family == 'Debian'
+
+- name: locales
+  import_tasks: locales.yml
+  when: ansible_facts.os_family == 'Debian'
+
+- name: packages
+  import_tasks: dnf.yml
+  when: ansible_facts.os_family == 'RedHat'
diff --git a/playbooks/roles/init-system2/README.txt b/playbooks/roles/init-system2/README.txt
new file mode 100644 (file)
index 0000000..fc8e94e
--- /dev/null
@@ -0,0 +1 @@
+Init Linux system: phase2 - setup /usr/local.
similarity index 57%
rename from playbooks/debian/roles/init-system2/tasks/main.yml
rename to playbooks/roles/init-system2/tasks/main.yml
index 48897d9a6b516f5a866cb28f39ead3b00cab26fb..c2e4a87188c77399a0629359e1c27bba4d1af320 100644 (file)
@@ -1,15 +1,18 @@
+- set_fact:
+    system_group: "{% if ansible_facts.os_family == 'Debian' %}staff{% elif ansible_facts.os_family == 'RedHat' %}wheel{% endif %}"
+
 - name: Setup /usr/local
   become: true
   file:
     path: /usr/local
     state: directory
     owner: root
-    group: staff
+    group: "{{ system_group }}"
     recurse: yes
 
 - name: Setup directories under /usr/local
   become: true
-  command: find /usr/local -type d -exec chown root.staff {} + -exec chmod ug+rwx,o+rx,g+s {} +
+  command: "find /usr/local -type d -exec chown root.{{ system_group }} {} + -exec chmod ug+rwx,o+rx,g+s {} +"
 
 - name: Setup files under /usr/local
   become: true
@@ -21,5 +24,5 @@
     path: /usr/local/src
     state: directory
     owner: phd
-    group: staff
+    group: "{{ system_group }}"
     recurse: yes
similarity index 75%
rename from playbooks/debian/roles/logcheck/tasks/main.yml
rename to playbooks/roles/logcheck/tasks/main.yml
index fa8c6d4a17b3ea4daacc5896a0f2ceb9b344e792..a303e5a406ea4f4618fdc9d1e3bd7f236aee90b0 100644 (file)
@@ -8,6 +8,15 @@
     name: logcheck
     state: latest
     update_cache: yes
+  when: ansible_facts.os_family == 'Debian'
+
+- name: Install logcheck
+  become: true
+  dnf:
+    name: logcheck
+    state: latest
+    update_cache: yes
+  when: ansible_facts.os_family == 'RedHat'
 
 - name: Configure logcheck
   become: true
diff --git a/playbooks/roles/packages/README.txt b/playbooks/roles/packages/README.txt
new file mode 100644 (file)
index 0000000..428d6ad
--- /dev/null
@@ -0,0 +1 @@
+Install more packages.
similarity index 51%
rename from playbooks/debian/roles/packages/tasks/main.yml
rename to playbooks/roles/packages/tasks/main.yml
index 5d3aeb105352f377548aa44964a9cd2844bd4565..bcc6668ae28c046a888531a7440015451bb23511 100644 (file)
           ]
     state: latest
     update_cache: yes
+  when: ansible_facts.os_family == 'Debian'
+
+- name: Install software packages
+  become: true
+  dnf:
+    name: ['adjtimex', 'arj', 'mailx', 'elinks', 'fetchmail', 'links',
+           'lzip', 'lzma', 'lzop', 'p7zip', 'xz',
+          ]
+    state: latest
+    update_cache: yes
+  when: ansible_facts.os_family == 'RedHat'
diff --git a/playbooks/roles/phd/defaults/main.yml b/playbooks/roles/phd/defaults/main.yml
new file mode 100644 (file)
index 0000000..a22565c
--- /dev/null
@@ -0,0 +1 @@
+system_groups: "{% if ansible_facts.os_family == 'Debian' %}root,adm,disk,cdrom,floppy,sudo,audio,www-data,video,plugdev,staff,users,Debian-exim,fuse,sambashare,input{% elif ansible_facts.os_family == 'RedHat' %}root,wheel,adm,disk,cdrom,floppy,audio,video,users,mail,input{% endif %}"
similarity index 85%
rename from playbooks/debian/roles/phd/tasks/main.yml
rename to playbooks/roles/phd/tasks/main.yml
index a26a738cf7af22bece6f41f84bdfbfd51312f2a9..cb36caa7276bb51b725765e795f14361c1f3af50 100644 (file)
         path: /etc/aliases
         regexp: "^root: phd$"
         line: "root: phd"
+      when: ansible_facts.os_family == 'Debian'
   when: phd_exists.results|selectattr('stat.exists')|list|length != 2
+
+- name: Add alias
+  become: true
+  lineinfile:
+    path: /etc/aliases
+    regexp: "^root:            phd$"
+    line: "root:               phd"
+  when: ansible_facts.os_family == 'RedHat'
similarity index 61%
rename from playbooks/debian/roles/python-dev-packages/tasks/main.yml
rename to playbooks/roles/python-dev-packages/tasks/main.yml
index 1c9277fe793bfc3cb6faaa6f2386df8bb28afdd8..2c3bae9560a8205ce009aa8b0d61033702c61e23 100644 (file)
@@ -10,6 +10,7 @@
     state: latest
     update_cache: yes
   when: ansible_facts.distribution_major_version == '9'
+  when: ansible_facts.os_family == 'Debian'
 
 - name: Install development packages
   become: true
           ]
     state: latest
     update_cache: yes
+  when: ansible_facts.os_family == 'Debian'
+
+- name: Install development packages
+  become: true
+  dnf:
+    name: ['bzip2-devel', 'expat-devel', 'gdbm-devel', 'gmp-devel',
+           'libffi-devel', 'lzma-sdk-devel', 'mpdecimal-devel',
+           'ncurses-devel', 'ncurses-libs', 'openssl-devel', 'openssl-libs',
+           'python2-devel', 'python3-devel', 'readline-devel', 'sqlite-devel',
+           'xz-devel', 'xz-libs', 'zlib-devel',
+          ]
+    state: latest
+    update_cache: yes
+  when: ansible_facts.os_family == 'RedHat'
similarity index 63%
rename from playbooks/debian/roles/python-packages/tasks/main.yml
rename to playbooks/roles/python-packages/tasks/main.yml
index 2509ea1ef6fc1cb06a23813c6af311d4d0a06581..0abb3a1ea6a6a1d068207ca5172fc90e50b52302 100644 (file)
     state: latest
     update_cache: yes
   register: python
+  when: ansible_facts.os_family == 'Debian'
+
+- name: Install Python and packages
+  become: true
+  dnf:
+    name: ['python2', 'python3', 'python2-pip', 'python3-pip',
+           'python2-setuptools', 'python3-setuptools',
+           'python2-pyOpenSSL', 'python3-pyOpenSSL',
+          ]
+    state: latest
+    update_cache: yes
+  register: python
+  when: ansible_facts.os_family == 'RedHat'
 
 - name: Upgrade Python packages
   become: true
similarity index 67%
rename from playbooks/debian/roles/sudo/tasks/main.yml
rename to playbooks/roles/sudo/tasks/main.yml
index 97b9b2a6d41063bdc611c8436721785090a62087..0c8770706194b309ca7edc60dfd915b2af849898 100644 (file)
@@ -6,6 +6,7 @@
     name: sudo
     state: latest
     update_cache: yes
+  when: ansible_facts.os_family == 'Debian'
 
 - name: Add user phd to group sudo
   become: true
@@ -13,6 +14,7 @@
     name: phd
     append: yes
     groups: sudo
+  when: ansible_facts.os_family == 'Debian'
 
 - name: Allow passwordless operations for phd
   become: true
@@ -20,5 +22,5 @@
     content: 'phd      ALL=(ALL:ALL) NOPASSWD: ALL'
     dest: /etc/sudoers.d/phd
     owner: root
-    group: sudo
+    group: "{% if ansible_facts.os_family == 'Debian' %}sudo{% elif ansible_facts.os_family == 'RedHat' %}root{% endif %}"
     mode: 0640