kolla-ansible/ansible/roles/baremetal/tasks/post-install.yml
zhuzeyu 49c0ca3a9c Optimize the code
make bool filter more consistence between all roles.

TrivialFix

Change-Id: Icd51749039b1448e09a4713da093b16f965f9ed8
2016-12-07 15:29:07 +08:00

86 lines
2.2 KiB
YAML

---
- name: Ensure docker service directory exists
file:
path=/etc/systemd/system/docker.service.d
state=directory
recurse=yes
become: True
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version > "14") or
(ansible_os_family == "RedHat") or (ansible_distribution == "Debian")
- name: Configure docker service
become: True
template:
src=docker_systemd_service.j2
dest=/etc/systemd/system/docker.service.d/kolla.conf
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version > "14") or
(ansible_os_family == "RedHat") or (ansible_distribution == "Debian")
- name: Reload docker service file
become: True
command: systemctl daemon-reload
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version > "14") or
(ansible_os_family == "RedHat") or (ansible_distribution == "Debian")
- name: Configure docker service
become: True
template:
src=docker_defaults.j2
dest=/etc/default/docker
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version < "15")
- name: Docker mount shared
command: mount --make-shared /run
become: True
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version < "15")
- name: Get stat of libvirtd apparmor profile
stat: path=/etc/apparmor.d/usr.sbin.libvirtd
register: apparmor_libvirtd_profile
when: ansible_distribution == "Ubuntu"
- name: Remove apparmor profile for libvirt
command: apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
become: True
when:
- ansible_distribution == "Ubuntu"
- apparmor_libvirtd_profile.stat.exists | bool
- name: Create docker group
group:
name: docker
become: True
- name: Add kolla user to docker group
user:
name: kolla
append: yes
groups: docker
become: True
when: create_kolla_user | bool
- name: Start docker
service:
name: docker
state: started
become: True
- name: Restart docker
service:
name: docker
state: restarted
become: True
- name: Enable docker
service:
name: docker
enabled: yes
become: True
- name: Reboot
command: reboot -f
become: True
when:
- reboot_required is defined
- reboot_required | bool