From 7e0c346c8406eb6142e8d38fdec4e13236f3cdc6 Mon Sep 17 00:00:00 2001 From: Russell Teague Date: Wed, 16 Nov 2016 16:30:28 -0500 Subject: Refactor to use Ansible package module The Ansible package module will call the correct package manager for the underlying OS. --- playbooks/adhoc/uninstall.yml | 10 +++++----- playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml | 2 +- playbooks/common/openshift-cluster/upgrades/etcd/backup.yml | 2 +- .../openshift-cluster/upgrades/etcd/containerized_tasks.yml | 2 +- playbooks/common/openshift-cluster/upgrades/rpm_upgrade.yml | 5 +++-- 5 files changed, 11 insertions(+), 10 deletions(-) (limited to 'playbooks') diff --git a/playbooks/adhoc/uninstall.yml b/playbooks/adhoc/uninstall.yml index 4ea639cbe..be1070f73 100644 --- a/playbooks/adhoc/uninstall.yml +++ b/playbooks/adhoc/uninstall.yml @@ -84,7 +84,7 @@ - firewalld - name: Remove packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent" + package: name={{ item }} state=absent when: not is_atomic | bool with_items: - atomic-enterprise @@ -114,7 +114,7 @@ - tuned-profiles-origin-node - name: Remove flannel package - action: "{{ ansible_pkg_mgr }} name=flannel state=absent" + package: name=flannel state=absent when: openshift_use_flannel | default(false) | bool and not is_atomic | bool - shell: systemctl reset-failed @@ -247,7 +247,7 @@ - atomic-openshift-master - name: Remove packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent" + package: name={{ item }} state=absent when: not is_atomic | bool with_items: - atomic-enterprise @@ -349,7 +349,7 @@ failed_when: false - name: Remove packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent" + package: name={{ item }} state=absent when: not is_atomic | bool with_items: - etcd @@ -388,7 +388,7 @@ - firewalld - name: Remove packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent" + package: name={{ item }} state=absent when: not is_atomic | bool with_items: - haproxy diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml index 417096dd0..5d753447c 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml @@ -35,7 +35,7 @@ - service: name=docker state=stopped - name: Upgrade Docker - action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present" + package: name=docker{{ '-' + docker_version }} state=present - service: name=docker state=started diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml b/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml index 57b156b1c..57d4fe4b6 100644 --- a/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml +++ b/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml @@ -42,7 +42,7 @@ when: (embedded_etcd | bool) and (etcd_disk_usage.stdout|int > avail_disk.stdout|int) - name: Install etcd (for etcdctl) - action: "{{ ansible_pkg_mgr }} name=etcd state=present" + package: name=etcd state=present when: not openshift.common.is_atomic | bool - name: Generate etcd backup diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml b/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml index 35f391f8c..f88981a0b 100644 --- a/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml +++ b/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml @@ -30,7 +30,7 @@ ## will fail on atomic host. We need to revisit how to do etcd backups there as ## the container may be newer than etcdctl on the host. Assumes etcd3 obsoletes etcd (7.3.1) - name: Upgrade etcd for etcdctl when not atomic - action: "{{ ansible_pkg_mgr }} name=etcd ensure=latest" + package: name=etcd state=latest when: not openshift.common.is_atomic | bool - name: Verify cluster is healthy diff --git a/playbooks/common/openshift-cluster/upgrades/rpm_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/rpm_upgrade.yml index cd1139b29..d7d1fe548 100644 --- a/playbooks/common/openshift-cluster/upgrades/rpm_upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/rpm_upgrade.yml @@ -1,9 +1,10 @@ +--- # We verified latest rpm available is suitable, so just yum update. - name: Upgrade packages - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-{{ component }}{{ openshift_pkg_version }} state=present" + package: "name={{ openshift.common.service_type }}-{{ component }}{{ openshift_pkg_version }} state=present" - name: Ensure python-yaml present for config upgrade - action: "{{ ansible_pkg_mgr }} name=PyYAML state=present" + package: name=PyYAML state=present when: not openshift.common.is_atomic | bool - name: Restart node service -- cgit v1.2.3