2017-02-22 00:58:24 +08:00
|
|
|
---
|
2019-04-16 21:33:02 +08:00
|
|
|
- name: include specific variables
|
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
2021-03-03 22:43:50 +08:00
|
|
|
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml"
|
|
|
|
- "{{ ansible_facts['os_family'] }}.yml"
|
2019-04-16 21:33:02 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: debian based systems tasks
|
2019-04-16 21:33:02 +08:00
|
|
|
include_tasks: debian_prerequisites.yml
|
2019-03-28 16:13:30 +08:00
|
|
|
when:
|
2021-03-03 22:43:50 +08:00
|
|
|
- ansible_facts['os_family'] == 'Debian'
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: with_pkg
|
2017-02-22 00:58:24 +08:00
|
|
|
|
2020-01-29 11:31:04 +08:00
|
|
|
- name: install container packages
|
2019-04-16 21:33:02 +08:00
|
|
|
package:
|
2020-10-10 02:34:14 +08:00
|
|
|
name: '{{ container_package_name }}'
|
2019-04-16 21:33:02 +08:00
|
|
|
update_cache: true
|
2020-01-03 04:50:24 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: with_pkg
|
2019-02-10 15:21:43 +08:00
|
|
|
|
2020-01-29 11:31:04 +08:00
|
|
|
- name: install lvm2 package
|
|
|
|
package:
|
|
|
|
name: lvm2
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
tags: with_pkg
|
|
|
|
when: inventory_hostname in groups.get(osd_group_name, [])
|
|
|
|
|
2020-09-15 08:13:13 +08:00
|
|
|
- name: extra configuration for docker
|
2019-08-23 02:29:40 +08:00
|
|
|
when: container_service_name == 'docker'
|
2020-09-15 08:13:13 +08:00
|
|
|
block:
|
|
|
|
- name: create the systemd docker override directory
|
|
|
|
file:
|
|
|
|
path: /etc/systemd/system/docker.service.d
|
|
|
|
state: directory
|
|
|
|
when: ceph_docker_http_proxy is defined or ceph_docker_https_proxy is defined
|
|
|
|
|
|
|
|
- name: create the systemd docker override file
|
|
|
|
template:
|
|
|
|
src: docker-proxy.conf.j2
|
|
|
|
dest: /etc/systemd/system/docker.service.d/proxy.conf
|
|
|
|
mode: 0600
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
register: proxy_created
|
|
|
|
when: ceph_docker_http_proxy is defined or ceph_docker_https_proxy is defined
|
|
|
|
|
|
|
|
- name: remove docker proxy configuration
|
|
|
|
file:
|
|
|
|
path: /etc/systemd/system/docker.service.d/proxy.conf
|
|
|
|
state: absent
|
|
|
|
register: proxy_removed
|
|
|
|
when:
|
|
|
|
- ceph_docker_http_proxy is not defined
|
|
|
|
- ceph_docker_https_proxy is not defined
|
|
|
|
|
|
|
|
# using xxx.changed here instead of an ansible handler because we need to
|
|
|
|
# have an immediate effect and not wait the end of the play.
|
|
|
|
# using flush_handlers via the meta action plugin isn't enough too because
|
|
|
|
# it flushes all handlers and not only the one notified in this role.
|
|
|
|
- name: restart docker
|
|
|
|
systemd:
|
|
|
|
name: "{{ container_service_name }}"
|
|
|
|
state: restarted
|
|
|
|
daemon_reload: yes
|
|
|
|
when: proxy_created.changed | bool or proxy_removed.changed | bool
|
|
|
|
|
|
|
|
- name: start container service
|
|
|
|
service:
|
|
|
|
name: '{{ container_service_name }}'
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
tags:
|
|
|
|
with_pkg
|