kolla-ansible/ansible/roles/baremetal/tasks/install.yml
Mark Goddard 4283dff9b4 Fix ownership of virtualenv in bootstrap-servers
In I86bf5e1df3d6568c4f1ca6f4757f08a3dd22754d, creation of the kolla user
was moved to after package installation to ensure the sudo package is
installed when required. This change does not work when python
dependencies are installed in a virtual environment however - when the
virtualenv variable is set.

This change moves the ownership change of the virtualenv to after the
kolla user has been created. It also uses the kolla_user and kolla_group
variables to set the user and group appropriately.

Change-Id: I320e5d611099ad162945a98d5505a79606da0eba
TrivialFix
2018-07-09 18:58:53 +01:00

106 lines
2.4 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 virtualenv packages
package:
name: python-virtualenv
state: present
become: True
when: virtualenv is not none
- name: Install pip
easy_install:
name: pip
virtualenv: "{{ virtualenv is none | ternary(omit, virtualenv) }}"
virtualenv_site_packages: "{{ virtualenv is none | ternary(omit, virtualenv_site_packages) }}"
become: True
- name: Install latest pip in the virtualenv
pip:
name: pip
state: latest
virtualenv: "{{ virtualenv }}"
virtualenv_site_packages: "{{ virtualenv_site_packages }}"
become: True
when: virtualenv is not none
- name: Install docker SDK for python
pip:
name: docker
state: latest
virtualenv: "{{ virtualenv is none | ternary(omit, virtualenv) }}"
virtualenv_site_packages: "{{ virtualenv is none | ternary(omit, virtualenv_site_packages) }}"
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'