From 457ed11b494a45cccfe1dce39492d3b52caadaca Mon Sep 17 00:00:00 2001 From: "teuto.net Netzdienste GmbH" Date: Wed, 30 Mar 2016 10:23:43 +0200 Subject: [PATCH 1/3] fixed deprecation warnings regarding bare variables --- roles/adduser/tasks/main.yml | 4 ++-- roles/dnsmasq/tasks/main.yml | 2 +- roles/docker/tasks/main.yml | 6 +++--- roles/download/tasks/main.yml | 8 ++++---- roles/kubernetes/master/tasks/main.yml | 2 +- roles/kubernetes/preinstall/tasks/etchosts.yml | 2 +- roles/kubernetes/secrets/tasks/gen_certs.yml | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/roles/adduser/tasks/main.yml b/roles/adduser/tasks/main.yml index 94e6503e7..58e5ce49e 100644 --- a/roles/adduser/tasks/main.yml +++ b/roles/adduser/tasks/main.yml @@ -15,7 +15,7 @@ - name: User | Create User Group group: name={{item.group|default(item.name)}} system={{item.system|default(omit)}} - with_items: addusers + with_items: "{{ addusers }}" - name: User | Create User user: @@ -25,4 +25,4 @@ home: "{{item.home|default(omit)}}" name: "{{item.name}}" system: "{{item.system|default(omit)}}" - with_items: addusers + with_items: "{{ addusers }}" diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index 020ef3b86..b27947f24 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -47,7 +47,7 @@ resource: "{{item.item.type}}" filename: /etc/kubernetes/{{item.item.file}} state: "{{item.changed | ternary('latest','present') }}" - with_items: manifests.results + with_items: "{{ manifests.results }}" when: inventory_hostname == groups['kube-master'][0] - name: Check for dnsmasq port (pulling image and running container) diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index c26f37783..b47c9d302 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -28,14 +28,14 @@ id: "{{item}}" keyserver: "{{docker_repo_key_info.keyserver}}" state: present - with_items: docker_repo_key_info.repo_keys + with_items: "{{ docker_repo_key_info.repo_keys }}" - name: ensure docker repository is enabled action: "{{ docker_repo_info.pkg_repo }}" args: repo: "{{item}}" state: present - with_items: docker_repo_info.repos + with_items: "{{ docker_repo_info.repos }}" when: docker_repo_info.repos|length > 0 - name: ensure docker packages are installed @@ -43,7 +43,7 @@ args: pkg: "{{item}}" state: present - with_items: docker_package_info.pkgs + with_items: "{{ docker_package_info.pkgs }}" when: docker_package_info.pkgs|length > 0 - name: Centos needs xfs storage type for devicemapper if used diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml index 0942115e4..746be939e 100644 --- a/roles/download/tasks/main.yml +++ b/roles/download/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Create dest directories file: path={{local_release_dir}}/{{item.dest|dirname}} state=directory recurse=yes - with_items: downloads + with_items: "{{ downloads }}" - name: Download items get_url: @@ -10,7 +10,7 @@ sha256sum: "{{item.sha256 | default(omit)}}" owner: "{{ item.owner|default(omit) }}" mode: "{{ item.mode|default(omit) }}" - with_items: downloads + with_items: "{{ downloads }}" - name: Extract archives unarchive: @@ -20,7 +20,7 @@ mode: "{{ item.mode|default(omit) }}" copy: no when: "{{item.unarchive is defined and item.unarchive == True}}" - with_items: downloads + with_items: "{{ downloads }}" - name: Fix permissions file: @@ -29,4 +29,4 @@ owner: "{{ item.owner|default(omit) }}" mode: "{{ item.mode|default(omit) }}" when: "{{item.unarchive is not defined or item.unarchive == False}}" - with_items: downloads + with_items: "{{ downloads }}" diff --git a/roles/kubernetes/master/tasks/main.yml b/roles/kubernetes/master/tasks/main.yml index 5124e152b..109ada3ea 100644 --- a/roles/kubernetes/master/tasks/main.yml +++ b/roles/kubernetes/master/tasks/main.yml @@ -45,7 +45,7 @@ - meta: flush_handlers - include: start.yml - with_items: groups['kube-master'] + with_items: "{{ groups['kube-master'] }}" when: "{{ hostvars[item].inventory_hostname == inventory_hostname }}" # Create kube-system namespace diff --git a/roles/kubernetes/preinstall/tasks/etchosts.yml b/roles/kubernetes/preinstall/tasks/etchosts.yml index e28eecc56..dd8562b8c 100644 --- a/roles/kubernetes/preinstall/tasks/etchosts.yml +++ b/roles/kubernetes/preinstall/tasks/etchosts.yml @@ -8,7 +8,7 @@ create: yes backup: yes when: hostvars[item].ansible_default_ipv4.address is defined - with_items: groups['all'] + with_items: "{{ groups['all'] }}" - name: Hosts | populate kubernetes loadbalancer address into hosts file lineinfile: diff --git a/roles/kubernetes/secrets/tasks/gen_certs.yml b/roles/kubernetes/secrets/tasks/gen_certs.yml index e2b3eaefa..e4dd69196 100644 --- a/roles/kubernetes/secrets/tasks/gen_certs.yml +++ b/roles/kubernetes/secrets/tasks/gen_certs.yml @@ -48,4 +48,4 @@ file: path: "{{ item }}" mode: 0600 - with_items: keyfiles.stdout_lines + with_items: "{{ keyfiles.stdout_lines }}" From 4271dd66453489588afa42fc0782fe16bdc6ef45 Mon Sep 17 00:00:00 2001 From: "teuto.net Netzdienste GmbH" Date: Wed, 30 Mar 2016 10:27:29 +0200 Subject: [PATCH 2/3] using apt module instead of command module to install python-apt --- roles/kubernetes/preinstall/tasks/main.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index be9515a2d..6b13efd8e 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -61,16 +61,12 @@ - "/opt/cni/bin" when: kube_network_plugin == "calico" -- name: Update package management cache (APT) - apt: update_cache=yes - when: ansible_pkg_mgr == 'apt' - - name: Update package management cache (YUM) yum: update_cache=yes name='*' when: ansible_pkg_mgr == 'yum' -- name: Install python-apt for Debian distribs - command: apt-get install -y python-apt +- name: Install latest version of python-apt for Debian distribs + apt: name=python-apt state=latest update_cache=yes cache_valid_time=3600 when: ansible_os_family == "Debian" changed_when: False @@ -78,7 +74,6 @@ command: dnf install -y python-dnf yum when: ansible_distribution == "Fedora" and ansible_distribution_major_version > 21 - changed_when: False - name: Install epel-release on RHEL command: rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm From a192111e6ac1449a54c204f51cc6bc7eb507ff74 Mon Sep 17 00:00:00 2001 From: "teuto.net Netzdienste GmbH" Date: Wed, 30 Mar 2016 11:21:36 +0200 Subject: [PATCH 3/3] Reverted deletion of "changed_when: False" for Task "Install python-dnf for latest RedHat versions". Deleted "changed_when: False" on Task "Install latest version of python-apt for Debian distribs" to get notified when kubespray has installed a new package version. --- roles/kubernetes/preinstall/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 6b13efd8e..248a4289e 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -68,12 +68,12 @@ - name: Install latest version of python-apt for Debian distribs apt: name=python-apt state=latest update_cache=yes cache_valid_time=3600 when: ansible_os_family == "Debian" - changed_when: False - name: Install python-dnf for latest RedHat versions command: dnf install -y python-dnf yum when: ansible_distribution == "Fedora" and ansible_distribution_major_version > 21 + changed_when: False - name: Install epel-release on RHEL command: rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm