ansible: Use clearer variable names in install-related roles
authornicoo <nicoo@realraum.at>
Sat, 24 Nov 2018 15:54:39 +0000 (16:54 +0100)
committernicoo <nicoo@realraum.at>
Sat, 24 Nov 2018 23:30:26 +0000 (00:30 +0100)
Rename `distro` to `install_distro` and `distcodename` to `install_codename`.

ansible/roles/preseed/tasks/main.yml
ansible/roles/usb-install/meta/main.yml
ansible/roles/vm/install/templates/libvirt-domain.xml.j2
ansible/vm-install.sh

index e8e62e7..54e348a 100644 (file)
@@ -5,17 +5,17 @@
 
     - set_fact:
         tmpdir: "{{ tmpdir.stdout }}"
-        initramfs: "{{ preseed_path | mandatory }}/{{ hostname }}-{{ distro }}-{{ distcodename }}.initrd.gz"
+        initramfs: "{{ preseed_path | mandatory }}/{{ hostname }}-{{ install_distro }}-{{ install_codename }}.initrd.gz"
 
     - name: Copy initramfs into position
       copy:
         remote_src: yes
-        src: "{{ debian_installer_path | mandatory }}/{{ distro }}-{{ distcodename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/initrd.gz"
+        src: "{{ debian_installer_path | mandatory }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/initrd.gz"
         dest: "{{ initramfs }}"
 
     - name: Generate preseed file
       template:
-        src: "preseed_{{ distro }}-{{ distcodename }}.cfg.j2"
+        src: "preseed_{{ install_distro }}-{{ install_codename }}.cfg.j2"
         dest: "{{ tmpdir }}/preseed.cfg"
 
     - name: Generate authorized_keys file
index 4fbb746..402b3d5 100644 (file)
@@ -1,8 +1,8 @@
 dependencies:
   - role: debian-installer
     distros:
-      - distro: "{{ distro }}"
-        codename: "{{ distcodename }}"
+      - distro: "{{ install_distro }}"
+        codename: "{{ install_codename }}"
         arch: [ "{{ install.arch }}" ]
 
   - role: preseed
index 0f4858b..81c732a 100644 (file)
@@ -6,8 +6,8 @@
   <os>
     <type arch='x86_64' machine='pc-0.12'>hvm</type>
 {% if run_installer %}
-    <kernel>{{ debian_installer_path }}/{{ distro }}-{{ distcodename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/linux</kernel>
-    <initrd>{{ preseed_path }}/{{ hostname }}-{{ distro }}-{{ distcodename }}.initrd.gz</initrd>
+    <kernel>{{ debian_installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/linux</kernel>
+    <initrd>{{ preseed_path }}/{{ hostname }}-{{ install_distro }}-{{ install_codename }}.initrd.gz</initrd>
     <cmdline>console=ttyS0,115200n8</cmdline>
 {% endif %}
     <boot dev='hd'/>
index 0846422..fcc8b5e 100755 (executable)
@@ -16,4 +16,4 @@ echo "installing $name with $distro/$codename"
 echo ""
 
 echo "######## running the install playbook ########"
-exec ansible-playbook -e "hostname=$name" -e "distro=$distro" -e "distcodename=$codename" $@ $(basename "$0" .sh).yml
+exec ansible-playbook -e "hostname=$name" -e "install_distro=$distro" -e "install_codename=$codename" $@ $(basename "$0" .sh).yml