Ansible and Python both support actual dictionaries, so make use
of them in the inventory instead of having a bunch of randomly
named variables lumped together.
This commit is best viewed with 'git show -w'.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/host_vars/libvirt-centos-7/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-centos-8/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-debian-10/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-debian-9/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-debian-sid/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-fedora-30/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-fedora-31/main.yml | 19 ++++++++-------
.../host_vars/libvirt-fedora-rawhide/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-freebsd-11/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-freebsd-12/main.yml | 19 ++++++++-------
.../libvirt-freebsd-current/main.yml | 19 ++++++++-------
.../host_vars/libvirt-opensuse-151/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-ubuntu-1604/main.yml | 19 ++++++++-------
guests/host_vars/libvirt-ubuntu-1804/main.yml | 19 ++++++++-------
guests/lcitool | 24 +++++++++----------
guests/playbooks/update/tasks/global.yml | 4 ++--
guests/playbooks/update/tasks/jenkins.yml | 2 +-
guests/playbooks/update/tasks/users.yml | 4 ++--
guests/playbooks/update/templates/bashrc.j2 | 6 ++---
.../update/templates/jenkins.service.j2 | 2 +-
20 files changed, 161 insertions(+), 147 deletions(-)
diff --git a/guests/host_vars/libvirt-centos-7/main.yml
b/guests/host_vars/libvirt-centos-7/main.yml
index 66cb113..d6efd00 100644
--- a/guests/host_vars/libvirt-centos-7/main.yml
+++ b/guests/host_vars/libvirt-centos-7/main.yml
@@ -23,15 +23,16 @@ packaging:
format: rpm
command: yum
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja-build
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja-build
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python2
ansible_python_interpreter: /usr/bin/python2
diff --git a/guests/host_vars/libvirt-centos-8/main.yml
b/guests/host_vars/libvirt-centos-8/main.yml
index e48c1ff..debc6df 100644
--- a/guests/host_vars/libvirt-centos-8/main.yml
+++ b/guests/host_vars/libvirt-centos-8/main.yml
@@ -23,15 +23,16 @@ packaging:
format: 'rpm'
command: 'dnf'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-debian-10/main.yml
b/guests/host_vars/libvirt-debian-10/main.yml
index da30dac..4d1f9cb 100644
--- a/guests/host_vars/libvirt-debian-10/main.yml
+++ b/guests/host_vars/libvirt-debian-10/main.yml
@@ -25,15 +25,16 @@ packaging:
format: 'deb'
command: 'apt-get'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-debian-9/main.yml
b/guests/host_vars/libvirt-debian-9/main.yml
index 82ed8b2..5bcb75d 100644
--- a/guests/host_vars/libvirt-debian-9/main.yml
+++ b/guests/host_vars/libvirt-debian-9/main.yml
@@ -25,15 +25,16 @@ packaging:
format: 'deb'
command: 'apt-get'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-debian-sid/main.yml
b/guests/host_vars/libvirt-debian-sid/main.yml
index f0c0c8e..2616678 100644
--- a/guests/host_vars/libvirt-debian-sid/main.yml
+++ b/guests/host_vars/libvirt-debian-sid/main.yml
@@ -25,15 +25,16 @@ packaging:
format: 'deb'
command: 'apt-get'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-fedora-30/main.yml
b/guests/host_vars/libvirt-fedora-30/main.yml
index d9e539e..33d3361 100644
--- a/guests/host_vars/libvirt-fedora-30/main.yml
+++ b/guests/host_vars/libvirt-fedora-30/main.yml
@@ -38,15 +38,16 @@ packaging:
format: 'rpm'
command: 'dnf'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-fedora-31/main.yml
b/guests/host_vars/libvirt-fedora-31/main.yml
index b884e7f..810c1f2 100644
--- a/guests/host_vars/libvirt-fedora-31/main.yml
+++ b/guests/host_vars/libvirt-fedora-31/main.yml
@@ -26,15 +26,16 @@ packaging:
format: 'rpm'
command: 'dnf'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-fedora-rawhide/main.yml
b/guests/host_vars/libvirt-fedora-rawhide/main.yml
index 732b988..c1fe726 100644
--- a/guests/host_vars/libvirt-fedora-rawhide/main.yml
+++ b/guests/host_vars/libvirt-fedora-rawhide/main.yml
@@ -26,15 +26,16 @@ packaging:
format: 'rpm'
command: 'dnf'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-freebsd-11/main.yml
b/guests/host_vars/libvirt-freebsd-11/main.yml
index e22b688..5e57368 100644
--- a/guests/host_vars/libvirt-freebsd-11/main.yml
+++ b/guests/host_vars/libvirt-freebsd-11/main.yml
@@ -24,15 +24,16 @@ packaging:
format: 'pkg'
command: 'pkg'
-bash: /usr/local/bin/bash
-cc: /usr/bin/clang
-ccache: /usr/local/bin/ccache
-java: /usr/local/bin/java
-make: /usr/local/bin/gmake
-ninja: /usr/local/bin/ninja
-python: /usr/local/bin/python3
-su: /usr/bin/su
-sudoers: /usr/local/etc/sudoers
+paths:
+ bash: /usr/local/bin/bash
+ cc: /usr/bin/clang
+ ccache: /usr/local/bin/ccache
+ java: /usr/local/bin/java
+ make: /usr/local/bin/gmake
+ ninja: /usr/local/bin/ninja
+ python: /usr/local/bin/python3
+ su: /usr/bin/su
+ sudoers: /usr/local/etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/local/bin/python3
diff --git a/guests/host_vars/libvirt-freebsd-12/main.yml
b/guests/host_vars/libvirt-freebsd-12/main.yml
index 1fa718e..8dfd1b8 100644
--- a/guests/host_vars/libvirt-freebsd-12/main.yml
+++ b/guests/host_vars/libvirt-freebsd-12/main.yml
@@ -24,15 +24,16 @@ packaging:
format: 'pkg'
command: 'pkg'
-bash: /usr/local/bin/bash
-cc: /usr/bin/clang
-ccache: /usr/local/bin/ccache
-java: /usr/local/bin/java
-make: /usr/local/bin/gmake
-ninja: /usr/local/bin/ninja
-python: /usr/local/bin/python3
-su: /usr/bin/su
-sudoers: /usr/local/etc/sudoers
+paths:
+ bash: /usr/local/bin/bash
+ cc: /usr/bin/clang
+ ccache: /usr/local/bin/ccache
+ java: /usr/local/bin/java
+ make: /usr/local/bin/gmake
+ ninja: /usr/local/bin/ninja
+ python: /usr/local/bin/python3
+ su: /usr/bin/su
+ sudoers: /usr/local/etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/local/bin/python3
diff --git a/guests/host_vars/libvirt-freebsd-current/main.yml
b/guests/host_vars/libvirt-freebsd-current/main.yml
index 706abc8..8f0e3fb 100644
--- a/guests/host_vars/libvirt-freebsd-current/main.yml
+++ b/guests/host_vars/libvirt-freebsd-current/main.yml
@@ -24,15 +24,16 @@ packaging:
format: 'pkg'
command: 'pkg'
-bash: /usr/local/bin/bash
-cc: /usr/bin/clang
-ccache: /usr/local/bin/ccache
-java: /usr/local/bin/java
-make: /usr/local/bin/gmake
-ninja: /usr/local/bin/ninja
-python: /usr/local/bin/python3
-su: /usr/bin/su
-sudoers: /usr/local/etc/sudoers
+paths:
+ bash: /usr/local/bin/bash
+ cc: /usr/bin/clang
+ ccache: /usr/local/bin/ccache
+ java: /usr/local/bin/java
+ make: /usr/local/bin/gmake
+ ninja: /usr/local/bin/ninja
+ python: /usr/local/bin/python3
+ su: /usr/bin/su
+ sudoers: /usr/local/etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/local/bin/python3
diff --git a/guests/host_vars/libvirt-opensuse-151/main.yml
b/guests/host_vars/libvirt-opensuse-151/main.yml
index b80a497..27d68dc 100644
--- a/guests/host_vars/libvirt-opensuse-151/main.yml
+++ b/guests/host_vars/libvirt-opensuse-151/main.yml
@@ -24,15 +24,16 @@ packaging:
format: 'rpm'
command: 'zypper'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-ubuntu-1604/main.yml
b/guests/host_vars/libvirt-ubuntu-1604/main.yml
index 2d99e3a..4eca69b 100644
--- a/guests/host_vars/libvirt-ubuntu-1604/main.yml
+++ b/guests/host_vars/libvirt-ubuntu-1604/main.yml
@@ -24,15 +24,16 @@ packaging:
format: 'deb'
command: 'apt-get'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/host_vars/libvirt-ubuntu-1804/main.yml
b/guests/host_vars/libvirt-ubuntu-1804/main.yml
index 4c63b35..7407241 100644
--- a/guests/host_vars/libvirt-ubuntu-1804/main.yml
+++ b/guests/host_vars/libvirt-ubuntu-1804/main.yml
@@ -25,15 +25,16 @@ packaging:
format: 'deb'
command: 'apt-get'
-bash: /bin/bash
-cc: /usr/bin/gcc
-ccache: /usr/bin/ccache
-java: /usr/bin/java
-make: /usr/bin/make
-ninja: /usr/bin/ninja
-python: /usr/bin/python3
-su: /bin/su
-sudoers: /etc/sudoers
+paths:
+ bash: /bin/bash
+ cc: /usr/bin/gcc
+ ccache: /usr/bin/ccache
+ java: /usr/bin/java
+ make: /usr/bin/make
+ ninja: /usr/bin/ninja
+ python: /usr/bin/python3
+ su: /bin/su
+ sudoers: /etc/sudoers
ansible_python_package: python3
ansible_python_interpreter: /usr/bin/python3
diff --git a/guests/lcitool b/guests/lcitool
index 89d5ef9..0c89e13 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -693,11 +693,11 @@ class Application:
varmap = self._dockerfile_build_varmap_rpm(facts, mappings, pip_mappings,
projects, cross_arch)
varmap["packaging_command"] =
facts["packaging"]["command"]
- varmap["cc"] = facts["cc"]
- varmap["ccache"] = facts["ccache"]
- varmap["make"] = facts["make"]
- varmap["ninja"] = facts["ninja"]
- varmap["python"] = facts["python"]
+ varmap["paths_cc"] = facts["paths"]["cc"]
+ varmap["paths_ccache"] = facts["paths"]["ccache"]
+ varmap["paths_make"] = facts["paths"]["make"]
+ varmap["paths_ninja"] = facts["paths"]["ninja"]
+ varmap["paths_python"] = facts["paths"]["python"]
if cross_arch:
varmap["cross_abi"] = Util.native_arch_to_abi(cross_arch)
@@ -907,13 +907,13 @@ class Application:
if cross_arch:
commands.extend([
- "ln -s {ccache} /usr/libexec/ccache-wrappers/{cross_abi}-cc",
- "ln -s {ccache} /usr/libexec/ccache-wrappers/{cross_abi}-$(basename
{cc})",
+ "ln -s {paths_ccache}
/usr/libexec/ccache-wrappers/{cross_abi}-cc",
+ "ln -s {paths_ccache}
/usr/libexec/ccache-wrappers/{cross_abi}-$(basename {paths_cc})",
])
else:
commands.extend([
- "ln -s {ccache} /usr/libexec/ccache-wrappers/cc",
- "ln -s {ccache} /usr/libexec/ccache-wrappers/$(basename
{cc})",
+ "ln -s {paths_ccache} /usr/libexec/ccache-wrappers/cc",
+ "ln -s {paths_ccache} /usr/libexec/ccache-wrappers/$(basename
{paths_cc})",
])
script = "\nRUN " + (" && \\\n ".join(commands)) +
"\n"
@@ -953,9 +953,9 @@ class Application:
sys.stdout.write(textwrap.dedent("""
ENV LANG "en_US.UTF-8"
- ENV MAKE "{make}"
- ENV NINJA "{ninja}"
- ENV PYTHON "{python}"
+ ENV MAKE "{paths_make}"
+ ENV NINJA "{paths_ninja}"
+ ENV PYTHON "{paths_python}"
ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
""").format(**varmap))
diff --git a/guests/playbooks/update/tasks/global.yml
b/guests/playbooks/update/tasks/global.yml
index db74a47..ca4a374 100644
--- a/guests/playbooks/update/tasks/global.yml
+++ b/guests/playbooks/update/tasks/global.yml
@@ -6,9 +6,9 @@
- name: 'Create ccache wrappers'
file:
- src: '{{ ccache }}'
+ src: '{{ paths.ccache }}'
dest: /usr/libexec/ccache-wrappers/{{ item }}
state: link
with_items:
- cc
- - '{{ cc | basename }}'
+ - '{{ paths.cc | basename }}'
diff --git a/guests/playbooks/update/tasks/jenkins.yml
b/guests/playbooks/update/tasks/jenkins.yml
index 479e5d6..5da3418 100644
--- a/guests/playbooks/update/tasks/jenkins.yml
+++ b/guests/playbooks/update/tasks/jenkins.yml
@@ -24,7 +24,7 @@
path: /etc/rc.local
create: yes
regexp: '^nohup.*jenkins.*java.*slave\.jar.*&$'
- line: "nohup {{ su }} - jenkins -c '{{ java }} -jar /home/jenkins/slave.jar
-jnlpUrl \"{{ jenkins_url }}\" -secret \"{{ jenkins_secret }}\"'
>/var/log/jenkins.log 2>&1 &"
+ line: "nohup {{ paths.su }} - jenkins -c '{{ paths.java }} -jar
/home/jenkins/slave.jar -jnlpUrl \"{{ jenkins_url }}\" -secret \"{{
jenkins_secret }}\"' >/var/log/jenkins.log 2>&1 &"
insertbefore: '^exit .*$'
when:
- jenkins_secret is defined
diff --git a/guests/playbooks/update/tasks/users.yml
b/guests/playbooks/update/tasks/users.yml
index 28ee96a..5c6ce8f 100644
--- a/guests/playbooks/update/tasks/users.yml
+++ b/guests/playbooks/update/tasks/users.yml
@@ -28,7 +28,7 @@
group: '{{ flavor }}'
comment: '{{ flavor }}'
password: '*'
- shell: '{{ bash }}'
+ shell: '{{ paths.bash }}'
- name: '{{ flavor }}: Set password'
user:
@@ -45,7 +45,7 @@
- name: '{{ flavor }}: Grant passwordless sudo access'
lineinfile:
- path: '{{ sudoers }}'
+ path: '{{ paths.sudoers }}'
line: '{{ flavor }} ALL=(ALL) NOPASSWD: ALL'
state: present
validate: 'visudo -cf %s'
diff --git a/guests/playbooks/update/templates/bashrc.j2
b/guests/playbooks/update/templates/bashrc.j2
index 1c90a42..8775864 100644
--- a/guests/playbooks/update/templates/bashrc.j2
+++ b/guests/playbooks/update/templates/bashrc.j2
@@ -1,8 +1,8 @@
export PS1="[\u@\h \w]\$ "
-export MAKE="{{ make }}"
-export NINJA="{{ ninja }}"
-export PYTHON="{{ python }}"
+export MAKE="{{ paths.make }}"
+export NINJA="{{ paths.ninja }}"
+export PYTHON="{{ paths.python }}"
export MAKEFLAGS="-j{{ install_vcpus|int + 1 }}"
export CCACHE_MAXSIZE="2G"
diff --git a/guests/playbooks/update/templates/jenkins.service.j2
b/guests/playbooks/update/templates/jenkins.service.j2
index 0b68e75..9bbd985 100644
--- a/guests/playbooks/update/templates/jenkins.service.j2
+++ b/guests/playbooks/update/templates/jenkins.service.j2
@@ -4,7 +4,7 @@ Wants=network.target
After=network.target
[Service]
-ExecStart={{ bash }} -l -c '{{ java }} -jar /home/jenkins/slave.jar -jnlpUrl "{{
jenkins_url }}" -secret "{{ jenkins_secret }}"'
+ExecStart={{ paths.bash }} -l -c '{{ paths.java }} -jar /home/jenkins/slave.jar
-jnlpUrl "{{ jenkins_url }}" -secret "{{ jenkins_secret }}"'
User=jenkins
Group=jenkins
WorkingDirectory=/home/jenkins
--
2.25.4