Update the file format for baremetal

Change-Id: I1e90b0aeebaa0db0b91370eccfc0b707d9668752
This commit is contained in:
caoyuan 2017-02-24 17:45:08 +08:00
parent 0883d34d4a
commit c39e896e7c
4 changed files with 39 additions and 37 deletions

View File

@ -1,4 +1,6 @@
--- ---
- include: pre-install.yml - include: pre-install.yml
- include: install.yml - include: install.yml
- include: post-install.yml - include: post-install.yml

View File

@ -24,8 +24,8 @@
with_items: with_items:
- firewalld - firewalld
when: when:
- ansible_os_family == 'RedHat' - ansible_os_family == 'RedHat'
- firewalld_check.rc == 0 - firewalld_check.rc == 0
- name: Install apt packages - name: Install apt packages
package: name={{item}} state=present package: name={{item}} state=present
@ -38,21 +38,21 @@
register: kernel_updated register: kernel_updated
become: True become: True
when: when:
- ansible_distribution|lower == "ubuntu" | bool - ansible_distribution|lower == "ubuntu" | bool
- ansible_distribution_release|lower == "trusty" | bool - ansible_distribution_release|lower == "trusty" | bool
- name: Set reboot required - name: Set reboot required
set_fact: set_fact:
reboot_required: True reboot_required: True
when: when:
- kernel_updated is defined - kernel_updated is defined
- kernel_updated.changed - kernel_updated.changed
- name: Install deltarpm packages - name: Install deltarpm packages
package: name={{item}} state=installed package: name={{item}} state=installed
become: True become: True
with_items: with_items:
- deltarpm - deltarpm
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
- name: Install yum packages - name: Install yum packages

View File

@ -1,9 +1,9 @@
--- ---
- name: Ensure docker service directory exists - name: Ensure docker service directory exists
file: file:
path=/etc/systemd/system/docker.service.d path=/etc/systemd/system/docker.service.d
state=directory state=directory
recurse=yes recurse=yes
become: True become: True
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version > "14") or when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version > "14") or
(ansible_os_family == "RedHat") or (ansible_distribution == "Debian") (ansible_os_family == "RedHat") or (ansible_distribution == "Debian")
@ -11,8 +11,8 @@
- name: Configure docker service - name: Configure docker service
become: True become: True
template: template:
src=docker_systemd_service.j2 src=docker_systemd_service.j2
dest=/etc/systemd/system/docker.service.d/kolla.conf dest=/etc/systemd/system/docker.service.d/kolla.conf
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version > "14") or when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version > "14") or
(ansible_os_family == "RedHat") or (ansible_distribution == "Debian") (ansible_os_family == "RedHat") or (ansible_distribution == "Debian")
@ -25,8 +25,8 @@
- name: Configure docker service - name: Configure docker service
become: True become: True
template: template:
src=docker_defaults.j2 src=docker_defaults.j2
dest=/etc/default/docker dest=/etc/default/docker
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version < "15") when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version < "15")
- name: Docker mount shared - name: Docker mount shared
@ -48,38 +48,38 @@
- name: Create docker group - name: Create docker group
group: group:
name: docker name: docker
become: True become: True
- name: Add kolla user to docker group - name: Add kolla user to docker group
user: user:
name: kolla name: kolla
append: yes append: yes
groups: docker groups: docker
become: True become: True
when: create_kolla_user | bool when: create_kolla_user | bool
- name: Start docker - name: Start docker
service: service:
name: docker name: docker
state: started state: started
become: True become: True
- name: Restart docker - name: Restart docker
service: service:
name: docker name: docker
state: restarted state: restarted
become: True become: True
- name: Enable docker - name: Enable docker
service: service:
name: docker name: docker
enabled: yes enabled: yes
become: True become: True
- name: Reboot - name: Reboot
command: reboot -f command: reboot -f
become: True become: True
when: when:
- reboot_required is defined - reboot_required is defined
- reboot_required | bool - reboot_required | bool

View File

@ -18,11 +18,11 @@
- name: Generate /etc/hosts for all of the nodes - name: Generate /etc/hosts for all of the nodes
blockinfile: blockinfile:
dest: /etc/hosts dest: /etc/hosts
marker: "# {mark} ANSIBLE GENERATED HOSTS" marker: "# {mark} ANSIBLE GENERATED HOSTS"
block: | block: |
{% for host in groups['all'] %} {% for host in groups['all'] %}
{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }} {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }} {{ hostvars[host]['ansible_hostname'] }}
{% endfor %} {% endfor %}
become: True become: True
when: customize_etc_hosts | bool when: customize_etc_hosts | bool
@ -70,10 +70,10 @@
package: name={{item}} state=latest package: name={{item}} state=latest
become: True become: True
with_items: with_items:
- ca-certificates - ca-certificates
- apt-transport-https - apt-transport-https
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- name: Ensure apt sources list directory exists - name: Ensure apt sources list directory exists
file: path=/etc/apt/sources.list.d state=directory recurse=yes file: path=/etc/apt/sources.list.d state=directory recurse=yes
@ -94,8 +94,8 @@
state: present state: present
become: True become: True
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- ansible_distribution == 'Ubuntu' - ansible_distribution == 'Ubuntu'
- name: Ensure yum repos directory exists - name: Ensure yum repos directory exists
file: path=/etc/yum.repos.d/ state=directory recurse=yes file: path=/etc/yum.repos.d/ state=directory recurse=yes
@ -118,7 +118,7 @@
- name: Ensure node_config_directory directory exists - name: Ensure node_config_directory directory exists
file: file:
path: "{{ node_config_directory }}" path: "{{ node_config_directory }}"
state: directory state: directory
recurse: yes recurse: yes
owner: kolla owner: kolla