Some playbooks and roles are distribution-independent.
shift
cd "`dirname \"$0\"`" &&
-ANSIBLE_ROLES_PATH=debian/roles \
+ANSIBLE_ROLES_PATH=debian/roles:roles \
exec ../run-role add-apache-vhost "$@" \
-e virtual_host="$vhost" -e gather_facts=true
shift
cd "`dirname \"$0\"`" &&
-ANSIBLE_ROLES_PATH=debian/roles \
+ANSIBLE_ROLES_PATH=debian/roles:roles \
exec ../run-role add-dns-domain "$@" \
-e domain="$domain" -e gather_facts=true
shift
cd "`dirname \"$0\"`" &&
+ANSIBLE_ROLES_PATH=roles:../roles &&
+export ANSIBLE_ROLES_PATH &&
# Passwordless access isn't configured yet; use `ssh` connection sharing.
# `sudo` isn't configured yet too; use `su` and ask for root password.
-ansible-playbook init-system.yml "$@" -e hosts="$host" \
+ansible-playbook ../init-system.yml "$@" -e hosts="$host" \
--become-method=su -K &&
exec ansible-playbook init-system2.yml "$@" -e hosts="$host"
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
+++ /dev/null
-Init new Debian system: setup ~root by copying files from ~phd.
+++ /dev/null
-Init new Debian system: configure sshd.
-- name: Setup Debain system
+- name: Setup Linux system
hosts: "{{ hosts | default('all') }}"
gather_facts: false
roles:
--- /dev/null
+Common roles.
--- /dev/null
+Setup new Linux system: setup ~root by copying files from ~phd.
--- /dev/null
+Setup new Linux system: configure sshd.
- name: Check sshd
- shell: "grep -c '^PermitRootLogin' /etc/ssh/sshd_config || :"
+ become: true
+ shell: "grep -c '^PermitRootLogin prohibit-password' /etc/ssh/sshd_config || :"
register: sshd
changed_when: sshd.stdout == "0"
msg: "sshd has already been configured"
when: sshd.stdout != "0"
+- name: "Setup sshd: disable root login"
+ become: true
+ lineinfile:
+ path: /etc/ssh/sshd_config
+ regexp: "^PermitRootLogin yes"
+ state: absent
+ when: sshd.stdout == "0"
+
- name: Configure sshd
become: true
lineinfile: