kolla-ansible/ansible/roles/baremetal/tasks/install.yml
David Rabel 12e0c5ae8e Use apt Ansible module instead of apt-get to update cache
Ansible recommends to use apt module instead of apt-get.
This patch fixes install.yml and pre-install.yml accordingly.

Change-Id: I3241ce332e7cf522786e78280643440a30a23875
Closes-Bug: #1747436
2018-02-05 15:38:17 +01:00

86 lines
1.8 KiB
YAML

---
- name: Update apt cache
apt:
update_cache: yes
become: True
when: ansible_os_family == 'Debian'
# TODO(inc0): Gates don't seem to have ufw executable, check for it instead of ignore errors
- name: Set firewall default policy
become: True
ufw:
state: disabled
policy: allow
when: ansible_os_family == 'Debian'
ignore_errors: yes
- name: Check if firewalld is installed
command: rpm -q firewalld
register: firewalld_check
failed_when: firewalld_check.rc > 1
when: ansible_os_family == 'RedHat'
- name: Disable firewalld
become: True
service:
name: "{{ item }}"
enabled: false
state: stopped
with_items:
- firewalld
when:
- ansible_os_family == 'RedHat'
- firewalld_check.rc == 0
- name: Install apt packages
package:
name: "{{ item }}"
state: present
become: True
with_items: "{{ debian_pkg_install }}"
when: ansible_os_family == 'Debian'
- name: Install deltarpm packages
package:
name: "{{ item }}"
state: installed
become: True
with_items:
- deltarpm
when: ansible_os_family == 'RedHat'
- name: Install yum packages
package:
name: "{{ item }}"
state: present
become: True
with_items: "{{ redhat_pkg_install }}"
when: ansible_os_family == 'RedHat'
- name: Install pip
easy_install:
name: pip
become: True
- name: Install docker SDK for python
pip:
name: docker
state: latest
become: True
- name: Remove packages
package:
name: "{{ item }}"
state: absent
with_items: "{{ ubuntu_pkg_removals }}"
become: True
when: ansible_distribution|lower == "ubuntu"
- name: Remove packages
package:
name: "{{ item }}"
state: absent
with_items: "{{ redhat_pkg_removals }}"
become: True
when: ansible_os_family == 'RedHat'