Add nc to the packages to install during upgrade

Upgrade uses nc, but doesn't enforce its presence.
This makes sure nc is installed.

On top of it, the filenames used are ubuntu ones,
so this moves to use a var to find which filename
should be used for centos.

See also the issue here:
http://logs.openstack.org/periodic/periodic-openstack-ansible-
upgrade-ceph-master-centos-7/d2fc540/
console.html#_2017-05-30_08_23_40_475244

Change-Id: I3ee2dfd6e435fb4d92a57e2debf7f001f7c03f98
(cherry picked from commit f7bb1e9e95)
This commit is contained in:
Jean-Philippe Evrard 2017-05-30 10:07:56 +00:00 committed by Jesse Pretorius (odyssey4me)
parent 1573a80d62
commit 0ff1e58960

View File

@ -15,9 +15,17 @@
- name: Memcached cache flush
hosts: memcached_all
gather_facts: false
gather_facts: true
user: root
vars:
memcached_conf_dest:
debian: "/etc/memcached.conf"
redhat: "/etc/sysconfig/memcached"
tasks:
- name: Ensuring nc is installed
package:
name: nc
state: present
- name: Flush all of the cache in memcached
shell: |
echo 'flush_all' | nc $(awk '/^\-l/ {print $2}' /etc/memcached.conf | awk -F, '{ print $1 }') $(awk '/^\-p/ {print $2}' /etc/memcached.conf)
echo 'flush_all' | nc $(awk '/^\-l/ {print $2}' {{ memcached_conf_dest.get(ansible_os_family | lower) }} | awk -F, '{ print $1 }') $(awk '/^\-p/ {print $2}' {{ memcached_conf_dest.get(ansible_family | lower) }} )